#clojure logs

2011-06-08

00:21konrAnybody using sexpbot? While trying to generate the uberjar, I get an exception, saying that 'irclj/irclj.clj' is not on classpath.
00:39Rayneskonr: That's odd.
00:39Rayneskonr: Is irclj in lib/?
00:39konrRaynes: yup
00:39Rayneskonr: Also, we have a channel for sexpbot: #sexpbot
00:45technomancyare there any operating systems in which (System/getenv "HOME") will return nil?
00:53amalloytechnomancy: the set of operating systems is open; one of them, somewhere, will get it "wrong". best to decide what you're supporting and make sure HOME is defined on those?
00:54technomancyamalloy: keep talking like that and you might get me to drop windows support =)
00:54technomancyconsidering windows actually gets (System/getProperty "user.home") wrong
00:54technomancyjust wondering if preferring $HOME and falling back to user.home is better
00:55amalloytechnomancy: really? i think user.home is a property the jvm is supposed to set
00:56amalloyie, i thought it wasn't possible for windows to get it wrong
00:56offby1technomancy: plenty, if someone deliberately removed HOME from the environment :)
00:57technomancyI guess it's technically cygwin that's screwing it up
00:58amalloythat i can believe
00:59amalloytechnomancy: what is cygwin returning for user.home?
00:59amalloy(out of idle curiosity)
01:02technomancyamalloy: good question; the issue has been reported three times, but nobody has actually thought to include that info in a bug report
01:03technomancyone of them is something ridiculous like /Documents and Settings/Administrator and one of them is /home/admin or whatever IIRC
01:03amalloyexpected: property will be set incorrectly. actual: property is not set correctly. please fix by: setting property correctly
01:04scgilardiit returns C:\\Documents and Settings\\<username>
01:04amalloythat's the right thing to return, so...
01:04scgilardiwell... single \ but they're escaped. yes, it's right from a windows perspective (which is all java knows about)
01:04technomancythe problem is bin/lein looks for plugins using $HOME
01:04technomancyso I suppose if $HOME isn't set it's screwed anyway
01:05amalloytechnomancy: i bet lein.bat doesn't look in $HOME
01:06technomancylooks like it's USERPROFILE
01:06technomancyI wonder if preferring HOME to USERPROFILE will screw with the bat?
01:06amalloytechnomancy: probably, because $HOME will exist, and be wrong, in a cygwin context
01:07amalloy(or, possibly be wrong)
01:07scgilardigetenv USERPROFILE returns the same dir as user.home
01:08technomancyamalloy: I think in cygwin $HOME is actually what we want?
01:08amalloytechnomancy: it might be, but i wouldn't treat it as canonical because cygwin does a lot of fudging
01:08scgilardiit is possible for a cygwin user to reset their home dir to /cygdrive/c/Documents and Settings/<username> . (I saw it recommended because it keeps c:\cygwin free of the user's data and eligible to be blown away)
01:08amalloyeg, it might have / instead of \
01:09technomancythe only requirement is that it match bin/lein or bin/lein.bat
01:09technomancyand the only way they are going to get it is via env vars
01:09technomancyso I think checking both env vars and preferring HOME is OK as long as non-cygwin doesn't set $HOME
01:10technomancyscgilardi: but in that case bin/lein will still match it as long as the environment var is considered the ground truth, right?
01:10scgilardithat's right
01:11technomancyok, cool
01:13scgilardiHOME is set on my windows box. it returns the same path as above. however when running under cygwin (at its command prompt), HOME is set to cygwin's notion of home.
01:13technomancyscgilardi: HOME is set to the same as USERPROFILE you mean?
01:13scgilardiright
01:14technomancyshould lein.bat use HOME instead?
01:14scgilardiI think a cygwin user will prefer lein bash script
01:14scgilardiand if some exclusively uses lien.bat, I think everything will still work
01:14scgilardisome becomes someone
01:15technomancythe thing about windows users is they usually let you know if you've screwed something up
01:20technomancy"Madness? Madness? This is WINDERRRRRRS!"
01:20technomancy*kick*
01:44robinkIs the Sattvik (com.sattvik.clojure_repl) Clojure environment/repl the best one for Android currently?
01:45ieureHuh. "Invalid memory access of location 0x0 rip=0x0"
01:51amalloyrobink: i think it's the only one
01:52robinkamalloy: Gotcha.
05:02Keptnwhere can I report a "bug" with clojure.core, and by bug I mean a shoddy function
05:46ilyakHi *
05:47ilyakI do (for [foo (make-some-potentially-huge-lazy-seq)] (do-work-on foo))
05:47ilyakand it seems that the head of huge-lazy-seq doesn't get released until I exit foo
05:47ilyakwhich leads to OOM
05:48ilyakwhat's the correct way to make a lazy sequence and iterate on it without meltdown?
05:48Chousukeilyak: for returns a lazy seq. you're probably misusing it
05:49Chousukeuse doseq if you need to iterate over seqs with side-effecty things and not create a new seq
05:49ilyakChousuke: I doseq printing it to file
05:49ilyakit's like (doseq [a (for [foo (make-some-potentially-huge-lazy-seq)] (do-work-on foo))] (print-to-file a)
05:50ilyakexcept in two defns
05:50Chousukehmmh
05:50Chousukethat should not be a problem
05:50ilyakOr maybe I'm leaking somewhere else
05:50Chousukemake sure you're not accidentally making another reference to the huge seq
05:50Chousukeor the seq that for returns
05:51ilyakdoes one in doseq counts?
05:51clojurebotdoseq is like for, but for side effects instead of values
07:00drguildoi downloaded clojure 1.2.1 from http://clojure.org/downloads but there's no jar file. am i missing something?
07:00drguildothere's a jar in the "Clojure 1.3 Alpha 8" download
07:02manutterMight be an error
07:03manutterI haven't downloaded from the downloads site, but if you're just getting a bunch of java files, you can probably build it by typing "ant" at the command line
07:03manutterthe best way to install clojure, though, is to use leiningen
07:04manutterhttp://github.com/technomancy/leiningen
07:07clgvwow clojure 1.2.1 finally made it on the downloads page :)
07:08drguildook. thanks.
07:28clgvI have a tree structure consisting of maps that contain vectors as values and I want to build a lazy sequence where the tree structure remains but instead of the vectors there is a single value from the vector. two trees of the lazy sequence shall differ in that one entry is replaced by the next element in the vector
07:29clgvwhat is the easiest way to accomplish this with built-in clojure functions?
07:34clgvexample {:n [1 2 3] :subconfig {:a [1] :b [7 10]}} -> ({:n 1 :subconfig {:a 1 :b 7}}, {:n 1 :subconfig {:a 1 :b 10}}, {:n 2 :subconfig {:a 1 :b 7}}, {:n 2 :subconfig {:a 1 :b 10}}, {:n 3 :subconfig {:a 1 :b 7}}, {:n 3 :subconfig {:a 1 :b 10}} )
07:39hoeckclgv: maybe clojure.walk, but it looks you need some kind of short circuiting after finding the first vector, and then continue from there
07:39hoeckwhich clojure.walk doesn't provide
07:39clgvhoeck: yeah I thought about clojure.walk as well. are there any examples on how to use that one?
07:40clgvI could use it to get all "option" paths and use assoc-in in the lazy-seq definition then
07:41hoeckclgv: right, good idea
07:42clgvso you know any examples on clojure.walk except from macroexpand-all?
07:42hoeckmaybe https://github.com/search?type=Everything&amp;language=&amp;q=clojure.walk+prewalk&amp;repo=&amp;langOverride=&amp;x=0&amp;y=0&amp;start_value=1 helps for finding useful examples
07:42clgvhoeck: interesting approach - didnt think of searching github like that :)
07:43hoeckdiscovered that only a few days ago, pretty exaustive and finds more than google codesearch (at least for clojure or python stuff)
07:44hoeckbtw, the macroexpand-all example in clojure.walk is broken, it also expands quoted forms
07:44clgvah really? that sucks^^
07:46clgv,(clojure.walk/macroexpand-all '(quote (let [a 1] a)))
07:46clojurebot(quote (let* [a 1] a))
07:46clgvhm yeah, I guess that's not always intended ;)
07:48hoeckright, you'll have to write a tree walker which takes a predicate fn to know where to stop walking
08:01clgvhumm I'd also need to know when I am at a leaf^^
08:13hoeckclgv: aren't all your leaves vectors?
08:14clgvhoeck: almost - all the paths I have to find are vectors but they might not be leafs in some special cases. but that works
08:15clgvafter reviewing clojure.walk implementation, I don't see a way to pass immutable state from function call to function call while traversing
08:15hoeckclgv: yep
08:15clgvis there already something similar to clojure.walk or do I have to implement that myself?
08:16hoeckclgv: walk is only helpful to modify a tree, not to return stuff
08:17hoeckclgv: I think clojure needs some additional tree walking functions, just like it has all the functions for working with seqs
08:18hoeckI had to write my own too, e.g. to create paths for assoc-in
08:18clgvyou have that one lying around right now? ;)
08:22hoeckI have, but my trees were vectors of hashmaps
08:23hoeckand I wanted to transform a tree structured address into a list of related nodes
08:24chouserhave you considered clojure.zip ?
08:25clgvchouser: humm, what's your idea with zip?
08:27clgvyou mean implementing a path enumeration in the tree with a zipper?
08:44clgvhmm I didnt learn anything from clojuredocs example on zipper :(
08:55kephaleclgv: you can do path enumeration with zippers by using base 5 integers to represent sequences of zipper functions
08:56manutterThere, it's not even 9:00AM (EST), and my mind is blown already...
08:56clgvkephale: I need paths that can be used with assoc-in
08:56manutterI really need to spend some time getting to know zippers
08:56manutteryou guys are having too much fun
08:58opqdonut1555.28 @opqdonut$ oh my
08:58opqdonut1555.31 @opqdonut$ from the clojure json library
08:58opqdonut1555.50 @opqdonut$ (let [c (char i)] (cond (= i -1) (handle-eof) ...))
08:58bpropqdonut: yeah... i bumped into that yesterday
08:58bpropqdonut: that is fixed in the new data.json lib on github
08:59bpropqdonut: i simply changed my lein project file and all was well... yymv
08:59bprlol... ymmv
09:00opqdonut:)
09:50nickikHallo all, i have a wired dependency problem. I have all the dependencies in project.clj http://pastebin.com/R9Mm7jij and a very simple core.clj http://pastebin.com/skMqzSZW but when i trie to compiler it says: error: java.io.FileNotFoundException: Could not locate appengine_magic/core__init.class or appengine_magic/core.clj on classpath.
09:50nickikdoes happen with other librarys to not only with appenginemagic
09:51mrBliss`nickik: have you done "lein deps"?
09:52nickikmrBliss, sure
09:52nickikno errors there
09:56manutterI think maybe you want appengine-magic in your dependencies, not your dev-dependencies
09:56bprno, dev-deps is right
09:57nickikPrograms using appengine-magic just need to include appengine-magic as a Leiningen dev-dependency.
09:59bprwell, let's start simple lol: do you have appengine-magic-0.4.1.jar in lib/dev?
09:59bpri can't see anything wrong with your project.clj or core.clj, that's why i suggest checking that
09:59manutterdoes lein add lib/dev to the classpath then?
10:00bpryes
10:01bprhow are you trying to compile, btw? w/lein i assume?
10:01manutterhmm, so what happens when you build your uberjar and try to install it on appengine, and your code tries to load appengine-magic.core and it's not there?
10:01bprmanutter: that doesn't happen
10:01bprmanutter: the code will use the other appengine-api classes
10:02bprmanutter: appengine-magic is for helping you run a dev server locally. It sorta mocks the app engine environment, and other things
10:02manutterbut the code as posted is making explicit calls to appengine-magic
10:02nickikall the deps are in lib/ or lib/dev
10:02nickiki compile in emacs
10:02manutterI'm probably just not understanding the model here
10:03manutterDo you do your development using appengine-magic, and then replace the calls to a-m with calls to the actual appengine api?
10:03bprappengine-magic calls will use google app engine if it detects it's in an app engine environment
10:03nickikmanutter, thats just macros when you deploy they will be replaced by the acctual app engine API
10:04manutterbut if the appengine-magic jar isn't there when you deploy, then those macros are not defined
10:04manutterright?
10:04bpraot-compile
10:04manutterah, ok
10:04manutterSo the jar is there at compile time, and then you don't need it after that
10:04bprright
10:05manutterok, sorry for the noise, carry on :)
10:05bprappengine-magic also provides some lein tasks, so all that mucking around when trying to deploy is automated
10:05bprit's quite nice
10:05bprno worries
10:05manutternickik: have you tried deleting your lib/dev dir and re-running lein-deps?
10:06nickikyeah
10:06bprnickik: try running: lein appengine-prepare
10:06bprat the command line in your project directory
10:06nickikk
10:08ilyakIt seems that my code spends memory at O(n^3)
10:08nickikbpr, didn't help
10:08bprO.o
10:09bpryou said this problem occurs with other libraries too?
10:09nickikmaybe its something about swank i trie to compiler with line directly
10:09manuttercan you load it into the REPL?
10:11manutternickik: what version of swank/emacs?
10:12nickiki just newly instaled 1.3.1 i think it is
10:12nickikanycase ist surly the new one
10:12nickiki used the new line plugin feature
10:13bproh?
10:13bprdo ls ~/.lein/plugins
10:14bprsometimes lein gets confused if there are libs in both its plugins dir and the project's lib/*
10:14ilyakI try to dig my memory heap using eclipse mat
10:14bprerr, to be more specific, diff versions of the same lib
10:15ilyakand it shows that the first and biggest-by-retained Cons is referred by <Java Local> Thread
10:15nickikthere only one thing inthere
10:15bprswank?
10:15clojurebotswank is try the readme. seriously.
10:15nickikswank 1.3.1
10:15bprok
10:15ilyakWhy that? How and why would Thread hold Cons?
10:15bprthat's prob ok
10:16nickiklein is upto date to
10:16bprnickik: at this point, i'm out of ideas :[
10:16nickiki just updated it
10:16bpri don't really know enough about lein to know what else to suggest
10:17manutternickik: latest version of appengine-magic too?
10:17nickikja
10:17nickiki mean yeah
10:18manutterhmm, wonder if you print out the classpath at the repl
10:18manuttermight tell you something interesting
10:18bprnickik: are u using durendal to load slime?
10:19bprthat works very well for me
10:19nickikdurendal ??
10:19ilyakIs <Java Local> something on the thread stack?
10:19bprhttp://developers.facebook.com/docs/reference/fbml/iframe/
10:19bprpfft
10:19bprhttps://github.com/technomancy/durendal
10:20bprthat's an elisp file that makes loading a slime repl very easy
10:20manutterilyak: sorry, don't mean to ignore you, but I know even less about Java thread internals than I do about appengine-magic
10:21manutterI tried durendal, but had bad results, then I found out it was because my emacs was only 22 and durendal expects 23 or later
10:21bproh
10:21bpr:(
10:22bprhow do you start your swank server then?
10:22manutterI've played with clojure-jack-in, works pretty well
10:22bpryeah, i liked that too
10:22manutterI usually start swank with lein swank and slime connect
10:23manutterI followed some old instructions using package.el and stuff, it was a while ago
10:23manutterclojure-jack-in seems much easier than what I went thru
10:23bpryeah, that works too. I'm to lazy though :p
10:23manutterI had to manually edit my .emacs file to get it to stick tho
10:23bpri want to use one of those *-jack-in functions from emacs
10:24bpri'm using technomancy's emacs starter package
10:24nickikI use the plugin and have an alias to start it so in a new project i just have to write "swank" and that starts the server
10:24bprit's really nice
10:24nickikbpr, i do too
10:24bpri wonder if maybe your alias is running lein swank in the wrong directory?
10:25manutterchallenge for the day: try to talk about starting clojure from emacs for 10 min *without* mentioning technomancy...
10:25manuttercan't be done :)
10:25bpryeah lol
10:25manutternickik: yeah, that sound plausible, try starting swank "manually" and see if that changes anything
10:26ilyakI have a loop like (for [x xs y ys], where xs and ys are rather large sequences
10:27ilyakenough that [xs X ys] would not fit in memory
10:27ilyakand for some reason that's exactly what I get, it seems that for some reason head of this bizzare sequence gets retained and I get out of memory
10:28manutterilyak: where are you getting your xs and ys from?
10:28Keptndifference between bound-fn and bound-fn*?
10:28manutterilyak are those function calls, or are you storing them in a var somewhere
10:29manutter,(doc bound-fn)
10:29clojurebot"([& fntail]); Returns a function defined by the given fntail, which will install the same bindings in effect as in the thread at the time bound-fn was called. This may be used to define a helper function which runs on a different thread, but needs the same bindings in place."
10:29manutter,(doc bound-fn*)
10:29clojurebot"([f]); Returns a function, which will install the same bindings in effect as in the thread at the time bound-fn* was called and then call f with any given arguments. This may be used to define a helper function which runs on a different thread, but needs the same bindings in place."
10:29ilyakmanutter: Yeah, those are sequences I read from a file
10:29ilyakbut xs + ys is small
10:29ilyakxs X ys is very large
10:30mrBliss`ilyak: you want xs X ys right?
10:30manutter,(for [x (range 3) y (range 3)] [x y])
10:30clojurebot([0 0] [0 1] [0 2] [1 0] [1 1] [1 2] [2 0] [2 1] [2 2])
10:30ilyakmrBliss`: Yes, but I don't to hold it in memory at once
10:30ilyakI just want to iterate it
10:30bpryeah, for doesn't step the sequences in parallel
10:31bprit gives you the cross-product essentially
10:31manutterhmm, but for should still return a lazy seq
10:31ilyakOh
10:31bprmaybe you want map?
10:31ilyakI think that the result sequence is the thing that is large
10:31ilyakNot input
10:31manutterIt might need to hold onto the ys in order to re-start the y seq for each step of x
10:32manutterYeah, the result seq should be a lazy seq, it shouldn't fill up your ram
10:32manutterWhat happens to the result seq after you generate it?
10:33ilyakmanutter: I print it using doseq
10:33ilyak(Still why would it reside in memory at once)
10:35ilyak(filter identity) didn't help
10:35nickikhey it works know (don't know why just redid everything)
10:35bprcool
10:38bpralright, i gotta get back to work :-p enough #clojure for me for now
10:39nickikthx for the help anyway
10:40manutterilyak: does your code look like (doseq [a (for [x xs y ys] ...)) or does it look like (let [a (for [x xs y ys] ...)] (doseq [b a] ...) ?
10:42mrBliss`btw: (doseq [a (for [x xs y ys] ..)] ..) can be written as (doseq [x xs y ys] ..)
10:43ilyakfirst one
10:43ilyaknickik: Not really, it's in fact (doseq [a (for...) b a]
10:43ilyaki.e. unnest
10:49ilyakit seems that a combination of (doall (filter identity (for....))) fixed the problem
10:49ilyakwould try to drop doall
10:52manutterwait, doall or doseq?
10:52manutterdoall returns nil, doesn't it?
10:53manutter(oh wait, so does doseq)
10:54manutterwhat's the point of adding the "(filter identity" part? Could you just do "(doall (for ..."
10:54ilyak(doseq (doall (filter (for
10:54ilyakright now
10:55ilyak(filter identity - i do not know why. Presumable so that sequence I doall on actually fits in memory
10:55manutterI think that's going to reduce down to (doseq nil) tho
10:55ilyakBecause it seems that (doseq [a (foo) b a] - head of a sits in memory
10:56opqdonutof course
10:56opqdonutbecause a is bound to it (less surprisingly)
10:57opqdonutyou might want (doseq [b (flatten (foo))] ...) or something like that
11:08Kratoss`hrm
12:16void_hi guys, a clojure beginner here. So let's say I have a set and I would like to add something to that set. What is the best way? Should I redefine it?
12:17technomancyvoid_: well, you can't add anything to it, you can only generate a new set that's based on it but with an additional entry.
12:17manuttergrr, technomancy types too fast :)
12:17technomancywhether you do that through rebinding a local, recursion, or via a reference type depends on context
12:17void_(def *my-set* (conj *my-set* :something)) <-- like that?
12:17manutter,(conj #{} :some-new-val)
12:17clojurebot#{:some-new-val}
12:18technomancymanutter: it's the dvorak.
12:18manutterdoh
12:18hiredmanredefing is never correct
12:18manuttervoid_: yeah, that's the general idea
12:18void_yeah that's the impression that I have from my two days with clojure
12:18void_that I shouldn't redefine things
12:18manutteronly if you get good at clojure you won't use def as much as in other, less functional languages
12:18technomancythe only reason redefining is allowed is to make interactive development possible
12:19void_I saw dosync + alter in peepcode cast, but I think I don't need that if I'm not multithreading, right?
12:19manuttertrue
12:19technomancyvoid_: atoms are the most basic reference type; that's probably what you want
12:19technomancyswap! instead of alter
12:20void_by the way, I had C# last semester in school and I thought *that* was complicated ... ;)
12:20technomancycomplexity and familiarity are orthogonal
12:21manutterC# *is* complicated, clojure isn't :)
12:21void_ok, let's say clojure's syntax is
12:21void_but I'm enjoying it
12:21void_didn't feel like this since learning Ruby
12:22manutteryeah, it's fun
12:22manutterclojure syntax isn't really complicated, it's just that it's *too* simple -- us C refugees get lost because we're so used to the complicated syntax
12:23manutterlike technomancy said, familiarity is more a factor than actual complexity
12:23manutterof course, that's just fanboy-speak :)
12:23manutter(my remarks I mean, not technomancy's)
12:25void_yeah I think it's familiarity
12:26manutterespecially it's a different way of thinking about problem solving
12:27manutterlists let you do weird stuff like ##(> 2 3 4 5 6)
12:27sexpbot⟹ false
12:27manutter##(< 2 3 4 5 6)
12:27sexpbot⟹ true
12:27mprenticehappy wednesday folks
12:27technomancyhappy ipv6 day
12:27manutteroh boy, that's today isn't it
12:29mprenticei have a list of dependencies of the form A->B, B->C, B->D, etc, that i need to turn into a dependency tree
12:29technomancynamespace dependencies or library dependencies?
12:30mprenticetechnomancy: it's a type hierarchy for a knowledge rep system
12:30mprenticetechnomancy: but i need to be able to define type A before type B, and B before C and D
12:30mprenticetechnomancy: i get the types in an unordered XML file where each type points to its supertype
12:31ieureDoes anyone know if Stu’s reflection patch ever made it into Clojure? http://clojure02.managed.contegix.com/display/design/Reflection+API
12:31mprenticetechnomancy: but that's not really relevant to my algorithmy question :P
12:31ieureI’m looking for a more pleasant way of inspecting Java objects.
12:32mprenticetechnomancy: leiningen is awesome!
12:32technomancygreat! =)
12:34mprenticei'm looking for an algorithm that does said dependency ordering
12:34mprenticeor failing that, wondering if a zipper is a good way to create the tree, where for each node i edit the tree to add the subtypes to the node and remove those subtypes from the list, then continue with the child types, etc
12:37dnolen_mprentice: Clojure has code for managing hierarchies.
12:38dnolen_mprentice: derive, ancestors, descendants, make-hierarchy
12:38dnolen_isa? as well
12:39fliebeldnolen_: Wow, I mean, yea... I knew these existed, and even wondered why they take an optional hierarchy, but it never occurred to me to use it like that. Cool!
12:40ieureSo, anyone? Handy Clojure wrapper around Java reflection API?
12:40kephalewhat is the proper way of changing a variable in an external namespace from within a function?
12:40dnolen_fliebel: yeah, Clojure's emphasis on a la carte is a lovely thing.
12:41mprenticednolen_: thanks. that looks promising.
12:41technomancykephale: clojure doesn't have variables
12:44kephaletechnomancy: a var that has been defined via def
12:45technomancykephale: you shouldn't be changing those at runtime. look into the reference types (atom/agent/ref) instead
12:45kephaletechnomancy: however, that code is out of my jurisdiction
12:46technomancyyou can use binding to give it a new thread-local value
12:48kephaleaha… nice purist response ; P
12:48nickikwhat are the pro and cons between clojure-json and data.json
12:50dnolen_https://github.com/mmcgrana/clj-json sounds like it's the fastest.
12:54void_this is what I do:
12:54void_(ns sib-clj.core
12:54void_ (:use [clojure.contrib]))
12:54void_and in my project.clj
12:54void_ :dependencies [[org.clojure/clojure "1.2.1"]
12:54void_ [org.clojure/clojure-contrib "1.2.0"]]
12:55mrBliss`void_: the (:use [clojure.contrib]) clause is wrong in two ways
12:56mrBliss`drop the []
12:56void_mrBliss`: still same error
12:56mrBliss`and you have to :use something in clojure.contrib like core or def
12:57mrBliss`for example (:use clojure.contrib.core)
12:57void_oh ok
12:57void_'core' is a namespace right?
12:57mrBliss`clojure.contrib.core is
12:58scgilardiyes, the target of :use must be a namespace. (and the [] around it is optional, including it allows you to specify more options within the [])
12:58void_so 'clojure.contrib' is not a namespace I understand
13:01mrBliss`void_: namespace segments (like "clojure", "contrib" and "core") map to files or directories. In this case clojure.contrib points to a directory (clojure/contrib). Only files (like clojure/contrib/core.clj) can contain definitions and can be ':use'd.
13:02void_thanks man
13:02mrBliss`you're welcome
13:02void_gotta go, bbl ;)
13:14Kratoss`I wonder if clojure will be able to collapse sequence allocations
13:19dnolen_Kratoss`: ?
13:19Kratoss`like if I do (filter (map
13:20Kratoss`I clearly don't need all those allocations of seqence objects that map does
13:22Kratoss`also why does clojure.core.map-indexed only take 1 sequence, not multiple like map?
13:24dnolen_Kratoss`: filter and map are lazy, not sure what you're getting at.
13:25Kratoss`well when filter tries to generate next element it consumes seq returned by map
13:26Kratoss`each time it goes to next element a new sequence object is created
13:26Kratoss`purpose (I guess) being that you can pass them around without any effect on the sequences already in use
13:27dnolen_Kratoss`: big plus
13:27Kratoss`all these new sequence objects are unneeded in this case as they get discarded
13:27Kratoss`generates tons of constructor calls
13:27Kratoss`allocations
13:27Kratoss`just asking if there's some kind of compiler optimization in the works
13:28dnolen_Kratoss`: if you really care about allocations, arrays can't be beat.
13:28dnolen_Kratoss`: seems like an optimization with little benefit.
13:28cemerickKratoss`: this is why we're all very thankful for the absurdly efficient GC in modern hotspot, etc.
13:29Kratoss`using (iterate inc 1) is twice as slow as loop recur on a counter
13:29Kratoss`well I made a small library for java
13:29Kratoss`microF, which allows using things like map, filter etc with object that implement the right interace...
13:30Kratoss`they all return Iterable, and when you call next, these calls are chained... but no allocations of new sequences are done, of course these are mutable and can't be passed around
13:31Kratoss`(well can be passed around if you know you mustn't change them)
13:31Kratoss`in any case that's the kind of optimization I had in mind
13:31Kratoss`but ok
13:31Kratoss`what about the second thing?
13:31Kratoss`why doesn't map-indexed support multiple collections?
13:32Kratoss`seems like a reasonable feature
13:34mprenticednolen_: derive &c are perfect. thanks!
13:36fliebeldnolen_: Why does tabling keep state across multiple runs? I'm okay with whatever storage complexity it has, but this counts as a memory leak in some cases, imo.
13:36halfprogrammerWhy is (apply or '(true false true)) throwing an exception
13:36cemerickKratoss`: it could, but you can trivially implement that on top of map-indexed if you care to do so.
13:36amalloyieure: clojure.contrib.repl-utils/show
13:37halfprogrammersays "can't take value of a macro: #'clojure.core/or"
13:37cemerickhalfprogrammer: because or is a macro, not a function
13:37amalloyhalfprogrammer: or isn't a function
13:37dnolen_mprentice: cool!
13:37dnolen_Kratoss`: oversight?
13:38dnolen_fliebel: because I haven't gotten around to thinking of a good solution to that problem.
13:38halfprogrammerHow can I find out if there is at least one true value?
13:38halfprogrammer...in a list
13:38cemerick,(some identity '[true false true]) ; halfprogrammer <<
13:38clojurebottrue
13:39dnolen_fliebel: def'ed memoized fns have the same issue.
13:39dnolen_fliebel: if you got some ideas, I'm all ears, it's something I want to fix.
13:40halfprogrammercemerick: thanks!
13:40fliebeldnolen_: I see. I have no idea how tabling works, but I imagine you could.. no, you couldn't use binding because run is lazy.
13:40dnolen_fliebel: I have strict variants of run (useful for debugging)
13:41fliebeldnolen_: Whee do you keep the state of a tabled goal?
13:41dnolen_fliebel: you don't need to know how tabling works, conceptually it's identical to memoized fns, I create a closure over an atom to store results.
13:42bhenrysay i have a ns called project.version. if a function within it called (get-version) parses the project.clj and gets the version then i (def version (get-version)) can i have the version var available in my project with AOT compilation?
13:42dnolen_fliebel: laziness of run is not essential for many goals, laziness in core.logic is almost entirely about preventing stack overflow
13:43dnolen_in fact I'm almost convinced that run should default to strict, and run lazy should be be the variant
13:43bhenry*in my project jar
13:45fliebeldnolen_: In any case, the best trick would be to position the closure/binding in such a way that it goes out of scope when the goal is done.
13:46Kratoss`thanks, but I'd rather see clojure.core version updated in the next release
13:47dnolen_fliebel: ok so I have an idea, feel free to open a ticket :)
13:48fliebeldnolen_: erm, okay. Talking about tickets, what became of my rel ticket?
13:48dnolen_fliebel: still thinking about it, also haven't seen a good solution yet.
13:49fliebeldnolen_: okay.
13:49void_so what would be the easiest way to create a vector of letters from a string?
13:49amalloy&(seq "test")
13:50sexpbot⟹ (\t \e \s \t)
13:50dnolen_,(vec "foo")
13:50clojurebot[\f \o \o]
13:51bhenrydnolen_ ftw
13:52dnolen_Kratoss`: people push for the fixes they want to see, I'd send in yr CA, get on the dev list, submit patch
13:54Kratoss`yr CA?
13:55void_,(seq "hmm")
13:55void_,(vec "hmm")
13:55void_clojurebot doesn't like me
13:55void_&(seq "hmm")
13:55void_what
13:55void_do I stink?
13:55void_ ,(vec "foo")
13:55void_seriously
13:55sexpbot⟹ (\h \m \m)
13:55clojurebot(\h \m \m)
13:55clojurebot[\h \m \m]
13:55bhenryKratoss`: contributors agreement i believe
13:55dnolen_Kratoss`: Contributor Agreement http://clojure.org/contributing
13:55amalloyvoid_: given the mess of messages you sent all at once, i'm guessing your connection stinks
13:56dnolen_fliebel: what do you think about lazy-run as a name for the lazy run variant?
13:56amalloyclojurebot: ca?
13:56clojurebotCA is Contributor Agreement: http://clojure.org/contributing
13:56fliebeldnolen_: slouch seems more appropriate :P
13:57fliebeldnolen_: But, sure, fine.
13:57dnolen_fliebel: heh
13:57bhenryfliebel: dnolen_ "jog"
13:57bhenry: P
13:57amalloysaunter
13:58amalloyfliebel: whenever i do that i just hack the internet to bring it all down before the packet makes it to anyone else's computer
13:59void_dnolen_: yeah that's the case ... sorry for the flood
13:59fliebelamalloy: Oh, so... you live in china? That explains a lot.
14:00amalloydon't tell google
14:00fliebelamalloy: Google does not index the logs of this channel, apparently, because we still don't rank for ad hoc, informally -specified, bug-ridden, slow implementation of half of whatever.
14:01amalloyfliebel: i don't think there are any links to specific dates
14:01fliebel~logs
14:01clojurebotlogs is http://clojure-log.n01se.net/
14:01fliebelhttp://clojure-log.n01se.net/date/2011-06-07.html
14:02amalloywell. the googlebot will get tired of clicking Previous long before it gets even a month in the past
14:02fliebelamalloy: only 2 clicks away: http://clojure-log.n01se.net/date/
14:03fliebelMaybe I'll start linking to logs that contain ad hoc, informally -specified, bug-ridden, slow implementation of half of whatever on my blog for extra exposure.
14:03amalloyhm
14:03amalloyfliebel: please stop making me wrong
14:04fliebelokay... tell your ego I like the word sounter ;)
14:04fliebel-.- saunter
14:08lawfulfalafeldoes anyone know where I could find a good tutorial on clojure data structures?
14:08amalloywow, you learn something new every day. i had no idea about ##(doc when-first)
14:08sexpbot⟹ "Macro ([bindings & body]); bindings => x xs Same as (when (seq xs) (let [x (first xs)] body))"
14:09lawfulfalafelhttp://en.wikibooks.org/wiki/Learning_Clojure/Data_Structures seems incomplete, I can't find anything on lists
14:11technomancyI get the impression it's mostly neglected
14:11bhenrylawfulfalafel: http://clojure.org/data_structures
14:12bhenryit's not a tutorial, but it's good
14:12bhenryand complete
14:13amalloyyeah i haven't found anything worthwhile on wikibooks
14:15gfrlogamalloy: I propose collaborative book-writing github style. Then professors could have their personal forks and thus more control.
14:16manuttergitbooki?
14:16gfrlogsure
14:17gfrlogthe grad students could do all the work and we'd finally have free high-quality textbooks
14:17gfrlog...maybe :)
14:23amalloymanutter: gittybook
14:23lawfulfalafelI have a list of numbers that I am generating and trying to save, should I use a list or a hash-set?
14:24gfrloglawfulfalafel: do you need order preserved? duplicates?
14:24amalloylawfulfalafel: not enough information to solve the problem?
14:24lawfulfalafelI do not need order preserved
14:25lawfulfalafelI am assuming I should a mutable structure like the hash-set; is that logic correct?
14:25lawfulfalafeluse*
14:25gfrloghash-sets are not mutable
14:25amalloynothing is mutable
14:26manutterodds are it would be possible to get your number generator to return a lazy seq, so it will already be in a usable format for you
14:27void_what's the difference between defn- and defn ?
14:27clojurebotGabh mo leithscéal?
14:28fliebel&(repeatedly #(rand-int 10))
14:28sexpbotExecution Timed Out!
14:28fliebelvoid_: defn- is private
14:28ieure"Where are the mutable data structures?" "They’re immutable, Dave." "Who is?" "All of them, Dave." "What, hash-maps?" "Everything’s immutable, Dave."
14:28ieure"They’re all immutable. Everything’s immutable, Dave."
14:28amalloyieure: wow, i was thinking of the wrong dave there for a bit
14:29amalloy2001, not lister
14:29ieure"What, vectors?" "They’re immutable, Dave, everything’s immutable, everything is immutable Dave."
14:30lawfulfalafelcould anyone reccommend a good example of using lazy-seq?
14:30manutterI just got an idea for a whole new clojure tutorial... :)
14:30lawfulfalafelI can find stuff on google, but I have trouble telling what advice is outdated
14:30lawfulfalafelor should I not worry about that?
14:30amalloylawfulfalafel: "everything" uses lazy-seq. do you mean using the raw form of lazy-seq, or just any lazy sequence?
14:31manutterlawfulfalafel: lazy-seq hasn't changed much
14:31lawfulfalafeluh, I was jus trying to follow manutter's advice
14:31manutterI suggested he look into writing his number generator as a lazy seq
14:31amalloyin that case, ##(take 4 (repeatedly #(rand-int 1000)))
14:31sexpbot⟹ (279 176 94 628)
14:32amalloyuses two lazy seqs already!
14:32manutteryeah, a bunch of built-ins already return lazy seqs
14:32lawfulfalafelI guess I don't really understand
14:32manuttertell us how you're generating your numbers
14:32manutterwe can show you how to turn it into a sequence you can use
14:33lawfulfalafel(dotimes [i 1000] (run-my-func i))
14:34manutterAh, an easy one :)
14:34lawfulfalafeland then run-my-func will add the number to an existing list if the number is divisible by 3 or 5
14:34manutter(map run-my-func (range i 1001))
14:35fliebellawfulfalafel: what, side effects?
14:35manutterThe map function already returns a lazy seq (and so does range iirc)
14:35void_so here's something I don't understand at all: when you use a symbol, like foo, and it's not defined, you get an exception. But you can use (binding [foo bar]) ... How come it doesn't throw an exception when it's used inside binding?
14:36void_I mean, foo is undefined when you use it inside that vector.
14:37manutterlawfulfalafel: sounds like you're working on one of the Project Euler problems :)
14:37lawfulfalafelyep, stuck on the first one :P
14:39technomancyvoid_: regular evaluation rules don't apply within macro calls
14:40manutter,(doc filter)
14:40clojurebot"([pred coll]); Returns a lazy sequence of the items in coll for which (pred item) returns true. pred must be free of side-effects."
14:40void_thanks technomancy
14:41raeklawfulfalafel: your 'run-my-func' does two things: calculate a number and add it to a collection. in Clojure you generally separate these two.
14:41raeklawfulfalafel: and in most cases, you don't need the second step at all
14:41raeksimply let the code that calls the function put it into the right place
14:42lawfulfalafelraek: cool, I didn't know that
14:42raekto just get the numbers, you can use (for [i (range 1000)] (my-side-effect-free-func i))
14:43raekor in this case, since the for body is so small: (map my-side-effect-free-func (range 1000))
14:44manutterhowever in this *specific* case I recommend you look at the docs for the filter function
14:44manutterMap will give you 1 result for each number in the input range
14:45manutterFilter lets you look at each number and decide whether or not to keep it
14:45raekalso, with "add it to a collection" I meant destructive updates (which are unideomatic in Clojure for code that just does calculations)
14:45lawfulfalafelokay, well I have this function: (defn by3or5 [number] (or (= 0 (mod number 3)) (= 0 (mod number 5))))
14:46lawfulfalafeland it returns "true" when number satisifies it, but how do I make it return the number instead?
14:46manutter,(doc filter)
14:46clojurebot"([pred coll]); Returns a lazy sequence of the items in coll for which (pred item) returns true. pred must be free of side-effects."
14:46lawfulfalafelor should I use filter and then add an if statement
14:46manutterThe "pred" argument in filter stands for "predicate", i.e. a function that returns true or false
14:46raeklawfulfalafel: (filter by3or5 (range 100))
14:47manutter,(filter odd? (range 1 10))
14:47clojurebot(1 3 5 7 9)
14:47lawfulfalafelso if filter does that, when would I want to use map?
14:48amalloywhen you…don't want to remove things
14:48bhenrylawfulfalafel: when you want to call a function on everything in a collection
14:48manutter,(map inc (range 1 10))
14:48clojurebot(2 3 4 5 6 7 8 9 10)
14:49lawfulfalafelso filter is really just a special version of map?
14:49amalloyno
14:49manutterFilter turns long seqs into shorter ones
14:49amalloyfilter calls a function to decide which things in a map to throw away
14:49manuttermap returns a seq that's the same size
14:49amalloy*in a sequence
14:49amalloymap calls a function to generate a new element corresponding to each element in the input seq
14:51lawfulfalafelokay, I think i get it now. Thank you!
14:52ieureUgh. Is there some way to increase my Java heap space in my lein-swank process?
14:52ieureFor whatever reason, slurping a 7mb file is OOMing it.
14:53raekmap takes function that takes an apple and returns a blueberry, and a sequence of apples, and returns a sequence of blueberries :-)
14:53lawfulfalafelalso, one quick question, is there a way to clear the state of the cake repl?
14:53lawfulfalafelbesides just closing/opening it again?
14:53amalloykill −9, baby
14:53amalloy(don't do that)
14:53raeklawfulfalafel: you want to remove old defs and defns?
14:53lawfulfalafelraek: yup
14:55bhenry(ns-unmap 'namespace 'var)
14:55bhenrylawfulfalafel: ^^^
14:55raeklawfulfalafel: (remove-ns 'user) (ns user)
15:05bhenrycan i AOT compile a namespace that parses the version out of project.clj and have a var available with that string in my uberjar?
15:07technomancybhenry: allowing unquoting of the version won't be possible until lein 1.6
15:07technomancyeverything else in defproject can be eval'd using ~
15:08technomancyyou could AOT a namespace that requires based on version at runtime using (System/getProperty "myproject.verison") in the mean time
15:09raekbhenry: do you want the code in the namespace to open the project.clj file and store the version of your project in a var?
15:09bhenryi just need the version string to be available in my uberjar
15:09raekso that it is available as a constant?
15:09bhenryas a var named version
15:09bhenryor whatever
15:09bhenryyes as a constant
15:10raekI don't see why it shouldn't be possible
15:10raekas long as you can find a reliable way of extracting the version from the project.clj
15:13raekbut I'm uncertain whether the static initializer that is responsible for making (def x (foo)) "happen" does this by storing the result of (foo) at compile time or by calling (foo) at runtime
15:13technomancyyeah, just AOT an ns that includes (def version (System/getProperty "myproj.version)) and you should be good
15:14bhenrytechnomancy: that sounds good i will try it out
15:14technomancymisunderstood your original question
15:15raektechnomancy: what code is responsible for setting the "myproj.version" value?
15:17technomancyraek: it's set in leiningen.compile/eval-in-project
15:29bhenrytechnomancy: weird. running from the standalone jar the aot compiled version ns gives me version as a blank string
15:30bhenry(ns floyd.version)
15:30bhenry(def version (System/getProperty "floyd.version"))
15:30technomancycan you confirm the AOT version is being loaded?
15:30bhenryhow would i do that. it compiled it during the lein uberjar
15:30bhenrybut that's as far as i know it went
15:31technomancymaybe javap on the corresponding .class file to see if it's got the right value?
15:32hiredmanno no
15:32hiredmanyou need a macro that emits the string value of (System/getProperty ...)
15:34technomancywait a minute
15:35technomancyjust load META-INF/maven/myproj/myproj/pom.properties
15:36bhenryi don't know what you mean.
15:37technomancythere's a file in the uberjar that includes the project version
15:38hiredmanbhenry: I think technomancy is thinking that if you AOT the file, the value of the system property from compile time will be used in the def, which is incorrect
15:38technomancywhat I mean is aot is a red herring; it's simpler just to use the properties file
15:41bhenryi guess i'm not familiar enough to be able to get this properties file from the jar
15:42amalloy$google java resourceAsStream
15:42sexpbotFirst out of 343 results is: ClassLoader.getResourceAsStream
15:42sexpbothttp://www.velocityreviews.com/forums/t128421-classloader-getresourceasstream.html
15:43amalloythat link is not at all canonical, but might be useful
15:44technomancy(into {} (doto (java.util.Properties.) (.load (.openStream "META-INF/maven/myproj/myproj/pom.properties"))))
15:49Kratoss`what about classloader.getResource?
15:50Kratoss`sorry... getResourceAsStream
15:50raekor clojure.java.io/resource
15:59cemerickJeez, LMGTFU responses via twitter are extraordinarily irritating.
16:00Kratoss`LMGTFU?
16:00amalloy$lmgtfy lmgtfu
16:00sexpbothttp://www.lmgtfy.com/?q=lmgtfu
16:00Kratoss`oh yes
16:00Kratoss`who uses twitter anyway :PPPPP
16:01cemerickamalloy: bravo ;-)
16:01amalloycemerick: learn by doing, that's my motto
16:08TimMc$lmgtfy does amalloy # remember to & check for = special chars?
16:08sexpbothttp://www.lmgtfy.com/?q=does+amalloy+#+remember+to+&amp;+check+for+=+special+chars?
16:08clojurebotmake a note of http://scienceblogs.com/goodmath/2006/11/the_c_is_efficient_language_fa.php it is yet another article about picking c or c++ for performance being naive
16:11RaynesTimMc: That one is actually my doing.
16:11amalloymost of them are
16:11RaynesTimMc: I've known about that bug for a year, but haven't bothered fixing it.
16:11kephale1clojurebot: tragically the source article is from greythumb which has more or less ceased to exist
16:11clojurebotIk begrijp
16:11kephale1clojurebot: me too, but on tuesdays
16:11clojurebotHuh?
16:28bhenrytechnomancy: turns out this doesn't even require aot compilation https://gist.github.com/14a8e9676ad1f090cfea
16:29hiredmanbhenry: it does, infact
16:29seancorfieldQ about resolve and classpaths...
16:29bhenrywell then it's being done automatically somewhere, because it works off the jar
16:30hiredmanother wise the macro while get re-expanded when you compile again
16:30hiredmanwill
16:31seancorfieldif i run a REPL in CCW/Eclipse and do (resolve 'controllers.main/default), it correctly resolves to src/controllers/main.clj:default
16:31seancorfieldbut if i run the REPL via lein at the command line, it gives me nil
16:31seancorfieldso i'm assuming it's a classpath issue but i'm stuck at figuring out how to solve it :(
16:32seancorfieldhmm, i guess i could (require 'controllers.main) dynamically first...
16:33seancorfieldjust a bit surprised that is needed for resolve?
16:33raekseancorfield: resolve returns the var named by the symbol. if the namespace has not been loaded, the var does not exist yet.
16:34seancorfieldah, so CCW is auto-loading the ns?
16:39pjstadigthere has been discussion before about whether referencing a symbol should auto load it
16:41pjstadigit was assembla 461
16:41pjstadignot sure if it got moved to jira or not
16:43hiredmanseems like it would make an ugly (uglier?) mess of the compiler
16:43pjstadighttp://dev.clojure.org/jira/browse/CLJ-461
16:44dnolen_hiredman: what? compiler and ugly mess aren't synonyms?
16:44pjstadigit's analagous to the way java classes are autoloaded if you fully qualify a class name
16:44hiredmanand depending how you did it (where you emitted the byte code to the load the required namespace) you could get very surprising behaviour
16:44dnolen_pjstadig: I think stuartsierra has a good point on that ticket.
16:45hiredmanI think it would be fine, if you made some changes to clojure's namespace system
16:46pjstadighttp://groups.google.com/group/clojure-dev/browse_frm/thread/69823ce63dd94a0c
16:46hiredmanpjstadig: sure, but the current implementation of namespaces and the compiler's support of namespaces doesn't seem like it would play nicely with it
16:46pjstadigok
16:47pjstadigi'm just giving historical context to the discussion, i'm not sure where i fall on it anymore
16:47hiredmanI am not opposed to changing them to play nice, just more work than you would expect
16:47hiredmanand noone likes working on the compiler
16:47pjstadigi know technomancy has to do some tricks to work around the Gilardi Scenario
16:48pjstadigthere were quite a few +1's in that thread...
16:53devngit rm --cached confienvs/c
16:53devngst
16:54devngit reset HEAD confienvironments/config/environments/cucumber.rb
16:54devngst
16:54devncp confienvironscucu../
16:54technomancyfatal: Not a git repository (or any of the parent directories): .git
16:54devngit rm --cached confienvs/c
16:54devnls config/environs
16:55devngst
16:55devngit add .giti
16:56devngit commit -m "Updating gitignore"
16:57devngst
16:57devngem --version
16:57seancorfieldraek: added (require 'controllers.main) to my app and it works fine now (i even have it running on heroku)
16:58devncucumber
16:59pjstadigcucumber: command not found
17:00devngst
17:00devngit add .rvmr
17:00devnee .rvmr
17:00devnc
17:00devngit add .rvmr
17:01devngit commit -m "Removing .rvmrc from gitignore"
17:01devngst
17:01devngit add ..git
17:01devngit commit -amend
17:01devngit commit --amend
17:01devngst
17:01devngit add db/sch
17:02devnb rake db:migrate
17:02hiredmandevn: cut it out
17:02devngst
17:03devngit commit -m "Checking in db/schema.rbC
17:03devngst
17:03dakronenow we're live-coding with devn!
17:03devnrm reru
17:03devnls
17:03TimMc*Someone* had better not have put any passwords in their command lines recently!
17:06TimMc(I can just barely believe devn accidentally pasted the contents of .bash_history or whatever on a thrashing computer.)
17:07devngst
17:08devnb rake spec
17:08technomancyops?
17:09TimMc$kick devn
17:09sexpbotTimMc: It is not the case that you don't not unhave insufficient privileges to do this.
17:09TimMc:-D
17:09devnsorry guys.
17:10devn:X
17:10TimMcWell, do tell.
17:10devnNo idea how that happened.
17:10TimMcWere you bit by a radioactive terminal multiplexer?
17:27offby1I always blame my cat
17:41dakronehttp://i.imgur.com/ekWpn.png
17:42TimMcnice
18:21devntechnomancy: haha i like your reply "not a git repository"
18:21technomancyI tell it like it is
18:23hiredmanlike what?
18:27devnseancorfield: you're running on heroku?
18:28seancorfielddevn: yup
18:28amalloytechnomancy: switched to a new computer, and "fontifying SLIME compilation" is taking forever. how do i turn that off?
18:29seancorfieldi couldn't resist trying it after i'd seen several ppl tweet about clojure on heroku :)
18:30seancorfieldand i'm porting my MVC framework FW/1 from CFML to Clojure so I figured it would be a good opportunity to play around with both!
18:30devnseancorfield: it's pretty cool eh?
18:31devni was surprised at how easy it was
18:31seancorfieldi have a p.o.c. working but i'm wrestling with enlive to make it do my bidding... and it's mostly winning the battle unfortunately :(
18:31devni have to run, but im thinking about padding out the skeleton that is described in the gist someone posted about cedar
18:31devnso people have sort of a base set of libs and what not to make a basic brochure site
18:32devnanyway im outta here, happy hacking
18:32seancorfieldi followed that gist to get my first app up on heroku... it's accurate
18:32seancorfieldlaters devn
18:32seancorfieldany bay area peeps here? (as in san francisco bay area)
18:32seancorfieldclojure user group meetup tomorrow - on zippers and other such fun
18:33technomancynot sure what else is needed outside that gist
18:33technomancyit should be pretty generic
18:34seancorfieldit seems to be, yup
18:35seancorfieldkinda cool that it recognizes leiningen and runs that after a git push to get all the dependencies in place
18:35seancorfieldi guess non-clojure jvm stuff could also be run on heroku now with the right magic to fire it up...?
18:35technomancyISTR people have reported go and erlang
18:36seancorfieldinteresting...
18:47chojinhey guys, question: I'm playing around with oauth and I need to save some data between sessions
18:47chojinnamely, a map
18:47chojinwhat's a good way of doing this?
18:48chojinI probably need to chuck it out to a file, but I'm not sure how you write code out to a file
18:48hiredman,(doc spit)
18:48clojurebot"([f content & options]); Opposite of slurp. Opens f with writer, writes content, then closes f. Options passed to clojure.java.io/writer."
18:50chojinthat was my suspicion, thanks for confirming
18:54chojinbest function names every, btw
18:54chojinspit & slurp
18:54chojin*ever
19:00Kratoss``how do you read it back?
19:01hiredmanhow do you read anything?
19:03chojinslurp will read it back in as a string
19:04Kratoss``that's what I mean
19:04chojinread-string turns that into an expression
19:04Kratoss``,(doc read-string)
19:04clojurebot"([s]); Reads one object from the string s"
19:04Kratoss``,(read-string "[1 2 3]")
19:04clojurebot[1 2 3]
19:04Kratoss``oh ok
20:38seancorfieldis there any reason why you shouldn't have (set! *warn-on-reflection* true) in every clojure file?
20:39technomancyyes
20:39seancorfieldand that reason would be...? :)
20:40technomancybecause it would be annoying?
20:40pdki always figured reflection was only a big deal writing applets
20:40seancorfieldlet's assume i don't want any reflection in my code :p
20:40seancorfieldfor performance reasons perhaps
20:41technomancyyou should remove the reflection that actually causes performance problems
20:41seancorfieldin other words, don't worry about performance until you have a proven problem... fair comment
20:42technomancyalso: set it in project.clj instead
20:42technomancywhen you are doing profiling
20:42seancorfieldah, good to know...
20:44scottjtechnomancy: in sample.project.clj is non-code files the best description for :resources-path? I had to add :dev-resources-path "/usr/lib/jvm/java-6-sun/lib/tools.jar" and I was confused because I thought of a jar like that as code, though maybe the .class files are what's important and that's not code?
20:45technomancypointing dev-resources-path to tools.jar seems odd to me
20:45technomancythe JDK should put tools.jar on the classpath for you
20:45technomancyaccording to gjahad, you can't mix and match tools.jar from one JDK to another
20:46scottjit should, wasn't for me though in ubuntu 10.04 and I found a chatlog in #cake.clj of another person having that problem
20:46scottjdidn't for me with openjdk, sunjdk through apt, or sunjdk from oracle's website
20:46technomancyyou sure you're not using a bare JRE?
20:48seancorfieldwhoa! putting (set! *warn-on-reflection* true) in project.clj triggers a slew of warnings from lancet, leiningen and so on...
20:48seancorfieldi expected it to trigger warnings in my own code but it didn't seem to?
20:50scottjnot entirely, all I know is I had jdk packages installed, if it was still running jre not sure how to change that update-java-alternatives didn't show separate jre/jdk options
20:50technomancyseancorfield: :warn-on-reflection true in defproject, rather
20:54seancorfieldah, sorry, misunderstood :)
20:56scottj+ jdk_home and java_home weren't pointed at jre subdirs in jdk folder
20:57seancorfieldnice technomancy thanx! highlights a lot of reflection warnings in clojure.java.jdbc which i probably ought to fix...
20:59technomancysweet
21:00gfrloglein stopped auto-including clojure contrib?
21:01technomancygfrlog: in new project skeletons, yes
21:01technomancyit's deprecated
21:01lancepantzseancorfield: we were talking in the office today bout clojure.java.jdbc
21:01technomancyjust pull in what you need
21:01gfrlogtechnomancy: I thought contrib wasn't splintering until 1.3
21:02lancepantzseancorfield: how do you plan to handle threads inheriting parent bindings in 1.3
21:02lancepantzseancorfield: with the jdbc not being thread safe
21:02technomancygfrlog: the split-up contrib libs generally should work with 1.2
21:02gfrlogtechnomancy: okay; thx
21:03technomancyit's still there if you need it; just not by default
21:03gfrlogright. Now I gotta figure out what the split up libs are...
21:04technomancyc.c.except is the only widely-used ns I know of that didn't get promoted.
21:04technomancyfsvo widely-used
21:05gfrlogis each namespace now a separate project? how are they named?
21:05technomancyit varies
21:05gfrlogsearching clojars for "combinatorics" yields nothing
21:05technomancyI think you still need monolithic-contrib for that one
21:05gfrlogoh okay
21:06gfrlogthanks
21:06technomancyall the promoted ones are listed in http://github.com/clojure
21:06technomancynp
21:06technomancywow, there are an awful lot of them
21:07technomancyoh, lots of dummy repos with only a readme though
21:07technomancyheh: https://github.com/clojure/io.incubator
21:07technomancyseriously?
21:07seancorfieldlancepantz: i'd like input on that issue :)
21:08hiredmanreminds me I need to TODO up a response for this http://dev.clojure.org/display/design/Contrib+Library+Names?focusedCommentId=2097200#comment-2097200
21:10seancorfieldlancepantz: can you open JIRA tickets for specific use cases / problems that need to be addressed about the bindings issue? - or is it more systemic?
21:10technomancyhiredman: yeah, a whole repo for a single function strikes me as very process-happy
21:11hiredmanjust a tad
21:12hiredman(and maven repos, omg)
21:12hiredmaner
21:12hiredmanmaven projects
21:12gfrlogclojure is so powerful that a whole repo has been condensed into a single function
21:21lancepantzseancorfield: it's systemic, but i can come up with an example snippet if you like, are you using the clojure dev jira i assume?
21:22seancorfieldlancepantz: yes, thanx!
21:23seancorfieldi'm having a hard time visualizing the problem so an example will be very helpful
21:23seancorfieldas i'm working with c.j.j more, i'm finding several problems with the API because it doesn't allow much manipulation of how things work under the hood
21:24lancepantzseancorfield: basically *connection* or whatever it is is going to be shared across multiple threads now
21:24lancepantzbut jdbc isn't thread safe
21:24seancorfieldfor example, i'd like to be able to apply a function to the PreparedStatement during any SQL operation
21:25seancorfieldah, so the connection would really need to be passed in directly rather than relying on binding? ooh, that would be a big change...
21:25lancepantzexactly
21:25lancepantzatleast, thats one possible solution
21:26lancepantzbut hopefully we can come up with something more elegant
21:26seancorfieldthat would also affect the naming strategy stuff i added too then...
21:26seancorfieldhmm, well, maybe not... i guess it only rebinds per thread and its immutable
21:26seancorfieldso it's really just *connection* or *db* or whatever?
21:29lancepantzyeah
22:06gfrlogman I just got bit by ##(< 2)
22:06sexpbot⟹ true
22:40dnolenhmm how do you redef fn in clojure w/ binding?
22:40dnolenin 1.2.0, I know about with-redefs in 1.3.0
23:08dakronednolen: alter-var-root
23:09dnolendakrone: I'm realizing I don't want to do that, will be visible in other threads ...
23:09dakrone'binding' will work then
23:10dakrone,(binding [map (fn [& _] (println :foo))] (map identity [1 2 3]))
23:10clojurebot:foo
23:11dnolendakrone: not for fns in other fns.
23:12dakroneyea, it will work for fns that call fns that you mock, it should be thread-local rebinding
23:12dakroneunless I misunderstand what you are trying to do
23:12dnolendakrone: doesn't work in 1.2.0 or 1.3.0 as far as I can tell.
23:13dakroneI must be misunderstanding then, can you post what you're trying to do?
23:14dnolendakrone: oh it does work in 1.2.0, but oddly not for fns like +, because those are inlined duh.
23:14dakroneoh, yea
23:20dnoleni wonder if it has problem w/ recursive definitions as well ...
23:22dnolenit does
23:23dnolenbecause lexical shadowing
23:26justinkocan anyone explain why clojure code needs less tests than OOP languages?
23:27justinkobecause there is less state and more immutability?
23:29dnolenjustinko: seems like a weird claim to me and trying to write unit tests for subtle concurrency bugs seems futile anyhow.
23:30justinkoI've heard many times that functional languages need less tests
23:33justinkoI don't see what concurrency has to do with my question
23:33justinkoanyway, I'm sure I'll find out myself
23:37scottjha, under rationale for fenrir: "To be honest, I don't have a good reason for creating Fenrir."
23:44jtszzzzzI have a macro question for anyone wise nice person. In my macro, I have the need resolve and deref a symbol from marco input to help build the output.
23:45jtszzzzzFor instance, I need to get the count of a list of records so that I know how many gensyms to create for the output form.
23:46jtszzzzzIs it considered bad practice to be evaluating the forms passed into the macro as opposed to just changing the structure?
23:47dnolenjtszzzzz: (var-get (resolve symbol)), will give you the value.
23:48dnolenjtszzzzz: its certainly necessary for some things. any reason your macro can't be an fn? are you def'ing something top level w/ this macro?
23:51jtszzzzzI have tried to do this what a func but i can't wrap my head around how. It really seems like a macro case. As far as the resolve goes.. I think I need to do a symbol? check before doing the resolve bit first because it could also be the case that my required value is passed in value a list. This is making me not like this :(
23:53dnolenwhat aspect of macros is required to solve the problem?
23:55jtszzzzzlet me past an example.. on a gist