#clojure logs

2012-09-11

00:23zenolij-v-e: Query from one of the guys at PLUG West...any chance you could do an encore at West next week or next month?
00:37mpanis there a reason why something like (#('[1 2])) doesn't have the meaning of fn that returns constant?
00:38mpantried with and without the quote and it still gave me an error that sounded like it was trying to call the vec
00:39tmcivermpan: as an alternative, check out the function 'constantly'
00:39abalonempan: those extra parens on the outside are making the call
00:39mpancool, thanks
00:39mpanabalone: I was expecting it to mean, call the fn which returns constant vec
00:39mpanrather, it seems to interpret it as, call the constant vec
00:39mpanwondering why
00:40abaloneah
00:40mpanas in, I would have guessed it should evaluate to '[1 2]
00:40mpanbut it didn't
00:41xeqi&`#([1 2]))
00:41lazybot⇒ (fn* [] ([1 2]))
00:44Sgeo(doc fn*)
00:44clojurebotexcusez-moi
00:44Sgeo,(doc fn*)
00:44clojurebotCool story bro.
00:44SgeoRight...
00:44Sgeo&(doc fn*)
00:44lazybot⇒ "Special: fn*; "
00:46mpanso is the shorthand not quite the same as a fn literal?
00:49alandipertmpan: it's so you can put an operation form inside the fn without extra parens, e.g. #(identity [1 2]) vs (fn [] (identity [1 2]))
00:50mpanI'm just confused why it doesn't just expand out to a regular fn form with literal args %1 %2 etc
00:50mpanplus handling for the % case
00:51mpanlike, why it works to write the return-literal-vec function with fn but not the #syntax
00:53bdeshamI'm looking for a function that takes one argument--a function of zero arguments--and executes it. is there anything in core that does that?
00:53alandipertbdesham: apply
00:54bdeshamah, of course! thanks
00:54xeqi&(apply #(+ 1 2))
00:54lazybotclojure.lang.ArityException: Wrong number of args (1) passed to: core$apply
00:54bdeshamnever even considered that you might use apply with just one argument
00:56alandipertoh yeah, nor had i
00:56alandipert&(.invoke #(+ 1 2))
00:56lazybot⇒ 3
00:56alandipert^ cheating
00:56bdeshamheh
00:57xeqi&(#(%) #(+ 1 2))
00:57lazybot⇒ 3
00:58carkbdesham: why do you need such function ?
01:00bdeshamcark: I'm writing a library to work with task queues. usually you'd specify a function at the beginning, and the function gets called with each item in the queue. I figured you could also store functions in the queue, but I wasn't sure which function you would pass as the thing that gets called
01:00xeqithough really I'd just do something like ##(#(+ 1 2))
01:00lazybot⇒ 3
01:00xeqi(f)
01:01cark#(%)
01:02carkthat's your function
01:02carkor (fn [func-to-be-called] (func-to-be-called))
01:03bdeshamyeah, looks like #(%) is what I need
01:03Raynes(fn [this-is-crazy] (call-me-maybe))
01:04bdeshamugh, can't get away from that song even in #Clojure...
01:08xeqi(fn [gangnam-style] (horse-dance))
01:15arrdem(inc xeqi)
01:15lazybot⇒ 4
01:17arrdem,(foreach [phrase ["op" "o-op" "op" "oppa gangnam style"] (println phrase))
01:17clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unmatched delimiter: )>
01:18arrdem,(foreach [phrase ["op" "o-op" "op" "oppa gangnam style"]] (println phrase))
01:18clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: foreach in this context, compiling:(NO_SOURCE_PATH:0)>
01:18xeqi(doc doseq)
01:18clojurebot"([seq-exprs & body]); Repeatedly executes body (presumably for side-effects) with bindings and filtering as provided by \"for\". Does not retain the head of the sequence. Returns nil."
01:18arrdem,(doseq [phrase ["op" "o-op" "op" "oppa gangnam style"]] (println phrase))
01:18clojurebotop
01:18clojureboto-op
01:18clojurebotop
01:18clojurebotoppa gangnam style
01:19arrdemyeah I just found the docs on that as you ,(doc)'d
01:24SgeoWait, clojurebot can be induced into saying stuff across multiple lines?
01:24SgeoAlso, why not dorun a map?
01:25Sgeoerm, dorun a sequence made with map
01:25SgeoI think I'd personally prefer that
01:25xeqidon't need to build up a list of nils
01:26arrdemclojurebot... has been caused to do many things. singing is the least of them.
01:26SgeoSince it's dorun, why would a list be built up?
01:26SgeoShouldn't each nil be quickly garbage collected?
01:27xeqiah, right, I was think doall
01:33xeqi(doc map)
01:33clojurebot"([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & ...]); Returns a lazy sequence consisting of the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in each coll, until any one of the colls is exhausted. Any remaining items in other colls are ignored. Function f should accept number-of-colls arguments."
01:34xeqi(doc dorun)
01:34clojurebot"([coll] [n coll]); When lazy sequences are produced via functions that have side effects, any effects other than those needed to produce the first element in the seq do not occur until the seq is consumed. dorun can be used to force any effects. Walks through the successive nexts of the seq, does not retain the head and returns nil."
01:38Sgeo,(dorun (map println ["op" "o-op" "op" "oppa gangnam style"]))
01:38clojurebotop
01:38clojureboto-op
01:38clojurebotop
01:38clojurebotoppa gangnam style
01:39SgeoI feelm like my Haskell knowledge is stopping me from grasping the true meaning of that line
01:40SgeoI keep thinking of dorun like sequence_ but it's not
01:41Sgeo,(take 0 (map println ["op" "o-op" "op" "oppa gangnam style"]))
01:41clojurebot()
01:41Sgeo,(take 1 (map println ["op" "o-op" "op" "oppa gangnam style"]))
01:41clojurebot(op
01:41clojureboto-op
01:41clojurebotop
01:41clojurebotoppa gangnam style
01:41clojurebotnil)
01:41Sgeo...that's still a bit bizarre.
01:41muhooah, doall hangs on to the head, dorun doesn't
01:42SgeoIn Haskell, map putStrLn ["somestring", "anotherstring] will make a list of actions that can be performed
01:42SgeoAnd sequence_ turns a list of actions into a single action
01:42muhoothis sounds like reducers to me, maybe
01:43SgeoI'd say the connection to reducers may be tenuous, but I don't understand reducers that well
01:47muhoo,(map deref (map #(delay (println %)) ["foo" "bar" "baz"]))
01:47clojurebot(foo
01:47clojurebotbar
01:47clojurebotbaz
01:47clojurebotnil nil nil)
01:49muhoo,(map #(delay (println %)) ["foo" "bar" "baz"])
01:49clojurebot(#<Delay@2418ec3b: :pending> #<Delay@8f8268e: :pending> #<Delay@5bab393b: :pending>)
01:50muhoothat's ugly, but it's a sequence of actions, kind of
01:52metellusmap is lazy, so (map println ["foo" "bar" "baz"]) is just a sequence of actions
01:52metellusbut if you do it in a repl or with the bot, evaluation is forced
01:54bdeshamis there a standard for the naming of clojure libraries? should I use "com.foo.whatever" or just "whatever"?
02:01ohpauleezbedsham, your namespaces or the library itself?
02:02ohpauleezTypically, if you're hosting it on clojars, you should use a group name: com.github.ohpauleez/mylib
02:03bdeshamI'm talking about the library itself
02:03ohpauleezbut if it's a major/canonical library and you expect a lot of usage, you can make the group and artifact name the same. For example: noir, shoreleave, etc
02:04bdeshamnah, I don't think so ;-)
02:04clojurebotTitim gan ?ir? ort.
02:04bdeshamthanks
02:07ohpauleezbdesham: Totally welcome
02:07ohpauleezGlad I could help
02:15UrthwhyteHey guys, simple, but odd task. I want to reduce a function across a collection and get back a hashmap of the results, where the key is the function input and the value is the function output
02:16UrthwhyteIt can be done easily with a reduce, but it seems as though there should be a more idiomatic way
02:17raekUrthwhyte: something like (zipmap inputs (map f inputs))?
02:18Urthwhyteyup
02:19Urthwhytethat'll do it
02:19Urthwhytethank you :)
02:56ecravenquick question, clj 1.4.0 on arch linux, if i enter (= '(1 2 1) (reverse '(1 2 1))), the repl hangs... why is that? shouldn't this just return true?
03:00dhofstetecraven: works fine here on arch linux
03:01ecraveni'll update everything, then try again
03:01ecravendhofstet: openjdk or sun java?
03:02dhofstetecraven: openjdk
03:03ecravendhofstet: 7 or 6?
03:03dhofstetecraven: 7
03:03ecravensame as me.. strange
03:37quacKZOVV3pepijn_away, meneer de vos, waarom gaat u weg?
03:37quacKZOVV3Chousuke, Droids? tut tut, you bore me.
03:37quacKZOVV3Inside of each exists the mind of a sapient being
03:38quacKZOVV3the finest brains harvested from across the galaxy
03:38quacKZOVV3no more droids, my deluded child, they are cyborgs
03:38quacKZOVV3CYBORGS UNDER MY COMMAND
03:40shaunxcodeexactly
04:41clgvis there some function or macro to avoid nesting more than 2 reduces?
04:42clgvin principle something with the capabilities of `for` would be awesome.
04:47ordnungswidrig1clgv: can't you comp the reducer functions?
04:48clgvordnungswidrig1: hmm good question the reduce would have the following path [p parameter vm (value-maps p) [k v] vm] and I want to create a map then
04:49clgvordnungswidrig1: solved it with merge-with with a special case in the function now
04:50ordnungswidrignested reduces means you're working with nested sequences, right?
04:51clgvordnungswidrig: nested maps
04:52ordnungswidrigwhich are reduces as sequences
04:52ordnungswidrigs/redeuces/reduced/
04:52clgvordnungswidrig: yep. it's not all maps but deftypes that are semantically treated like maüs
04:52clgv*maps
04:54ordnungswidrigso the inner reduce actually produces a seq. isn't it a map then?
04:56clgvno all three reduces should produce a final map. with `merge-with` now there is only one reduce. I think I just use this and remember that expression pattern. if it occurs again I have to do something ;)
04:57ordnungswidrighave a paste?
04:59clgvordnungswidrig: thats the merge-with approach https://www.refheap.com/paste/5007
05:02clgvordnungswidrig: result is a map of key to vector of values
05:03ordnungswidrigI see
06:04Kneferiliswhy clojure uses all these parenthesis?
06:08babilenKneferilis: It is a Lisp and uses s-expressions -- Please read http://en.wikipedia.org/wiki/S-expression and http://en.wikipedia.org/wiki/Lisp_(programming_language)
06:13RaynesAlso, the number of parentheses is comparable to languages like Java with the primary difference being the location of the parens.
06:13naegone could even say Java has more brackets: http://www.andrewhjon.es/142343729
06:13naeg("Show me the brackets")
06:16stainnaeg: that's very tongue in cheek because the JAva example uses the secret and frawned-uppon style of {{ }}
06:19noidifoo(bar) -> (foo bar)
06:20noidilook at all those parentheses appearing when the code is rewritten in lisp! :P
06:21hyPiRionOr, for instance, foo.toString().length() is (.. foo toString length)
06:27ro_stso, how do i get an rfc 3339 compatible date string in clojurescript?
06:27ro_stmutter datomic db.type/instant mutter
06:30Kneferilisbabilen: thanks for the information
06:31babilenKneferilis: You are welcome
06:41babilenI am wondering what is needed to update ClojureDocs to show documentation for Clojure 1.4 as well ... It's just that I thought that it'll happen "eventually", but it took a while already and there might be someone that can/should be poked regarding this.
06:58antares_babilen: please ask on the mailing list, that's a great idea
06:59babilenantares_: ack :)
07:00naegbabilen: indeed, I might even provide my time if needed
07:01babilenSo would I (as I constantly use it), but I am just not sure what the process is. I'll write that mail and maybe we can sort it out.
07:01naegI'll finally subscribe to the ML then
07:02antares_babilen: as far as I know there are two parts to clojuredocs, an indexer and a web app. The latter probably won't change at all, the former may need updates and reindexing to cover 1.4 + new contrib.
07:06babilenantares_: My secret hope is still that somebody will just answer: "Oh, right. Totally forgot to run MAGIC_UPDATER because I thought that it is handled by CRON-JOB". (I know, that is a little too optimistic, but well)
07:07antares_babilen: it should not be a lot of work to reindex clojure.core but getting all the new contrib libraries and removing or isolation the old stuff will probably take some effort
07:08babilenantares_: Getting clojure.core updated to 1.4 would be wonderful even if the rest of it is still cruft
07:10AustinYunanyone implement ELO or any of the glicko rating systems in clojure before? I'd be interested in seeing what it looks like
07:16mpanis there a built-in "function exponentiation"?
07:16ordnungswidrigmpan: ?
07:16mpaner, like, you pass f n x and it gives you (f (f (f ... [n times] x)))
07:17llasram&(-> (iterate (partial * 2) 1) (nth 8))
07:17lazybot⇒ 256
07:18llasrammpan: Like that?
07:18mpanyea
07:18mpanalthough a bit confused by the use of -> there
07:19mpanhow do I ask the bot to expand that?
07:19llasramOh, it's just the same as:
07:19llasram&(nth (iterate (partial * 2) 1) 8)
07:19lazybot⇒ 256
07:19llasramIn general:
07:20llasram&(macroexpand '(-> (iterate (partial * 2) 1) (nth 8)))
07:20lazybot⇒ (nth (iterate (partial * 2) 1) 8)
07:20mpanall right, thank you!
07:37clgvmpan: use java.util.Math
07:38clgvmpan: or do you really want to apply a function several times?
07:38clgvmpan: in that case you can write a higher-order function for that
08:16djanatynhmm, time to write my first tests in clojure
08:16djanatynI'm using lein2 and emacs, with nrepl. where do I start?
08:18ro_stmidje!
08:18djanatynwhat advantages does midje have over clojure.test?
08:19ro_sti can't really answer that because i've never used c.t
08:20ro_sthttps://www.refheap.com/paste/5011
08:21clgvdjanatyn: read midje's wiki to get an impression. it has checkers to express tests easily
08:21ro_sthttp://www.youtube.com/watch?v=HK2HG9U3anA
08:21ro_stemacs mode for midje: with a repl up, hit C-c . to run the fact under point and see output directly above the top-level form
08:22ro_sti use midje-mode and lazy test in combination
08:22ro_stand our CI runs the midje tests too
08:22ro_stnot sure if nrepl and midje-mode play nice. hopefully they do
08:33djanatynI don't understand why our school network blocks clojars.org ._.
08:33clgvdjanatyn: paranoia
08:33djanatynare there any mirrors? I'd like to grab midje, and I guess I could manually install it, but I don't know how
08:33clgvdjanatyn: no mirros afaik
08:34cemerickdjanatyn: that's bizarre!
08:34clgvdjanatyn: I'd talk to the admin
08:34cemerickIndeed, that's indefensible.
08:35clgvdjanatyn: I have been to a conference at a university where they blocked almost all ports except http/https
08:35djanatynclgv: same thing on our network :P
08:35clgvcouldnt even log onto my server via ssh there... :/
08:36ro_sttor -whistle-
08:36djanatynthe first year, the network flowed free, and I could ssh home and tunnel everything through SSH
08:36clgvI wonder how their CS post grads and students work there
08:36djanatynthen halfway through my freshman year they closed down everything
08:37djanatynnow I'm in my senior year and I've learned a few tricks, but they add new restrictions and filters every year
08:38djanatynhas anyone here used both midje and clojure.test?
08:39clgvI started out with clojure.test
08:39ro_sti believe midje's runner runs clojure.test tests as well, so you can try both out and use midje's runner
08:39clgvbut I found it painfull to check collection contents with it. midje solved that issue
08:39ro_stwith contains, clgv ?
08:40clgvfor example
08:40ro_sti found background to be really nice too
08:40ro_steasy to quickly establish a stable testing context without having to wrap top-level test forms in a macro call
08:41clgvI also like `provided` and `anything`
08:41ro_sti haven't used those yet
08:41ro_stprobably should :-)
08:43clgvyou can do something like that: (fact "cdf" (build-cdf anything (sorted-map 'na 'a, 'nb 'b, 'nc 'c)) => [['a v1] ['b (+ v1 v2)] ['c (+ v1 v2 v3)]] (provided
08:43clgv (rating anything, 'a) => v1 :times 1) ... and so on
08:43clgvups
08:44clgvthats almost an algebraic description ;)
09:27bytechunkyIm dealing with a data structure that I cannot represent with nesting, because there are cyclic dependencies. As a step of indirection I want to use either integer indexes or vars. Is any one of them preferable?
09:29bytechunkyidentify 0!s_vk<%Kio|1M
09:29duck1123time to change that pw
09:29bytechunkylol
09:29ro_sthaha
09:30clgvalmost random ^^
09:31gfredericksbytechunky: I don't think vars are appropriate for that
09:32duck1123There's also namespaced keywords at your disposal. Might be a little better than using vars
09:33clgvbytechunky: integers would work fine. I did something like that
09:34bytechunkylright, i'll go with integers the
09:37nDuffbytechunky: ...why would you prefer vars to atoms?
09:38nDuffNot saying that integer indexes are bad, mind you
09:43chouserbytechunky: why not something like a UUID or Object instead of integers?
09:43ro_stchouser: your in-memory pubsub looks really interesting!
09:44ro_sti've been using shoreleave-pubsub in cljs and i'm looking for a clj pubsub to use with the clj code that i'm using in cljsbuild crossovers
09:45ohpauleezro_st: At some point in the future, I plan on providing that (I'll be in need of it soon)
09:45ro_stcan't wait :-)
09:47bytechunkychouser: im not following the Object part (im a bit of a software engineering newb)
09:47clgvbytechunky: do you want to represent a graph?
09:48bytechunkyclgv: yes, indeed
09:49clgvbytechunky: well than there are two general lightweight options: adjacency matrix or adjacency list - you can also build it as objects with references to each other. depends what you do with it
09:51chouserbytechunky: Objects use identity for equality, so two different Objects are guaranteed to be unequal, and creating them is fast.
09:52clgvchouser: nice trick if you dont need names to identify them ^^
09:52chouserSo you could say (let [a (Object.), b (Object.)] {a {:name "foo", :other b}, b {:name "bar", :other a}})
09:54bytechunkychouser: i need to think about this a little to grok it. Thank you for the example.
10:01naegchouser: I'm "almost" finished with the checking algorithm for a connect four field in core.logic
10:01naegcould you take a look at this question though: http://stackoverflow.com/questions/12355352/predicate-to-declare-descending-ascending-coordinates-using-finite-domains
10:02naeg(checking rows and cols works already, beside a bug which I suspect being in core.logic itself: http://dev.clojure.org/jira/browse/LOGIC-52)
10:03bytechunkyclgv: i want to be able to represent graphs with edges connecting edges ("higher order" edges), multigraphs, maybe even hypergraphs. i am really just exploring what options there are to represent things like this. So i'll contemplate it.
10:04clgvbytechunky: ah ok. that's far more than I did. I needed a simple graph and learned that an adjacency matrix without node and edge objects works best
10:04Sonderbladeis there something like cpan or pypi for clojure?
10:04lotiaclojars
10:04clgvSonderblade: clojars.org
10:04nDuffSonderblade: Maven is used for distributing Clojure packages
10:04Sonderbladethanks
10:04nDuffSonderblade: ...and Clojars is the most common Maven repository for the purpose
10:05nDuffSonderblade: ...if you're using Leiningen, it'll automate downloading things from Maven for you.
10:06ro_stdoes anyone know if you can do the dynamic binding hijinks in clojurescript? (def ^:dynamic foo) (binding [foo (atom {})] …)
10:14ro_stwooo it does
10:18ohpauleezro_st: Just saw this now. It does but I think it has a few edge cases. Shoreleave does it configure alternate endpoints for the remotes (a little hidden gem)
10:19ro_sti have a whole bunch of namespaces that have top-level atoms (yeah i know)
10:19ro_stthey constitute the cljs model code
10:19ro_sti want to be able to spin up instances of this code server side, which means not using top level atoms
10:20ro_sttrying to find a way to refactor without having to inject some state param into every fn in all these namespaces
10:21ohpauleezro_st: It's typically bad design to use dynamic bindings for confs
10:21ohpauleezyou should pass in the state
10:21ro_sti figured that'd be the case
10:21ohpauleezthe dynamic var will hurt composability and adds some piece of black magic that the programmer needs to keep in his head
10:22ro_styup
10:24anildigitalto learn clojure or to learn scala first?
10:24ro_stscala, definitely. it's waaaay better than clojure.
10:24ro_stwho needs simplicity anyway
10:25anildigitalro_st: raally?
10:25ro_stno. :-)
10:25clgvro_st: unexpected answer for #clojure ;) :P
10:26ohpauleezanildigital: I'd learn Clojure first. It is a simpler language, with simpler constructs and less syntax. It'll force you to mold your brain to think functionally
10:26ohpauleezonce you have the functional foundation, you'll be able to swing over to scala and write idiomatic scala code without any issues
10:27ro_stnice, balanced answer. i'm far too biased. clojure clojure clojure.
10:27ohpauleezThe data structure work done in scala and Clojure are pushed forward by the same group of people. Scala thinks collections themselves should be parallel (but what the hell is a parallel vector?!?!), Clojure things base operations should be parallel (map, filter, reduce ala reducers)
10:28ohpauleezScala's type system is nice (same general type system as Haskell), but it can be a pain point
10:28ohpauleezBest to learn to think functionally first here in Clojure and branch out
10:29ohpauleezClojure thinks base… ***
10:30cemerickut-oh, githubs are having issues again.
10:31ohpauleezcemerick: :( it's going to be a longer-than-necessary day
10:32cemerickIt's subtle at the moment. Commits not showing up in the web UI, etc.
10:32ohpauleezahh
10:33abalone~gagnam
10:33clojurebotPardon?
10:33abalonegood. clojurebot unscathed.
10:33ohpauleezhaha
10:37chouserneag: You're beyond me. I haven't done anything with the finite domain stuff yet.
10:37chouserI'm still struggling with my understanding of conda
10:40naegchouser: I see. I'm still struggling with a lot of things too, but I only started using it yesterday
10:41chouserro_st: thanks for the pubsub comments. That snippet is of course not close to a library of reusable code, but I hope the feature set provided by such a simple combination of Clojure features helps people think about what they need and some less obvious approaches to getting it.
10:41naegcore.logic is really fun though
10:41chousernaeg: yeah, I'm having fun with it too
10:41chouserThough less fun at the moment than previously, because I can't believe conda is supposed to act like this. :-)
10:43babilenWhat is the best/easiest way to compile clojure with Java7? (I want to play with reducers and the deployed jar has obviously been compiled with java6)
10:45clgv babilen: it has a build.xml for ant
10:45naegchouser: haven't looked at it yet, but doesn't it do what ! does in prolog? basically a "cut" which stops backtracking
10:45babilenclgv: I was planning to use "mvn install" for now, but thought I ask first.
10:46antares_babilen: ant w/o arguments should do it but you don't need to use JDK 7 until you specifically want to
10:46antares_babilen: there is a fork/join framework port to JDK 6 and I believe it is bundled with Clojure
10:47naegoh, well it's titled a soft-cut in the source, so maybe not quite !
10:48TimMcbytechunky: Here's a new password for you: ##(apply str (map char (repeatedly 14 #(+ (rand-int 94) 33))))
10:48lazybot⇒ "hpV~\\93S`v!7Dd"
10:48babilenantares_: Well, I could specify that dependency explicitly, but I am running 7 here anyway. It does *not* work if you just declare a depdency on clojure 1.5.0-alpha4 (ClassNotFound exception for jsr166y)
10:49antares_babilen: I use 1.5 master and JDK 7 (not reducers, though) for something, it works great
10:49antares_babilen: if it does not work on JDK 7 then that's a bug you should report
10:49babilenjira?
10:49clojurebotto be fair I dunno that I've ever had code out right rejected, it just sits in jira or assembla or where ever, or if I ask if there is any interest (before writing any code) I get told to go write alioth benchmarks
10:50antares_hahaha, I love you clojurebot
10:50babilenantares_: It does not -- I mean clojure works just fine, but reducers/join throws a ClassNotFound exception for jsr166y.
10:50antares_babilen: yeah, Clojure follows a 16th century development model
10:50bytechunkyTimMc: Thany you XD
10:51ivanlooks pretty 17th to me
10:51clgvmaven?
10:51clojurebotHelp, I'm trapped in an XmlFactoryFactory!
10:51clgvlol
10:51antares_ant?
10:51clojurebotant is like a band-aid: one motion, right off! <cemerick>
10:51cemerickhah-hah
10:52gkoWhen "lein repl", is the stuff defined in project.clj loaded?
10:52antares_gko: yes, to set up your classpath and so on
10:52chousernaeg: I expected this to return (1): (o/run 10 [q] (o/conda (o/succeed o/fail (o/== q 1)) ((o/== q 2))))
10:53gkoantares_: sorry, I meant, is the stuff in src loaded...?
10:54antares_gko: only if you require it (or some other library you require does)
10:54antares_AOT-compiled stuff is compiled either way
10:56clgvgko: if you have specified a :main then namespaces your main namespace uses or requires are loaded transitively
10:56babilenantares_: https://www.refheap.com/paste/5016 is what I am seeing -- Unfortunately it means that deployment is pretty tricky. It is probably a better idea to just list jsr166y as a dependency for now.
10:56gkoantares_: got it. thanks.
10:58naegchouser: why do you o/succeed and o/fail in row?
10:58antares_babilen: still, file an issue, it should not be ignored forever. Shipping 1.5 with it would be a big issue given how long it takes for point releases to come out.
10:58chousernaeg: as a demonstration. reverse their order and you get the results I expected, (2)
10:59chouseroh, sorry, I expected (1) not ()
10:59chousergah
10:59chouseroh, sorry, I expected (2) not () nor (1)
10:59babilenantares_: Where do I file that? http://dev.clojure.org/jira/browse/CLJ ?
11:01antares_babilen: yes, and maybe ask a thread on the mailing list about what you are seeing
11:02naegchouser: I'm confused now. from the original code with o/succeed o/fail - what do you expect? and what from the second one with o/fail o/succeed?
11:02gko(doc require)
11:03clojurebot"([& args]); Loads libs, skipping any that are already loaded. Each argument is either a libspec that identifies a lib, a prefix list that identifies multiple libs whose names share a common prefix, or a flag that modifies how all the identified libs are loaded. Use :require in the ns macro in preference to calling this directly. Libs A 'lib' is a named set of resources in classpath whose contents define a library of Clojure
11:04chouserSorry, I messed it up. I expect the order of clauses to be unimportant within each conda clause. Therefore the existence of fail anywhere in the first clause should make it fail, and cause conda to pursue the second clause. Therefore the result should always be (2), from the second clause
11:05chouserBut my expectations don't match reality, so either there's a bug (which I assume not to be the case) or my mental model needs some serious work. :-P
11:06naegchouser: hmm...as I said, haven't really looked at conda, but from my understanding the orginal code returns () because o/succeed is the head of the clause, but o/fail "consumes" (o/== q 1) and returns nil (resulting into () for q)
11:07naegand when switching o/succeed with o/fail, the second clause is chosen because the head of the first is o/fail
11:20chousernaeg: I think you're right, just not what I expected.
11:21chouserIt looks like wrapping (fresh [] ...) around each clause produces what I expected, but surely isn't the Right Way to do anything.
11:22naegchouser: the theory makes sense at least according to the behaviour (not neccessarly true therefore though...)
11:23zerokarmaleftchouser: was (o/succeed (o/== q 1) o/fail) your other ordering for the first clause?
11:24mpanis there a built-in for "the elem of c with highest value of f"?
11:24llasram&(doc max-key)
11:24lazybot⇒ "([k x] [k x y] [k x y & more]); Returns the x for which (k x), a number, is greatest."
11:24mpando you know if it would call k more than once on a particular x?
11:25llasramI don't believe it should, but if it matters then you may want to re-think what you're doing :-)
11:25mpanfor correctness it's the same regardless
11:25mpanfor performance I might be a bit worried
11:26llasramAh, I see. Well, the implementation is at your fingerprints!
11:26mpanreading that at the moment
11:26mpanunfortunately it appears to use k kind of like a comparator
11:26chouserzerokarmaleft: I meant (o/succeed o/fail (o/== q 1)), but yours behaves the same.
11:27babilenantares_away: I've reported it and it was aptly named CLJ-1066. I just got the priority wrong, which I apparently can't change anymore.
11:27antares_babilen: thank you!
11:28babilennp, thank you!
11:30mpanI guess if I want decorate-sort-undecorate I should do it directly
11:30mpanthanks!
11:30zerokarmaleftchouser: (o/run 10 [q] (o/conda ((o/== q 2)) (o/succeed o/fail (o/== q 1)))) <= conda commits to the first clause with this ordering
11:32zerokarmaleftbecause it succeeds, and in conda only one clause can succeed
11:32chouserzerokarmaleft: yes, I understood that. What was confusing me was that in my original example, I assumed the o/fail would cause conda to move on to the second clause, but it did not. It had already committed to the first clause, so the o/fail caused it to find no solutioons at all.
11:33zerokarmaleftchouser: ah...no, the first succeed prunes the rest of the tree at the level of conda
11:35FrozenlockAwww git is down... anyone has a copy of the domina readme?
11:36gfredericksI oughta
11:36gfrederickswait no
11:36gfrederickswait maybe
11:36Frozenlock:P
11:36FrozenlockI would really appreciate if you could pastebin it.
11:37gfredericksFrozenlock: http://upload.gfredericks.com/domina-1.0.0.jar
11:37gfredericksI went half-way for you :)
11:37gfredericksif it's not in the jar then I don't think I have it
11:37FrozenlockThank you very much
11:37gfrederickslet me know if that 404's I didn't check it
11:38FrozenlockNo it's good, checking now if the readme is in there
11:38gfrederickscool
11:38gfrederickscome to think of it it probably isn't :/
11:38gfredericksI can't imagine a build process that puts it in
11:38naegFrozenlock: what about google cache?
11:38naeg(if you can't find the readme there)
11:38FrozenlockNo it's not, however I have the source, I can use that :p
11:39zerokarmaleftchouser: since the first clause succeeds, you're getting the disjunction of o/fail and (o/== q 1), which is ()
11:39gfredericksFrozenlock: glad I could be mildly helpful
11:40Frozenlocknaeg: Indeed...
11:40FrozenlockYay first occasion of the day to do the smart thing and I missed it!
11:40naegit's available in google cache, just google "cache:https://github.com/levand/domina&quot;
11:40Frozenlock\o/
11:40FrozenlockThanks :)
11:41naegyou're welcome
11:42zerokarmaleftwhich i guess naeg already said, in so many words...time for a second cup of coffee
11:42FrozenlockI'm still on my first... but I'm getting there!
11:44naegzerokarmaleft: I guess it results in a better understanding for all of us ;)
11:44naegis there a naming convention for passing HOF's as arguments? like "step-f" or do I simply use "step"?
11:44jocke12a couple of guys in my office are planning to learn some new languages. i've decided to learn clojure (they've chosen haskell and erlang respectively). we want to make it more interesting by having some sort of competition. do you guys have any idea on what would be a good "first project" type of system, that we then could, in some way, compete with? :)
11:44chouserzerokarmaleft: yes thanks, I just didn't understand that the first expression in each conda clause was "special".
11:45scriptorjocke12: well, there's the canonical convert-something-you-already-use project
11:47jocke12scriptor: thanks for the tip. we were thinking something more ... fun. :) less useful but equally instructive
11:48scriptorhmm, is there something all three of you are good at?
11:48jocke12within programming you mean?
11:49scriptoryep
11:49scriptoras in, some specific, field, data analysis, web dev, etc.
11:49jocke12a definite now on that one. only two of us are even programmers to begin with. thinking something like calculus would be a good starting point, though
11:50jocke12definite no*
11:50TimMcWrite a Haskell interpreter in Clojure, a Clojure interpreter in Erlang, and an Erlang interpreter in Haskell. :-P
11:50naegjocke12: sudoku solver, conways game of life, tic tac toe AI, ...
11:50jocke12;)
11:50nsxtjocke12: totally absurd suggestion, but how about each person writes an interpreter for the other two languages?
11:50nsxtTimMc: beat me to it :)
11:50naeglol
11:50jocke12haha
11:50TimMcheh
11:51TimMcClojure has the most complex runtime, though.
11:51gfrederickswrite an interpreter for (intersection clj cljs)
11:51scriptorgame of life actually sounds pretty fun
11:52rbxbxActually, writing a simple lisp interpreter wouldn't be bad, though I feel like Erlang might be slighted in that domain.
11:52gfrederickserlang. what a guy.
11:52pepijndevos$['a 'b #_foo 42]
11:53pepijndevos&['a 'b #_foo 42]
11:53lazybot⇒ [a b 42]
11:53abalonegfredericks: haha. a corporation is not a person :-P
11:53scriptorisn't erlang's string processing a little handicapped or is that just a myth?
11:53abalonegfredericks: (political joke)
11:53TimMcabalone: Erlang was a guy.
11:53gfredericksabalone: programming languages are people my friend
11:53TimMchttps://en.wikipedia.org/wiki/Agner_Krarup_Erlang
11:54rbxbxscriptor I know sadly little of Erlang, tbh :(
11:54gfredericksyou can't spell people without PL
11:54TimMc>_<
11:54pjstadigor EO
11:54TimMcabalone: https://en.wikipedia.org/wiki/Ericsson is the place erlang was developed.
11:54abaloneTimMc: there are four lights!
11:54TimMcWhat does that even mean?
11:55rbxbxTimMc the internet tells me it's a Star Trek TNG reference.
11:56zerokarmaleftabalone: ah! you called me Picard!
11:56abaloneok i didn't know erlang was also a guy. seemed like such a convenient abbreviation
11:56TimMcAh, found it.
11:56jocke12did not know that erlang was a person connected to ericsson. just thought it was ERicsson LANGuage
11:56scriptorhuh, it sounds a lot like the scene from 1984
11:56qubit[01]github down :(
11:56jocke12thanks for that, gfredericks
11:57rbxbxscriptor: the internet also tells me it's that the episode of TNG was a reference to 1984 ;)
11:57scriptorrbxbx: that's what I get for commenting before finishing the wiki article
11:57jocke12naeg: think we're going with sudoku solver. thanks
11:57TimMcjocke12: I don't know that Mr. Erlang had anything to do with Ericsson.
11:58gfredericksjocke12: ironically I wasn't even referring to that; but I did know it I think
11:58jocke12TimMc: well, not directly maybe, but it says on wikipedia that he was important to telecommunications, so i guess in some way he was
11:59jocke12gfredericks: :D
11:59scriptorapparently it was both a reference to the danish mathematician and the company
11:59scriptortwo birds
11:59rbxbxjocke12 "A unit of measurement, statistical distribution and programming language listed below have been named in his honour."
11:59jocke12indeed
11:59rbxbxYeah. Fancy, that.
12:00rbxbxEveryone gets to learn something today :)
12:00jocke12:)
12:00scriptorI'm surprised nobody has name a language after euler
12:00scriptoroh, never mind
12:00jocke12http://en.wikipedia.org/wiki/Euler_(programming_language)
12:01zerokarmaleftdamn you, Wirth, you claim everything that is cool
12:01abaloneclearly i need my own language. but with the existence of clojure i cannot be motivated enough
12:01basicsenseiis there a ccw channel?
12:02basicsenseiis it possible to specify in :dependencies a project that's in (eclipse) workspace ?
12:02basicsenseior I'm stuck having to upload any updates to clojars?
12:02unlinkHow do I insert or update a row with clojure.java.jdbc if one of the columns is a PostgreSQL enum type?
12:04basicsenseisince github's dead, I'm stuck waiting for the clojars tutorial to show: https://github.com/ato/clojars-web/wiki/tutorial
12:04TimMcbasicsensei: https://encrypted.google.com/search?q=cache%3Ahttps%3A%2F%2Fgithub.com%2Fato%2Fclojars-web%2Fwiki%2Ftutorial
12:05basicsenseitimmc thanks, wise one;)
12:05TimMcbasicsensei: ...but you may want to look at firing up a local maven repo.
12:05TimMc~repeatability
12:05clojurebotrepeatability is crucial for builds, see https://github.com/technomancy/leiningen/wiki/Repeatability
12:05TimMc^ there are some options here
12:06basicsenseisounds good
12:06naegjocke12: believe me, that will be fun. you might want to think about writing a functional solution (like the others) and then write a logic one using clojure.core.logic
12:06basicsenseitimmc, I'll take that as: https://webcache.googleusercontent.com/search?q=cache:KxQdDLSiirIJ:https://github.com/technomancy/leiningen/wiki/Repeatability+&amp;cd=1&amp;hl=en&amp;ct=clnk
12:07rbxbxnaeg is there a CGOL implementation on top of core.logic?
12:08naegrbxbx: I don't know what exactly CGOL is nor whether core.logic has it :3
12:09naegrbxbx: not sure whether this answers your question, but core.logic has the same syntax as clojure itself (s-expressions)
12:09rbxbxnaeg: sorry. conways game of life. I thought that's what you were referring to before.
12:09scriptorhttp://en.wikipedia.org/wiki/CGOL
12:09scriptorI thought it was that for a bit
12:10rbxbxCGOL is an unfortunate acronym apparently. I shan't use it again.
12:10naegrbxbx: I'm not aware of one, but haven't searched. there is a sudoku solver in core.logic though (about 30 lines iirc)
12:12naegrbxbx: I'm not sure whether a core.logic implementation of conways would be a good idea...
12:12rbxbxnaeg: looking into it it doesn't seem like a problem often approached with logic programming
12:13rbxbxnaeg so perhaps you're correct
12:13rbxbxnaeg: I've only just started reading "The Art of Prolog" last night, so I can't say I have a good grasp on the sort of problems Logic Porgramming is suited for yet.
12:13naegrbxbx: but it sounds interesting though, I'll put it on my ToDo and might come back to you with one
12:14rbxbxnaeg: that would certainly be appreciated if you did :)
12:15rbxbxnaeg: a paper to get you started, if you fancy (and can read their notation) http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.23.4552
12:15naegrbxbx: it can't be that hard on first thought though, because you're actually just applying rules on some data
12:15augustlis there a mirror for leiningen out there, or is it only available on github.com?
12:16technomancyaugustl: I had it on gitorious for a while but I don't know if the mirroring scripts have kept up
12:16technomancylemme take a look
12:16naegrbxbx: but the pure clokure solution of conways will be hard or impossible to beat...
12:16naegclojure*
12:16technomancynope =(
12:17technomancyI'll push
12:17augustlaww, let's hope github.com goes back up soon then :)
12:17HodappI eagerly await whatever paradigm replaces OOP as "that paradigm that must be good because everyone uses it and claims to support it and is therefore responsible for all things that are good because all modern things support it"
12:17Hodappaugustl: it's down again?
12:17augustlit's down for me at least
12:18jkkramerit's been down for a while
12:18technomancyaugustl: https://gitorious.org/leiningen/leiningen
12:18gfredericksHodapp: that will happen when somebody figures out some turing-complete thing based on REST
12:18augustltechnomancy: nice!
12:18gfredericksHodapp: or maybe it will just be the javascript paradigm
12:18rbxbxnaeg: would be an interesting intellectual exercise, regardless. Plus wouldn't a hybrid solution be possible using 'core.logic ?
12:18augustlOS X seems pretty github centric :) Can't even get git (homebrew, that is)
12:18jkkramernice, github's status page is down too
12:19technomancyif anyone has suggestions for how to automate mirroring from github to gitorious I'm all ears
12:19Hodappgfredericks: It's not that OOP is bad, it's that it is certainly not everything it's so often claimed to be...
12:19Hodappaugustl: odd, it went down for 5-10 minutes yesterday too
12:19gfredericksHodapp: I haven't been convinced it isn't bad
12:19technomancygetting an OS X dev environment seems a lot like terraforming; you need a friendly civilization on a nearby planet from which to shuttle supplies.
12:20Hodappgfredericks: I see how it can map well to GUI development. My issue is with the common view that this must mean it also is optimal for every other problem, ever.
12:21augustltechnomancy: you can set multiple URLs on a remote
12:21augustlso that when you push you push to both
12:21technomancyaugustl: aha; clever
12:21gfredericksHodapp: oh yeah guis are a good example maybe; I've been puzzling over organizing GUIs in clojurescript just recently
12:21naegrbxbx: yes, for board representation, etc. I'd just use this: only (neighbours) and (stepper) will be replaced with logic predicates
12:21naegrbxbx: and again, this: http://bpaste.net/show/S5OpM7BHWMQGfnzYO6ho/
12:21technomancythat's probably good enough. won't help for other committers, but it'll be eventually consistent
12:21augustltechnomancy: hehe indeed :)
12:22Hodappgfredericks: and the "object-oriented is the best paradigm for all other problems, because the world is made of objects!" is, er, hand-waving bullshit
12:22duck1123at least it'll only be out of date till you next push
12:22duck1123or you could set up a cron to pull and then push
12:23gfredericksHodapp: Erik Meijer and rhickey recently talked back to back here; Meijer ended with a demonstration of tearing a stuffed bear in half and claimed that therefore mutability is great because the real world is mutable
12:23gfredericksHodapp: rhickey did not let that slide
12:23technomancyduck1123: yeah, I'd like to keep the cron somewhere it'd stick around. I could probably do it in a heroku app
12:23Hodappo_O
12:23zerokarmaleftgfredericks: heh, i didn't watch that far into it
12:23Hodappgfredericks: I would think tearing a stuffed bear in half is a demonstration that mutability is NOT always great
12:24duck1123The real wold is mutable, but you don't want to give a bear to a small child that someone else ripped up in another thread
12:24gfredericksrhickey's main rhetorical point, as I remember it, was that despite the bear no longer having a head, you don't have to forget that it had one
12:24gfredericksthere is value to remembering :)
12:25rbxbxnaeg: that is a pretty elegant solution, though I'm not super big on the heavy use of list comprehensions, but that's probably just a personal style matter :)
12:25gfredericks"don't be the bear" I think he said a few times
12:25technomancyjust because we can't hop between parallel universes in real life doesn't mean it's not a totally awesome thing to be able to do
12:26technomancyand I mean awesome there literally
12:26HodappPaul Graham has a few interesting essays on why he doesn't like OO much
12:27justicefriesmutability also resulted in a bear without its head. ;)
12:28gfrederickseh that happens in either case
12:28casionHodapp: PaulGraham has essays on why he doesn't like … anything that's not lisp ;)
12:28gfrederickszerokarmaleft: is the talk on the interwebs somewhere? or were you there?
12:28justicefriesrhetorically wouldn't it be a new head being made and given to you, and you still have the original bear?
12:28justicefrieshead twisting.
12:28zerokarmaleftgfredericks: http://channel9.msdn.com/posts/Expert-to-Expert-Erik-Meijer-and-Rich-Hickey-Clojure-and-Datomic
12:29gfrederickszerokarmaleft: oh that was just their conversation afterwards, right?
12:29naegrbxbx: what else would you use there for e.g. create-world or neighbours? i'm rather new to clojure
12:29gfredericksthey each gave actual hour-long talks
12:29FrozenlockNooooo, no more interesting videos, stop it!
12:30zerokarmaleftgfredericks: no idea, i hope their GOTO talks get posted to infoq
12:30rbxbxnaeg: as am I, but I'd probably be inclined to use HOFs. Not to say they would reach as elegant a solution though.. just work better to my mind :)
12:30Hodappcasion: well, I do agree with a lot of his essays, fiery as they sometimes are.
12:31naegrbxbx: that code is actually based on that one: http://clj-me.cgrand.net/2011/08/19/conways-game-of-life/
12:31naeg(used in the book I'm reading)
12:31casionHodapp: I do too, but citing graham has never worked for me ("Oh.. that guy, of course…")
12:34mpanis there a particular reason the language allows both calling a map with a keyword and calling a keyword with a map?
12:34rbxbxnaeg: yup, I'm reading that as well. Cheers for the link though :)
12:35dnolenmpan: it's useful to have the collections be functions of their keys. have keywords implement IFn is also useful in other ways.
12:35abalonempan: if you're using a threading macro, being able to choose where each goes is convenient
12:35dnolen,(map {:foo 1 :bar 2 :baz} [:foo :baz])
12:35clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Map literal must contain an even number of forms>
12:35dnolen,(map {:foo 1 :bar 2 :baz 3} [:foo :baz])
12:35clojurebot(1 3)
12:36dnolen,(map :foo [{:foo 1} {:foo 2}])
12:36clojurebot(1 2)
12:36mpanso like, it helps in the places where you would want something fn-like?
12:36mpanthanks!
12:36nsxtlispnyc meeting later: http://www.meetup.com/LispNYC/events/67027682/
12:39naegdnolen: hey, have you seen my bug report for core.logic's +fd and infd? I'm still a bit unsure whether I misunderstood something
12:40dnolennaeg: I did, I'm happy that people are filing tickets on the FD stuff, but they probably aren't going to get addressed until I do a pretty serious refactor of how that's stuff works.
12:41dnolennaeg: which probably won't happen until after StrangeLoop
12:41naegdnolen: oh, so I should switch away from using FD stuff for my fun project since it's not going to be fixed in the near future?
12:42dnolennaeg: it's alpha stuff :) it will probably get addressed w/in 3-4 weeks.
12:42naegI took a look at the code base, but that's too much for me as a clojure newbie
12:42dnolennaeg: heh, I don't really expect patches for the FD stuff. The refactor is pretty significant and addresses some serious flaws in the original Scheme design
12:45naegdnolen: ok, great. can't wait to hear about it. btw, how can I get informed about such news? (github down atm, can't look myself)
12:45dnolennaeg: I will definitely announce a 0.8.0 beta on the Clojure mailing list.
12:45gfredericksdnolen: I've been fantasizing about doing OSS work during free time at strange loop; if that doesn't turn out to be over-ambitious maybe I'll be able to get my head around the FD code
12:47dnolengfredericks: the Scheme cKanren code is definitely approachable - that + the paper is all you need. hopefully my unsession talk can clear up the basic internals for core.logic users.
12:47gfredericksdnolen: I will nearly almost probably be there then!
12:48dnolengfredericks: the refactor from a high level is simple - the constraint fixpoint calculation in cKanren Scheme is not very good. so my refactor is mostly around improving that.
12:48dnolengfredericks: cool!
12:49naegdnolen: one more question - is domain meant to be used on vectors? like this: (domain [[0 0] [1 1] ...])?
12:49naegbetter say, can it be used on vectors
12:49dnolennaeg: no, meant to be used like: (domain 1 2 4 5)
12:51naegdnolen: it is possible to create a domain of vectors then (not e.g. of LCons, since they are not comparable). is the workaround of using membero instead of domain correct then?
12:51naegsee here for more information on my issue: http://stackoverflow.com/questions/12355352/predicate-to-declare-descending-ascending-coordinates-using-finite-domains
12:56dnolennaeg: can't really go into a full explanation right now - will try to find some time to answer that question soon tho. but yes that last solution look OK at first glance. I'll try to make the domain doc string for domain more clear about valid inputs.
12:56djanatyncool! I never knew assoc could work with vectors
12:56djanatynassoc is my favorite function so far
12:56technomancymeh; it's OK. it's no juxt though.
12:57djanatynI've never seen juxt :O
12:57chouserfnil -- a white knight on a charging steed
12:57naegdnolen: thanks, you helped me a lot and saved me quite some time today :) will just replace conso with ==
12:57djanatynI'm excited; I'm going to a local clojure meetup in pittsburgh today
12:57technomancyclojurebot: juxt?
12:57clojurebotjuxt is usually the right answer
12:57technomancyclojurebot: have a scooby snack
12:57clojurebotforget botsnack is Thanks. Can I have chocolate next time
12:57chouserha! lie!
12:57technomancyoh dear
12:58djanatynO_O
12:58djanatynjuxt is awesome
12:58cemerickdnolen: is the restriction that e.g. :refer in ClojureScript's :require must be a vector something that could be relaxed? Seems like a silly clj/cljs incompatibility.
12:58scriptorit's like how "hashmaps" is the answer to 90% of software interview questions
12:58djanatynit's like...backwards map
12:59djanatynthat takes functions instead of things to feed to functions
12:59Hodappscriptor: I prefer "interfaces". Or just pick a random design pattern.
13:00TimMcsingleton factories
13:00dnolencemerick: I personally have no strong opinions about that. It's not clear to me whether the restriction was intended.
13:00technomancylists in :require make me =(
13:01TimMcDesign Patterns was intended as a set of observations, not recommendations. :-/
13:02cemericktechnomancy: I like them as values of :refer, :only, etc. Some visual distinction helps with readability IMO. But, that's besides the point…
13:02technomancycemerick: it's all about the indentation
13:02cemericktechnomancy: fix your editor :-P
13:02hiredmancemerick: I tried to tell him
13:03chouser[:require ...] ftw!
13:04xeqidjanatyn: &&& from http://www.haskell.org/ghc/docs/latest/html/libraries/base/Control-Arrow.html
13:04hiredmanyou've certainly won something there
13:04cemerickdnolen: It seems to be intentional (it's enforced with an assertion with firm error message), but goes against the docs for require, refer, and canonical examples like @ http://clojure.org/libs
13:04technomancycemerick: every other place you use parens, the head is indented separately from the tail
13:04technomancyand things in vectors are indented as peers
13:04technomancywhy complicate things with new rules that only apply inside ns?
13:05cemerickI can't say I've ever had more than 3-4 things in a :refer or :only list *shrug*
13:05djanatynlooks like sequence does what juxt does
13:05cemerickIf you're bringing in more than that, an ns alias is probably a better route?
13:05djanatyntoo much clojure, I forgot to add commas in my lists in haskell :)
13:06technomancycemerick: yeah actually I strongly prefer :require/:as now, but I used to work on a codebase with ginormous :only vectors
13:06technomancydjanatyn: funny how you start to realize that commas are really only there to pacify the parser
13:07dnolencemerick: then I would bring it up on the ML ... the restriction dates back to the original release - so perhaps it was a explicit effort to limit variations.
13:07technomancyand once you realize that it starts to get more and more annoying because it's obvious the designer of the parser didn't realize it =(
13:07cemerickdnolen: will do
13:07thorbjornDXtechnomancy: python
13:08djanatyntechnomancy: I'm pretty sure the commas are important in haskell, because of how haskell does functions
13:09djanatynmy example was:
13:09technomancyoh yeah, the whitespace sensitivity probably complicates things too
13:11thorbjornDXtechnomancy: ggVG= shouldn't break code functionality IMO
13:19naegIf I want to wrap certain funccalls into always the same sourrouding funccallls - is this where I use macros of HOF?
13:19djanatyn> let juxt fs x = map (\f -> f x) fs in juxt [(+1), (+2), (+3)] 5
13:20gfredericksnaeg: I have no idea what that means
13:21naeggfredericks: I'm having severals checks which always have the same core.logic run, fresh, and (== q) around them. only the goals in between differ on each call
13:22gfredericksnaeg: if you're just doing (== q [x y z]) for some fresh x y z, you can actually use x y z as the query variables
13:22gfredericksi.e., (run [x y z] ...)
13:22naeggfredericks: ok, so the fresh is not needed - but the other stuff around is
13:23gfredericksyou don't need the fresh or the ==; what else is there?
13:23naeggfredericks: concrete code: http://bpaste.net/show/44967/
13:24naeggfredericks: but the first and second goal (infd and everyg with +fd) are the variables and the stuff around is always the same
13:24naegtried to just give check* functions through parameters, but that didn't work
13:26gfredericksyou could make a function (relation) that takes the a b c d as args, couldn't you?
13:26gfredericksthen does the variable stuff
13:26gfredericksI guess I'm suggesting exactly what you claimed doesn't work
13:26gfredericksso I'm curious what didn't work for you
13:27naeggfredericks: just a sec, have to rewrite what didn't work for me
13:30naeggfredericks: trying something new now, just giving check* & rules parameter and trying to extract that inside l/run then - takes some time, clojure newbie
13:32gfredericksso you have a list of relations and you want to assert each of them
13:32gfredericksI think you'd want a helper function for that
13:36gfrederickseveryg would be a good name for it but that is apparently taken
13:36gfredericksmaybe all-fn
13:37gfredericks(defn all-fn [funcs & args] (if (empty? funcs) succeed (all (apply (first funcs) args) (apply all-fn (rest funcs) args))))
13:38naeggfredericks: I just realized it's always just two functions - one which is a constraint (either infd or membero) and one rule which describes the winner
13:38oichWhen I attempt to run line-ritz it trys and fails to fetch leiningen:leiningen:jar:2.0.0-SNAPSHOT. I have the most recent leiningen. Do you know where I can change this, or find the jar? I don't see a reference in any pom in my maven pile 'o jars or the ritz source tree.
13:38gfredericksyeah it'd be simpler for sure to avoid the dynamic-length part
13:39naeggfredericks: yeah, and it seems not to be needed at all
13:39oichlein-ritz... I mean
13:40hugodoich: I realised I messed up with that dependency yesterday - you will either need to build lein master and install it, or build lein-ritz from source and install it. I should have a new ritz release shortly to fix this properly.
13:44naeggfredericks: I'm still fiddling around, but this is about what I'm trying to do:
13:44naeghttp://bpaste.net/show/jl6FZMfZrqmTBCACzNL6/
13:44naegthe -old versions work, the two new ones don't
13:44FrozenlockIs the 'indices' function in clojure now, or do I need to add it in my programs? http://stackoverflow.com/questions/8641305/how-do-i-find-the-index-of-an-element-that-matches-a-predicate-in-clojure
13:47sayyestolifeI'm having some trouble with encodings, more precisly the swedish characters å, ä and ö. I can read a file with slurp from the REPL or clj myfile.clj and it does print correct characters. However when using noir, all I get is those famous unicode-boxes
13:48S110010011sayyestolife: content-type header in http responses?
13:52the-kennyIs there a browser-connected nrepl that works nicely with nrepl.el?
13:54cemerickthe-kenny: see piggieback
13:55cemerickhttps://github.com/cemerick/piggieback
13:56amalloyS11001001, sayyestolife: content-encoding, not content-type
13:57abaloneworking on my subset of paredit for codemirror (which i shall call 'subpar') .... does light-table use ctrl- up/down/left/right for anything?
14:04pepijndevosdnolen: I modified Clojure so it does not use ArrayNode, and it's somewhat slower.
14:04pepijndevosWith ArrayNode: "Elapsed time: 37540.096 msecs"
14:04pepijndevoswithout: "Elapsed time: 48837.642 msecs"
14:05dnolenpepijndevos: did you figure out why?
14:07pepijndevosdnolen: still thinking about that. The only thing I figured out so far is that it switches on the degree of the node, and that ArrayNode contains only other INodes
14:07xeqithe-kenny: piggieback works as a repl, though nrepl.el needs some changes to load files; kingtim/nrepl.el#95
14:07lazybotUse :op load-file to load a file -- https://github.com/kingtim/nrepl.el/issues/95 is open
14:08the-kennyxeqi, cemerick: Thanks, that looks nice. I can't wait for full support in nrepl.el. Finally a nice dev-environment for hybrid projects
14:09pepijndevosdnolen: So far it does not seem a matter of time complexity, but rather regular time :) Still about 8 reads of the code to go.
14:12nsxtring-anti-forgery's docs/code give me the impression that, after adding it as middleware, *anti-forgery-token* should be available. unfortunately, i keep getting Unbound: #'ring.middleware.anti-forgery/*anti-forgery-token*
14:13weavejesternsxt: It's likely you're not accessing the var within the middleware.
14:13nsxtweavejester: haha, so i'm operating under a gross misunderstanding - the var isn't available throughout the application, but only within the middleware?
14:13weavejesternsxt: The middleware adds a binding around your handler, so you can only access that var's value within the handler that has been wrapped.
14:14nsxtweavejester: thanks
14:14weavejesternsxt: It's available in the handler the middleware wraps
14:14weavejesternsxt: And any functions called by that handler within the same thread, of course.
14:17sayyestolifeS11001001: none is visible from firebug, only content-type which is utf-8
14:18naegllasram: hey, I tried to apply your solution for checking rows/cols on a connect four field onto diagonals - but it's messy
14:18naegofc, instead of looking whether they are in sequence, I have to check whether they are ascending/descending (which means, y and x coordinates matter)
14:18S11001001amalloy: charset is in content-type
14:18S11001001amalloy: content-encoding is like gzip or what have you
14:19amalloydang. too long since i fiddled with that stuff, i guess. objection withdrawn
14:19oichhugod thanks about the leiningen dependency. I mistyped though, I meant lein ritz-nrepl. Now, I get an exception in thread "main " of com.sun.jdi.connect.VMStartException: VM initialization failed for: /opt/jdk1.7.0_04/jre/bin/java. Do I need a different jdk version?
14:19S11001001sayyestolife: does the writer on java side know you're in utf8 land?
14:19llasramnaeg: Yeah. I'm not sure what the best representation to make the expression most straightforward
14:20sayyestolifeI'm using slurp straight out
14:20naegllasram: did you try around with diagonals too?
14:20naegllasram: I'm thinking about converting diagonals to rows/cols, so I only have to care about one coordinate again
14:20hugodoich: looks like you are running a jre rather than the jdk. Could that be?
14:22naegllasram: well, I could create "matches" based on [y x] like [2 2] would be 22 and the difference between each has to be 11
14:23naegdamn, that seems neat on first thought...
14:24mpenetsayyestolife : you could also try adding :jvm-opts ["-Dfile.encoding=UTF-8"] in your project.clj just in case
14:24FrozenlockIn the DOM, if I ask for td[1], I will get the FIRST cell from a row in a HTML table. However, nth 0 will give me the first element in a coll. If I want to make some cljs function to manipulate the html table, how should I implement it? 0--> first, or 1--> first?
14:25FrozenlockIdiomatic clojure would be 0---> first, right?
14:26Bronsaè
14:26Bronsai think so*
14:26nsxtweavejester: not sure if you're intimate with noir, but would this entail using a custom-handler, rather than add-middleware?
14:27sayyestolifeS11001001:, mpenet the difference is that it works when running it in a REPL or in a "clj myfile.clj"-script, but not when I do lein run?
14:27nsxt(i'll admit to being completely lost as to how to access values within the handler)
14:28dnolenpepijndevos: w/ ArrayNode that's 30% faster tho right? Not quite a "slight" difference.
14:29thorbjornDXis it best to use (int (/ 1 2)) if I want floor division? or should I use with-precision?
14:29pepijndevosdnolen: yea… funny.
14:30aperiodicthorbjornDX: quot
14:30nsxtweavejester: never mind, i got it. sorry for the pestering.
14:30naeghow can I put two numbers together, like (f 1 2) => 12
14:31thorbjornDXaperiodic: thanks
14:31Bronsa,(str 1 2)
14:31clojurebot"12"
14:31keugaerg(#(+ (* 10 % ) %2 )
14:31keugaerg((#(+ (* 10 % ) %2 ) 1 2)
14:31llasramnaeg: I don't think you want to do that... I think it'd be more straightforward to just express the logical conjunction of the two conditions
14:31keugaerg(#(+ (* 10 % ) %2 ) 1 2)
14:31naegoh, yeah, meant "12" - so str
14:32keugaerg,(#(+ (* 10 % ) %2 ) 1 2)
14:32clojurebot12
14:32zenoli(Integer/parseInt (str 1 2)) to round trip it back to a number.
14:32naegllasram: "two conditions"?
14:32keugaerg^^
14:32llasramnaeg: incrementing in both the x and y directions
14:33naegllasram: that's what I was trying to do, but it got really ugly, let me paste some code
14:35llasramnaeg: Actually... You know what, I retract what I was saying. I think the basic approach is right. If you collapse the board positions into a single index, then you can express all winning states as patterns of those indices
14:35llasramso (let [i (+ x (* 5 y))])
14:36naegllasram: (* 5 y)?
14:36llasramThen rows are just incrementing values by one, columns by 5, and diagonals by 6
14:36llasramWith some extra rules to prevent wrapping around edges :-)
14:37naegllasram: I was actually planning to leave the check for rows and cols the same. also, the ugly code I promised: http://bpaste.net/show/Pc0jRiSXy0LBOySfeAT7/
14:37naeg(it doesn't even work yet actually)
14:37llasramnaeg: Oh, right 6x6 grid, so *6
14:38naegllasram: 6x7 grid
14:38llasramOh, same principle :-)
14:38llasramYeah... that code seems a bit much for what should be a simple problem
14:39naegllasram: I learnt a lot of things though, so not completly wasted time :P
14:39llasramOf course! Plan to throw one away and all
14:39naeg(and it could be made improved and reduced to less code a lot, like ascendo/descendo, etc.)
14:40naegllasram: but generating values for actual coordinates is only needed for diagonals - would you apply that pattern on the checks for rows and cols anyway?
14:41llasramnaeg: I think so. Because then you could collapse to a single representation
14:42llasramI think you could do this version in ~6 lines of code
14:42djanatynwoah woah woah woah woah
14:42djanatyndoes clojure have built in pattern matching? :O
14:42naegllasram: yeah, I guess I'll use a vector of strings then, instead of a vector of vectors of strings
14:42naegthen the index is all i have to care about
14:43djanatyn,((fn [[x y]] (+ x y)) [1 2])
14:43clojurebot3
14:43naegI just love throwing all the code and concepts away for something new
14:43djanatynwhaaaaaat
14:43djanatynI can now remove apply in like...500% of my code
14:44llasramnaeg: I hope not sarcasm?
14:44dnolendjanatyn: not pattern matching, destructuring. tho proper pattern matching is possible via macros.
14:45naegllasram: biased - put quite some time in the old stuff, but I'm somewhat excited about the new solution
14:48cemerickdjanatyn: see http://clojure.org/special_forms#let for more about destructuring
14:49cemerickOr a good book ;-) …there's a lot of nifty tricks one can do with destructuring.
14:53unlinkI can't be the first person to want to insert an enum value into PostgreSQL with Clojure, am I?
14:56unlinkOr am I supposed to use sql/do-prepared "INSERT ... VALUES (?::my_enum_type, ?, ? ...)" directly?
14:56hoover_dammunlink, you could
14:59hiredmanunlink: what type of column are you trying to insert it in to?
14:59hiredman(java enums are ints at the bottom, I believe)
15:00pepijndevosWhere is this box class defined? https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentHashMap.java
15:00hiredmanunlink: http://stackoverflow.com/questions/3155967/are-enums-supported-by-jdbc
15:00dnolenpepijndevos: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Box.java
15:00pepijndevoshur dur
15:00S11001001pepijndevos: grep is your friend
15:01oichhugod about lein ritz-nrepl I see it is using the jre. which java returns the JDK java and JAVA_HOME is set to the JDK directory. Do you have any guess about where the jre path is coming from?
15:01unlinkhiredman: It's an enum type I've created with CREATE TYPE. No, JDBC does not in fact support transparent mapping between Java enums and database enums. That isn't what I'm asking for, though.
15:01pepijndevosS11001001: can't grep on github. Oh wait, I do have a copy now, Yea, should try that.
15:02S11001001also probably can't log -f or chase blames on github
15:02unlinkhiredman: I have a value like 'USD' and I'm trying to insert it into a column of type currency, such as one created by CREATE TYPE currency AS ENUM('USD', 'EUR', 'JPY', 'CHF');
15:02hiredmanunlink: oh, I thought you meant java enums
15:03unlinkI would like to do (sql/update-values :products ["id=?" product-id] {:currency "USD"}) but this doesn't work.
15:03hugodoich: which os? do you have a leinrc file?
15:03hiredmanunlink: what db?
15:04naegllasram: although, I'm wondering - what exatly should be done in ~6LOC?
15:04unlinkhiredman: PostgreSQL
15:04hiredmanunlink: does the sql work from pgsql?
15:05oichhugod linux (fedora). .lein/profiles.clj contains only: {:user {:plugins [[lein-ritz "0.4.1"]]}}
15:05hiredmanor whatever the postgress command line client is called
15:05unlinkhiredman: if I do echo "UPDATE products SET currency = 'USD' WHERE id = 123" | psql db?
15:05jsabeaudry(if-let [x (foo)] x :other-value) is there a more idiomatic way of writing this ?
15:05hiredmanunlink: yeah
15:06unlinkhiredman: yes, works fine.
15:06hiredmanunlink: did you pastebin the error you get somewhere?
15:07llasramnaeg: Well, maybe closer to a dozen. But take a board, a piece-symbol, and return all winning index-sets
15:07raekjsabeaudry: (or (foo) :other-value)
15:07llasramnaeg: That's just the scope I was considering
15:08hiredmanat work in mysql what we have in schemas is something like ..., state SET ('new', 'scheduled', 'complete'), …
15:08jsabeaudryraek, ah yes, thanks!
15:08hiredmanwhich works fine with jdbc and mysql
15:08unlinkhiredman: Yeah, MySQL casts text to enums without complaining. PostgreSQL does not.
15:08naegllasram: I'm currently writing (get-matches) which gets index for the relevant rows, cols and diags - then i'm trying to find those patterns in all those index
15:09hiredmanunlink: you may have to dig in to how jdbc does type mapping
15:09naegllasram: i'm only considering those which are relevant to the newest turn - shall I just go with all?
15:15pepijndevoshehe, I had this thought too. If you remove everything from the bitmap, do you remove the bitmap. NO: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentHashMap.java#L653
15:15djanatyndestructuring using maps is *very* cool
15:18djanatynI feel like I find out a new *very* cool thing about clojure every day, but it's not nearly as confusing as it was when I was learning haskell
15:19djanatynalso, I'm solving a lot of problems I never had the patience to solve in other languages
15:20llasramnaeg: Relevant to the newest turn? Not quite following
15:23naegllasram: if the player's coin landed at [0 2], I only have to check row 0, because there sure won't be a row-based winning combination in row 1-5
15:24llasramnaeg: Oh. Yeah, seems way easier to just re-evaluate the whole board
15:24pepijndevosdnolen: any idea what this box is used for? I'm on my third read through BitmapIndexedNode
15:25llasramnaeg: If this were a harder problem, might help to include forcing the solution to include the new piece, but probably not worth it here
15:25naegllasram: well, not exactly. I'm struggling with determining where diagonals start/end based on a given index
15:25dnolenpepijndevos: a mutable container to know whether a leaf has been added.
15:26naegllasram: it's probably easier to just filter out all index where the given piece-symbol is present and search for the patterns in there - also more "logial" in general
15:26casionnaeg: are you using an array for your board representation?
15:26llasramnaeg: Oh, for "harder" I meant for the computer to solve, like pruning solutions
15:26casionor a vector
15:26pepijndevosdnolen: ah, I think it's only used to ceep track of the number of elements in the map: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentHashMap.java#L146
15:26naegcasion: actually a vector of vectors of strings, but the solving part works on a vector of strings
15:27casionnaeg: in chess engines that use 2d arrays, they have bounds padding around the the board (2 levels due to knight movement)
15:27casionsurround your board with invalid values so you can easily check for exceeding boundaries
15:29naegcasion: sounds like a great idea, will consider it if I can't attempt to do what is in my mind now
15:30casionif your board is [[x x] [y y]], it becomes something like [[-1 -1 -1 -1] [-1 x x -1] [-1 y y -1] [-1 -1 -1 -1]]
15:34TimMcIn clojure that would be (get-in board [x y] :out-of-bounds)
15:37amalloysurrounding the board with invalid values sounds awful. make use of TimMc's suggestion
15:42naegllasram: it might be a better idea to use (+ (* y 10) x) for the index, because then the diagonals can't go over boundaries?
15:44naegllasram: with current representation, [30 22 14 6] could be a diagonal, but it obviously isn't
15:45llasramnaeg: Maybe. That actually seems like casion's suggestion, applied to this representation. Honestly, my focus is elsewhere ATM :-)
15:45naegthat's fine, thanks though :)
15:45clojurebotthanks for your suggestion, but as usual it is irrelevant
15:46naeg?
15:46technomancyclojurebot: be nice
15:46clojurebotIt's greek to me.
15:46casionif you don't have bounds, or pre-calc deltas (inefficient), you end up wrapping around when calculating diagonoals
15:46ro_sttechnomancy: how do i tell clojure-mode to use a different font-lock for strings?
15:47casionyou can't just arbitrarily check for out of bounds without explicit boundaries because a basic diagonal calculation won't generate invalid indices till it reaches the top or bottom of the game board
15:47naegcasion: what I first thought of was just (apply concat vec-of-vecs-of-strings-board) and then have index from 0 to 42 - but there are problems with diags
15:47ro_stkeywords and strings are all mashed together, colour wise. i'd like to distinguish strings to improve readability
15:47technomancyro_st: not sure if you can do it just for clojure-mode. M-x customize-face can do it globally
15:47ro_stdidn't you write clojure-mode?
15:47technomancyno, I just maintain it
15:48naegcasion: but when I use (+ (* y 10) x) for the index, then I don't seem to have problems with diags/boundaries
15:48ro_stthe thing is, i'm using solarized which specifies a colour for strings, but cl-mode ignores it and uses the one for keywords
15:48ro_stah
15:49naegcasion: don't know whether you read that before, but when I filtered all the relevant index for a piece-symbol, I would search for patterns in it: either a +1 sequence (row), +10 sequence (col), +11 sequence (\) or +9 sequence (/)
15:49ro_stnah, customize-face alteration is ignoring me
15:49ro_stoh well
15:49ro_stback to solving real problems :-)
15:50abalonero_st: try deep-blue theme
15:50naegcasion: boundaries are still a problem though -.-
15:50abalonero_st: strings and keywords are different colors for me
15:51ro_sthmm. i'll try that, thanks
15:51abalonero_st: i used to use solarized dark
15:52ro_stthat's what i'm on now
15:52abalonero_st: i know. but i'm not standing behind you.
15:52ro_sthaha :-)
15:52casionnaeg: if you're always generating diagonals in the same direction, you can check if you've exceeded wrapped by comparing current and previous values
15:53pepijndevosdnolen: fisnished third read. Other than that BitmapIndexedNode is just a lot more complex, they basically do the same thing, afaict. Now, sleep.
15:53ro_sthow many fingers am i holding up
15:53casionbut that's far less efficient than just having an explicit boundary
15:53abalonero_st: your thumb counts as a finger.
15:53dnolenpepijndevos: did you read Karl Krukow's posts about PHM?
15:53casionyou could also switch to using bitboards, then diagonals are easy ;)
15:54pepijndevosdnolen: … maybe… link?
15:54dnolenpepijndevos: http://blog.higher-order.net/2009/09/08/understanding-clojures-persistenthashmap-deftwice/, that and the follow up post might shed some light.
15:54pepijndevosdnolen: yea, read that one, but it doesn't go into much detail about the actual implementaion
15:55pepijndevosdnolen: he uses ingle nodes and empty nodes, while the clojure impl uses just bitmap nodes that are wildly more complex
15:55naegcasion: I'm getting insane - now i'm thinking again that with this representation boundaries are no problems...enough for today
15:55pepijndevos*single
15:56casionnaeg: it's not a problem… it's just not as efficient
15:56pepijndevosoh, he calls them leaf nodes. Anyway, no such thing exists. The edge case is handled in the mitmap node itself.
15:57lnostdalhi guys, anyone else constantly getting the *nrepl error* buffer popping up even though there are no errors? (nrepl.el + nrepl instead of slime and swank this)
15:59pepijndevosdnolen: his bitmapindexed node is actually more like arraynode
16:00dnolenpepijndevos: he's actually referring to the old PHM implementation, before rhickey refactored faster version.
16:00dnolenpepijndevos: follow up post covers that.
16:00pepijndevosoh! I never read part 2
16:01nsxtis there a way to get the name of the referring namespace? e.g. within namespace a, there's a call to foo within namespace b - can b return 'a' as its referrer?
16:01nsxterr... can foo* return
16:01pepijndevossweet!
16:02dnolenpepijndevos: one thought perhaps the win is because BIN (bitmap indexed nodes) is not really 32 way - it's 16 way since it holds leaves. ArrayNode support the full 32 way branching?
16:03dnolenpepijndevos: BINs become ANs when there are more than 16 KV pairs I think.
16:03pepijndevosdnolen: but it's arraynode that's the optimization. And… why would leaves be 16-way?
16:03pepijndevosoh yea
16:04djanatynhmm :\
16:05chousernsxt: if foo is a macro, you might be able to swing it.
16:05chouseror I suppose you could capture a call stack and troll through it. ew.
16:08pepijndevosdnolen: not necessarily leaves though, any "sparse" node. Maybe that is the secret. But I doubt bitcounting makes for 30% time diff
16:12dnolenpepijndevos: yep looking at CLJS implement, ArrayNodes always hold arrays of 32 elements - nodes. BINs are 32 arrays of alternating KV pairs.
16:12dnolenpepijndevos: so you really want BINs to be at the bottom - ArrayNodes are just going to be faster - you want to hop through those.
16:13pepijndevosdnolen: right, so maybe the time difference comes from copying 32 elements, instead of 64? and not using a bitmap, and… lots of small things.
16:20sveduboisHow I can change the default font of seesaw?
16:20svedubois(default-font "Label.font")
16:21svedubois#<FontUIResource javax.swing.plaf.FontUIResource[family=Dialog,name=Dialog,style=bold,size=12]>
16:24rattboihi, I'm working on doing the 4clojure problems, and I think I'm stuck on syntax for one problem. Is it ok to ask about it here? I know what I'm attempting to do, but it's not working as I expected.
16:24HodappI don't expect anyone will bitch at you.
16:25rattboithe problem is to reimplement count
16:25rattboilemme just paste what I have somewhere
16:26rattboihttp://pastebin.com/TfbGZXan
16:27rattboiI thought when it recurred to the point where the list is empty, ind would have been incremented the # of drops, and so it would return ind = # of elements.
16:28hyPiRion,(rest [])
16:28clojurebot()
16:28hyPiRion,(nil? (rest []))
16:28clojurebotfalse
16:28hyPiRion^
16:28rattboiah, that's a problem
16:29hyPiRionHint: There's a function called empty? - check it out :)
16:31rattboicould I be using a local let instead of the multi-arrity call thing?
16:33hyPiRionYou could use loop instead.
16:35naegcasion: after a short break, I managed to implement it: http://bpaste.net/show/zNBy4VYkoQexPga2BkVQ/
16:35hyPiRion,(loop [a () b [1 2 3]] (if (empty? b) a (recur (conj a (peek b)) (pop b))))
16:35clojurebot(1 2 3)
16:35casionnaeg: l is core-logic?
16:36naegcasion: yeah
16:36casionbah, I don't know anything about core-logic :(
16:37naegcasion: well, it's basically trying to find pattern of either +1, +10, +11 or +9 inside the given dataset
16:37naegif it can find such a pattern with in sequence of 4 numbers, we have a winner
16:37casionoh… so you're not generating diagonals, you're searching them?
16:38rattboihttp://pastebin.com/eti22j8V <-- 2nd attempt
16:38hyPiRionrattboi: That looks good, sir!
16:38rattboi(counter [1])
16:39rattboiIllegalArgumentException Don't know how to create ISeq from: java.lang.Long clojure.lang.RT.seqFrom (RT.java:487)
16:39rattboi^^ I'm not sure what that's about...
16:39naegcasion: I wanted to make heavy use of core.logic - all i did outside of it is generating the indices of (+ (* y 10) x) for each piece of a player
16:39hyPiRionrattboi: in the recur, you've mixed the first and second argument
16:40naegis there something like map in core.logic which can be used inside a conda?
16:40hyPiRionc is the first argument, lst is the second.
16:40rattboiawesome. I need to read more on recur. I think there's something fundamental I'm not understanding with it
16:40rattboithanks for the help though :)
16:41naegcasion: i'm not sure what you were talking about though. anyway, i'm having three algorithms for checking a connect four field now (generating all possible winning combinations and pulling out those, a bitboard solution and this core.logic)
16:41hyPiRionrattboi: Play around with it a bit more
16:42casionnaeg: I did not realize you were searching the diagonals, I though you were just generating long diagonals from a position
16:42naegcasion: I guess that's what I'm doing here: https://gist.github.com/3520562
16:44samueljHey guys, I'm trying to build something simple on top of compojure, but I'm getting a PersistentList cannot be cast to Ifn exception. I've included a pastebin here, can anyone point me in the right direction? http://pastebin.com/fEUEVuCQ
16:44hyPiRion,(let [foo (fn [a] (if (= 0 (get a 0)) a (recur (update-in a [0] dec))))] (foo [10 9 8 7 6 5 4 3 2 1 0]))
16:44clojurebot[0 9 8 7 6 ...]
16:44samueljAny help is greatly appreciated :)
16:44naegchouser: good thing we talked about conda before, just made use of it now :)
16:45chousernaeg: :-)
16:45weavejestersamuelj: routes doesn't take a list. It's signature is (routes & handlers) rather than (routes handler). So you need an "apply" in there
16:46weavejestersamuelj: (def app (apply routes @my-routes))
16:46naegchouser: anyway, an idea what I could do about all those redundant calls to find-pattern? http://bpaste.net/show/zNBy4VYkoQexPga2BkVQ/
16:46samueljweavejester: ah thanks! i'm getting there!
16:46CheironHi, I need to build a REST API. I checked a couple of projects modeled after WebMachine but I'm not satisfied. Do you recommend a project to build REST APIs?
16:46weavejestersamuelj: But if you're going to be dereferencing the atom immediately, there's no point in having it, really.
16:46samueljoh, is there a better way?
16:47hyPiRionJust defroutes immediately: Put all the routes within the defroutes.
16:48weavejestersamuelj: I'm not entirely sure what you want to do, but atoms are used for modifying state atomically
16:48weavejestersamuelj: If you're going to be creating it and dereferencing at compile time, there's not a lot of point to it.
16:49franksanyone seen this error, which seems to come and go (?): Caused by: java.lang.IllegalStateException: Attempting to call unbound fn: #'hiccup.core/render-html
16:50weavejesterfranks: That's familair, but I can't remember what caused it...
16:51samueljweavejester - so I could actually just add to a list right?
16:51weavejestersamuelj: If you want to split up the routes you could just define them in parts and then combine them later.
16:51franksweavejester: i upgraded from hiccup 0.3.8 to 1.0.1 ...
16:52piranhahm, what's the best way to follow releases of leiningen, lein-cljsbuild, and so on? I just discovered that my lein is hundred years old already...
16:52hugodoich: do you have LEIN_JAVA_CMD or JAVA_CMD set? or are you using drip?
16:53technomancypiranha: `lein upgrade` will mostly do the right thing. there's a lein-outdated plugin for dependencies
16:53piranhatechnomancy: thanks!
16:54technomancypiranha: `lein upgrade` won't get you from 1.x to 2.x though since it's still a preview
16:54hugodoich: ritz 0.4.2 is out now, which fixes the dependency in lein ritz-nrepl on leiningen-SNAPSHOT
16:54piranhatechnomancy: sure, I had preview4 :)
16:56piranhainteresting, why 'lein repl' now writes 'Compiling ClojureScript'... it didn't do that before upgrade
16:57technomancypiranha: hooks can be auto-detected from plugins now
16:57piranhaI see :)
16:58piranhaehm, is there anybody who got piggieback working with browser repl?
16:59technomancypiranha: there's a thread about that on the mailing list
16:59piranhacemerick: its readme says I can ping you, so here we go, I can't really understand where do I execute (cemerick.piggieback/cljs.repl ...), because cljs.repl isn't on my path...
17:00piranhatechnomancy: yeah, I've read it, I probably lack experience a bit, still newbie to clojure :\
17:00technomancypiranha: it's not just you; the whole setup is really convoluted
17:00cemerickpiranha: what's the actual error you get?
17:01piranhacemerick: well, I thought I should paste those 3 lines of code in a running repl
17:01piranhaand it says CompilerException java.lang.ClassNotFoundException: cljs.repl.browser, compiling:(NO_SOURCE_PATH:2)
17:01piranhamaybe I'm wrong? should I create some script?
17:01cemerickpiranha: how are you starting this REPL?
17:01piranhacemerick: 'lein repl'
17:02piranhain a directory of cljs project
17:02cemerickand you've added piggieback as a dependency?
17:02piranhayes
17:02cemerickbizarre
17:02cemerickpiranha: what version of lein?
17:02piranhaI can show my project.clj if that will help :)
17:02piranhapreview10 :-)
17:02cemerickpiranha: please
17:03piranhacemerick: http://paste.in.ua/4708/
17:03franksweavejester: when i go back to 0.3.8 everything works... and 1.0.1 doesn't give me any useful line number of the offending line (?)
17:03weavejesterfranks: Which Lein are you using?
17:04weavejesterfranks: i.e. Lein 1 or 2?
17:04cemerickpiranha: meh, looks sane. It's bizarre that you don't have cljs.repl on your classpath though, it's part of ClojureScript :-/
17:04piranha:\
17:04franksweavejester: tried both lein 1 and 2 - same error
17:04piranhacemerick: maybe that's because of :extra-classpath-dirs somehow?
17:04franksweavejester: blew away ~/.m2 but that didn't help
17:04cemerickoh.
17:05piranhaI'll try commenting them out :)
17:05cemerickpiranha: Hell, maybe. Take those out of the project.clj and give it a whirl.
17:05piranhasure
17:05cemerickso I guess you have a cljs checkout in /deps?
17:05weavejesterfranks: Hm, I thought I recalled this being a problem with deps… Are you doing anything unusual with Hiccup? Can you reproduce the problem in a repo I can look at?
17:05piranhacemerick: yes, current release has a small bug
17:06piranhatechnomancy: can I somehow remove a hook which compiles clojurescript from a repl command? It doesn't make a lot of sense to me...
17:06piranhacemerick: same error, without extra classpath
17:07cemerickpiranha: you can move cljsbuild to its own profile to keep it out of repl invocations
17:08piranhacemerick: is it described in lein docs? I'll read then :)
17:08technomancypiranha: ugh; I thought you could but looking over the implementation I don't see a clear way to =(
17:08cemerickpiranha: yeah, look in leiningen/doc
17:08piranhacemerick: if you have time/will have time/desire, I can push changes with piggieback to my project on github so you can see if it's a bug in piggieback...
17:08technomancywill definitely need to fix that
17:08franksweavejester: just changed it back to 1.0.1 to push it on github for you, but now it compiles without the error... scary stuff
17:09weavejesterfranks: Which version of Clojure?
17:10cemerickpiranha: your project.clj works here. Sorry :-|
17:10franksweavejester: clojure 1.4
17:10weavejesterfranks: Hm. Curious.
17:10piranhacemerick: eh, what can it be... I'll remove ~/.m2/ to try again %)
17:11technomancypiranha: oh wait I see now it might be possible
17:11technomancytry :plugins [[lein-cljsbuild "x.x.x" :hooks false]]
17:11weavejesterfranks: I've only heard of this problem once before, and I seem to remember it vanished as well after some random fiddling around.
17:11piranhatechnomancy: ok :)
17:11technomancyoh, it's even documented in sample.project.clj; I'm dumb
17:12cemericktechnomancy: that probably won't work because of the profile double-application that's going on
17:12franksweavejester: sorry, i screwed up editting the wrong project.clj - error is still there... which is "good" - let me push it out on github
17:12cemerick(or, I seem to remember trying that at some point, and it not working)
17:13technomancyhm... if it's not possible we should have a bug open about it
17:14piranhaeh, still ClassNotFound :((
17:14piranhacemerick: any ideas where should I poke to make it work? :)
17:15weavejesterfranks: I'll look at it tomorrow or Thursday night. Now I need sleep :)
17:15russfrankwhy was lein plugin removed again?
17:15russfrankwhy not have lein-plugin just add a plugin to the ~/.lain/profiles.clj
17:16franksweavejester: https://github.com/franks42/clj-info - just "lein jar" will give you the error
17:16russfranks/lein-plugin/lein plugin/
17:16franksweavejester: have a good night - thanks for the help
17:17weavejesterfranks: Hm, it works fine for me on lein2 preview10
17:18weavejesterfranks: Also in Lein 1.7.1
17:19russfrankhi!
17:19franksweavejester: ough...
17:19weavejesterfranks: I'll take a closer look tomorrow - see if I can't see anything
17:20franksweavejester: ok - I will see if I can reboot my environment in the mean time
17:20technomancyrussfrank: I think the declarative approach has a lot of advantages over the imperative approach. a task that rewrites ~/.lein/profiles.clj would obliterate formatting and comments, which are valuable.
17:20technomancywell, comments are valuable anyway
17:21russfranktechnomancy: yeah, but a really awesomely easy plugin system is probably better
17:22russfrankwhy not have the plugin def stored elsewhere so it can be rewritten, if comments are desirable in the user profile (which sounds like it may include more than plugins)
17:22technomancythat's a lot more complicated than a single map
17:22russfrankits just an include or whatever
17:23russfrankload-file?
17:23technomancyconceptual simplicity is more valuable than supporting the old interface
17:24technomancyas soon as you start inserting things behind the scenes, debugging gets a lot more complicated
17:26russfranktechnomancy: the old interface was just so much easier, though
17:26russfrankthere's a huge difference between "paste this thing" and "find this file and edit it inthis particular way"
17:26cemerickI run far, far away from system I see that has a usage pattern like `x install foo`.
17:26russfrankcemerick: that's very weird of you
17:27piranhacemerick: ok, doing (require '[cljs.repl]) and (require '[cljs.repl.browser]) made it work. I feel dumb. :(
17:27technomancyyou can't check `lein install swank-clojure` into your dotfiles repo
17:27russfranktechnomancy: you can have it pop a thing into a dotfile though, which is how a lot of things work
17:27cemerickpiranha: cemerick.piggieback requires cljs.repl itself; wasn't that the ns it was complaining about?
17:28franksweavejester: well... blowing away ~/.lein/ and letting leiningen rebuild itself seems to do the trick - no more hiccup error - not sure how to find out what went wrong...
17:28technomancyrussfrank: sure, and that would be viable if we had a lossless reader, but we don't.
17:28russfranktechnomancy: but really, that's not a configuration - its a program thats installed or not installed, which isn't really a function of dotfiles imo
17:28piranhacemerick: well, having requires before code made it work
17:28technomancyrussfrank: that's an arbitrary distinction
17:28russfrankthats like saying "I can't put zsh in my dotfiles repo so I can have zsh everywhere"
17:28technomancythat's only true because the unix model isn't as good as the lisp model =)
17:28russfrankyou configure things in your dotfiles -- you don't manage installed programs
17:29weavejesterfranks: It might be an error to do with some subtle ordering that works 99.9% of the time but somehow fails under rare and specific circumstances
17:29cemerickpiranha: dammit, I misread your earlier msg; it was cljs.repl.browser that it wasn't finding, not cljs.repl. Sorry!
17:29cemerickYou can definitely stop requiring cljs.repl explicitly though.
17:29weavejesterfranks: I'm planning out Hiccup 2.0, and hope to get that out sometime this year, so perhaps a new compiling engine will fix things.
17:29piranhacemerick: well, cljs.repl had the same problem, but I'll check
17:29technomancyanyway, you can and I do, it's just a crappier experience because apt-get isn't declarative.
17:29ordnungswidrignaeg: could you solve the fd +1 mistery?
17:30technomancyhttps://github.com/technomancy/dotfiles/blob/master/bin/init/debs.yml
17:30russfranktechnomancy: is it possible I could convince you to take a PR that adds this functionality but warns the user that their profiles file will be overwritten
17:31piranhacemerick: if I understand correctly, I can connect my browser to emacs using nrepl and piggieback and then evaluate code in the browser as I write it?
17:31technomancyrussfrank: I'd consider an implementation based on a lossless reader. I think cgrand is working on one, but it's not quite ready yet.
17:31russfrankok
17:31technomancybest to implement it in a plugin first though
17:32russfrankI feel like this is a really important issue.. I think people will very quickly be turned off of an environment/language because the tooling isn't easy enough to use
17:32technomancyif you do it in a plugin you can use the existing reader now and swap it out for cgrand's once it's stabilized.
17:32franksweavejester: may not be hiccup... may be leiningen - going back and forth between lein 1&2 and following all the beta releases sometimes makes the environment a little unpredictable - plus the fact that there seems to be some voodoo associated with a build-system - thanks and good night!
17:32oichhugod thanks. about ritz-nrepl: after updating and installing ritz source from git and exporting LEIN_JAVA_CMD set to java in the JDK, ritz-repl still uses java from the jre.
17:32cemerickrussfrank: weird or not, experience with things like easy_install, pip, and so on (and then nightmares I've heard re: gems) have forever made me want to have control over the environment I'm using, with a minimum of magic.
17:33technomancyI haven't heard any complaints about editing profiles.clj yet, but noted.
17:33russfrankcemerick: I've used all of these things, and npm.. npm generally does much, much better than anything else of course, but that's mostly because of its unique dep model
17:33naegordnungswidrig: how do you mean "solve"? I reported it and dnolen said he would address this in about 3-4 weeks
17:33hugodoich: could you gist the full stacktrace?
17:33russfranktechnomancy: that's because those people probably have moved on before they get a chance to complain
17:33technomancyheh; well that's one theory
17:34russfrank:]
17:34cemerickEveryone is fleeing Leiningen!
17:34russfrankyou wouldn't know, would you :]
17:34cemerick~survey
17:34clojurebotsurvey is http://cemerick.com/2012/08/06/results-of-the-2012-state-of-clojure-survey/
17:34cemerickrussfrank: ^^
17:34ordnungswidrignaeg: so it's a bug. I did not wait for the end of the story, yesterday.
17:34cemerick~suddenly
17:34clojurebotCLABANGO!
17:34cemerickdata!
17:35cemerickrussfrank: ;-) :-D
17:35naegordnungswidrig: I asked him today. yes it is a bug, but as far as i understood it, it would not make sense to hunt it down and solve it. all the FD will be re-designed
17:35technomancywith nrepl.el now you don't even need a third-party plugin for proper emacs integration
17:35russfrankreading ;P
17:35technomancywhich is what I felt like most of my old `lein plugin install` invocations were doing in 1.x
17:36cemerickpiranha: Yup, that's about right.
17:36cemerickAlthough you're not connecting your browser to emacs, it's connecting to your Clojure/ClojureScript process.
17:36cemerickEr, to the webapp that process is serving.
17:36piranharight
17:37piranhawell, I don't have a webapp
17:37piranhaI only have clojurescript part
17:37cemerickYup. Hack away. :-)
17:37cemerickwell, you need one to use browser-repl
17:37cemerickeven if it's just a shell to set up the browser-repl channel
17:37russfrankcemerick: yknow, I find it interesting that clojure hasnt' seen more adoption in academia, though I suppose that requires inordinate amounts of time
17:38ordnungswidrigrussfrank: maybe because it was not build by academia?
17:39russfrankwas java?
17:39ordnungswidrigis java adopted?
17:39scriptorwhat do you consider academia here?
17:39cemerickI'm not sure why it would be used in an academic setting. Most schools are either actually vocational in nature (so they'll use java and maybe python), or heavily research oriented (and would probably tend towards fortran and C and scheme).
17:40naegordnungswidrig: but it seems to be OK to use +fd and just membero instead of infd
17:40russfrankused in classes
17:40russfrankat my university we use mostly java in the lower courses, C in some of the higher ones, and in the few that want to touch on a variety of languages they use scheme
17:40scriptoreven python is only seeing more recent acceptance in classes
17:41ordnungswidrigwe have been introduces to programmung with haskell. "To give everbody equal chance". epic fail, IMHO.
17:42aperiodicmy college did that, and i thought it worked pretty well
17:42thorbjornDXaperiodic: I hated swing programming in my freshman courses
17:43oichhugod here is a ritz-nrepl stack trace: https://gist.github.com/3702261
17:43ordnungswidrigaperiodic: the effect was that who did not know about programming would not get it at all. those who knew some programming managed it somehow.
17:43ordnungswidrignext language was delphi with gui and "database" programming. (paradox file based db).
17:44russfrankis noir actually active at all? is there a more active web dev framework
17:47hugodoich: the exception message doesn't show any quoting for the -cp or -e arguments, which is strange
17:47cemerickrussfrank: you mean the one that had a commit 5 days ago?
17:48hugodoich: is this oracle jdk?
17:48cemerickI guess that's more active than compojure, the most popular "framework", only committed to 8 days ago. ;-)
17:48russfrankcemerick: that was a commit noting that the repo has moved
17:48aperiodicordnungswidrig: very few people in the class had programming experience, and it wasn't a barrier to learning the material
17:48russfrankto github/noir-clojure/noir
17:48russfranklast updated 3 months ago
17:49cemerickheh, fair point
17:49russfrankalso their main site says to use the lein 1.x plugin system
17:49ordnungswidrigaperiodic: nice to see that i can work, too. :)
17:49russfrankand we're now full circle :]
17:49cemerickCompojure is certainly the best default IMO.
17:51oichhugod yes it's the jdk from oracle from within the last few months
17:53technomancyrussfrank: IIRC the plugin noir recommends is just a template, so it's not even needed to use noir in the first place
17:53technomancyanyway, I highly recommend compojure
17:55FrozenlockIs there some documentation for Domina's xpath? I've checked the readme, but there's some other options used in the tests, which leaves me wondering if there's more to this xpath thingy.
17:55gfredericksevery other day I see somebody saying "Don't use noir; use compojure."
17:55technomancyhuh, github is case-sensitive on git clone but not in the browser.
17:57cemerickgfredericks: there's a bunch of magic in noir that I think people either love or hate
17:57djanatynI'm having a blast trying to write minesweeper in clojure :)
17:57djanatynI'm getting weird erros that are hard to debug, though :O
18:07djanatynaha! fixed everything. :)
18:16gfrederickscemerick: I'm not usually attracted to magic; I've never tried noir
18:16gfredericksI haven't built any large web apps in clojure though
18:17djanatynis there any way to make clojure errors more...informative?
18:19S11001001djanatyn: most people come here asking them to be less informative
18:32cemerickdjanatyn: clj-stacktrace is the best there is
18:33unlinkhiredman: Things work well from a JDBC perspective if you do (.setObject stmt ix value java.sql.Types/OTHER)
18:33cemerickgfredericks: noir builds on compojure, and makes things a lot easier insofar as you don't need to make quite so many of your own choices. Both are used widely and successfully; I think it boils down to taste.
18:34unlinkhiredman: clojure.java.jdbc/set-parameters calls setObject() without the last parameter.
18:36cemerickI also have a vague impression that those that use ClojureScript significantly/successfully are more likely to use noir. I think that comes from ibdknox being a cljs early adopter.
18:37thorbjornDXcemerick: what's the status on lighttable btw?
18:37thorbjornDXthe last I heard about it was at oscon
18:37thorbjornDXand I think project/files were added, but I never managed to get them working
18:38cemerickthorbjornDX: you're asking the wrong guy :-)
18:39thorbjornDXheh, just figured I'd throw the question out there
18:48rattboiis there an easy method to add to the end of a sequence?
18:48rattboiit seems like cons and conj add to the front
18:49cemerickconj is polymorphic over the type of collection being operated upon
18:49cemerick,(conj [1 2 3] 4)
18:49clojurebot[1 2 3 4]
18:49cemerick,(conj '(1 2 3) 4)
18:49clojurebot(4 1 2 3)
18:50rattboiright, I understand that. So you're not supposed to add to the end of a sequence?
18:50Bronsayou can do that
18:50cemerickYou cannot *efficiently* append to a list or sequence.
18:50Bronsabut it's an expensive computation
18:50thorbjornDXseqs have to be traversed
18:50cemerick(concat '(1 2 3) [4])
18:51cemerick&(concat '(1 2 3) [4])
18:51lazybot⇒ (1 2 3 4)
18:51rattboiif I can do it with cons, is it cheaper to get it backwards, then (reverse s) ?
18:52cemerickgoodness no
18:53cemerickrattboi: If you absolutely must append cheaply, then you must use vectors.
18:53cemerickBut, it's generally a good thing to not care about the concrete type of sequential collection you're using.
18:53rattboiI didn't think so. I would use a vector, if that's what the problem requested. I'm doing 4clojure problems, and it wants fibonacci #s in a '() sequence.
18:54llasramYou can also just create a lazy sequence
18:54rattboiI'm sure there's a clever way to do it, but I'm doing a loop/recur method that recurs passing (conj s newfib)
18:55rattboihere, I have a solution, that isn't clever. I'll do that for now, and see what clever solutions looked like.
19:22shinobi_oneclojure noobie here. can anyone help me with a function that reads a specific line from a file? where the lines are new line separated?
19:22shinobi_onei want to use java.io BufferedReader FileReader due to being on 1.1.0
19:22ordnungswidrigshinobi_one: what is the problem?
19:23shinobi_onei'm not really sure where to start ha
19:23ordnungswidrigshinobi_one: what do you want to achieve?
19:24shinobi_onei want to be able to call this function i've named get-line that reads a file and outputs that specific line from the file
19:24ordnungswidrigshinobi_one: what do you mean by "specific"?
19:25shinobi_onefor instance get-line "file.txt" 5
19:25shinobi_oneoutputs the 5th line of text in the file
19:27ordnungswidrigyou're on clojure 1.1.0?
19:27shinobi_oneha yeah
19:30ordnungswidrig(let [r (BufferedReader. (FileReader. "file.txt")) eof (Object.)] (nth (take-while #(not= eof %) (repreatedly #(read r false eof)))) 5))
19:30ordnungswidriglike that.
19:39technomancyshinobi_one: that's a pretty old version; any reason you can't upgrade?
19:39shinobi_onewell.. it depends on how much breaks and how time consuming it is lol
19:39technomancyvirtually nothing will break if you upgrade to 1.2.1
19:39shinobi_oneand 1.4?
19:40technomancydepends on how much you have that uses the yucky old contrib library
19:40technomancybut there is virtually no reason to stay on 1.1.0
19:40shinobi_one^ except the time consumption part
19:41S11001001shinobi_one: #1 problem jumping to 1.3 is contrib, #2 is dynamics, #3 is looking at your math to make sure you didn't assume bigint promotion too hard. But 1.1.0->1.2.1 is trivial
19:41shinobi_onei will keep that in mind thanks :)
19:44technomancyI'm actually kinda surprised there are still any codebases left on pre-1.2
19:44shinobi_oneyeah it's unfortunate
19:49shinobi_oneordnungswidrig: in your example how can i get it to output the text?
19:50ordnungswidrigit evalutes to the string read as line 5
19:51shinobi_oneyeah i changed it to take a line number as an argument instead, but it outputs nothing when i run the script with the args
19:53shinobi_oneerrr wait
19:53shinobi_onei'm being stupid hang on
19:54paxanDynamic access to static class fields question. Say I want a function that given a string like "YEAR" or "DAY_OF_MONTH", would return the value of the static field in java.util.Calendar class (e.g. (foo "YEAR") => Calendar/YEAR… I tried something like this (defn foo [field] (eval (read-string (format "Calendar/%s" field)))), but it fails with No such namespace: Calendar, even though the .clj file that defines foo also imports Calendar class. I am lacking somet
19:55S11001001paxan: use reflection; you'll live longer
19:56S11001001paxan: also please note that your pidgin/adium doesn't correctly wrap IRC messages, so your messages are cut off after ≈500 chars
19:57paxanS11001001: thanks
19:58S11001001paxan: since you know the class in advance, I would suggest building a map of strings to static fields at load time (i.e. in a top-level def) so any failures happen during loading instead of ordinary execution
20:11paxans11001001: Yay!(.getInt (.getField Calendar "DAY_OF_MONTH") nil)
20:14mpanany recommendations for ways/libraries to generate images? I'm looking to plot some points and a path between them
20:17TimMcI've certainly used straight-up Swing graphics before.
20:17TimMcYou might look to see if there's a good way of using Processing from Clojure.
20:18thorbjornDXmpan: I've seen a bit of this (and I like d3): http://keminglabs.com/c2/
20:18mpanthe thing I'm trying to visualize is a bit arbitrary
20:18thorbjornDXmpan: it's cljs though
20:19mpanuh, like, I'm trying to show a path through a graph
20:20mpanso I was thinking just drawing it directly using hue to indicate path progression
20:20mpanwould look silly, but all I need is informative
20:20technomancyyeah, I'd try quil
20:22mpanthanks guys!
20:26mpanwith quil, how would I get everything in an output file rather than screen output? can't seem to find that in the docs even though the cheatsheet briefly mentions files
20:26technomancyyou might need to check the processing docs for that
20:33technomancyhttps://blogs.oracle.com/henrik/entry/java_6_eol_h_h
20:33technomancyEOL on Java 6 extended to February
20:58eriderhi all
21:05cjfriszI'm not sure if I write goofy commit messages hoping that somebody or that nobody reads them
21:08aperiodic$mail mpan in case you haven't found it yet: https://github.com/quil/quil/wiki/save~frame
21:08lazybotMessage saved.
21:08clj_newb_2345is there an tutorial on writing a forht interpreter in clojure?
21:08clj_newb_2345it doesnt' need to be efficeint
21:08clj_newb_2345it just needs to model the core of forth
21:09clj_newb_2345I suspect it can be done in < 1000 LOC
21:09technomancyI would totally read such a tutorial
21:09casionhttp://nakkaya.com/2010/12/02/a-simple-forth-interpreter-in-clojure/
21:10clj_newb_2345wtf
21:10clj_newb_2345it looks like less than 100 LOC
21:10casionwhat?
21:10clojurebotwhat is 2d6
21:11clj_newb_2345clojurebot: 2d6 is sampling a random integers betwen 2, 12 s..t. P(X = i) = (7-|i-7|)/36
21:11clojurebotIn Ordnung
21:11hiredmanI have an interpreter for a concatenative language written in shell, it's only 337 lines
21:12hiredman2d6
21:12clojurebot5
21:12hiredman2d6
21:12clojurebot7
21:12casionyou can roll with clojurebot?!
21:13casionthis thing is infinitely useful
21:13TimMc(def infinitely 5)
21:14hiredmanhttps://github.com/hiredman/stack/blob/master/foo.stack
21:14llasramclj_newb_2345: To be fair, that is only a "forth" interpreter in the sense that it's a stack-based language with superficially similar syntax. It doesn't have control structures or any of the supporting abstraction you need to implement them
21:15llasramOOC, who here has implemented a reasonably complete Forth/-like stack-based language?
21:15llasramI imagine it's a pretty common exercise, given how easy it is
21:16casionI use amforth relatively often for 'actual' work
21:16casionnever implemented a forth
21:17llasramcasion: Really! Neat. I know it's still used in the embedded space, but I've never met anyone who's actually used it for real work. What do you think of it in practice?
21:18casionllasram: it's better than writing avr firmware in assembly
21:18llasramhahaha
21:18casionthat's all I have positive to say :)
21:18llasramThat's fair :-)
21:19casionI"m still waiting for the day where one can do avr development in something other than C, asm or in some circumstances forth
21:19hiredmanhttp://home.pipeline.com/~hbaker1/LinearLisp.html might be easily dropped on top of forth, I think
21:19casionI'd even be excited to use scheme
21:20casionI've messed with some scheme on arm, but I don't even remember what it was…
21:21casionarmpit. that's it
21:21llasramWhat a charming name
21:22clj_newb_2345hmm
21:22clj_newb_2345does clojure promise that argumengs to functions are evaluated in order?
21:22casionclojure is really my first serious attempt at doing something in a relatively high level language
21:23_tcawhatever you are doing it sounds evil clj_newb_2345
21:23aperiodiccasion: alan dipert & friends were working on a lisp for arduino-compatible AVR chips, but i don't know how usable it is (https://github.com/splatspace/wombat)
21:23clj_newb_2345_tca : http://nakkaya.com/2010/12/02/a-simple-forth-interpreter-in-clojure/ <-- I think this assumes the args are evaluted in order
21:24llasramclj_newb_2345: left to right http://clojure.org/evaluation
21:24clj_newb_2345the way how it pops arguents off the stack
21:24casionaperiodic: ohhhhhh, thanks
21:24clj_newb_2345llarsam: thanks
21:25aperiodiccasion: when i talked to him about it at clojure/west, he said 'garbage collection in 4k of RAM is hard'
21:25casionI was about to say
21:25casionevery lisp-ish thing I've seen for embedded requires just using boehm
21:25casionwhich isn't exactly reasonably
21:29clj_newb_2345is there a way to turn a clojure string into a stream?
21:30clj_newb_2345(I want to be able to test the interpreterwith wrings, rather than send inputs over stdin)
21:30aperiodiccasion: i've been wondering if i can't hack together something based around either static analysis or promises from the programmer that certain parts of the program won't allocate memory (for the sorts of things i like to do, i don't think making memory usage steady-state would be too onerous), but i haven't had the bandwidth to tackle that
21:31llasramclj_newb_2345: java.io.StringReader
21:31clj_newb_2345casion: one of the things I like forth is that I think the core of it requires not gc
21:31casionaperiodic: well, avr-gcc already has some limitations on alloctions
21:31casioneven at the very base of it, you can't use new/delete or templates with c++ code
21:32llasramaperiodic: I've wondered similar things, although somewhat less grand. Constrain the language to make memory management somewhat manual, so the runtime can stay out of that business all together
21:32casionand m/c/re/alloc all are a bit 'stupid' in that sometimes they don't always return null pointers on failure
21:33casionI've had a few times where I spent days debugging that nonsense :|
21:33llasramcasion: .... wha? I don't think that's spec-compliant
21:33casionllasram: avr-gcc is not spec compliant.
21:33casionno advertisement of such either
21:33llasramWell, that's okay then
21:34aperiodicllasram: yeah, or maybe have some way of coming up with an allocation plan ahead of time using static analysis (many of my programs don't take any inputs, and so their runtime behavior is entirely pure)
22:00mkwhat's the best way to get swt set up? (1.4, lein)
22:02clj_newb_2345swt as in eclipse?
22:02mkyes, it was made by/for the eclipse project
22:03mk(I don't need to get eclipse set up, though)
22:04mkmany of the tutorials seem dated
22:20SgeoIs the code that Noir's defpage emits side-effecting?
22:20SgeoHow does Noir know which routes to use if it isn't, since all defpages aren't under some larger macro?
22:22gfredericksSgeo: it must be
22:23gfredericksas is anything called def-something, idiomatically
22:23gfredericksusually at the very least they end up deffing something :)
22:25gfredericksprobably also registers it somewhere globally while it's at it
22:31Sgeohttp://yogthos.net/blog/23-Noir+tutorial+-+part+2
22:32SgeoThe defn init-db's code is indented in a way that doesn't suggest that sql/with-connection and catch are part of the try form
22:32SgeoIsn't that bad style?
22:47RaynesSgeo: Noir's defpage mutates an atom.
22:47RaynesNot really a good thing.
22:49Sgeo:(
22:50cemerickThat's one thing I need to get out of my shoreleave-remote server-side impl (i.e. eliminate the statefulness of defremote).
22:51SgeoWould it make sense to force things such as defpage and defremote to be in one macro, and the macro sees all the defpages or defremotes and makes one data structure that ... etc?
22:52cemerickSgeo: I think you just described a set of compojure routes? :-)
22:52xeqithats what I heard too
22:52gfredericks+1
22:54SgeoIt would be nice if there was .... hmm, a sort of .... way to have the defpage convenience of not needing one mega macro while still being stateless
22:55cemerickmega macro?
22:55SgeoPerhaps each file can be run through one macro that processes everything in the file?
22:55SgeoIn the Noir example, it could hunt down all defpages in the file and make a structure out of them without side effecting, and leave all other code as-is
22:55cemerickThere's no reason to define Ring handlers all in one place.
22:56xeqi(defroutes app group/routes todo/routes user/routes ...)
22:57cemerickOK, cljs time: is there anything out there that's (a) gclosure-ready and (b) even close to jquery in terms of support for transitions, animation, css, etc?
22:57gfrederickscemerick: I've been using straight jquery for a lot (via jayq)
22:57xeqino
22:58zakwilsonWhat's the state of the art for making GUIs in Clojure?
22:59xeqizakwilson: seesaw or quil
22:59cemerickgfredericks: same here, although I know jquery well enough that I just use the interop for most of it.
22:59RaynesOr embed webkit like lighttable.
22:59HodappI haven't tried Lighttable yet...
22:59xeqiisn't that cljs?
22:59cemerickThe protocol extensions are key, of course.
23:00Raynesxeqi: Yes, but how else would he render it except with webkit?
23:00zakwilsonI have. It's promising, and the version I tried launched Chrome rather than embedding webkit.
23:00Rayneszakwilson: It embeds webkit on OS X. From what I've been told, it'll do the same in Windows and Linux eventually.
23:01dnolencemerick: relying jQuery for animations at this point is a waste of time.
23:02cemerickdnolen: oh?
23:02dnolencemerick: just to graceful fallbacks for crap browsers, CSS3 transitions all the way.
23:02dnolenjust do
23:02zakwilsonI think that approach is a bit Rube Goldberg for what I have in mind, but seesaw seems appropriate.
23:02cemerickdnolen: noted. I've not investigated those at all.
23:03dnolencemerick: jQuery animations are horrible once you have a couple of things going, CSS transitions are optimized, CSS transforms even more so.
23:03zakwilsonQuil looks to be more for drawing and animation than general-purpose UI.
23:04RaynesYeah, but it is so trendy at the moment that everyone is recommending it for everything.
23:04aperiodicit is not suited for making GUIs
23:04aperiodicunless you hate yourself and your users
23:04RaynesI'm surprised it hasn't been recommended for JSON parsing and XML emitting.
23:04cemerickdnolen: Yea or nay on inline svg? I loved raphael when I last used it a year ago or so.
23:05dnolencemerick: just depends on the complexity of the graphics.
23:05dnolencemerick: SVG is crazy slow on mobile devices.
23:05zakwilsonI have no users... maybe because I have no UI. I should probably make a UI.
23:06ohpauleezI'm with dnolen, favor CSS3. It's hardware optimized on mobiles
23:06mkwhat does quil use to draw? java's graphics2d?
23:07ohpauleezI think jQuery uses CSS3 and falls back to js, but it ends up being a mess if you're going a whole bunch of things. For simple stuff, just grab all the less files from bootstrap and hack something together
23:07aperiodicmk: it can use a few things, including that
23:07ohpauleezcemerick: What's missing from your shoreleave-remote experience?
23:07cemerickohpauleez: Nothing so far. :-)
23:07ohpauleezohh the statefulness
23:07ohpauleezyeah, I agree. It's carry-over from the fetch
23:07cemerickoh, that. Yeah, going to eliminate defremote.
23:08cemerickThe middleware should take a map of name -> fn, done.
23:08cemerickor, name -> var so as to be REPL-friendly.
23:08ohpauleez(shoreleave started has just adding CSRF protection on fetch, and exploded into: "Here's everything I wish I hard to make my life easier")
23:08aperiodicmk: also an alternative 2D drawing backend written by the processing.org team, a 3D drawing backend also from processing, or OpenGL (via JOGL)
23:08ohpauleezI favor name- > var personally
23:09cemerickyup
23:09mkaperiodic: oh neat. I've found that java has pretty bad buildin drawing. Slow, and the fonts aren't native.
23:09cemerickThere'll probably be a macro version so there won't be #' littered everywhere.
23:09mkbuiltin*
23:09ohpauleezcemerick: Definitely dive into the pubsub stuff too. It's helped me out a lot in my apps
23:09cemerickohpauleez: it's on the list
23:10cemerickohpauleez: FWIW, I'd be happy to put remote-ring under the shoreleave org if you want it.
23:10aperiodicmk: yeah, java2D is optimized for accuracy, not speed. fonts are pretty wonky no matter the backend, though, in my experience
23:10ohpauleezcemerick: Agreed. I plan on rolling your remote backend, refactoring things a bit and hopefully coming up with something better for everyone
23:10ohpauleezcemerick: I'd love it :)
23:11ohpauleezI want to adjust a few things (bring ns stuff back in somehow), but other than that, I thought it was solid. Exactly what I was gunning for
23:12cemericksure, the ns stuff can sit on top of the middleware; should be cake
23:12cemerickohpauleez: I think if you add me to the org, I can move the repo over as-is, and twiddle away there.
23:14ohpauleezcemerick: Sounds awesome!
23:14cemerick\m/
23:36mkcan I make an element in a list not exist using a conditional, at that position?
23:37jkkramermk: example?
23:37mkfor example, (new Foo (if ... optional-param))
23:37amalloyno
23:38mkin this case, it would either invoke the Foo() or the Foo(Param p) method
23:38amalloythat's not even a list; you want to modify the contents of a special form
23:39mkwell suppose that I wanted either the list (1 2 3 4) or (1 2 4)
23:40mkamalloy: why is that a special form?
23:40mkit's a list at one stage, it seems