#clojure logs

2011-08-03

00:08semperosat the Slime repl I generally just work inside namespaces that I've loaded via a file, but for the first time I was using `in-ns` to create some throw-away namespaces
00:09semperosI thought when you switched to a new namespace with `in-ns`, you started with a "blank slate"
00:09semperosso nothing I had `require` or `use` in another namesapce with be available
00:09semperosis that not the case?
00:14PupenoHello.
00:14pcavssemperos: I believe that is the case, what makes you think that is not?
00:14semperospcavs: working at the repl, switching between namespaces and not having a "blank slate" between namespaces
00:14dnolen:D tell me you don't want this awesomeness, https://gist.github.com/1121891
00:20pcavssemperos: could you be more precise? certain core clojure libs are defaulted to being loaded in every ns
00:21semperoslet's say I created a file with a namespace of foo
00:22semperosthen at the repl, I enter a namespace bar by evaluating `(in-ns 'bar)`
00:22semperoswhile inside bar, I `(require 'foo)`
00:22semperosthen, say I leave bar and go to the user namespace, `(in-ns 'user)`
00:23semperoswhat I'm experiencing at that point is the functions in my file's `foo` namespace, that I required while inside bar, are available in my user namespace at the REPL
00:23pcavswhat if you change 'user to be 'baz
00:23pcavssame effect?
00:25pcavssemperos: I'm just thinking that there may be some defaults already loaded into the 'user namespace previously, which you forgot to wipe, or from leiningen/whatever you're using for your swank server
00:25pcavssince 'user is the default ns name
00:25semperosyes
00:25semperosthat was just an example, the point is that when switching between namespaces, code `required` in one is available in another
00:26semperospossible "expected" behavior of swank, but it just doesn't make much sense to me
00:26pcavssemperos: interesting
00:28lobotomyhaving some problems with multimethods, trying type-based dispatch: http://pastebin.com/i2nHHUs7
00:28lobotomyquestions: 1) does this sort of "typing" thing make sense in clojure anyway? :) 2) why isn't it working?
00:29brehautlobotomy: types definately exist in clojure, but the signatures of functions are not bound to them as they would be in java
00:35brehautlobotomy: your definition for make-piece you have defmulti where you mean defmethod
00:36lobotomy...oh ffs
00:36lobotomythanks a lot :D
00:36brehautnp
00:38semperoslobotomy: for pure type-based dispatch, protocols might be a better fit
00:38brehautsemperos: hes doing multiple dispatch however, so multis is right in this case
00:39tomojis it?
00:39tomojI guess there are some missing parts maybe that justify the use of records and multimethods
00:39brehauttomoj: for make-piece it is
00:39tomojok
00:40brehautmake-edge could definately be a protocol
00:40semperosyep
00:40tomojoh, I guess there are going to be more implementations?
00:40tomoj:)
00:41brehautoh, no tomoj you are right, it doesnt need to be multiple dispatch if its always expecting strings for second and third args
00:42tomojI was looking at just that code thinking less than 5 lines do exactly the same thing, but the part left out is where else you're going with it
00:42tomoj(naturally..)
00:44brehautlobotomy: if you dont care about the types of the second and third args, you dont need to make your dispatch function handle them.
00:47lobotomytomoj, i don't know yet where i'm going with it :) right now though, nowhere
00:47brehautlobotomy: which is to say (fn [[a & _] _ _] (type a)) would do for your dispatch function
00:47lobotomyhmm, destructuring. good point
00:48tomoj(comp type first vector)
00:48brehauttomoj: that was my first though too :P but i think the destructuring is nicer in this case, because its explicit about the arguments
00:48lobotomywas also thinking where best to verify the validity of the given edges... a {:pre ...} in make-piece-from-edges i think?
00:49brehautoh, tomoj ffirst rather than first
00:49tomojright
00:49lobotomymy first version had a make-piece with a {:pre} that checked if the given things are strings, if so turned them into edges, and checked if they're valid for a piece, but that just seemed ugly
00:49tomojlobotomy: .. so you aren't just using multimethods and records because it looks sorta like some OOP you're used to, are you? :)
00:50lobotomywell, the previous version of this program i wrote in java, so hm... ;)
00:50lobotomyyeah, i'm kind of contaminated that way, haha
00:50brehautlobotomy you can actually scrap the entire multi for make-piece;
00:51brehaut(defn make-piece [e c n] (Piece. (make-edge e) c n))
00:51brehautif you (defmethod make-edge Edge [x] x)
00:52tomojI doubt there is need for Pieces or Edges
00:52PupenoI need an embedded database for my app, should I go with Derby?
00:52tomojnor for make-piece
00:53lobotomywell, the use case is basically that i want to be able to say (make-piece ["00011" "10100" "00110" "00110"] "purple" "P1") and have it verify that the edges (or strings, whichever) match each other
00:53brehautlobotomy: and if you have a fixed set of types that you need to coerce, you dont need late bound polymorphism, you can just use case (or other cond family form)
00:53tomojwhy not just use the ints themselves, (filter #(<= 0 % 31)) them (or throw an exception if you insist..)
00:53lobotomytomoj, not sure how things would be clearer without Piece or Edge at all?
00:53lobotomyi mean, at this point probably, but once i add the other zillion lines of stuff
00:54tomojthen just write {:edges [1 2 3 4] :colour "purple" :name "P1"}
00:54tomojI suggest adding multimethods and records and these things after you notice you need them
00:54lobotomyhow to do the error checking though with {}?
00:55tomojbefore, they just turn 3 lines of code into 30
00:55lobotomyfor instance, "10101" "01101" is invalid since the corner between consecutive edges can't be both 1 and 0
00:56lobotomyyou're saying to do the make-piece just with that check, parseInt and that's all? i guess that could work too :]
00:56tomojwell, I don't know about any of that, was just looking at the code, so can't really say you don't need multimethods or records
00:56lobotomyyeah, the code isn't all, but the rest is rather unfinished
00:56tomojbut.. it is generally better to err towards not using them
00:57lobotomyin the (near) future i'll need to add a mutable version of edges and hmm... i'll need to link the mutable edges together
00:57tomoj..guess that is not really useful advice, since them problem is just deciding whether or not you need them
00:58tomojoh god
00:58tomojwait
00:58lobotomyi think at that point it will be necessary to wrap the int in something
00:58lobotomyin the mutable edge i mean
00:58tomojyou mean mutable like clojure's reference types?
00:59tomojor mutable like bad evil mutable?
00:59tomoj:)
00:59lobotomyi don't know. was thinking of using ref
00:59lobotomywhat i'd do is build a wire frame kind of thing, for this puzzle solver
00:59tomojwhew, thought you meant really mutable
00:59lobotomyinto which pieces are "added" as the solver proceeds
01:00lobotomyand the addition is probably a lot simpler by just changing the int inside the edge
01:00semperostomoj: nothing inherently evil about mutable state; things get interesting with *shared* mutable state, but localized mutability can be used strategically
01:00tomojwhat puzzle is it, anyway? was curious from the beginning
01:00lobotomysince the edge needs to be linked to other edges, and creating a new edge and transferring the links seems more complicated than modifying existing edge's int and not touching the links
01:00lobotomyhttp://www.happycube.com/
01:02brehautoh man. happy cubes
01:02tomojneat
01:02brehautso many hours of suffering and fun
01:02tomojI can feel the frustration watching those flash videos
01:05lobotomyhere's some ascii art: http://pastebin.com/mp3QNzHB
01:06brehauttomoj: once you have the basic cubes solved, you get the frustration of assembling shapes from multiple cube sets
01:07lobotomyanyway, the java version of the solver simply has Edge, MutableEdge, Piece and Hole
01:07lobotomyand Structure, which is a bunch of holes plus the solver
01:07brehautlobotomy: why are you repeating the corners?
01:07lobotomywhy not?
01:08brehautno i mean, what is the benefit you gain from it?
01:08lobotomyit's probably simplest to just repeat them :)
01:08lobotomyhow else would you do it? edges and corners separately?
01:08lobotomythat's more complicated, but the benefit is... what?
01:08brehautlobotomy: what about a vector of 16 bools?
01:09lobotomywith that, how would it work when you're modeling something like this: http://happysolver.sourceforge.net/realComplex.jpg
01:10lobotomywhich bools in which vectors would correspond to which holes in the structure you're trying to build?
01:11lobotomy(i'm not saying my edge linking solution is the best, but it seems the most intuitive to me)
01:12brehautlobotomy, the bools encode the same information your vector of strings does, but flattened
01:12brehautand with the corners occuring only once
01:13brehaut(because the end of side of a piece is the beginning of the next side)
01:13tomojin the solutions, are the pieces always arranged in (a subset of) a 3d grid?
01:13brehautyes
01:13tomoj(like in the picture, in a single cube, in a flat arrangement)
01:14lobotomybrehaut, and why would i want the information flattened?
01:14lobotomythe 3d structure doesn't look very flattened...
01:15brehautlobotomy: i like to choose the simplist representation possible; and the simplest one possible is the one i can apply more standard library function
01:15tomojno need to validate that the corners in the input edges match up if there's no room for error because you only specify each corner once
01:16lobotomyno need to optimise that bit out since all pieces are immutable and specified only once
01:16lobotomythe more important point is the 3d (mutable) structure
01:16tomojoriginally I was thinking your way made sense, if the pieces never change maybe I still do
01:17lobotomybrehaut, what then is the simplest representation possible for that big 3d case? i'm inclined to think flattened won't do
01:17brehautlobotomy: consider this [false false false true true true false true false false false true false false true true false]
01:17lobotomywell, of course flattened is possible, but...
01:18brehautso the case of rotations you just need to use cycle drop take
01:19lobotomythink about it this way: i have a piece, and a structure with a hole. task: find out if the piece matches the hole
01:19lobotomynow, you're saying that the structure is a flat vector of bools?
01:19lobotomywhere in that vector is the hole? which bools?
01:20lobotomymy current solution simply has a Hole, which consists of 4 MutableEdges. done
01:20lobotomywhen i find a matching piece, i modify the hole's mutable edges (and, possibly, their successor edges - since corners are shared) to incorporate it
01:22tomojif you write the clojure like the java it's going to be ugly
01:23tomojdon't think most idiomatic solutions to this problem in clojure use any mutability or refs or multimethods or records
01:24lobotomyhmm, by "this problem" do you mean the entire problem, or just the (immutable) edges and pieces?
01:24tomoj..but I just realized I've only been thinking of the puzzle, and have only a vague idea what an actual solver algorithm looks like, so.. dunno
01:24brehautlobotomy: consider this ##(every? #(== 1 %) (map bit-xor [1 1 1 0 1] [0 0 0 1 1]))
01:24lazybot⇒ false
01:24tomojI meant the entire problem, for that specific puzzle (generalizations might make use of records/multimethods I suppose)
01:25lobotomyare you saying my solution is easier to do without mutability, or that there's an idiomatic solution where no mutability is needed?
01:27brehautlobotomy: heres every rotation of a piece ##(take 4 (partition 16 4 (cycle [0 0 0 1 1 1 0 1 0 0 0 1 0 0 0 1 1 0])))
01:27lazybot⇒ ((0 0 0 1 1 1 0 1 0 0 0 1 0 0 0 1) (1 1 0 1 0 0 0 1 0 0 0 1 1 0 0 0) (0 0 0 1 0 0 0 1 1 0 0 0 0 1 1 1) (0 0 0 1 1 0 0 0 0 1 1 1 0 1 0 0))
01:27clojurebot,(let [testar (fn [x y] (if (= (reduce + (filter odd? (range 0 x))) y) (str y " is an square perfect")) )] (testar 10 25))
01:27lobotomy(the solver algorithm is a simple depth-first search, not much mystery there)
01:29tomojhmm
01:30tomojif you have a partial clojure solution written with mutability in mind, I have no idea whether it is easier to write a different (more idiomatic) solution in clojure instead of just finishing it
01:30lobotomyare you sure that idiomatic clojure never has any mutability in it anywhere? :)
01:31brehautidiomatic clojure strongly favors immutability
01:31tomojI am sure that that is not true
01:31lobotomyi'm basically making a wireframe, then modifying that as the solver proceeds, and that seems like the most natural way of doing this
01:31lobotomyin the java version i have multiple solver threads, each creates its own private version of the wireframe
01:31lobotomybut the pieces are shared since those are immutable
01:32brehautlobotomy: both breadth and depth first search are algorithms that naturally suits immutable implementation
01:33lobotomyand the wireframe is a thing that naturally suits a mutable implementation
01:34tomojwe should probably taboo "mutable"
01:34tomojI don't think we're talking about the same things
01:41tomojdo you have any of the wireframe code written yet?
01:42tomojwell, is that your sourceforge project?
01:44lobotomyhmm, no, the sourceforge one is completely different
01:44brehautlobotomy: are you wanting the solver to find arbitrary solutions, or to solve specific shapes?
01:44lobotomymine is unreleased. just wrote it for fun, not looking at the sourceforge version :)
01:44tomojah
01:44lobotomyto solve specific shapes with given pieces
01:45lobotomybasically, the problem is: given a list of pieces, and a shape, print out (somehow) the solution, or indicate that one doesn't exist
01:45lobotomymy code just prints out the pieces in the solution with ascii art, in a predetermined order (depending on the shape)
01:45lobotomyso it's not quite as user friendly as the sourceforge solution ;)
01:47brehautsure, thats the easier one than any arbitrary shape
01:47lobotomymy version supports arbitrary shapes actually
01:47brehautyou misunderstand
01:48lobotomyyou mean, given these pieces, figure out which shapes can be built?
01:48brehautyes
01:48lobotomyhmm... that could be done fairly easily with my solution: go through each shape, if shape requires at most n pieces, try to solve it with the given n pieces
01:49brehautway more concise than the garbled explaination iwas typing :P
01:49lobotomybeyond a certain point the shapes start to require more than n pieces so this will eventually terminate ;)
01:59tomojso you have some canonical order for holes
01:59tomoja shape is a list of open hole indices
02:00tomojeh.. a shape is a function from holes to sets of holes
02:01tomojor neither of those but both mixed together, I dunno
02:13tomojlobotomy: ok, does representing a shape as a list of hole coords make sense?
02:14lobotomycoords? do elaborate
02:22tomojso the simple cube is, uh
02:23tomoj&(for [x [0 1] y [0 1] z [0 1]] [x y z])
02:23lazybot⇒ ([0 0 0] [0 0 1] [0 1 0] [0 1 1] [1 0 0] [1 0 1] [1 1 0] [1 1 1])
02:23tomojguess not, he
02:23tomojeh
02:28tomojI was thinking in 2d with a bad analogy, not going to understand this problem tonight :)
03:33CozeyHello. How to run a multi module (reactor build) from leiningen's maven integration? Is it possible? I have a project A (lein) depending on B (maven) and I'd like to quickly update A's loaded dependencies (into lib/) when B changes.
04:20peteriserins(print) does not print to the screen in uberjar; should I have used Java prints instead?
04:23raekprint should work...
04:27peteriserinsok, it was because of the System/exit call, I assume print uses BufferedWriter or something
04:28brehaut,(doc flush)
04:28clojurebot"([]); Flushes the output stream that is the current value of *out*"
04:49wallhello
04:52zarachi wall : 0
04:52wallcan anybody help me reduce code to simple
04:52wallcode here http://paste.lisp.org/display/123754
04:52walli need convert 12 lines to doseq or any cycle
04:53wallindex now id numbers from 0 to 11
04:54wallid = is
04:54opqdonutuse for and range
04:56opqdonutyou can do something like (for [angle (range 0 Math/PI step)] (struct point-8 <stuff>))
04:58wallsuper!!!!!
04:58wallthancs
04:58wallsorry my bad english
04:59jonasenA simple ClojureScript game, http://jonase.github.com/make-adder/ Enjoy! :)
05:17Fossi99.65000000000224% yes ;D
05:17Fossii guess your print needs a format :)
05:18jonasenFossi: I agree, but I don't think its in clojurescript yet
05:18Fossibut nice
05:18Fossireal fun too ;)
05:19jonasenFossi: thanks.
05:50Pupeno_I think I'm starting to like http://clojuredocs.org.
05:59MasseRPupeno_: Have you noticed, it doesn't find results with hyphens?
05:59MasseRWell the autocompletion finds
05:59MasseRBut if you press enter you get 'no results'
05:59MasseRTry for example maybe-m
05:59Pupeno_MasseR: clojuredocs.org? no... generally I arrive through google.
05:59MasseRPupeno_: Ah. I use duckduckgo with !clojure bang pattern
05:59MasseRMakes it kind of useless
06:00Pupeno_Yeap: http://clojuredocs.org/search?q=as-file
06:01MasseRHmm.. I think it's an open source project on github.. issue time
06:02MasseRAh it's a known issue
06:02Pupeno_https://github.com/zkim/clojuredocs/issues/34
06:02MasseRhttps://github.com/zkim/clojuredocs/issues/22
06:02Pupeno_Damn.
06:03MasseR:P
06:03Pupeno_I been using sphinx way more than I like... maybe I could look into it later.
06:04MasseRSomehow python docs ruined sphinx for me
06:05MasseRI actually like hoogle and hayoo. Signature based searching, which works excellent on a static language such as haskell
06:05MasseRBut then again haddock (haskell documentation) has troubles that clojure (whatever engine they use) has fixed
06:14pyrreading ring and compojure souce
06:14pyrsource i mean
06:14pyri'm not seeing how one differentiates request handlers from response handlers
06:15pyrmeh, i see
06:52wallhello. help me please with my problem. how i must visit 2 sequence in code with equal offset. this code (let [a '(1 2 3) b '(4 5 6)] (for [x a y b] (println x y))) don't work I need (1 4 2 5 3 6) at result but this code produce multiple of set
06:55jonasen,(interleave [1 2 3] [4 5 6])
06:55clojurebot(1 4 2 5 3 ...)
06:59manutter,(map (fn [a b] [a b]) [1 2 3] [:a :b :c])
06:59clojurebot([1 :a] [2 :b] [3 :c])
07:00manutter,(mapcat (fn [a b] [a b]) [1 2 3] [:a :b :c])
07:00clojurebot(1 :a 2 :b 3 ...)
07:10wallhow write code simple
07:10wall(defn paint2 [c g]
07:10wall (let [w (.getWidth c) w2 (/ w 2)
07:10wall h (.getHeight c) h2 (/ h 2)]
07:10wall (doseq [x (:circles *game*)]
07:10wall (let [col (interleave (:points x) (:colors x))]
07:10wall (doseq [i (range 0 (/ (count col) 2))]
07:10wall (draw g
07:10wall (ellipse (int (+ h2 (:x (nth col (* 2 i))))) (int (+ w2 (:y (nth col (* 2 i))))) (:r (nth col (* 2 i))) (:r (nth col (* 2 i))))
07:10wall (style :background (*colors* (nth col (+ 1 (* 2 i)))))))))))
07:11wall?
07:11wallwith interleave its very long...
07:12manutterYou would probably be better off using (map (fn [p c] [p c]) (:points x) (:colors x)) instead of interleave
07:13manutterThis will give you a sequence of [p c] pairs that you could destructure to get the actual point and color
07:14manutteralso by the way it's customary to use something like a github gist or similar service for long code snippets
07:16manutterhmm, looking at your code more closely you might like something like this...
07:18manutterwait, no, hrm that won't work
07:34manutterYeah, try this: (doseq [{:keys [x y r]} x] (draw g (ellipse (int (+ h2 x)) (int (+ w2 y)) r r)...
07:52wallsorry, but map produce list, but i need only call functions (ellipse and style)
07:52wallhow i can apply each element of 2 sequence to draw?
08:03pyrok, got itre
08:04pyroops
08:17wallno. iterate - not. i need samething like apply only for 2 sequence
08:24wallevrika!!!!
08:24wall (defn paint2 [c g]
08:24wall (let [w (.getWidth c) w2 (/ w 2)
08:24wall h (.getHeight c) h2 (/ h 2)]
08:24wall (doseq [x (:circles *game*)]
08:24wall (doseq [[y z] (map list (:points x) (:colors x))]
08:24wall (draw g
08:24wall (ellipse (int (+ h2 (:x y))) (int (+ w2 (:y y))) (:r y) (:r y))
08:24wall (style :background (*colors* z)))))))
08:26MasseRThat's not even hard to read
08:46wallsorry, stupid question - how change element in list?
08:47Scriptorwall: you don't, usually. Why do you need to change an element?
08:49wallother words - i must re-produce list with changed element?
08:50MasseRwall: Yes
08:50MasseRImmutable data structures
08:50MasseRBut don't worry, it's done 'the right way', meaning that the two lists share a lot of common
08:51Scriptorwall: basically, but it's still a good idea to look at the problem from a more high-level persepctive
08:51Scriptorto see whether there's a better way of doing it
08:51wallа по русски никто не говорит?
08:51wallwho speak Russia?
08:51ScriptorGreek?
08:51Scriptoroh
08:52Scriptorsorry, this channel is mostly english-speaking, I think
08:52walli see
08:52wallbut my english bad for describe problem
08:52Scriptortry anyway
08:54wallthis is idea for my first game on clojure. Picture here http://gamehappy.ru/f/i/gamehappy/games/220/640-480_screenshot_3.jpg
08:55wallgame consist of set of circle which describe set of points and list of colors of small ball
08:55wallnow i write function move-left which must change state of circles
08:56wallfunction simple get next value in list, and change to previous in circle
08:57walland now i don know how change elements in list
08:59Scriptorwall: so move-left changes the state of all the circles?
08:59wallno
08:59wallonly linked circles
09:00wallmy code here http://paste.lisp.org/display/123756
09:00wallmaybe simple think
09:00dnolen,(update-in [{:points {:x 1 :y 2}}] [0 :points :x] inc)
09:00clojurebot[{:points {:y 2, :x 2}}]
09:01dnolenwall: ^ ?
09:04wallupdate-in work with hash
09:04wallnot list
09:04dnolen,(update-in '(1 2 3) [1] inc)
09:04clojurebot#<NullPointerException java.lang.NullPointerException>
09:04Scriptorwall: it's a list of colors, right?
09:05dnolen,(update-in [1 2 3] [1] inc)
09:05clojurebot[1 3 3]
09:05wallyes
09:05wallScriptor, yes
09:05dnolen,(update-in (into [] '(1 2 3)) [1] inc)
09:05clojurebot[1 3 3]
09:05Scriptoryep, I think what you actually have is a vector
09:05Scriptorso update-in will work with that
09:06walldnolen, (let [a '(1 2 3 4)] (update-in a [2] inc)) - not work
09:07wallScriptor, i must rewrite using list to using vector?
09:08Scriptorwall: in the code you posted, isn't *colors* already a vector?
09:09wallnot *colors*. see field :color in structure one-circle
09:09wallthis field have info about state of circle
09:09wall*colors* need only then show circle on screen
09:10dnolenwall: you can't efficiently or easily update inside the middle of a list.
09:11wallok. i'm rewriting use vector
09:11Scriptorgood idea, lists are better for iterating through one by one
10:10ambrosebsI'm trying to perform this type of conversion: [1 2 3 4] -> [[[1 2] 3] 4] any hints of how to approach this?
10:11ambrosebsim trying to convert a function call into a lambda calculus function call, with only one argument
10:11ambrosebs(add 1 2) => ((add 1) 2)
10:13SomelauwAnybody already developing for android?
10:15sthuebnerambrosebs: do you mean something like this:
10:15sthuebner,(let [add (fn [x y] (+ x y)) add-1 (partial add 1)] (add-1 2))
10:15clojurebot3
10:15sthuebneror:
10:15sthuebner,(let [add (fn [x] (fn [y] (add x y)))] ((add 1) 2))
10:15clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: add in this context, compiling:(NO_SOURCE_PATH:0)>
10:16sthuebner,(let [add (fn [x] (fn [y] (+ x y)))] ((add 1) 2))
10:16clojurebot3
10:16ambrosebsI have the raw form (add 1 2), I want to transform it into the raw form ((add 1) 2)
10:16ambrosebsdont want to execute it
10:17TimMcsome kind of reduce, maybe
10:18dpritchettIs it normal to restart one's interpreter every time you finish editing a function in your source file?
10:18TimMcambrosebs: Can you guarantee at least 2 elements?
10:19dpritchettI went to #python and #django asking for advice on how to re-import classes loaded with "from myapp.models Person" without having to restart the interpreter and the unanimous response was "you have to restart your interpreter".
10:19ambrosebsTimMc: yes
10:20ambrosebsif it's a function call, it will have an argument
10:20ambrosebsat least
10:20tufflax,(let [form '(add 1 2 3 4 5)] (reduce (fn [f x] (list f x)) (first form) (next form)))
10:20clojurebot(((((add 1) 2) 3) 4) 5)
10:20ambrosebsphew!
10:21ambrosebstufflax: thanks :)
10:21tufflaxnp
10:21TimMcdpritchett: When you work from Emacs, it is not uncommon to have a REPL open in another pane and just keep sending your edited functions down to the REPL for reevaluation.
10:22dpritchettExactly! I assumed that was doable in other interpreted languages too. Perhaps I just need to try #python at a different hour.
10:22TimMcI do things a little differently -- I use the REPL to refine a function, then paste it into my source files and run my unit tests.
10:23dpritchettThat's pretty much what I do too tim
10:24TimMcI'm sure someone has cooked up (or will) a hot-swap thingy for Clojure, a la Eclipse.
10:24TimMcThat's a joy to work with when doing Java servlet dev.
10:24dpritchettThere's ring middleware for it, I discovered this on Noir
10:25dpritchetthttps://github.com/ibdknox/noir/blob/master/src/noir/server.clj#L8
10:26dpritchettIt's pretty sweet that my django *server* restarts itself automagically whenever i save a file on its path... not sure why the interpreter can't hot reload things without a full restart
10:26dpritchettAh well... obviously this isn't really a Clojure question, I just wanted to get confirmation that the emacsy way of doing things actually worked the way i remembered it.
10:33pepijnClojureScript bootstrap says script/bootstrap: 28: jar: not found
10:33pepijnAny ideas?
10:34pepijnOh, and has anyone tried CouchDB with ClojureScript yet?
10:46bsteubertalking of clojurescript
10:46bsteuberwithout optimizing, shouldn't I be able to call cljs stuff from a javascript-console?
10:47bsteuberI can call stuff, but e.g. keywords don't work
10:48bsteubercljs.core.name(cljs.core.keyword('foo')) => "î.'foo"
10:48pepijnend of wifi, good bye
10:48bsteuberhowever, the same works fine using brepl
11:05iceyIs apache web server + tomcat the way most people deploy clojure web applications?
11:09icey(i'm familiar with lein-beanstalk and clojure on heroku; but I have a bunch of little single serve apps that i want to put online so i'd just as soon put them on a vps at linode or something)
12:13zvrbathis complains on .isProbablePrime about no matching field found: (let [x (BigInteger. "13")] (.isProbablePrime x))
12:13zvrbawhat am I doing wrong?
12:14hiredmanzvrba: read the javadoc for the method you are trying to call
12:15ejacksonhiredman: reading those things is usually where I go wrong :P
12:15zvrbaah!
12:15zvrbaforgot the other mandatory argument
12:16zvrbawhen I write a dot and press TAB for completion, in which packages does slime look?
12:19technomancyzvrba: it's impossible to get instance methods for objects where the type is unknown
12:19zvrbai know
12:19technomancyslime's currently not hooked up to hinting, though it wouldn't be impossible
12:19zvrbawhat hinting?
12:19technomancytry C-h TAB in slime to find out what it's bound to
12:19jweisscan anyone suggest where i might find an algorithm that does the following - traverses a tree with n threads, such that no child node is processed before its parent? seems simple enough, but i can't seem to find one that honors the restriction and uses the threads efficiently.
12:19technomancyzvrba: slime could theoretically be tied into type hints
12:20technomancynobody's bothered yet since the compiler's going to get chucked out and rewritten
12:20zvrbai get message about C-h TAB being undefined.
12:20technomancysorry, C-h k TAB
12:20technomancymaybe in the future once the compiler does type inference and exposes it to tools, swank will tie into that
12:20zvrbaslime-indent-and-complete-symbol
12:20zvrbadoes eclipse plugin do type inference?
12:21zvrbatechnomancy: though, I asked something much simpler: in which packages does completion look into?
12:21zvrbatechnomancy: I know that I simply get a list of all accessible methods, but from which Java packages?
12:22technomancyzvrba: hah; I didn't even know it did that. I don't know if that's intentional or not.
12:22technomancyno idea where it's coming from.
12:23zvrbaand even better, it would be enough if each completed method name would be prefixed by its class
12:23zvrbathat would go a long way before type inference is here
12:23jolyjweiss: if a breadth-first search is ok, you could put make a nodes-to-visit queue and have the individual threads pull from it. As long as the node is processed before you put the children into the queue, it should work
12:25jweissjoly: yeah, that's the problem, i can't just queue up all the nodes at once. so how do i have the main thread wait to queue up the children? once the tree branches i'd need multiple threads doing queueing also
12:26jweissthe only (ugly) solution that would actually work that i came up with is to queue up all at once, and have the worker thread just re-queue an item if its parent hasn't been processed
12:27jolyjweiss: the main thread would put the first item on the queue, any worker would retrieve it, process it, then put its (multiple) children on the queue.
12:27hiredmanwhy not have the thread that processed a parent queue up it's children?
12:28hiredmane.g. put the root on a work queue n threads are pulling from, one thread pulls it off processes the root, and places the immdediate childred on the queue for work, rinse and repeat
12:28jweisshiredman: that is a better idea
12:28jweissit does require breadth first traversal, which since i'm using clojure.zip, i'd have to write, but that's ok
12:30manutterwell, if each worker processes 1 node, and then puts the immediate children on the queue, that's breadth-first automatically
12:30jolyexactly
12:33jolywell, like breadth-first anyway. some threads could get easy tasks and pull ahead of those doing slower tasks
12:33jolyand switching to a stack the threads pull from should give you something like depth-first
12:34manutterYeah, the parallelism makes terms like "first" a bit ambiguous.
13:35lobotomyso i've figured out i probably want a (defstruct wire :name :i :inverted :successors), and with it a (defn set-wire! [wire i inverted successors] (dosync (alter wire assoc :i i :inverted inverted :successors successors)))
13:35lobotomywhere the idea is that :inverted is another wire, and :successors is a vector of other wires
13:36lobotomyhmm, and of course (defn make-wire [name] (ref (struct wire name)))
13:36lobotomyso, should the :inverted be a ref to the other wire, or deref'd plain wire?
13:36lobotomylikewise for :successors
13:37dnolenlobotomy: defstruct is deprecated.
13:38lobotomywell damn :D
13:38lobotomydefrecord then?
13:39lobotomyhmm, (doc defrecord) tells me "Alpha - subject to change"
13:45lobotomyor just use a map instead of defrecord? hmm, that should be fine at this point
13:55lobotomyhmm... if i store the dereffed ref, it seems to copy the data? so that won't work
13:56lobotomyand when i do (dosync (alter w0 assoc :inverted w1)) then (dosync (alter w1 assoc :inverted w0)), i get a stack overflow
13:56lobotomyso: what's the correct way to do circularly linked datums in clojure?
13:59dnolenlobotomy: plain maps are fine. circularly linked data is not really possible. better to do this via some relational abstraction of one's own.
13:59lobotomynot really possible? what?
13:59hiredmandnolen: it is possible via mutable refs
13:59lobotomyare you serious?
14:00dnolenhiredman: yes, but not recommended by any means.
14:00dnolenlobotomy: or Java arrays etc.
14:00technomancyalso possible with laziness IIRC
14:00hiredmanlobotomy: please stop trying to print cyclic graphs
14:00technomancybut more trouble than it's worth
14:00lobotomywhat is the recommended way of doing cyclic things then?
14:00lobotomyhiredman, good point ;)
14:01dnolenlobotomy: why do you need a cyclic data structure in this case?
14:01jolythings like graphs can be done with maps: {:a [:a :c] :b [:c] :c [:a :b]}
14:01technomancy"doing cyclic things" isn't something you want to do
14:01jolythe graph has a cycle even though the data structure doesn't
14:02lobotomycyclicness is how i modeled it in java, seemed the most straightforward way
14:02dnolenlobotomy: cyclic data structure are code smell in Clojure from what I can tell.
14:03lobotomythis is a wireframe for a puzzle solver basically. e.g. a cube, with each "wire" an edge. edges are linked to each other (and to an inverted version of themselves)
14:03dnolenlobotomy: in order to have a cyclic data structure you need to have some notion of identity, in Clojure those can only be represented via low level facilities or reference types.
14:03dnolenbut Clojure emphasizes values, not identities
14:05lobotomythe edges are linked to each other because that seemed the easiest way to deal with the corners, which are shared by more than one edge
14:05dnolenlobotomy: write graph using a map.
14:05dnolenwrite the
14:05lobotomymodify a wireframe edge => also checks the beginning or end of each linked edge and modifies that too if necessary
14:06lobotomyhmm, a 3-d graph with a map... need to think about that
14:08lobotomyhmm, joly's map example seems workable here
14:09lobotomyso i'd make one big map with the whole graph in it as symbols
14:10lobotomythe hardest part in this solver is building the wireframe, but that's probably just as hard (or easy) with the map as with the link-these-together method
14:10dnolenlobotomy: an it'll be sanely printable.
14:11lobotomyso's my circularly linked thing, as long as you only print the name of each successor/inverted
14:12dnolenlobotomy: but you had to write that conditional logic right?
14:14lobotomywhat conditional logic? foreach edge in pile_of_edges: print edge " " edge.inverted " " (map name edge.successors)
14:24devndnolen: So, forgive me if this is way off base, but is part of the goal of core.logic to have an ad-hoc type system in clojure? Sort of a drop-in typeclass system?
14:24dnolenlobotomy: oh yeah I see yr point there.
14:24ambrosebsdnolen has evil plans
14:25dnolenha!
14:25devndnolen: I was talking to a Scala guy at my Clojure meetup last night and he was talking about Scala's type system and I mentioned core.logic => ad-hoc type systems. I didn't have sufficient ammunition to sell him on the idea, so I'm curious if there's a blog post or a writeup somewhere that I could give to him.
14:26devnThen again, I might totally misunderstand the aims of core.logic, I just remember that being brought up at some point.
14:27dnolendevn: no I have no set plans as of yet.
14:27devndnolen: but that doesn't mean you haven't considered it. :)
14:27dnolenopen questions - 1) is it fast enough yet? 2) will Clojure provide the necessary hooks? 3) do we need constraint solver?
14:28st3fanhooks?
14:28st3fanyarrrrrr!
14:29dnolendevn: there is plenty of prior art - Typed Racket, H-M in Prolog, Qi/Shen, so to me it's not a matter of possibility, just time and interest
14:30dnolenhowever it also my experience that most FP people don't understand logic programming and can't see the relationship between their type checker and logic programming.
14:31dnolennot language implementors / researcher of course, but the users.
14:31devndnolen: *nod*, so, I'm sure you've thought about this. Can you imagine a way to abstract the knowledge of logic programming in a way that would provide the benefits without the learning curve?
14:31dnolendevn: no
14:32dnolenlogic programming is as deep and profound as object oriented and functional programming - there is no easy path.
14:32ambrosebswhy would users need to know LP to use a type checker?
14:32dnolenambrosebs: exactly.
14:33dnolenthey don't, but since they're don't understand they're skeptical about ad-hoc type checker claims.
14:33ambrosebsah
14:33ambrosebsso in a "generating interest" sense
14:34ambrosebsnight everyone
14:34jweissam i wrong to think clojure.zip is not suited for concurrent programming (since the notion of "current location" doesn't really make sense)?
14:36hiredmanjweiss: how so?
14:37jweisshiredman: well, if i have multiple threads going through the zipper and editing nodes, how do i merge them together?
14:37hiredmanuh
14:37hiredmanof that won't work, how did you think it would?
14:37hiredmanof course
14:38jweissi didn't. i used zippers when my app was single threaded, now i'm trying to make it multithreaded, so just confirming that i probably shouldn't keep using zippers
14:39jweissi could use refs but the nature of my app is such that i don't want to repeat transactions
14:39jweissand i shouldn't have to since there will never be conflicting changes
14:44dnolendevn: part of my interest in putting core.logic together was/is to get people excited about exploring Functional/OO/Relational concepts from the same language. Besides Mozart/OZ I'm not aware of another language that lets you do this so seemlessly.
14:48dnolenwell non-Lisps, you have Allegro Common Lisp and Racket of course.
15:06devndnolen: thanks for your comments. that gives me something to think about.
15:24dnolendevn: I'm definitely planning on revisiting the idea at after the pattern/predicate stuff is sorted. as with the pattern/predicate stuff there's a higher chance of success if people are willing to help contribute ideas/code to help push the project along. hopefully next year around this time there'll be something to show for.
15:36netrealmQuestion, how would I get "cake repl" to switch to my project's namespace automatically?
15:38amalloynetrealm: you can put a :startup form in your project.clj
15:39amalloyit gets evaled when you start the repl
15:39user317is there a "type" function in clojure, like haskells/ghci's :t command
15:39amalloy&(type ())
15:39lazybot⇒ clojure.lang.PersistentList$EmptyList
15:39amalloybut of course clojure is dynamically typed, so that's the "runtime" type, not some sort of compile-time type like haskell has
15:40user317&(type reduce)
15:40lazybot⇒ clojure.core$r
15:40user317thats not to usefull :(
15:40amalloyuser317: well, functions don't have type signatures. not much you can do about that
15:41amalloy&(doc reduce)
15:41user317is there any way to do that kind of intraspection from the interpreter?
15:41lazybot⇒ "([f coll] [f val coll]); f should be a function of 2 arguments. If val is not supplied, returns the result of applying f to the first 2 items in coll, then applying f to that result and the 3rd item, etc. If coll contains no items, f must accept no arguments as wel... http://gist.github.com/1123583
15:41user317ah thank you
15:41amalloyfor which, out of curiosity? telling you about doc, or that functions don't have type signatures?
15:43user317telling me about the doc ;)
15:43user317just need a way to explore the language, ghc's :t command was pretty useful when i first started coding in haskell
15:44amalloy*nod* just :t can tell you a lot about a function for sure
15:45MasseRGood to see other haskellists here
15:45MasseR*haskellers
15:48user317what does the '^' symbol mean?
15:48lobotomyhey guys, what's a better way to do this: http://pastebin.com/Xug6HApt
15:48dnolenuser317: for type-hinting
15:49Chousukeor arbitrary metadata actually
15:49Chousukelobotomy: I'm not sure what that does :p
15:50lobotomyjust creates a map of stuff
15:50lobotomytried doing that with map, mapcat, concat and whatnot, but couldn't quite
15:50mattmitchelli'm trying to get :or working with de structuring a hash-map, I'm doing something wrong... is :or even possible in this scenario? https://gist.github.com/1123602
15:50Chousukewell as long as you have a seq of [k v] pairs you can put that into a map
15:50lobotomyalready the flatten in the keyword generation bit looks ugly to me
15:51amalloyi haven't looked at the code, but i heard someone say flatten and i'm 80% sure the code doesn't work
15:52dnolenChousuke: true, I didn't actually realize the following worked.
15:52Chousukeso, given keywords, (into {} (map (fn [x] [x {:name (str x) :i (ref 0)}]) keywords))
15:52dnolen,(meta ^long [])
15:52clojurebot{:tag #<core$long clojure.core$long@fe0ce9>}
15:53Chousukehm
15:53Chousukethat looks weird
15:53Chousukewhy does the function long get put as the metadata
15:54amalloymattmitchell: try https://gist.github.com/1123606
15:54mattmitchellamalloy: oh man, duh :) thank you!
15:57lobotomy,(into [] (map #(list (keyword (str "w" %)) (keyword (str "w" % "-"))) (range 2)))
15:57clojurebot[(:w0 :w0-) (:w1 :w1-)]
15:57lobotomysee, this is what i mean: looking for [:w0 :w0- :w1 :w1-]
15:58lobotomytried getting there with map etc, didn't work, so i just wrote that simple loop
15:58lobotomybut there has to be a better way :)
15:59lobotomyi mean, you could add flatten to that i guess, but is that recommended?
15:59dnolen_,(apply concat (map #(list (keyword (str "w" %)) (keyword (str "w" % "-"))) (range 2)))
15:59clojurebot(:w0 :w0- :w1 :w1-)
16:00dnolen_lobotomy: ^
16:02lobotomyhmm, ok. isn't that essentially the same as with flatten?
16:02lobotomyor does flatten do an extra pass over the list?
16:02amalloyflatten is evil and sinful, and will trick you if you ever depend on it
16:02user317whats the difference between (list 1 2) and #(list 1 2)
16:04amalloycompare ##(apply concat [[[1 2]] [3 4]]) and ##(flatten [[[1 2]] [3 4]])
16:04lazybot (apply concat [[[1 2]] [3 4]]) ⇒ ([1 2] 3 4)
16:04lazybot (flatten [[[1 2]] [3 4]]) ⇒ (1 2 3 4)
16:05dnolen_user317: # is shorthand for fn.
16:05dnolen_,(map #(* % 2) (range 10))
16:05clojurebot(0 2 4 6 8 ...)
16:05lobotomyyeah i see, flatten happens to work here, but in general it might be overzealous
16:05lobotomywhat about the rest of the thing then? ;)
16:06user317dnolen_: so "*" is the implicit argument?
16:06amalloy% is
16:06hiredmanerm
16:06user317right ;)
16:06hiredmanit is pretty explicit
16:06amalloyhiredman: is the implicit name of the argument, if you like
16:07user317amalloy: so only 1 argument or does this support variable arguments as well
16:07lobotomyooh, (into {} (for [k keywords] [k {:name (str k) :i (ref 0)}]))
16:07lobotomyit seems into is what i wanted here
16:08user317&(#(* %1 %2) 3 2)
16:08lazybot⇒ 6
16:10joly,(#(vector %&) 1 2 3 4 5 6)
16:10clojurebot[(1 2 3 4 5 ...)]
16:12dnolen_,(#(vector (* %1 %2) %&) 1 2 3 4 5)
16:13clojurebot[2 (3 4 5)]
16:13user317dnolen_: cool, thanks
17:05hiredmanclojurebot: ping?
17:05clojurebotPONG!
17:06ibdknoxit's very excited about that ping.
17:06hiredman~guards
17:06clojurebotSEIZE HIM!
17:07ibdknoxlol
17:07hiredman~\o
17:07clojurebotExcuse me?
17:07hiredman~ o/
17:07clojurebot\o ... High five!
17:30gtrakis there a simple way to move a bunch of values from one map to different keys in a second?
17:31hiredman,(doc rename)
17:31clojurebotNo entiendo
17:31hiredman,(doc rename-keys)
17:31clojurebotGabh mo leithscéal?
17:31gtrakah, I'll have a look
17:31hiredmanpffft
17:31hiredman,(doc clojure.set/rename-keys)
17:31clojurebotCool story bro.
17:32hiredman,(use 'clojure.set)
17:32clojurebotnil
17:32hiredman,(doc clojure.set/rename-keys)
17:32clojurebot"([map kmap]); Returns the map with the keys in kmap renamed to the vals in kmap"
17:32gtrakclojurebot is stateful?
17:35hiredmancode loading (require,use,load,etc) is inherently stateful
17:36luccaIn Xanadu did Kubla Khan / A stateful clojurebot decree...
17:37hiredmanI've looked a little at throwing away the classloader used to load the clojure runtime that runs in the sandbox, and using a new instance of the clojure runtime every time but I have gotten it to work yet
17:37hiredman(or a new clojure runtime every 10 minutes or something)
17:38luccadoes all the repetitive internal classloading leak memory?
17:40hiredmanclassloaders can be gc'ed once all the classes they have loaded have been gc'ed
17:41luccahmmmmm. So in practice if you execute new incoming code in a loop (like clojurebot), it does... but there are ways around that by re-allocating the classloader.
17:53technomancythat's a good way to sum it up
18:12vertegal /clear
18:15XPheriorIs it legal to use destructuring in doseq?
18:16XPheriorI have a sequence, ([1 2] [3 4] [5 6] [7 8]) and I want to iterate over it, two elements at a time.
18:17brehaut,(doseq [[a b] [[1 2] [2 3]]] (prn (+ a b)))
18:17clojurebot3
18:17clojurebot5
18:18brehautXPherior: ^
18:18XPheriorWeird. Wonder why that isn't working for me..
18:19XPheriorOh, wait. I lied.
18:19XPheriorThe data I want to iterate over is this: [1 2 3 4 5 6]
18:19XPherior,(doseq [[a b] [1 2 3 4 5 6]] (prn (+ a b)))
18:19clojurebot#<UnsupportedOperationException java.lang.UnsupportedOperationException: nth not supported on this type: Long>
18:19brehautXPherior: ##(partition 2 [1 2 3 4 5 6])
18:19lazybot⇒ ((1 2) (3 4) (5 6))
18:20XPheriorOh man. Cool Clojure functions strike again. :)
18:20XPheriorThat does it for me. Thanks man.
18:21brehautno worries
18:22XPheriorHm.. Can you iterate over two sequences at once? Such as [1 2 3 4] and [5 6 7 8]?
18:22sritchie,(map vector [1 2 3 4] [5 6 7 8])
18:22clojurebot([1 5] [2 6] [3 7] [4 8])
18:24XPheriorCool :)
18:24XPheriorFunctional programming blows my mind, heh
18:25XPheriorHm, okay. One more. Can you turn something like [1 2 3 4 5 6] into [(1 2) (2 3) (3 4) (4 5) (5 6)] ?
18:26XPheriorOh wait. I think I can actually do that one, haha
18:26sritchie,(partition 1 2 [1 2 3 4 5 6])
18:26brehaut,(partition 2 1 [1 2 3 4 5 6])
18:26clojurebot((1) (3) (5))
18:26clojurebot((1 2) (2 3) (3 4) (4 5) (5 6))
18:26sritchiewhoops, wrong order!
18:26XPheriorI was close. Thanks both. :)
18:26brehautXPherior: keep in mind that partition-all might be useful in some case too
18:27brehaut,(parition-all 2 [1 2 3])
18:27clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: parition-all in this context, compiling:(NO_SOURCE_PATH:0)>
18:27brehaut,(partition-all 2 [1 2 3])
18:27clojurebot((1 2) (3))
18:27brehaut,(partition 2 [1 2 3])
18:27clojurebot((1 2))
18:27XPheriorAh, that's pretty cool!
18:28XPheriorYou guys are smart.
18:30amalloyi love (partition 2 1 ...)
18:36XPheriorThanks guys! See ya~
20:10st3fanif i add a depencency to my project.clj and then run lein deps, lein swank, should those classes be available from the repl ?
20:10st3fanlike i can access them with (new com.foo.bar.SomeClass) without having to import them?
20:14st3fanoh nevermind .. i see the real error now, in the window running lein swank
20:24st3fanis there an easy way to time the execution speed of some block of code?
20:25Raynes&(doc time)
20:25lazybot⇒ "Macro ([expr]); Evaluates expr and prints the time it took. Returns the value of expr."
20:28st3fanyay
20:43st3fanis there something like (repeat 10 (foo)) .. to call a block of code N times?
20:44technomancy(doc repeatedly)
20:44clojurebot"([f] [n f]); Takes a function of no args, presumably with side effects, and returns an infinite (or length n if supplied) lazy sequence of calls to it"
20:44st3fanoh repeat already does something different
20:44st3fanahh repeatedly :)
20:44fulletsdotimes might also do what you want
20:46technomancyyeah, depends on if you want a return value or not
20:46technomancyfunctions named after adverbs are the best, amirite?
20:47fulletsundoubtedly
20:48technomancy(is (definitely (process-finished?)))
21:12darevayHi everybody.
21:14groovy2shoesoi, darevay
21:15darevayA while ago, I asked about proxy-super and reflection on the ML (http://goo.gl/1l1an). Sadly, no one responded so I'm asking here.
21:17amalloyit's a limitation of java, i think. you can't call super.foo(this) in a proxy
21:17amalloyuh. nm
21:17amalloyhaha
21:18ataggartjust got on, but is this about reflection inproxy?
21:18darevayataggart: http://goo.gl/1l1an
21:19ataggartyep, easy to fix though
21:19ataggartone sec
21:19ataggarthttps://github.com/clojure/tools.logging/blob/master/src/main/clojure/clojure/tools/logging.clj#L141
21:19darevayataggart: that's what i like to hear :)
21:20ataggartthe problem is that the "this" var doesn't have a known type
21:20ataggartit can't since proxy could be a lot of things
21:20darevayI could have sworn I tried that to no avail. I will try again now.
21:27pschorfhas anyone worked with a websocket client using aleph (or another clojure library)?
21:34hiredmanataggart: but the runtime class of a proxy is generated at compile time, no? so this should be hintable
21:35ataggartwhich class?
21:35ataggartyou can proxy n number of interfaces
21:36hiredmanright, but (proxy ...) creates a class that implements and inherits from the specified class/interfaces and the creates an instance of that class
21:36ataggartah I see what you mean
21:37ataggartnot sure
21:37hiredmanit may be trick because of update-proxy
21:37hiredmantricky
21:37hiredmanyou would be able to swap in your own fn without the proper hints
21:45darevayataggart: thanks. I don't have it working yet, but I think I see what I was doing wrong. The proxy's actually in a macro, so inserting the hints is complicated.
21:45st3fani'm looking at the source for clojure.sql
21:45st3fandoes anyone know why there is both with-connection and with-connection* ?
21:45st3fanwhere the first calls the second
21:45ataggartit shouldn't be any more complicated than surrounding the proxy-super calls in a (let [^Foo this this] ...)
21:49darevayI've observer, maybe incorrectly, that the ^Hints get eaten by the reader (or something) so I have to use with-meta: http://w01fe.com/blog/2009/07/dynamic-type-hints-in-clojure-macros/
21:59currymjwhat's the best way to learn how to use penumbra? I don't know opengl at all, should I try to learn it in C first?
22:05darevayataggart: Actually, it's not the macro. It seems like the "let this" trick doesn't work when the method is protected. https://gist.github.com/1124352
22:06ataggartah, yes, you can't call protected methods
22:06ataggartdoes it work with the reflection when called?
22:07darevayYeah. It works fine. I just want the reflection gone :)
22:07ataggartodd, I thought the reflector only pulled public methods
22:07darevay... without gen-class
22:07ataggartI'm surprised it works at all
22:09darevayI guess it could be worse then.
22:10darevayThanks for your help though.
23:11darevayHi everybody. For Seesaw, there are some system-wide settings that a user of a Seesaw-based app might like to override, most notably the look & feel. I was thinking of having a ~/.seesawrc.clj file or something where they could put that stuff. Is that a dumb idea? Should I just stick with Java system properties or a properties file?
23:36st3fanwhat does it mean if my macro fails with "Can't let qualified name"
23:36st3fandoes that mean i need to generate the name?
23:37cemerickst3fan: you're trying to establish a local binding in the code emitted by a macro? Use a gensym.
23:38st3fan`foo# ?
23:38cemerickYou are emitting a let form, right? In that case, `(let [foo# (some-fn)] (do-something-with-foo foo#))
23:41st3fani'm doing this now: http://pastie.org/2317797
23:42amalloyst3fan: that's fine, but a little unidiomatic, in two ways
23:42amalloyas cemerick says, you could more easily write `(if-let [value# (get ~key)] value# ...)
23:43st3fanis that 'auto gensym' ?
23:43amalloyindeed
23:43cemerickyes
23:43amalloy&`(let [foo# 1] foo#)
23:43lazybot⇒ (clojure.core/let [foo__14246__auto__ 1] foo__14246__auto__)
23:43st3fanyeah cool
23:43amalloyin this particular function, though, you can be even more clear with `(or (get ~key) (set ...))
23:44cemerickThere's nothing there that will let a qualified name, though. Presumably there's a `get` macro you're also defining (since the core get fn won't take a single arg)?
23:46st3fanhm yeah i have get/set/delete .. this is a little memcache wrapper
23:47st3fani'm doing this:
23:47cemerickright; so, you're not using a gensym where you should be
23:47st3fanhttp://pastie.org/2317814
23:47amalloyst3fan: are those macros? there's no reason they couldn't be functions
23:47st3fanthey are functions indeed
23:47amalloythen they're not letting qualified names either
23:49amalloyfwiw, there's not much point in & body and ~@body if you're not wrapping them in a (do) at some point
23:49amalloyor, at any rate, there could be plenty of use; but more likely what happens would surprise you
23:50st3fanyeah something is not right there
23:51st3fanshould the macro wrap the body in (do) or should the caller do that?
23:53st3fanyeah sorry
23:53st3fanlet me fix it and i'll post it
23:57st3fancool this works pretty well
23:57st3fanthe code is at http://pastie.org/2317844
23:58amalloyst3fan: i don't really see why memoize should be a macro either
23:59st3fanhm how would yo prevent the body from being evaluated then?
23:59amalloy(memoize "foobar" 60 #(do (Thread/sleep 2500) (* 2 21))) ;; more composable, i suspect
23:59st3fanoh
23:59st3fan:-)