#clojure logs

2012-09-09

00:01carkso the 2 things bothering me are : first i have to pass the full state around, and i feel like a person "object" should not be concerned about the full database
00:01carksecond: integer id's are not the data they represent
00:01carkreplace "object" by namespace
00:03S11001001lenses also need context to acquire data
00:03carkright
00:04frioquick question; i've been googling, but haven't yet found the answer
00:04friohow do i use multiple args with ->? ie. (-> [arg1 arg2] func1 func2 func3)
00:04frio(where arg1 arg2 will be applied to func1)
00:05S11001001,(doc ->)
00:05clojurebot"([x] [x form] [x form & more]); Threads the expr through the forms. Inserts x as the second item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the second item in second form, etc."
00:05S11001001frio: ^^^ "second item", "if it is not a list already"
00:06SgeoYou could do something like ... wait, hmm
00:06SgeoSuddenly I really want thrush
00:06frioi read that, but im not grokking it :). im guessing i should make func1 take a list, rather than 2 args?
00:06SgeoOr -<>
00:07S11001001frio: also look at ->> to better understand what -> is
00:07S11001001frio: ##(doc apply)
00:07lazybotjava.lang.ClassCastException: clojure.lang.PersistentStructMap$Def cannot be cast to clojure.lang.IFn
00:07S11001001oh really
00:07S11001001whatever lazybot
00:07S11001001,(doc apply)
00:07clojurebot"([f args] [f x args] [f x y args] [f x y z args] [f a b c d ...]); Applies fn f to the argument list formed by prepending intervening arguments to args."
00:08friowill do S11001001. I had a look at apply, but it didn't seem to be quite what I wanted... unless I did something like (-> [arg1 arg2] #(apply func1 %) func2 func3)?
00:09S11001001frio: hint: -> has nothing to do with functions
00:09frio(which seems ugly; i figured there might be a better way of getting there)
00:09friohrm S11001001. OK. im obviously missing something a little more fundamental :)
00:09S11001001,(require 'clojure.walk)
00:09clojurebotnil
00:10metellusif f1 f2 f3 only take 2 args, then (->> [arg1 arg2] (apply f1) (apply f2) (apply f3)) should work
00:10metelluserr, with just 1 apply. as you already said.
00:10frioOK, thanks :).
00:11friocheers S11001001 and metellus, ill go back to tinkering/googling/scribbling
00:12seancorfieldtolstoy: yes, i just blogged about project-specific lein 2 tasks today and referred folks to the documentation! http://corfield.org
00:13tolstoyseancorfield: cool. I'm going with hooks in project.clj (as per Raynes' hint). Taking a look at your post.
00:13seancorfieldi added a project-specific higher-order task to modify the behavior of an existing lein 2 task...
00:14tolstoyAh, so technomancy stuck with the .lein-classpath thing.
00:15tolstoyHa! I missed that heading completely.
00:15seancorfieldi found it about the same time xeqi pointed out a google groups discussion about project-specific tasks...
00:59tolstoyseancorfield: Typo second sentence! ;)
01:00seancorfielddarn... i read it thru several times... what did i miss?
01:00tolstoyWe having been using ....
01:00seancorfielddoh! thanx
01:01seancorfieldfixed...
01:02tolstoyYou mean you didn't have to go through a change review board? *shocked*
01:04Raynesseancorfield: Twitter is fun.
01:04tolstoyKinda wish .lein-classpath was in project.clj. That hidden file feels like something I'd spend days missing if it were someone else's project.
01:05RaynesI write each of my tweets to you about 10 times until I get it small enough to fit in a tweet.
01:05RaynesIt's amusing how we're both in IRC and having an argument on twitter...
01:17seancorfieldThe most frustrating tweets are the political arguments - because it's so hard to cram a coherent counter-argument into just 140 characters!
01:18seancorfieldtolstoy: yeah .lein-classpath is a bit of a weird fish...
01:21tolstoyI've been re-doing Emacs today (newbie), but seem to have lost that auto indent in Clojure. Or is that something that's never there?
01:38seancorfieldtolstoy: what did you install? clojure-mode? starter-kit?
01:38tolstoyNope. clojure mode off of melba.
01:39tolstoyI'm wondering if newline-and-indent is the key.
01:39tolstoyMaybe it's the diff between marmalade and melpa? Anyway, now reading Brian Carper. ;)
01:43tolstoy(add-hook 'clojure-mode-hook '(lambda () (local-set-key (kbd "RET") 'newline-and-indent)))
01:43seancorfieldhmm, i didn't have to do that...
01:45ro_stthe current datomic docs show how to make a new partition, but not how to write data into one. my guess is that :db/id needs to use that partition? irc://irc.freenode.org:6667/#db/id%5B:db.part/my-domain-partition] or (tempid :db.part/my-domain-partition). is that right?
01:45tolstoyclojure mode 1.11.5 from melba. I've no idea if that's "old"
02:06seancorfieldi have 1.11.5 (from marmalade but should be the same)
02:07seancorfieldbut i also installed the starter-kit 2.0.3 (hmm, and starter-kit-lisp 2.0.3) which may help?
02:09tolstoyI've never installed that, but perhaps some other thing I had somehow set things up right.
02:09tolstoyAnyway, works now.
02:16nsxturgh... just moved to lein2 tonight - i can reference other namespaces declared in my project dependencies through lein repl, but not through my vimclojure repl (filenotfoundexception)
02:18nsxtis there some classpath configuration i need to handle, or should these :dependencies now go in :dev-dependencies, or...?
02:19ro_stare they in jars, or in checkouts?
02:20ro_stactually, nevermind. it should just pick em up if they're in checkouts
02:21nsxti was under the impression they were all downloaded to ~/.m2?
02:21ro_styup
02:22nsxtmaybe it's my totally ass-backwards vimclojure setup then
02:22ro_sti don't use vimclojure so i'm not sure what to suggest
02:22seancorfieldi think :dev-dependencies has been replaced by :profiles {:dev {:dependencies ...}}
02:22seancorfieldbut some :dev-dependencies have moved to :plugins (if they are lein plugins)
02:23seancorfieldand the swank-clojure dev-dependencies entry has become lein-swank "1.4.4" under :plugins
02:24nsxtunderstood, thanks guys. fairly sure it's my vimclojure configuration, and the fact that it's not taking into account anything in ~/.m2
02:24seancorfieldbtw, the precate plugin for lein1 did a pretty good job of creating a valid lein2 verson of your project.clj
02:24nsxti'm actually just starting a new noir project
02:24seancorfieldisn't there a lein template for noir?
02:25nsxtyeah
02:25nsxtbut while trying to get enlive working, i can't reference it from my vimclojure repl, which is a huge pita
02:26seancorfieldhmm, didn't know folks used enlive with noir
02:27seancorfieldfirst time i've tried the noir template... very slick... lein new noir ntest; cd ntest; PORT=8123 lein run ... instant web app...
02:27nsxti love hiccup, but i've a ton of predefined html and would rather keep it as markup (working with a designer...)
02:28seancorfieldyeah, i hear that... it's why fw/1 uses enlive and why we use it for html emails at world singles
02:28seancorfieldi need to update the fw/1 template so it works out of the box with lein2... sigh
02:28nsxtwhat's fw/l?
02:30nsxtwhoa, the lein-tarsier plugin is crazy magic
02:44seancorfieldnsxt: fw/1 is a lightweight convention-based web app framework i wrote back in 2009 in cfml - and ported to clojure a while back
02:45seancorfieldi haven't done much to promote it yet tho'... but it's very popular in the cfml world
02:45seancorfielddarn this lein-template stuff... wonder what i'm missing?
02:50nsxtseancorfield: are you guys over at world singles still hiring?
03:01seancorfieldyup http://bit.ly/worldsingleshiring
03:01seancorfieldcurrently interviewing
03:14Raynes&((fn [& col] col) 1 2 3)
03:14lazybotjava.lang.ClassCastException: clojure.lang.PersistentStructMap$Def cannot be cast to clojure.lang.IFn
03:15Raynes$login
03:15lazybotYou've been logged in.
03:15Raynes$reload
03:19seancorfieldfw/1 template fixed now (0.1.1) ... sigh ... missing [ ] in :use ... doh!
03:20seancorfield&*clojure-version*
03:20lazybot⇒ {:major 1, :minor 4, :incremental 0, :qualifier nil}
03:35seancorfieldRaynes: how do I send someone mail via lazybot?
03:36Raynesseancorfield: $mail nick message
03:36seancorfieldthanx
03:36Raynes&((fn [& col] col) 1 2 3)
03:36lazybot⇒ (1 2 3)
03:36Raynes&((fn [& col] list col) 1 2 3)
03:36lazybot⇒ (1 2 3)
03:37RaynesHrm.
03:37RaynesNot sure what this twitter guy was doing
03:37seancorfield$mail amalloy DPRIMAP-1 is fixed in 0.0.2-SNAPSHOT (currently waiting for Hudson to see the changes and run a build - will cut a new release once it passes the matrix)
03:37lazybotMessage saved.
03:37seancorfieldthe japanese guy?
03:39seancorfield(fn [& col] list col) is (fn [& col] (do list col)) which evaluates to col (and throws away list which resolves to clojure.core/list)
03:40RaynesI know.
03:40seancorfield&((fn [& col] (list col)) 1 2 3)
03:40lazybot⇒ ((1 2 3))
03:40RaynesBut I don't understand if he thought he was doing something clever, or...
03:40Raynes*shrug*
03:40seancorfieldi don't speak japanese so i don't know either :)
03:41seancorfieldi replied tho'...
03:41RaynesI replied pointing out (fn [& col] col)
03:41seancorfieldme too :) and that (list col) would be ((1 2 3))
03:42seancorfieldbedtime...
03:47SgeoHow common/acceptable is it to use agents as a .. thing to send side-effecting functions to without actually caring what value the agent holds?
04:06tomojshould it be possible to write cljs macros which check the compilation target?
04:11hiredmantomoj: http://dev.clojure.org/display/design/Feature+Expressions
04:22tomojhmm, I guess I can detect my own features too, don't need cljs compiler to provide them
04:22tomojsince for the browser I may want features that can't be determined by cljs anyway..
04:23tomojwell, no..
04:23tomojobviously that won't work
04:25leonardoborgesHi everyone - I got a question about Clojure compilation. While debugging some code I realised top level function calls get evaluated during compile time as well as during runtime. The Clojure compilation docs provide little information as to why that's the case.
04:25leonardoborgesCould anyone shed some light on this or point me somewhere that could clarify this?
04:26michaelr525leonardoborges: funny, i'm dealing with such a thing right now..
04:26antares_leonardoborges: defn is a macro, so it is expanded at compile time. Vars are then looked up at runtime because they can be replaced at runtime.
04:27antares_but that is not compilation, just a hash map lookup, basically
04:27michaelr525just changed the problematic (def)'s to (defn)s
04:28leonardoborgesantares_: sure. but if you actually call (some-fn …), it will get evaluated at compile time as well
04:28antares_leonardoborges: what do you mean "evaluated at compile time"?
04:29michaelr525my def's are evaluated when I run 'lein repl'
04:29antares_functions are compiled to classes, a function call means instantiating a class and calling #invoke on it
04:29antares_michaelr525: and how do you expect REPL to work without compiling your code?
04:30antares_michaelr525: in Clojure, namespaces are compiled when they are loaded
04:30leonardoborgesantares_: I should have mentioned that this behaviour happens when doing AOT compilation
04:31leonardoborgesI sent a message to the clojure user group a couple of days ago. If you'd like to have a look: https://groups.google.com/forum/?fromgroups#!topic/clojure/LNd8kAnB0-g
04:31leonardoborgesit has more information about the issue.
04:31hiredmanhttp://clojure-log.n01se.net/date/2008-11-12.html#16:07
04:32hiredmanleonardoborges: yeah, so don't do that
04:33leonardoborgeshiredman: so when you say don't do that. You mean AOT compiling? or Calling functions at the top-level namespace?
04:33hiredmanboth
04:33leonardoborgesI now know that if I'm AOT compiling my code, I shouldn't do it. But what I'm after is a little extra info as to why that is the case.
04:33leonardoborgeshiredman: that log link clarifies some of it. tks for that.
04:33hiredmando you need to aot compile your code?
04:34hiredmanif not, then don't
04:34hiredmanif you don't know, then that means you don't have a reason to, so don't
04:35michaelr525antares_: maybe i'm completely wrong about it but I think I read somewhere that a def is evaluated the first time it is referenced or something like that..
04:35leonardoborgesI don't really need. However I stumbled upon this when deploying to Heroku. If using leiningen 2, they default to AOT compile your project. Which is why I started to dig into this
04:35Raynesleonardoborges: AOT is indeed something you don't usually want to do. Unless you need it done, you don't want it.
04:35antares_michaelr525: I highly doubt that is true
04:37michaelr525antares_: ok
04:37michaelr525:)
04:38leonardoborgesI'm actually putting a post together with all I went through 'cause it was a bit of a rabbit whole - mostly because Heroku decided to default to compile :all with lein 2. I am just lacking that extra knowledge as to why the compilation process also loads the namespace
04:38leonardoborgeswhich, according to that link hiredman sent, seems to be in order to make macros and function s they use available.
04:38leonardoborgesso that explains it I guess.
04:39antares_leonardoborges: because some Clojure features require that. Everything is highly dynamic and may be used by macros.
04:39antares_yes, this is a very good explanation
04:40leonardoborgesgreat. I'll add that as a reference to the post I'm writing. I basically ran into this issue since code that connects to the database used to be at the top level and relied on env vars - e.g.: (System/getenv …) which isn't available during compilation on Heroku.
04:41hiredmanputting your database connection in a def is gross
04:42hiredmanyou switch from OOP to FP, and suddenly people think globals are cool
04:43antares_leonardoborges: it is a very bad idea to have that kind of code at the top level
04:43antares_leonardoborges: do that in main (well, functions you call from main)
04:43leonardoborgeshiredman: it was in a def. It was a macro that expanded to a defence - in korma - and that got loaded at compile time.
04:43antares_some libraries will block on initialization (like Quartzite) and if you have that code in the top level ns, your compilation will never finish
04:43leonardoborgesantares_: yes, that's what I changed the code to now.
04:43SgeoGo learn Haskell. You'll get rid of your global addiction
04:44hiredmanfor a number of reasons, what happens when you want to talk to more than one database? who reconnects to the database if the connection dies? who reports errors? etc etc etc
04:44SgeoAlthough, in Haskell, there are situations where one does want to use globals :/
04:44Sgeo(Particularly, I wanted to make a wrapper for a non-threadsafe C library, and so wanted to have a global lock)
04:48leonardoborgesso the way korma connect to the database - using defonce - is frowned upon?
04:50michaelr525leonardoborges: i think it's delayed
04:50michaelr525leonardoborges: it will not open the connection until you actually try to query the db
04:54tomojhmm.. can clojure-mode be made to indent cljs try*/catch correctly?
04:59leonardoborgesmichaelr525: true. but it'll bind the db spec using defence. If defonce then depends on any System/getenv calls, and those are not available at compile time, problems could arise.
04:59leonardoborgeswhich is why in the end I moved my db init code into a function call under main-
05:00leonardoborgesanyway.. tks everyone for the help. It did explain a lot to me.
05:40tomojwould be kinda cool if (= nil ((fn [& [y :or {y 3}]] y) nil))
05:41tomoj.. nil?
05:42tomojhuh, actually..
05:43tomoj(fn [{(or foo 3) :foo}]), (fn [& [(or foo 3)]]) ? looks weird
06:21ro_stif i want to map two functions over a single collection, how would that look?
06:21ro_st(map #(2nd (1st %)) coll) is what i have now.
06:21ro_sti guess i could use comp
06:24hyPiRionro_st: comp is probably the way to go.
06:24ro_sti just don't like that it's in reverse order. doesn't read as well as #(-> % 1st 2nd)
06:25ro_stguess i'll use -> :-)
06:43tomojouch, if you require clojure.browser.repl on node.js, the output is broken since Element doesn't exist
06:44tomojthis means funky cljsbuild comments for target, I guess
06:44tomojeven if we have feature-cond and a target feature passed from cljs compiler, we can't use it in ns
06:44ro_stthat's painful
06:45tomojthat or you tell cljsbuild to ignore certain files in certain targets
06:45ro_ststicky :-(
06:45tomojwonder if the funky cljsbuild macros can be easily separated from crossover stuff...
06:53tomojam I just daft or do you have to do something other than sign up to comment on an atlassian wiki comment thread
06:54tomojhiredman: another possible reason we need features in the reader, ns ^
06:54tomojhmm
06:54tomojwell, clojure.browser.repl could use feature-cond and that specific problem would go away
06:55tomojbut :{use,require}-macros still suggest the need for reader features to me
07:19tomojsweet, def{types,records} can be in closures in cljs
07:36hyPiRionHuh, seems like making recursive, anonymous fns is rather hard.
07:37hyPiRion*memoized ^
07:37hyPiRionmemoized, recursive anonymous, I meant.
07:54RadarTrying to add readline support to my repl, but can't find where homebrew has installed clojure.jar. Anyone got some tips on where it could be?
07:57jballancRadar: Have you checked /usr/local/Cellar/clojure ?
07:58Radarjballanc: Ah, that's where it is. Thanks!
07:58jballancnp
08:29kryftHmm, how can I prevent the *nREPL error* buffer from jumping into the foreground every time I make a mistake in the repl buffer? :P
09:06kryftAh, found my answer: (setq nrepl-popup-stacktraces nil)
09:06kryftApparently this possibility was only patched into nrepl.el a few weeks ago. :P
09:15sattvikxeqi: I'll look into converting to core.contracts.
09:23nz-is there a way to make clojurescript compiler issue an error if I am trying to use undelcared variable? e.g. made a typo in variable name. Now I get just a warning, probably from google closure compiler.
09:41_KY_I used "doseq" to evaluate something, but it still seems to be lazy... is that normal?
09:41_KY_But if I add a "print" to debug it, it evaluates fully
09:41_KY_doseq is supposed to force evaluation, right?
09:42ssideris_KY_: try doall
09:49_KY_ssideris: still the same... inside the doseq I call other functions with lazy sequences inside... could that be the problem?
09:50michaelr`hello
09:56_KY_Ohh I see the problem.... I used some asynchronous update...
10:36wmealingi'm trying to understand a form, and I don't know what it does.. the irclj library..
10:36wmealing  (let [{:keys [in] :as connection} (connection/create-connection host port)
10:36wmealingi dont see where "in" is defined
10:36wmealinghttp://raynes.me/hfiles/narrow.html
10:39xeqithat says bind in to the (:in (connection/create-connection host port)). it'll be defined there
10:41tmciverwmealing: it's map destructuring; :in should be a key in connection.
10:42wmealingreading both of you guys comment, and trying to fully understand it, this may take a few minutes.
10:44tmciverwmealing: read up on map destructuring. It does take a bit to get your head around, imo.
10:46wmealingsimilar t how erlang does it.. ok
10:49wmealingand the rabbit hole goes deeper
10:54wmealingthanks both xeqi and tmciver, i have a better understanding now :)
13:38senethwhen evaluating ((print "works")(print "works")) I get "NullPointerException user/eval1284 (NO_SOURCE_FILE:1)worksworks". Whay is that?
13:39senethcan you evaluate more expressions with just wrapping them in () or do you have to explicity use (do)?
13:39xeqiseneth: its trying to call the result of (print "works") with the result of the other (print "works")
13:41piskettiseneth: you have to use do
13:41senethso is it treating first result of print like a function call and second result of print like an argument?
13:41piskettiyes
13:41senethbut why there is no whitespace?
13:42Sgeo*like a function
13:42seneth(fun-name arg) isnt this syntax to call a fun?
13:42seneth(fun-namearg) shouldnt work?
13:42piskettiyes
13:43piskettihuh?
13:44piskettiI don't follow
13:44seneth(print"works") is the same as (print "works") didnt know that
13:44senethi have tried it and it works
13:44piskettiI'll be damn, it does ;)
13:44senethseems like I dont have to put a whitespace befor first argument
13:45piskettiwell, it has to be a string literal I guess
13:45SgeoOr perhaps just something that the reader will separate into different parts
13:45Sgeo,(+1(+ 2 3))
13:45clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
13:46Sgeohm
13:46Sgeo,(+1 (+ 2 3))
13:46clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
13:46Sgeo,(+ 1(+ 2 3))
13:46clojurebot6
13:46cark+1 is a valid symbol name
13:46senethfor a fun with more then one param you have to put a whitespace, with just one you dont have to.Its not consistent
13:46Sgeoseneth, that's not what's going on
13:46Sgeo,(+ 1(+ 2 3)(+ 4 5))
13:46clojurebot15
13:46carkit's not a matter fo white space, but of reader understanding things are different as sgeo said
13:47keugaerg(+ 1 2)
13:47clojurebot3
13:47keugaerg,(+ 1 2)
13:47clojurebot3
13:47cark(let [+1 inc] (+1 2))
13:47cark,(let [+1 inc] (+1 2))
13:47clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.Exception: Unsupported binding form: 1>
13:47keugaergnice :-)
13:47chouseris there a way to so "not" in core.logic?
13:47Sgeocut-fail? /me ducks
13:47hyPiRion,+1
13:47clojurebot1
13:48chouserspecifically, that a sublist does not appear in a longer list
13:48Bronsa+1 is the number 1
13:48carkright =/
13:49carkit's still an "atom" and the reader interprets it as a single thing
13:49carkatom in the old lisp sense
13:49Bronsa(not (coll? )) :)
13:51Sgeo,(*1)
13:51clojurebot#<IllegalStateException java.lang.IllegalStateException: Attempting to call unbound fn: #'clojure.core/*1>
13:51Sgeo,(+(+ 1 1))
13:51clojurebot2
13:55chouseror even just an exclusive-or in core.logic? Like a then/else, rather that the "any" that conde gets you
13:56senethi don˙t get it. Why this works (+ 1(+ 2 3)) => 6 ? There is no whitespace. Does the interpreter know where the second argument starts cuz of the "("??
13:56lazybotseneth: Uh, no. Why would you even ask?
13:56Sgeoseneth, yes
13:56SgeoBecause 1( is not a valid symbol
13:57SgeoIncidentally, lazybot should be slapped
13:57Sgeolazybot, should you be slapped??
13:57lazybotSgeo: Uh, no. Why would you even ask?
13:57lazybotSgeo: Yes.
13:57SgeoOk then...
13:58hyPiRionheh
13:59hyPiRionConsider every "(" as " ("
13:59SgeoIt works with other things too
13:59Sgeo(let [foo "foo"] (str foo"bar"))
13:59Sgeo,(let [foo "foo"] (str foo"bar"))
13:59clojurebot"foobar"
14:00Sgeo,(str"foo""bar")
14:00clojurebot"foobar"
14:00senethThen why this doesnt work (+2.0 1)?
14:00mk(+123b_d)
14:00mk,(+123b_d)
14:00clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.NumberFormatException: Invalid number: +123b_d>
14:00Sgeoseneth, because +2.0 reads as a number
14:01chouserWell, shoot. I'm stuck.
14:01SgeoDoes core.logic have cut?
14:03chouserah, that's the word I needed!
14:03chouserconda
14:03chouserconda might be what I need. Thanks!
14:04Sgeoo.O you're welcome
14:07chouserseriously. I've been grepping through the code and tutorials looking for "not", "complement", etc. Using "cut" found the set of functions that I think will work.
14:08RonnieDkI've been using Korma to connect to and read data from a WordPress MySQL. But I'm experiencing difficulty with datetime fields. Korma says: java.sql.SQLException: Cannot convert value '0000-00-00 00:00:00' from column 4 to TIMESTAMP ... is the datetime type not support?
14:11jballancwhat date would 0000-00-00 be?
14:12jballancI guess 0000-01-01 should work?
14:13jballanchmm...
14:13RonnieDkjballanc: all the zeros is the default value for the field
14:13jballanc,(++2.0 1)
14:14clojurebot#<CompilerException java.lang.RuntimeException: java.lang.ClassNotFoundException: ++2.0, compiling:(NO_SOURCE_PATH:0)>
14:14jballancguess not
14:14jballancRonnieDk: yeah, that's what I thought...
14:14jballancjust wondering if the adapter doesn't know that?
14:14jballanc(I'm a Korma newbie myself)
14:14senethFinally I got it thanks. Still dont udnerstand why would you let that form of expression to work.
14:15RonnieDkjballanc: I wonder why it says TIMESTAMP in the exception and not DATETIME
14:16uvtccemerick: Does clutch work well with CouchDB 1.0.1? That's the version which is available via apt, but the couchdb install instructions recommend installing 1.2.0 using an alternative method.
14:18llasramuvtc: Debian sid has a 1.2.0 package which you should be able to rebuild for your environment w/o too much trouble. There have been enough bugfixes and improvements since 1.0 that I personally highly recommended it even if your client-side is compatible w/ 1.0
14:18danslamoother than indenting, is a common way of making nested map applications more readable?
14:18danslamo,(apply str (map char (map (partial + 32) (map int (seq "ABCDEFG")))))
14:18clojurebot"abcdefg"
14:19jballancRonnieDk: I think that depends on the JDBC driver, no? I can't imagine it wouldn't
14:19danslamoother than indenting, is [there] a common way of making nested map applications more readable?
14:19llasram&(->> (seq "BCDEFG) (map int) (map partial + 32) (map char) (apply str))
14:19lazybotjava.lang.RuntimeException: EOF while reading string
14:19danslamo, (map char (map (partial + 32) (map int (seq "ABCDEFG"))))
14:19clojurebot(\a \b \c \d \e ...)
14:19llasram&(->> (seq "BCDEFG") (map int) (map partial + 32) (map char) (apply str))
14:19lazybotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.core$_PLUS_
14:20uvtcllasram: The couch install instructions recommend installing from source using "build-couchdb". I'm on the most recent Xubuntu. Have you used build-couchdb?
14:20llasramThird time is the charm...
14:20llasram&(->> (seq "BCDEFG") (map int) (map (partial + 32)) (map char) (apply str))
14:20lazybot⇒ "bcdefg"
14:20danslamo:llasrm very cool thanks!
14:20RonnieDkjballanc: maybe I should try out clojureql instead. Have you?
14:20llasramuvtc: I have not. We just used the sid package, tweaked the dependency list, and rebuilt for Debian squeeze
14:20clojurebotlist* doesn't actually make a `list?`
14:20uvtcllasram: thanks.
14:21uvtcclojurebot: what is your least-favorite class this semester?
14:21clojurebotadd-classpath is bad, avoid it. I mean it!
14:22danslamolol
14:22hyPiRionwhat's up with clojurebot?
14:22hyPiRionis someone trying to make it sentient?
14:23uvtchyPiRion: I assume it's just using some heuristics to try and guess what you're asking it about.
14:23hyPiRionclojurebot: what are you planning?
14:23clojurebotCool story bro.
14:24jballancRonnieDk: only played a little with clojureql, and only with Postgres
14:24hyPiRionuvtc: okay for me, as long it doesn't improve that heurestic.
14:24RonnieDkjballanc: why do think in general? ClojureQL vs. Korma?
14:25jballancclojurebot: recite the litany against cons
14:25clojurebot(def ^:const x 42) will cause any compiled reference to x to be as if you wrote 42 instead
14:25jballanchmm...yeah, someone's been messing with clojurebot methinks
14:25jballancRonnieDk: I like ClojureQL's approach better, but I like Korma's activity profile more :-/
14:26mthvedtclojurebot: do you know any songs
14:26clojurebotExcuse me?
14:28jballanci.e. I think Korma is the better supported library at the moment
14:28RonnieDkjballanc: and maybe less complete as well.
14:28jballancclojurebot: litany against cons
14:28clojurebotlitany against cons is "I must not cons. Cons is the perf-killer. Cons is the little death that brings total obliteration. I will face my cons and permit it to pass over me and through me, and when it has gone past I will turn my GC to see its path. And where it has gone there will be nothing; only I will remain."
14:29jballancthere we go
14:29jballancRonnieDk: You mean Korma is less complete? I had the impression that ClojureQL was missing more, IIRC
14:30RonnieDkjballanc: the code base for ClojureQL is larger and it's at v1 vs. 0.3 beta, though it may not say much
14:32Hodappokay, this <LocalLeader> noise is confusing me in :help vimclojure
14:34Hodappnevermind, just needed to save the file as a .clj for it to work
14:41RonnieDkjballanc: Might have found the problem. The mysql-connector-java on clojars is way outdated
14:41RonnieDkjballanc: the datetime stuff was a known bug in mysql years ago
14:44jballancoh, good catch :)
14:45RonnieDkjballanc: maven is more uptodate.
14:45raekjdbc connectors are usually hosted on maven
14:46RonnieDkraek: I followed the sqlkorma docs and tricked me up :)
14:46Hodappblaaargh I just want to code shit with Quil, not spend 2 hours debugging the environment
14:50FrozenlockIf I compile cljs, does everything need to be in the same js file, or can clojure be in one, another namespace in another, etc. ?
14:52Hodapphttps://github.com/quil/quil - I'm trying to run the example here, but if I do it in vim (I installed lein-tarsier and such) and do /ef to run the entire file, I just get a long stack trace like...
14:52Hodappjava.io.FileNotFoundException: Could not locate for_the_glory_of_art__init.class or for_the_glory_of_art.clj on classpath:
14:52basicsensei,(javax.tools.ToolProvider/getSystemJavaCompiler)
14:52clojurebotnil
14:53Hodappand I don't know what I'm supposed to be doing differently here.
14:53basicsenseihey guys, I just noticed something: (javax.tools.ToolProvider/getSystemJavaCompiler) returns nil if it's jdk7, and works with jdk6u33 or so
14:53basicsenseipossibly related to this "bug": http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7181951
14:54basicsenseijdk6u31 is the one I tested it to work actually
14:55basicsenseiwhy is this relevant you ask ? lein uberjar will err: lein-javac: system java compiler not found; a JDK (vs. JRE) install is required.
14:56basicsenseihmm it may be possible that lein (in that case) is using jre7 instead of jdk7 ?
14:57basicsenseiI ask because, all jdk6 and 7 that I have , they have tools.jar in lib only
14:57naegsomeone having a neat idea for a algorithm to check a connect four field using core.logic?
14:57naegcan't really come up with something that really makes use of LP
14:58Hodapphttps://github.com/quil/quil - can anyone more familiar with leiningen than myself explain how to run that code example they give, in a way that is not just pasting it into a REPL?
14:59basicsenseinaeg you reminded me of this tweet from @blcooley "Some people, when confronted with a problem, think, I'll use #clojure core.logic. Now they have a problemo."
15:00naegbasicsensei: I'm just curious :P someone in here said that I could try that (programming a connect four game currently)
15:00naegbut I can't come up with something which is really a logic solution
15:01basicsenseinaeg, to be hones I've no idea what core.logic does , or what you said :) I am new to clojure, but I did notice that tweet
15:01xeqiHodapp: whats the path of the file you saved it in?
15:01Hodappxeqi: test.clj
15:01Hodappin the project directory that lein created
15:01xeqiso.. not in the src directory?
15:02raekHodapp: the project directory is not added to the classpath, but the src/ directory is
15:02pepijndevosAre there any ring router libs that use core.match or other pattern matching? Seems like an obvious thing to do.
15:02xeqiand if it is test.clj, then change the namespace as well
15:02Hodappgah, what should the namespace be?
15:03xeqiif the file is src/test.clj then (ns test ...)
15:03raekHodapp: the name in the (ns ...) line should be the same as the filename, but where there is - in the ns name, there should be _ in the file name
15:03raekand . in the ns name correspond to / in the file name
15:04Hodapphmm, I sort of wish that the authors behind 'quil', if they're going to include in instructions for getting started using lein, would refrain from half-assing them and leaving out details like that
15:04chousernaeg: I'm exploring working with tic-tac-toe boards in core.logic. Haven't gotten very far yet.
15:04basicsenseilol
15:04Hodappso with the source code put in 'src', how might I go about running this?
15:05xeqipepijndevos: I haven't seen anything. thought the same thing
15:05naegchouser: similar problem, but when doing tic-tac-toe I'd just check pre-stored winning combinations (there aren't that much on a field of 3x3)
15:05raekHodapp: you can then load the code and enter the namespace by running (require 'the-namespace-name) (in-ns 'the-namespace-name)
15:05chousernaeg: sure
15:05pepijndevosxeqi: I made an half-assed attempt, and it seems to work.
15:05raekthis will evaluate all the top-level stuff in that file and put the repl in the namespace you just loaded
15:05basicsenseiHodapp: it says: "For more detailed instructions head over to the wiki." https://github.com/quil/quil/wiki/Installing
15:05chouserbut for a learning experience, one can still attempt a more general solution, even if you've only got a 3x3
15:06Hodappbasicsensei: I'm looking at those, but I'm not particularly interested in pasting all my code into a REPL.
15:06naegchouser: it's actually also what I'm doing with clojure without using core.logic - don't really need it for that. (69 winning combinations for 6x7 btw)
15:07xeqiI don't know enough about quil to awnser that... it looks like defsketch starts up the gui, os `lein run -m test/example` might or might not work
15:07xeqidepending on the underlieing implementation
15:08xeqiI gave a brief demo using that yesterday, but could just C-c C-k from emacs to nrepl. Not sure the vim equivalent
15:08Hodappq
15:09pepijndevosThis is what… something… compojure ore moustache uses, apparently: https://github.com/weavejester/clout/blob/master/src/clout/core.clj
15:09basicsenseiHodapp: you have a point, they don't quite tell you where in the file to paste the code and what ns changes would that require
15:09pepijndevosNo macros involved <3
15:11naegbasicsensei: about your tweet - do you actually get the joke in it without knowing what core.logic is about? ;
15:11naeg;)
15:11basicsenseihow can I make lein spit out what java (jdk or jre or path to the exe) it's using? lein version doesn't seem to tell me jdk or jre
15:11basicsenseinaeg, probably not, unless it's related to the "o" in problemo :)
15:12pepijndevosMy attempt, there was something awkward about this: https://github.com/pepijndevos/Baard/blob/master/src/baard.clj
15:12basicsenseinaeg, can you tell me though? curious:)
15:12Hodappalrighty. putting source code in the correct namespace allows me to run it from lein-tarsier with \ef but I don't actually know what \ef is doing (as far as, for instance, a lein command)
15:13naegbasicsensei: I can send you the link to a nice talk about it
15:13basicsenseinaeg, much obliged thanks
15:15gfredericksoh man I just had apparent cause in my cljs code to make an atom that holds an atom O_O
15:15gfredericksI think I am using too many atoms
15:16naegbasicsensei: http://blip.tv/clojure/dan-friedman-and-william-byrd-minikanren-5936333
15:16Hodappokay, this is odd. If I take that example from quil's github intro, and then run it with 'lein -m for-the-glory-of-art', it works properly, but it also gives the error:
15:16naegI think it's that one
15:16HodappException in thread "main" java.lang.ClassNotFoundException: for-the-glory-of-art
15:16basicsenseidoesn't it need a -main ?
15:16basicsenseiwhich would maybe do (sketch example) ?
15:17raekah, yes
15:17basicsenseinaeg, thanks, checking
15:17Hodappbasicsensei: perhaps, but why would it run just fine without this?
15:17raekHodapp: the convention for "runnable" namespaces is to have a function in it that is called "-main"
15:17naegbasicsensei: if you're really interested in core.logic, I can send you a few more talks and articles. just ping me
15:17raekHodapp: because this code does not do its work when the -main function is called. it does its work when the file is compiled
15:18basicsenseiHodapp: in which way you say it works? does it like display the example as in (sketch example) ?
15:18basicsenseicause I would guess it doesn't, just as raek said
15:18raek"Finally defsketch a convenience macro around sketch ties everything together, specifies a title and size and starts things running."
15:19Hodappbasicsensei: everything is drawn, and it continues to loop and draw more
15:19basicsenseioh i see:)
15:19raekso it's like a defn that does both (def foo (fn ..)) and (foo)
15:20raekI wouldn't name such a macro "def___"
15:20HodappI'm just trying to figure out what VimClojure is doing when I do \ef to run the whole file
15:20xeqiit probably has a repl running in the background and sends the file to it
15:20basicsenseiraek, so in the process of trying to evaluate that .clj file to then call -main it evaluates (foo) which causes it to "start" and then shows the lack of main ?
15:20raekHodapp: some people use another convention where you run a script by just evaluating everything in a file though
15:21Hodappbecause it has to be run with 'lein' to set up the classpath, I'm guessing
15:21raekthis approach has some problems though
15:21Hodappbut what command would I run?
15:21raekand lein does not support it
15:21raekHodapp: in this case I would add a (defn -main [] nil) line to the for_the_glory_of_art.clj file
15:22raekHodapp: and then run the whole thing using "lein run -m for-the-glory-of-art"
15:22Hodappahh, okay
15:22basicsensei,*clojure-version*
15:22clojurebot{:interim true, :major 1, :minor 4, :incremental 0, :qualifier "master"}
15:22pepijndevosDoes Meikel Brandmeyer com in here sometime?
15:23basicsenseihow would we get the java version ? I figure maybe need to use java interop but don't know how to get it in java either
15:23Hodappraek: Thanks, this is working
15:24konrWhy would I want to share code between Clojure and ClojureScript?
15:25SgeoBecause some libraries might be useful in either language
15:25SgeoSuch as algo.monads
15:25raekHodapp: also, if you add a :main for-the-glory-of-art entry to the project.clj file, make sure you write it like this: :main ^{:skip-aot true} for-the-glory-of-art
15:25xeqibasicsensei: what does `java -version` give you?
15:25basicsenseinaeg, I'm getting that video to watch it later
15:25xeqishould be what lein is using unless you're doing something to change it
15:26raek...otherwise you will get mysterious problems when reloading code interactively
15:26Hodappraek: why?
15:26basicsenseixeqi, kind of the same as lein version , can't tell if it's jre or jdk
15:26basicsenseixeqi, you're right I think and it's in c:\windows\system32\java.exe =)
15:26raek(ahead of time compilation is enableod here for historical reasons and backwards compatibility)
15:27raekif you use AOT compilation you will get .class-file versions of your source files, which will have precedence
15:28raekso when you update the source, clojure won't pick up the changes when you reload the namespace using (require '... :reload)
15:29basicsenseixeqi: guess what? I stopped being stubborn and assumed it's jre6, therefore i placed tools.jar inside jre7\lib and now lein uberjar doesn't give me the now famous: lein-javac: system java compiler not found; a JDK (vs. JRE) install is required.
15:29raekor maybe :skip-aot is the default in lein2?
15:29basicsenseixeqi, thanks ;)
15:29SgeoWhat's the difference between jre and jdk?
15:30gfredericksjdk has the compiler and scuch
15:30basicsenseixeqi, any sugestions that I can do so that others know how to fix this?
15:30naegbasicsensei: what core.logic basically does is bringing prolog-like (logic) problem solving to clojure - you define rules and facts, which make up a knowledge base and you then query this knowledge base to get results
15:30basicsenseigfredericks: yeah, but lein was using the jre which java.exe was in system32
15:31Hodappraek: thanks.
15:31basicsenseinaeg, oh that gives me some clues
15:31xeqicould try an summarize this in a pull request or issue. Not sure I understand what you did there
15:31basicsenseixeqi, I was thinking the same thing, thanks
15:35Hodappraek: Seeing no difference (with lein 2) with or without ^{:skip-aot true} when I just do 'lein run'.
15:35raekHodapp: does stuff appear in the classes/ directory?
15:36Hodapphmm, it's empty now
15:37raekif it is empty the you should be fine
15:37raekHodapp: the :main option lets you run your project using just "lein run"
15:37SgeoDoes the JDK come with the JRE? Should I uninstall JRE before installing JDK if so?
15:38HodappJDK comes with JRE, typically
15:45lnostdalis it possible to express things like (fn [x & _] (* x x)) using the #(...) reader form somehow?
15:45gfredericksyes but it's very ugly
15:46basicsenseiSgeo, jdk will install jre afaik, I don't think you can opt-out of having jre installed when installing the jdk, and they seem to reside in two folders, for windows (the 64bit jdk) it made 'jdk1.7.0_06' and 'jre7' folders in 'C:\Program Files\' and I also have leftover folders like 'jdk1.7.0_05' but the java in 'jre7' folder is always from the last jdk installed(or does it keep the highest version? unsure), and it also puts the
15:46gfredericks,(#(do %& (* % %)) 7 8 9 10)
15:46clojurebot49
15:47lnostdalmmh, yeah, i thought of that, but ugly indeed
15:47gfrederickslnostdal: any instance of %& in the form will make it varargy; even #_%&, currently
15:47basicsenseiwhat does the (do %& part do ?
15:47SgeoI guess the question is since I already have JRE installed, do I need to uninstall it before installing JDK
15:47gfredericksbut I think that should be considered a bug
15:47SgeoOr will the JDK's version replace the JRE smoothly?
15:48gfredericksbasicsensei: mentions %& but ignores it
15:48basicsenseiSgeo, it will replace/upgrade the existing jre i believe, unless(and maybe even then) you're installing an older jdk
15:48gfredericks,((comp #(* % %) first list) 7 8 9 10)
15:48clojurebot49
15:49basicsenseigfredericks: oh it makes sense now, I was thinking that it function calls but it didn't have the ()
15:49casionso if I'm using something like http://docs.oracle.com/javase/6/docs/api/java/io/InputStream.html#read(byte%5B%5D) is there any other way to use 'b' in the same statement, or do I have to wrap everything in a (do)
15:50Sgeo,(#(do (* % %)) 7 8 9 10)
15:50clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (4) passed to: sandbox$eval87$fn>
15:51basicsensei,(#(do %& (* % %)) 7 8 9 10)
15:51clojurebot49
15:51basicsenseithat's very clever! if you don't mention %& it has like 1 arity
15:52basicsensei,(#(do (* %1 %2)) 7 8 9 10)
15:52clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (4) passed to: sandbox$eval176$fn>
15:52basicsensei,(#(do (* %1 %2)) 7 8)
15:52clojurebot56
15:52basicsenseiok the arity is determined by however many are used, cool:)
15:53basicsenseigfredericks: so that's why you had to mention %&
15:53gfredericksexactly
15:53basicsenseiI like finding out things like this=)
15:55SgeoMight it be easier to just use fn for this stuff?
15:55lnostdali think fn looks cleaner in this case, yes, Sgeo
15:55lnostdalit's 3 extra chars, but cleaner IMHO
15:56lnostdal,((fn [x & _] (* x x)) 7 8 9 10)
15:56clojurebot49
15:57SgeoOh hey now I understand what's going on
15:57lnostdali think clojure 1.5.x supports custom reader macros though
15:57gfrederickswat
15:57basicsenseilnostdal: those with # ?
15:58lnostdalyeah, basicsensei .. i haven't looked at it yet .. they are maybe not the same as e.g. Common Lisp reader macros
15:59gfrederickslnostdal: I cannot believe that is the case
15:59basicsenseilnostdal: I don't know anything about the lisp ones, but I think I've stumbled upon a case where they were defined and used with lein , if I could only remember where to take a second look
16:00gfredericksbecause as I understood it the 1.4 data readers were partially intended to avoid a need for custom reader macros
16:01lnostdal1.4 actually, yes; https://github.com/clojure/clojure/blob/master/changes.md .. but never mind .. it's not a big deal
16:03SgeoI've asked this before, but I don't think I got an answer.
16:03gfredericksthat makes me curious if you could use data readers to emit code
16:03SgeoHow acceptable is it to use an agent as a place to send functions to without using the actual value of the agent for anything
16:04gfredericksSgeo why not futures?
16:04basicsenseiactually that's what I saw: https://github.com/clojure/clojure/blob/master/changes.md#21-reader-literals
16:04basicsenseiwith the data_readers.clj :)
16:05basicsensei(so it wasn't with lein, my bad)
16:14basicsenseican I specify java version to be used when compiling ? in project.clj maybe?
16:14raekSgeo: why not thread pools? An agent is basically just a thread pool + state handling.
16:15raekSgeo: http://blog.raek.se/2011/01/24/executors-in-clojure/
16:15SgeoI know what a thread is, but.... what's a thread pool?
16:15SgeoIs it going to be some kind of hack on the JVM to work around threads being heavyweight or something?
16:15raekSgeo: well, yeah.
16:16raekan Executor is an object that accepts tasks to be executed
16:16raekit is backened by some threads
16:17raekclojure functions implement the Runnable interface, so you can submit them as they are to executors
16:18raekan agent is just a state transition mechanism built on top of an executor
16:19SgeoWhat's the difference between reify and proxy?
16:22raekSgeo: reify was added later and was designed together with defprotocol, deftype and defrecord
16:22raekboth Clojure and ClojureScript have reify, defprotocol, deftype, and defrecord
16:23raekbut only Clojure has proxy (which is more JVM/CLR centric)
16:23raekyou can use reify on java interface in Clojure though, so reify and proxy overlap there
16:26beffbernardI'm having some trouble with decoding my .lein/credentials.clj.gpg file. I get the follow error: gpg: can't query passphrase in batch mode.. when I issue a lein command.. Any thoughts?
16:45tomojthink we can get bound-fn* in cljs?
16:46tomojseems unlikely..
16:49danslamoI'm becoming a clojure junky. Is closure a gateway language? Should I be worried about a future addiction to harder languages like Haskell?
16:50chouserdanslamo: I wouldn't say /worried/, but there's a definite risk.
16:50chouserAlthough intimate familiarity with macros may be a sufficient antidote.
16:52danslamoI have not yet tried macros
16:52AimHereYou might go full loper and demand that your computers become Lisp, all the way down
16:52chouserI think love of Clojure is unlikely to lead that direction.
16:54danslamoI wanted to try a macro for this, but have not yet attempted. http://tinyurl.com/8k5esyd
16:55danslamoI am working on going full loper
16:56gfredericksdanslamo: without reading more that 30 seconds I think currj can do that
16:56danslamoI decided to learn fn programming the hard way by writing a lambda calculus complier / reducer
16:57danslamoI will try that
16:57danslamowriting a lambda calculus complier / reducer in clojure is hard when you don't really understand either
17:03konrIn a clojurescript REPL connected to a browser, how can I examine more thoroughly the objects? For example, typing 'js/console' returns no information on the object's methods and attributes
17:09tomojkonr: well, you can at least do (js-keys js/console)
17:10tomojjs->clj doesn't work on js/console because its type isn't directly Object
17:11meliponehello! Can I "slurp" a java hashmap that I wrote out with "spit"? I'm getting a string but I can't make it into a hashmap with read-string. Help!
17:11chouserNo, java objects aren't readable, generally
17:11meliponethat's what I was afraid of. Any work around?
17:12chousermelipone: is this a one-off thing (you're trying to manually recover data)?
17:12meliponechouser: no, it
17:12chouseror you intend to do it regularly? In that case, I'd just convert it to a clojure map first.
17:12meliponeit's not a one-time thing
17:13meliponechouser: okay, I thought that might be a way to go but wanted to check first
17:13chouserwell, you could customize the printer so as to print it as if it were a clojure map
17:14chouserof course it would get read as a PersistentMap. Would that be good enough for your purposes?
17:14meliponeI need the java hashmap because I want to rerun the same function without re-populating the hashmap again
17:14meliponechouser: yes, I can just convert it to a hashmap I guess
17:15chouserare they nested inside each other, or the hashmap's keys and values normal printable things (like strings, numbers)
17:15meliponechouser: how do you customize the printer?
17:16meliponechouser: yes, the keys are numbers (hashcodes really) and the values are string
17:17chouser,(into {} (java.util.HashMap. {"a" 1 "b" 2}))
17:17clojurebot{"b" 2, "a" 1}
17:17chouser,(read-string (pr-str (into {} (java.util.HashMap. {"a" 1 "b" 2}))))
17:17clojurebot{"b" 2, "a" 1}
17:17meliponechouser: thanks, that's easy
17:17chouserthat's probably the easiest
17:18chousercustomizing the printer would involve doing a defmethod on clojure.core/print-method. doable, but if 'into' will work for you, that's probably better.
17:21muhoowait, deploying to clojars requires gpg signing now?
17:21muhooi missed that meeting.
17:22RaynesIt doesn't require it yet. It's just that there will be two repos on the future, one with requirements (where gpg signing is one) and one where anything goes. You generally want your artifacts to be in the one with requirements.
17:22RaynesIf you set up gpg, leiningen will sign your jars for you if you use `lein deploy clojars`.
17:23muhoothanks. lein deploy clojars gave me an error, wasnt' clear to me if it succeeded or not
17:25zenoliSo, I've got some code that generates a stream of vectors describing events (changes in a graph). I have a number of consumers (one of whch is a Java graph visualization library) that may want to act on these events. What's the best way to implement something like an Observer pattern?
17:25zenoliIt seems like maybe an agent with a watcher?
17:26chouserthat's an option. what about a lazy-seq?
17:27danslamo:gfredericks Is currj more efficient that partial?
17:28danslamo[than]
17:28zenolichouser: Hm...how would that work? So, let's say I've got two sinks, a visualizer and a file-writer for this stream of events, and I want to keep them decoupled from the rest of the code. But if there are no observers, I don't want any state hanging around.
17:29zenoliWhere would the lazy-seq live, in that case?
17:30chouserzenoli: not sure. I guess you'd need a way for a new observer to jump into the stream, so perhaps a function that returns the most recent seq head?
17:31chouserthen observers would just call .more, get the next event, call .more on that, etc. Sometimes calling .more would block until the next event comes in.
17:32chouserI guess that would force observers to give up a thread to block on the next event.
17:33chouserif you wanted async, where they provide a callback and your publisher provides the thread, a watcher is closer to what you want, though you could do it on any reference type, not just an agent.
17:33muhooRaynes: um, is there any reason the lein deploy clojars should fail because there's no gpg?
17:33muhoobecuause, i think it just did.
17:33gfredericksdanslamo: I suspect so but I haven't measured anything
17:33Raynesmuhoo: > technomancy
17:34muhoo*sigh*
17:34gfredericksdanslamo: certainly in the case where there are parts of your function that are independent of the remaining arguments, it will compute that stuff ahead of time and only once
17:34zenolichouser: For a quick test, I stuck a PersistentQueue in a ref, which works if there is exactly one consumer.
17:35zenoliFor the lazy-seq, how would I go about making sure the implementation didn't hang on to the head? lazy-seq is one of those features that I don't grok intuitively yet.
17:37chouserthis would be a somewhat unusual use of lazy-seq anyway, but if you don't mind the observers blocking, it might work out quite nicely. The producer would just hang on to only the most recent cell, so nothing would be leaked there.
17:38chouserthe consumers would have to drop each cell as they do .next to move on. If they failed to drop and move on, then the seq between what it's holding and what the producer is producing would remain on the heap.
17:39technomancymuhoo: you can put `:sign-releases false` in the clojars entry under repositories. I'm working on a library to let all that happen entirely inside the JVM; certain parts of it currently rely on assumptions of sane infrastructure that don't hold on most non-gnome systems
17:41gfredericksdanslamo: note the main reason I wrote than lib was for the eager partial evaluation; to simply defer to partial when fewer args are passed would be a much simpler macro, and I suspect there are a few floating around
17:44zenolichouser: So, trying to think through the producer...I've got a simulation that does a world-step, which includes a list of all the graph changes since the last round. Before those changes are applied to make the new simulation state for the next cycle, there's a place to hook the code to do...something else with the vector of events. It was obvious what to do with the ref...just conj the new events onto it. How would the lazy-seq dip i
17:44chouserzenoli: that got cut off at "lazy-seq dip i" .. but it's a tricky question. let me see if I can slap together an example.
17:45zenoli"...its toe into the stream?" was the end.
17:45zenolichouser: Cheers, I appreciate the time.
17:46chouserto be clear, I'm not confident this is the better solution, just an option to consider.
17:49zenoliIt's quite an interesting idea...abusive edge cases can be quite useful in getting one's hands around language features.
17:50zenoliSo, if I go the agent route, could I make the "state" that it holds be just the latest change? Will the registered watchers be guaranteed a sequential view of all the states?
17:53muhootechnomancy: No matching ctor found for class org.sonatype.aether.repository.Authentication
17:55muhoosecurity/auth always seems to be the boss-level of any otherwise simple task which needs to get done. alas.
17:56chouserzenoli: https://gist.github.com/3687532
17:57zenolichouser: Thanks, taking a look.
18:02muhootechnomancy: nm, i bypassed deploy clojars and just used the scp method.
18:06zenolichouser: Nifty! I had to think about it for a bit, but that's really slick.
18:07chouserzenoli: of course I don't know how well that will fit your model or needs.
18:07zenoliIt's the piece with the atom that was eluding me when trying to think through where the "identity" of the seq would live.
18:08chouseryeah, I didn't explain that well. You could of course hide the atom inside a closure or something, so consumers would call that instead of derefing an atom in order to start consuming
18:09chouser...on the other hand, if you were to do it as written, consumers could choose to use either .next on the lazy seq *or* install a watcher on the atom.
18:09chouserthat would allow a consumer to be either blocking or async.
18:19zenolichouser: So, figuring out where the events are added to the stream is still a bit hazy...the cons needs to be looking at some data structure that either holds or is producing the events...but the producer is running even if nobody is looking.
18:20zenoliThanks for the very interesting suggestion, I'll poke at it for a bit and see how it fits in.
18:21chouserzenoli: you're saying your model has a mismatch with my code because your producer is always running?
18:22konrI'm trying to use jayq in my clojurescript demo, yet 'google.require' cannot find the 'jayq.core' I'm trying to import. The jar file is in /lib and the require line is right in the .cljs file: do I need to do anything else to make the library available?
18:38zenolichouser: Not saying for certain its a mismatch, just that there's a piece I haven't seen to the end of, yet. In your example, the clock is off doing its own thing.
18:39chouserzenoli: so you'd like a busy looping producer to be able to toss items into the outgoing queue whenever, right?
18:39zenolichouser: yes, and have those items fall through and disappear if nobody is waiting around for them.
18:41chouserhm, maybe a linkedblockingqueue between the producer and the atom...
18:44zenolichouser: Have to step away from the computer for a while, but I really appreciate the suggestions. I'll play with the code a bit later tonight.
18:44chouserzenoli: ok. I'll update the gist with a blockingqueue thing, if it looks useful.
18:53Hodappis there a standard way of getting documentation on a function? Quil says it has an 'explorable' API but the functions they mention just list function names, and I am wondering if I can get other documentation or at least a signature or description
18:54skelternet(doc doc) ?
18:54clojurebot"([name]); Prints documentation for a var or special form given its name"
18:54Hodappthere we go.
19:00gfrederickskonr: are you compiling incrementally somehow? There is some bug in cljs that makes it spit out namespaces out of order. I occasionally have to restart lein-cljsbuild (auto) and that fixes it
19:00konrgfredericks: yes, I was. Let me try that
19:05konrgfredericks: I think this is not the problem, as there are no 'jayq' tokens at all besides requires in the main js file. I can keep it at the .jar at libs/, right, with no need to unzip it to src-cljs?
19:05gfrederickskonr: lein1 or lein2?
19:06konrgfredericks: lein 1(.7.1)
19:06gfredericksand you have jayq listed in the project.clj?
19:06konryes
19:06gfredericksso it's in /lib because lein put it there?
19:06konryes
19:07gfredericksthat sounds pretty standard
19:07gfredericksit oughta just work
19:08gfrederickskonr: do you have more than one :require clause in the ns decl?
19:09konrgfredericks: no, just a :require for clojure.browser.repl and :use for jayq.core - let me upload the code
19:10gfrederickskonr: if you use :use you should add an :only
19:10gfredericksor switch to :require with :refer
19:10gfredericksin any case, just one clause of each I think
19:11`thomasis (System/exit 0) the best way to quit a clojure process under emacs nrepl?
19:24konrgfredericks: in the end, it was that bug you mentioned! Thanks for pointing out!
19:25gfredericksit's a shifty little thing
19:25gfredericksoh the other thing I do
19:25gfredericksI forgot to say
19:25gfredericksis to always `rm -rf .lein-cljs*` before starting it back up again
19:26gfredericksmostly I do it out of paranoia but maybe that would have solved your problem faster
19:26Hodapphrm, it can't resolve 'doc' in this REPL for some reason :|
19:26Hodappbut works if I do 'lein repl'
19:26gfredericks(use 'clojure.repl)
19:27Hodapphuh, thanks
19:31syntaxfreeshort one: to change the default file path read by 'load-file ?
19:32gfredericksI don't know for sure but would not be surprised if it weren't possible
19:32gfredericksi.e., if it were tied to the jvm's CWD
19:35gfredericksif that's the case and you really don't like it, the fs library might interest you
19:37syntaxfreeat some point this is going to be tied in some more permanent way to The System. which The Dev folks are too busy to explain to me. I agreed to be a technical consultant and provide prototype Matlab code but now I find myself crash learning me some actual software development.
19:38gfredericksoh noes!
19:40mdeboardoh YES
19:41syntaxfreeYes, I took Scheme in college and prior to that I was self-taught in Haskell and had a snarky blog, and I wrote BASICA.EXE games as a kid. that said, I basically understood I was entering in a partnership with a tech startup doing the mathy stuff, but it's more of a social marketing company and The Dev Group who wrote all the system are all of the two founders. the entire company is me, the two founders and a salesman. And they're so focused on tryin
19:41syntaxfreeto make some actual money to make everyone's time worth it, they seem to be losing touch of the tech stuff.
19:42gfredericksjust toss in a few parentheses and it'll all work out
19:42syntaxfreeit's not nearly as orthogonal as they want to. I tried to lie to myself too, after it sank that Matlab prototypes in Octave weren't scaling.
19:43gfredericksorthogonal?
19:44syntaxfreeIt's mostly a blob of PHP that writes a csv edge list, gets delicious mathy sprinkles on Octave (a Matlab partial reimplementation) and gets muched back into the system. They keep saying they want to move into Python, which at least has some access to linear algebra primitives (I`m disturbed by the lack of sparse matrix support in Incanter, btw), but Python is really wordy and unreliable.
19:45syntaxfreelast time I tried to prototype something in python for other reasons? Kept stumbling on 3/2 = 1 bugs.
19:46gfrederickswell you'll be happy to know that ##(= 3/2 1)
19:46lazybot⇒ false
19:47gfredericksalso ##(= (/ 3 2) 1)
19:47lazybot⇒ false
19:47syntaxfreeanyway, now I'm trying to design an abstract interface. if some part of my corner of the system ends up being written in clojure, it will probably communicate with that. but trying to take software engineering in five days is not like, say, trying to take Erlang in 5 days.
19:48syntaxfreeand they don't have much engineering in The System to begin with. Worst yet? I agreed to do it for a cut of the company. And they keep missing the point, possibly because they want to make money faster.
19:48syntaxfreeThe point is that by integrating merchant user DBs into our Big DB we have a Big DB to draw intelligence from, and this snowballs as we get more clients. At least that was why I bought in.
19:49syntaxfreeIt's such a shame, seeing a bad dev become a bad marketer.
19:52wmealing_syntaxfree: which place can he do less damage ?
19:53jballanchmm...and I correct in guessing that type hinting does not allow you to dispatch on type?
19:54gfrederickscorrect!
20:00unlinkjballanc: multimethods and protocols are Clojure's type dispatch features.
20:26jballancunlink: sure, I guess I was just hoping to be able to short-circuit that with type hints
20:27casionyou could always write a macro ;)
20:28unlinkjballanc: Protocols are actually rather concise.
20:28SgeoIf I want to wrap around a thread-unsafe C API, does it make sense to have functions that call the API directly be sent to a single agent?
20:29casionSgeo: if it's thread-unsafe… that'd kind of be exactly what you'd want to avoid
20:29SgeoShould I just make a lock?
20:30SgeoHow do I do locks in Clojure?
20:30gfrederickscasion: why would the agent be bad?
20:30gfredericksSgeo: I think an agent would be fine
20:31technomancySgeo: one option is to use a linked blocking queue or the like; that way you avoid the whole "serialization through a reference type" messiness
20:31technomancyagents have queues in them, but that's not what they're designed for
20:31casiongfredericks: agents can read from a state at an arbitrary time can't they?
20:31gfrederickscasion: he wouldn't be using the state
20:31technomancypush stuff onto a regular j.u.c queue and only consume it from a single thread.
20:31chouserI updated https://gist.github.com/3687532 for anyone who cares.
20:31technomancyno agents needed
20:32technomancyclojurebot: java.util.concurrent?
20:32clojurebotjava.util.concurrent is "When I find myself in times of trouble / Prof. Doug Lea comes to me / Coding lines of wisdom / j.u.c."
20:32technomancythat is all
20:32casiongfredericks: that would depend on the API I'd think
20:32SgeoBut I don't want to think of concurrency in a Java-esque way
20:32gfrederickscasion: the agent forces the method calls to be sequential
20:32technomancySgeo: java's linked blocking queues are just fine
20:33technomancySgeo: the reason Clojure doesn't provide what you want is that the built-in JVM stuff is perfectly reasonable and we don't need to NIH our way away from it
20:35casiongfredericks: I see what you mean
20:41konrWhen I connect a REPL to a browser, what should I call to be able to access one namespace? (load-namespace) returns an empty string and apparently does nothing. (ns) does give me some of its symbols, such as functions, but nothing from its dependencies, defined with :use and :require
20:42gfrederickskonr: I'm not an expert but whenever I'm in that situation I just repeat the whole dang ns decl
20:42gfredericksor create a new one and import whatever I'm interested in
20:43gfredericksI don't really know what's going on behind the scenes there...
20:50gfrederickskonr: clojurescript is really light on the whole namespace-and-var thing, so for now it can be awkward when you're trying to be interactive
21:06l1xhey guys, how can i perform the same operation on all the members of a lazyseq which consists of vecotrs? ( [1 2 3] [5 3 2] ..... )
21:06l1xi would like to filter and get the vectors which third number is bigger than 0
21:07S11001001l1x: vectors aren't special; just use normal filter and test your condition
21:07gfredericks,(filter #(pos? (nth % 3)) [[1 2 3] [ 5 3 2] [-3 -2 -1] [3 54 -3 6 7]])
21:07clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.IndexOutOfBoundsException>
21:07S11001001gfredericks: off by one :P
21:07gfrederickswaps
21:07S11001001gfredericks: been smalltalking lately?
21:08gfredericksno; maybe it's because I'm evesdropping at the same time
21:08hoover_dammoops
21:08gfredericks,(filter #(pos? (nth % 2)) [[1 2 3] [ 5 3 2] [-3 -2 -1] [3 54 -3 6 7]])
21:08clojurebot([1 2 3] [5 3 2])
21:10l1xthx
21:10gfredericksapparently mine will fail if your vectors are too small though :)
21:10gfredericks(nth 3 '(1 2))
21:11gfredericks,(nth 3 '(1 2))
21:11clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to java.lang.Number>
21:11gfredericks,(nth '(1 2) 3)
21:11clojurebot#<IndexOutOfBoundsException java.lang.IndexOutOfBoundsException>
21:11gfredericksclojure is hard
21:11S11001001gfredericks: moreover I don't see why you are using nth
21:11gfredericksdon't ever let them tell you clojure is easy kids; I've been using clojure for years and I still can't find things in a list
21:12gfredericksS11001001: what would you use besides nth?
21:12S11001001gfredericks: function calling
21:12S11001001clojure's easy, l1x, gfredericks is jus' joshin' ya
21:13S11001001,(ifn? [1 2 3])
21:13clojurebottrue
21:13l1x:))
21:13gfredericks,([38 4 2] 48)
21:13clojurebot#<IndexOutOfBoundsException java.lang.IndexOutOfBoundsException>
21:13gfredericks,(get [28 3] 283)
21:13clojurebotnil
21:13gfredericksthere's the nilly way to get it
21:14S11001001bottoms out in pos?
21:14gfredericksoh crap
21:14gfrederickswe need a nilly pos?
21:14S11001001nah, that's what -?> from core.incubator is for
21:14l1xS11001001: and how would you apply the max function to the seq where i am looking for the max value of the first number in the vectors?
21:14S11001001l1x: map first
21:15gfredericks(def mxmpfst (comp (partial apply max) (partial map first)))
21:15S11001001l1x: break down your task into individual operations: first, obtain a list of all the first numbers; then, obtain the max of that list
21:16l1xoch i see
21:16l1xS11001001: thanks
21:16gfredericksI think I'm only spreading FUD tonight...
21:16l1xgfredericks: :))
21:20hoover_dammgfredericks, first step is acknowledgement
21:21gfrederickssecond step: embracement
21:24l1x,(reduce max (map first (map reverse '([2 2 2] [2 1 0] [2 0 0]))))
21:24clojurebot2
21:24l1xhow bad is this?
21:26tmciverl1x: it's rather expensive to reverse a vector.
21:26dnolentmciver: that's not true.
21:26tmciverdnolen: oh, no?
21:27l1xi thought it is not, since it is a tree where you can obtain the nth element with O(c)
21:28l1xafaik
21:28dnolentmciver: er sorry actually you're right about the reverse fn itself. was thinking about rseq.
21:28l1xpls note you are reversing the [] only
21:29l1xwell i can time it :)
21:29gfredericksif they're all length-3 then it's not a huge difference anyways
21:29l1xyeah
21:30SgeoIs there a quick-and-easy way to make lein repl see a jar?
21:30tmciverl1x: if you're looking for max of the last item of each vector, might it be better to just use 'last'?
21:30l1xyep
21:31l1xi was reading the last doc atm
21:32gfredericksew last isn't fast on vectors :/
21:33Sgeo,(count? '())
21:33clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: count? in this context, compiling:(NO_SOURCE_PATH:0)>
21:33Sgeo,(countable? '())
21:33clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: countable? in this context, compiling:(NO_SOURCE_PATH:0)>
21:33SgeoBluh
21:33gfredericks,(counted? ())
21:33clojurebottrue
21:33Sgeoo.O Isn't count slow on lists?
21:34Sgeo,(counted (map identity '())
21:34clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
21:34Sgeo,(counted? (map identity '())
21:34clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
21:34Sgeo,(counted? (map identity '()))
21:34clojurebotfalse
21:34gfredericks,(counted? (list* (range 100000)))
21:34clojurebotfalse
21:34Sgeo,(doc list*)
21:34clojurebot"([args] [a args] [a b args] [a b c args] [a b c d & ...]); Creates a new list containing the items prepended to the rest, the last of which will be treated as a sequence."
21:35dnolenSgeo: not on persistent lists since they can easily keep their count, sequences yes.
21:35l1x,(time last (vec (range 1e6))
21:35clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
21:35l1x,(time last (vec (range 1e6)))
21:35clojurebot#<ExecutionException java.util.concurrent.ExecutionException: clojure.lang.ArityException: Wrong number of args (2) passed to: core$time>
21:35gfredericksl1x: you'd want to create the vec outside the time
21:35gfredericks,(let [v (vec (range 1000000))] (time (last v)) (time (last (seq v))))
21:35clojurebot"Elapsed time: 460.981717 msecs"
21:36clojurebot"Elapsed time: 693.845984 msecs"
21:36clojurebot999999
21:36gfredericks,(let [v (vec (range 1000000))] (time (count v)) (time (count (seq v))))
21:36clojurebot"Elapsed time: 0.042897 msecs"
21:36clojurebot"Elapsed time: 104.769792 msecs"
21:36clojurebot1000000
21:36l1xi see
21:36gfredericksso count optimizes with countables while last doesn't
21:36gfredericksI guess countable is different from indexable
21:37gfredericksI don't know if there's an interface/protocol for that
21:38SgeoIs there an option I can pass to lein repl to let me specify additional classpath stuff?
21:38SgeoI just want to toy around with a local jar
21:43gfredericksSgeo: if there's anything it's probably in the leiningen sample project.clj
21:47technomancySgeo: if you're just messing around you can put it on :source-paths
22:16gfredericksgaughhug
22:16gfrederickssuddenly lein cljsbuild silently does nothing
22:36dnolenwow this is a bit of a head scratcher
22:37dnolenhttp://jsperf.com/stl-pd
22:37dnolenCLJS transient PVs come out faster to build in Chrome 21 than regular arrays ...
22:41gfredericksdo transients just punch a single array underneath?
22:41dnolengfredericks: no
22:42gfrederickseven for size < 32?
22:43dnolengfredericks: oh, yes I think it does mutate the tail
22:56Raynesdnolen: That sounds sexy.
23:23chouserdnolen: I was looking for a sort of "not" in core.logic. conda got me quite a ways, but I'm again wanting "not"
23:23chouserAny hints?
23:24chouserI mean, I want to say that if x unifies with y, this branch is a dead end.
23:26chouserhm, I think I found a way to use membero in this case, to force x to be one of a set that doesn't include y.
23:29muhooum, ok, nrepl wat? https://www.refheap.com/paste/4972
23:30chouserlooks like all your threads threw NPEs at once.
23:30muhoothat's different. i was able to get a repl back by killing *nrepl-connection*, so no real problem, except, wow.
23:31chouseras if all the threads did (refer nil)
23:33dnolenchouser: negation is a serious challenge in a Prolog-like system.
23:33dnolenchouser: I have some ideas for a solution but it's bit farther out.
23:34dnolenchouser: I don't mind adding something though note that like Prolog if your vars aren't ground you'll run into a lot of toruble.
23:38dnolenchouser: if I add a not goal - I definitely recommend using it only as a last resort. It's basically (defn not [g] (fn [a] (if (nil? (g a)) a)))
23:41chouserdnolen: interesting. Don't add it for me -- I don't know what I'm asking for.
23:46chouserI'm intrigued at how much I can get done without actually defining any relations.
23:46chouserThis is pleasing because that means I'm avoiding global mutable state.