#clojure logs

2008-11-27

00:06quuxmanjshen: I had the same problem
00:07quuxmanjshen: I gave up eventually. That was also the advice of a couple other people who were around here
00:07jshenhehe
00:07quuxmanjshen: rlwrap is a little better than nothing
00:07jsheni'll just jump to getting oen of the emacs modes working
00:08quuxmanjshen: yeah, think that's what most people do. I'd be interested to hear how you get SLIME working
00:09jshenis that a pain point for a lot of people?
00:09quuxmanI don't know. I didn't try very hard
00:12jshendid you see this? http://en.wikibooks.org/wiki/Clojure_Programming#Emacs_.2F_Slime_Integration
00:12jshenI'm going to start there, but not tonight
00:13mattrepljshen: let me know if you run into any hitches. the one gotcha is if you want extra items on the classpath, you need to set those before the requiring of swank-clojure-autoload.el
00:14jshenthanks
01:04yanbeA lisp compiler for the AVM2. http://github.com/aemoncannon/las3r/wikis/home
01:05yanbeperhaps related to this channel
03:18Lau_of_DKTop of the morning gents
09:05mmcgranaIs this a reasonable / the best way to do a trailing optional arg? : (fn [req-arg & [opt-arg]] (do-something req-arg opt-arg)) I'd prefer not make a second definition with reduced arity.
09:32Lau_of_DKmmcgrana: How else would you do it?
09:34mmcgranaI couldn't immediately think of one - that was my question.
09:34mmcgranaI was just wondering because I think of & as a "vararg" operator not an "optional arg" operator
09:35mmcgranabut this works for me i guess
09:35Lau_of_DKI cant think of a better way :)
09:35mmcgranahet Lau_of_DK I actually have a another question about *warn-on-reflection* - you ever use that?
09:36mmcgrana*hey
09:36Lau_of_DKI'd phrase it as: Ive disabled it :)
09:36mmcgranaok
09:46duck1123warn on reflection is good if you're into premature optimization
09:49Lau_of_DKduck1123: news to me, can you explain what you mean ?
09:50duck1123# "We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. Yet we should not pass up our opportunities in that critical 3%." - Donald Knuth
09:52notallamathis reminds me: how do you do profiling, when you know something is going slow? just wrap things in a time block until you find it?
09:53duck1123notallama: You have all the java profiling tools at your disposal
09:53Lau_of_DKnotallama: you just hook up the profiler, run the program and read the results :)
09:53Lau_of_DKNetbeans JFluid works fine with Clojure
09:54duck1123of course, I say this after just getting done profiling two different versions of a function with time
09:56notallamathese java tools confuse me. : ( i suppose i'll have to learn them eventually, though.
09:57mmcgranaLua_of_DK: is it possible to use JFluid outside of / without Netbeans? I've used YourKit with good results during my free trail period but can't really pay for a license at this point...
09:58Lau_of_DKYes JFluid _should_ be able to standalone, I just downloaded the integrated version because it was so easy to fetch from the plugins list
09:58Lau_of_DK@ mmcgrana
10:00mmcgranaok cool, will investigate.
10:00mmcgranaLau_of_DK: thanks
10:00Lau_of_DKnotallama: It should be TOO confusion. You start your repl with certain paramters. Like for the profiler you start an agent, which stops execution until the profiler connects. So in the end, it makes sense
10:02Lau_of_DKnotallama: and for the debugger, you dont have to wait for anything, start with appropriate paramters, and code away to your hearts content. When you need it, just attach the debugger to localhost:8888 or whatever port you picked when starting the repl
10:05notallamai'm mainly thinking of jswat. it was situations where there's menus and windows /everywhere/. i got it hooked up, and found out how to set a breakpoint, though, so i'm probably not too far grom getting it to do something useful.
10:06duck1123has anyone here used jdee for emacs?
10:06duck1123I downloaded it, but haven't gotten around to setting it up
10:07Lau_of_DKduck1123: jdee?
10:11duck1123clojurebot: jdee is http://jdee.sourceforge.net/
10:11clojurebotYou don't have to tell me twice.
10:12Lau_of_DKhiredman: Maybe you should let cb pick on questions without the clojurebot : prefix
10:12duck1123fsbot uses the ,keyword syntax
10:13Lau_of_DKduck1123: oh... a glorified java-mode :)
10:13duck1123Lau_of_DK: it says it has a debugger, so I'm thinking of giving it a try
10:13timothypratleywhat's a good way of of managing shared access (between threads) to a single stream?
10:13Lau_of_DKduck1123: looking forward to reading your report
10:14Lau_of_DKtimothypratley: you mean besides refs ?
10:14timothypratleyhmmm I assumed ref would only control access to the stream object
10:14timothypratleybut writting to the stream would still conflict
10:16timothypratleyooo maybe an agent
10:16Lau_of_DKCommute the reads to the stream, have an agent atomically write out the stream and clear the buffer... how about that ?
10:20timothypratleyoh... wait commute solves the problem without agents entirely though doesn't it? Because "write" can be the function, and it will be contained in the transaction
10:21timothypratleyI hadn't thought of that
10:26ChouserYou might want to use a clojure.lang.PersistentQueue in your collecting ref.
10:35notallamaanyone know how to set up a classpath properly? i went into my clojure-extras clojure script, and i tried adding some jars and dirs to the path, but no luck. it can't seem to find anything i add, yet it can find jline and clojure.
10:35notallamai just put :path.jar at the end of the stuff on the -cp flag.
10:36Chousernotallama: that should be all it takes.
10:36Chouserjava -cp foo/bar/clojure.jar:bing/bang/other.jar clojure.lang.Repl
10:37Chousernotallama: are you on Windows?
10:37notallamalinux
10:38timothypratleyChouser: thanks for the tip re PersistentQueue, can you expand a bit on what you mean?
10:39Chouserwell, that should do it. Then at the REPL you should be able to refer to a class name from the jar: user=> com.fancypants.Other
10:39Chousertimothypratley: you used the word "stream" which suggests you might have thread pushing items onto one and of the queue, and some other thread (or threads) pulling them off the other end. thus a queue.
10:40timothypratleyyup, that's exactly right! :)
10:41Chouserso you can have a ref pointing to a persistent queue, push onto it inside transactions, pop from it inside transactions, and you should be all set.
10:41timothypratleyyup, that's perfect thanks.
10:42Chouseron the other hand ... do you want these threads to block on empty queues?
10:42rhickeyChouser: exactly
10:42rhickeymost usage of queues requires workflow
10:43rhickeythat's why I haven't exposed PersistentQueue yet - I'm afraid of people building polling systems on top of refs
10:44rhickeythat's also why java.util.concurrent wrappers are on the way - not enough people know about them
10:44rhickeybut I consider them an important complement to Clojure's facilities
10:44notallamai think i tracked down the problem i was having: it doesn't seem to like "~" in the classpath.
10:44Chouserrhickey: I just saw clojure code that was doing busy polling on a UI events and a IO events.
10:45rhickeyChouser: aargh
10:45ChouserIt's hard to save programmers from themselves via langauge features.
10:45rhickeyChouser: we'll see, when there are queues in the API and examples using them
10:46rhickeyBut yeah, polling sucks and everyone should know that
10:46timothypratleyin my particular case I do want to block on empty queue, does that put me in the bad category or the good category?
10:46Chouseryeah, I guess that's the best hope -- make the right way so easy and obvious that nobody bothers trying the wrong way.
10:46rhickeyChouser: right
10:46timothypratleygreat!
10:47Chousertimothypratley: it means a PersistentQueue ref is not right for you.
10:47rhickeytimothypratley: look at java.util.concurrent.BlockingQueue
10:47timothypratleydamn.
10:47timothypratleyok will do
10:47rhickeyhttp://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/BlockingQueue.html
10:47Chousertimothypratley: the fact that you know you want to block is a great sign. :-) You'd find yourself stuck after a while trying to use the PersistentQueue.
10:49Chouserhm, and no dosyncs around 'put's or 'take's, right?
10:49Chouserthose count as side-effects.
10:50rhickeyChouser: right, find out you have work, take and do it in a transaction, maybe put after transaction or via action sent in transaction
10:51rhickeyqueues are I/O
10:52Chousernon-persistent queues are I/O
10:52rhickeyChouser: yeah, I wish they had different names, the workflow queue and the data structure queue
10:52ChouserLFE? Is that the io/seq thing from the Haskell slides?
10:53rhickeyChouser: yes, cgrand did that nice write-up and I never got back to him
10:54rhickeyI implemented about half the Haskell system exactly in Clojure - I found it extremely cumbersome and unlikely to be used as is in Clojure
10:54timothypratleyjust to humour me, would this be a terrible way: create an agent which is the stream. I send the stream agent a "send message" function which returns the stream itself. From my very virgin understanding of agents they effectively queue up function calls that transition states (though here I would just be side-effecting). [in reality I'm going to pursue the blockingqueue as I expect to later want to monitor the queue etc]
10:54rhickeyToo much effort to make iterators chainable, lots of rules to follow in your implementation
10:56ChouserJust to make sure I was understanding it despite the Haskell syntax, I tried implementing what I thought were the important parts for the half or so of the slides. I was intruiged at how different my code was from cgrands.
10:56Chouser...mainly having to do with what I thought were the important features.
10:56ChouserBut differing from cgrand is not a great sign, so I'll have to go back through it again at some point.
10:57rhickeycgrand based his work on an earlier paper (one I saw Oleg present at LL3), not the slides I mentioned, which is the most recent state of that earlier work
10:58rhickeyThe earlier paper tried to show that you could turn any enumerator into a seq/stream, but in doing so you negate the benefits of LFE in controlling resource lifetime
10:59Chousertimothypratley: hm, so your "work queue" would be the agent's own queue and the items of work would be action closures.
11:00rhickeythe newer work instead focuses on making both iterators and enumerators composable so you don't convert to streams/seqs, but cgrand did to implement multi-collection map
11:00Chouserrhickey: ah! ok, that explains some of the different emphasis in cgrand's work.
11:01Chousertimothypratley: That would limit you to a single consuming thread, but other than that I can't think of why that wouldn't work.
11:04rhickeyBut the interfaces involved to/from the iterators are pretty complex - possibly empty streams, done states with stream remainders, continuation states with fns of streams - ugh, no wonder it takes 90 slides to explain
11:05rhickeyChouser: yes, agents are single-consumer queues
11:14Chouserclojure seqs are comparatively simple and tidy.
11:14ChouserBut resource management is hardly ever simple or tidy, so I guess it's to be expected.
11:18rhickeyChouser: right, I want something as simple for io
12:06notallamais there a "standard" way to name two-word namespaces? dashes? camel case? underscores?
12:08Chouserdashes
12:08Chouserwhich become underscores in file and class names
14:05AWizzArdAnyone here who uses Tomcat and/or Jetty?
14:05blackdogjetty
14:06AWizzArdsame here
14:06AWizzArddid you also use it in combination with Clojure?
14:06blackdogyes,
14:06blackdogi do servlets returning json
14:06blackdogthat's it really, no jsp
14:06AWizzArdI want to get it running with Rife
14:06blackdogdon't know what that is
14:07AWizzArdOne of the (if not the) most powerful webapplication development frameworks available.
14:07blackdogah
14:08blackdogi'm done with web frameworks, i do all my rendering on the client
14:08AWizzArdYes, I will have to think about that as well.
14:08AWizzArdStill, there is a lot of stuff to do.
14:09AWizzArdValidation of each and every input field. Continuation support, so that the user can go back and forth, scaffolding, etc
14:10blackdogif you just return json then you have a very large selection of client side tools, jquery/dojo etc
14:10blackdogwhich can provide a lot of the scaffolding
14:10AWizzArdYeah, I am looking at using dojo as well.
14:36blackdogAWizzArd, you need to do ./run test.clj
14:37AWizzArdre
15:41nolbathow does java make everything so complicated? im trying to translate paul grahams raytracer to clojure. i use javax.imageio but i dont get how to just create an image pixel for pixel.
15:41nolbatimagewrite has like 10 different donkeymethods
15:41AWizzArd:-)
15:41AWizzArdJava is the modern assembler
15:42AWizzArdIf Java is your only tool then every problem looks like a thumb.
15:52nolbatno matching ctor found = constructor
16:09nolbatseriously can someone help me with this.
16:10nolbat(new ImageReader "C:/users/saftarn/desktop/raytracing.jpg")
16:10nolbatdoesnt work no mathcin constructor
16:10nolbati have to call some ImageReaderSpi wtf
16:10nolbatwho writes the javax libs? is it Sun? becaus eif not even the creators of the language can write decent code...
16:11pdoubleyanolbat: do you have a working sample in Java? i worked with the imageio apis in the last...hmm, over a year ago, may have some sample code, at least for writing images to a file
16:12waltersnolbat: ImageReader looks like it's an abstract class
16:13nolbatyeah i dont know java evry well, abtsratc this implements extends that.
16:14waltersnolbat: it looks like you may want just ImageIO.read(new File("C:/users/saftarn/desktop/raytracing.jpg"))
16:14nolbatseems like Java was a contribution to an obfuscated C contest then some mistook for a real programming language
16:15pdoubleyanolbat: yeah, the imageio lib is pretty complex, from what i recall...but it was aimed at people who need full control over many different image formats...i found it a hassle as well
16:18nolbatjava.lang.ClassNotFoundException: ImageIO.read (NO_SOURCE_FILE:1)
16:18nolbat(import '(javax.imageio ImageIO ImageWriter ImageReader))
16:18nolbathow do i import File=
16:18nolbatFile?
16:19walters(import '(java.io File)) looks like
16:20waltersso all together: (ImageIO/read (File. "/usr/share/icons/abiword_48.png"))
16:20waltersworked for me
16:20waltersbut i don't actually know Clojure, only Java so take it with a grain of salt =)
16:29nolbatah nice
16:32AWizzArdI would really like to know how many of you are actually coming from Java, from CLand from something else.
16:34kotarakAWizzArd: coming from Scheme, Perl, Ruby, C, pick one.... :)
16:44nolbathave minor java knowledge(tried and hated it). know Python very well adn scome Scheme, haskell, C, little C++
16:46nolbatwanted to learn lisp more and scheme and cl didnt have a practical platform.
16:48nolbatso: ImageIO.write(rendImage, "png", file);
16:48nolbatbecomes what ? (ImageIO/write rendImage "png" file) ?
16:48rottywalters: hi there! didn't know you were into lisp :-)
16:49nolbatDoes CLojure use Javas green threads?
16:49waltershey rotty! well, clojure has a lot of interesting ideas I think; the readonly data structures with structural sharing, the STM etc. I'm not totally sold on Lisp, but I'm pretty sure some of Clojure's DNA is going to start appearing in new languages at least
16:49walters(and existing ones)
16:50waltersnolbat: OpenJDK hasn't used green threads since the mid 1990s
16:51rottyyeah, clojure is pretty interesting. I've yet to try it -- still sticking with Scheme so far...
16:53notallamai know a bit of java, c, scheme, and a tiny bit of python (i found python irritating.) i have not really written much of anything though. just school type stuff. clojure's by far the nicest, though.
16:54AWizzArdNot all are in the lucky position to be paid Clojure developers *g*
16:56nolbatnotallama: what did you find annoyin about python?
16:58notallamai think it was the lambdas. they set my brain in scheme mode, but they're not really the same as scheme lambdas. it's probably somehting i'd get used to if i used it more.
16:59kotarakthe python lambda doesn't deserve the name...
17:00nolbatso whatever
17:00nolbatthey do everything i need
17:00nolbatbig deal
17:03notallamait's probably the same idea as trying to use java style in scheme. it just doesn't work well.
17:04nolbatbut you can do most of what u need wiht python lambdas
17:05notallamawith c and java, i had classes to figure out what idiomatic code looks like. with scheme, there's sicp. with python, i just wasn't sure what i was doing. i'm not saying python is bad, just that my first attempt at it didn't go well.
17:06nolbat>>> map(lambda x: x**2 if x < 5 else x**3, range(10))
17:06nolbat[0, 1, 4, 9, 16, 125, 216, 343, 512, 729]
17:07AWizzArdwalters: it is not dramatically different in Clojure. There you also have no "private" data. And you will store lot's of your data in hash maps :-)
17:09waltersAWizzArd: right, but Clojure doesn't claim to be an object oriented system, which is fine; I agree for concurrency the readonly data structures make more sense, but object orientation (without the need for concurrency) makes a lot of sense in other problem domains like GUIs
17:11notallamaclojure can do oo now, with gen-class. has private methods too.
17:12AWizzArdwe want to try to avoid that as much as possible
17:12notallamaoh? how come?
17:12hiredman(doc defn-)
17:12clojurebotsame as defn, yielding non-public def; arglists ([name & decls])
17:13hiredmanspeaking of private
17:14AWizzArdnotallama: because Clojure is a functional programming language and I personally believe that the functional paradigm has more use in many cases
17:15AWizzArdIt is declarative.. you say *what* you want to do, and not *how* to do it.
17:17nolbati wrote a basic OO-system in clojure, it is not hard
17:17nolbatbut i dont need it
17:17nolbatjust using Maps and multimethods works fine
17:17notallamai don't really see where the conflict is. you have a function that maps some set of objects onto some other set of objects.
17:19nolbatwhich conflict?
17:21notallamaAWizzArd was saying that we want to avoid oo with gen-class because functional is more useful (i interpreted it that way, anyway). so your question is pretty much a repeat of mine.
17:22nolbatah
17:22nolbati still havent figured out how to write to an mage
17:23nolbatlike in Python I just look these things up and then do it. with java...
17:25notallamadid you look at the compilation section on the clojure site?
17:27nolbati never have to throw and catch checked exceptions n Clojure?
17:29AWizzArdnolbat: we want to go away from telling the computers how to do things. The direction should be: saying what we want and let them figure out how to do it.
17:30AWizzArdto some extent a functional programming style is exactly that. When you write a fibonacci function you have not programmed anything. You wrote down the mathematical definition.
17:35kotarak(doc refer)
17:35clojurebotrefers to all public vars of ns, subject to filters. filters can include at most one each of: :exclude list-of-symbols :only list-of-symbols :rename map-of-fromsymbol-tosymbol For each public interned var in the namespace named by the symbol, adds a mapping from the name of the var to the var to the current namespace. Throws an exception if name is already mapped to something else in the current namespa
17:35notallamaright. but don't you still need the computer to have some description of what the function is operating on? (i'm aware that you can construct natural numbers from lambdas, but it's certainly helpful to have first class integers. why not extend that to objects?)
17:35nolbat(defn writeFile [image format path]
17:35nolbat (ImageIO/write image format (File. path)))
17:35nolbatworks
17:36AWizzArdnotallama: of course, a program without side effects makes no sense and is very boring
17:37AWizzArdI just want to minimize and centralize them
17:38rottybtw, is there any chance that clojure might get call/cc at some point in the future?
17:38AWizzArdYou can do that with threads
17:38notallamai don't know a lot about call/cc, but trampoline seems like it's getting close.
17:39rottynotallama: I think trampolines are about proper tail calls
17:39rottyAWizzArd: how so?
17:39AWizzArdand well, you could implement them yourself rotty, you have macros
17:40AWizzArdthreads and their environment
17:41nolbatanyway good with imageio? i can open a file and write to another file but i dont get how to manipulate it, it is funny how for all its documentation, static typing JAVA stillf ails to get to the point and tell wtf a method is actully doing. it just passes classes here and there
17:41AWizzArdrotty: do you know http://www.paulgraham.com/onlisp.html already? It's maybe the best book about macros in Lisp. Paul Graham implements continuations in there. You can download the book (legally) for free there.
17:42AWizzArdnolbat: I know how you feel.. it seems the authors wanted to put in everything at an extremly fine granularity
17:43notallamarotty: it is for that, but it works by passing a function and an environment around. i just have a hunch that it's about 2 macros away from call/cc.
17:44waltersnolbat: it looks like you need to call createGraphics to get a graphics context; then there are a bunch of drawing methods on that
17:45drewcnotallama: my pet project is an implementation of delimited continuations for clojure.
17:45waltersnolbat: or if you want to get/set pixels, you can call getRaster
17:46drewctrampolining was the technique i was playing with prior to it being included, and it is indeed a good start.
17:47nolbatwalters: ah iw ant toget/set pixels , thanks
17:47drewcrotty: that's honestly not the best introduction to either call/cc or on how to implement it IMO.. but it is somewhat accessible.
17:48drewcrotty: just don't go getting the idea that his method is the only, or the best, way to hack up call/cc on top of a lisp that doesn't offer it :)
17:48nolbatwhat d i call getRaster on? i cant find the method
17:49waltersnolbat: BufferedImage
17:50kotarakDoes anyone experience problems with the latest SVN?
17:50kotarakIn particular with use/require?
17:58nolbatim a bit unsure on the whole how to use JAVA from clojure. if i pass a BufferedImage to a funciton and want to do getRaster on it, whats it he correct way.
17:58kotarak(.getRaster your-buffered-image)
18:21nolbathttp://java.sun.com/javase/6/docs/api/java/awt/image/WritableRaster.html
18:25nolbatso i have my raster and want to do setPixel, how do i supply an areay?
18:25nolbatis that array meant to rep the color?
18:28nolbat#<ByteInterleavedRaster ByteInterleavedRaster: wid
18:28nolbatis what i get but i should get WritableRaster
18:29nolbatand then it says no setColor for ByteInt...Raster
18:30waltersnolbat: http://clojure.org/java_interop#toc26
18:47nolbatone thing i dont get with the clojure mentality is. lets say i want the equivalence of an Image-class, how would abstract that in CLojure?
18:48nolbati mean thats a thing where i normally think of some sort of entity/object with attached methods
18:48AWizzArdnolbat: a structured map with some functions operating on it, in it's own namespace
18:50AWizzArdso instead of having a class person with the fields name, age, address you will have a (defstruct person :name :age :address)
18:53nolbatah i see
18:54nolbatcan i check the type of a java-object at runtime?
18:55nolbatyes class
18:56waltersnolbat: (.getClass foo)
19:00nolbatso if i want to collect a bunch of clojure-functions for image-stuff. should i put it in its own namespace?
19:01nolbatsun.awt.image.ByteInterleavedRaster is what i get but according to the docs i should get WritableRaster. anyone could guess why?
19:03lisppaste8nolbat pasted "raster-problems" at http://paste.lisp.org/display/71140
19:06waltersnolbat: groovy:000> WritableRaster.class.isAssignableFrom(ByteInterleavedRaster.class)
19:06walters===> true
19:06walters(i don't know how to refer to class literals in clojure, so using groovy syntax)
19:08nolbati dont know java to well so what does that mean? how do i go from Byteratser to Writableraster?
19:09waltersthe ByteInterleavedRaster *is* a WritableRaster, it subclasses it
19:11nolbatok, but t doesnt have that methods
19:12nolbatwait wtf
19:12nolbatsetPixel it should be wtf was i thinking
19:12nolbatstill deosnt work though :)
19:13Chouseruser=> (isa? sun.awt.image.ByteInterleavedRaster java.awt.image.WritableRaster)
19:13Chousertrue
19:13nolbatjava.lang.IllegalArgumentException: No matching method found: setPixel for class sun.awt.image.ByteInterleavedRaster (NO_SOURCE_FILE:0)
19:14waltersas for how you set the pixels, it looks like the format depends on samples, and it isn't immediately obvious to me how it works
19:14Chousernolbat: that error often means the argument types are incorrect.
19:14waltersi haven't actually done any awt or swing since the late 1990s, and am in fact right now actively working to replace both of them =)
19:14nolbatanything wrong with them? arent they the most used ones in java?
19:18waltersnothing strictly speaking wrong with them, particularly if you care about cross platform
19:18Chousernolbat: setPixel takes an array of int, float, or double. into-array cannot produce any of those.
19:27Chouser(doc int-array)
19:27clojurebotCreates an array of ints; arglists ([size-or-seq] [size init-val-or-seq])
19:32nolbatbut is int-array a java-array?
19:32nolbator i ahve to do into-array (int-array?
19:33nolbatwhat does it mean when a JAVA method returns NIL? java method retuns nothing? just does its sideffect?
19:33nolbatso it workd?
19:34Chouserseems likely, yes.
19:34Chouseryeah, setPixel returns void, so if you should expect nil
19:34Chouserno exception is a good sign.
19:37nolbatim learning image analysis, clojure seem to be good because it connects to java, allows for easy parallell processing. is there an interface to matlab?
19:37nolbatwould it possible to create?
19:38nolbatif i want to create an imaging-module, i then put it in its own namespace
19:38nolbat(in-ns 'imaging)
19:38nolbatbut when i import in that fle i get import not recognized or soemthing
19:40nolbatshould i import to the namespace or soemthing?
19:51Chouserin a file, use 'ns' instead of 'in-ns'
19:53Chouserand namespaces ought to have at least one package-part
19:53nolbatjava.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.Symbol (imaging.clj:0)
19:53nolbatpackage-part? i thought that was the name-space
19:56nolbat#<imaging$get_image__2587 imaging$get_image__2587@1332109>
19:56nolbat(ns imaging)
19:57Chouser(ns nolbat.imaging (:import (java.awt.image WritableRaster)))
19:58nolbatyou mean imaging should be part of a package?
19:58nolbatwhy?
19:58Chousernamespaces map to class names, and Java class names should be in a package.
20:51nolbatusing setPixel should be enough right?
20:51nolbaton a Raster
20:52Chouserenough for what?
20:52lisppaste8nobalt pasted "writing-image" at http://paste.lisp.org/display/71145
20:52nolbatim trying to write a line on a white image.
20:57ChouserI don't know the APIs involved at all. you might want to try translate a Java example to begin with.
21:08Flox_nolbat: If you want something interactive accessible from Clojure, you might be interested in Fiji (http://groups.google.com/group/clojure/browse_thread/thread/15f566f12cc485a4/8b2a5b1a0dc61c87?lnk=gst&amp;q=imagej#8b2a5b1a0dc61c87).
21:08Flox_That way, you would have access to all existing ImageJ image analysis plugins from Clojure...
21:09nolbatcool
21:10nolbatwow cool exactly what iw as thinking about creating :)
21:14Flox_nolbat: Don't look at what Albert Cardona has achieved using ImageJ. It will make your eyes pop out...
21:15rsynnottpresumably the JVM would make returning multiple values similar in perfirmance to using a vector, anyway
21:16Flox_I can't wait to see the first multithreaded image transformation and analysis plugins appear - thanks to Clojure!
21:17Flox_Good night!
21:23nolbatFlox_: thats what im want to learn, image processing si perfect for parallellism(embarassingly parallell)
22:16nolbatok i have a java-version fo what iw ant to do now. this is good btw cuz im learning java at the same time which you kind of have to no matter what you think of it right, its seems to be everywhere?
22:17nolbatbut my main problem in mky head is
22:17nolbatjava is sideffectful, clojure is functional
22:17nolbatso when oing with sideffects im a it confused here
22:19lisppaste8nolbat pasted "writing to image" at http://paste.lisp.org/display/71148
22:19nolbatsomeone can have a look?
22:24nolbatplz
22:31nolbatnoone there?
22:32nolbathttp://paste.lisp.org/display/71148
22:32nolbat(for [x (range 300 300)]
22:32nolbat (for [y (range 300 300)]
22:32nolbat(.setRGB buffered-reader x y rgb-color)))
22:32nolbatsomething wrong with that?
22:35durkai don't really know clojure yet but the range in the paste looks a little strange
22:35nolbatam i that annoying? everyone put me on ignore?
22:35nolbatoh well lol
22:35durkaand different from the range you just typed
22:35nolbatbut that isnt the problem it still doesnt work for 200 300
22:37durkahmm
22:38lisppaste8fdg annotated #71148 with "fdgfdg" at http://paste.lisp.org/display/71148#1
22:38nolbatwait i might see
22:38nolbatno it should be ok
22:39nolbatah wait
22:39nolbatno that should be ok too :(
22:42nolbator somehow the buffer im updating isnt the one im writing to the file?
22:44nolbatdurka why does the range in the paste look strange?
22:45durkawell the one in the annotation doesn't
22:45durkabut range(100 200) doesn't look like lisp
22:45nolbatnah i hcnaged that
22:46nolbatbut as i see it i do exactly like the JAVA version
22:48nolbatsetRGB is void
22:48nolbatdoes for need a return value?
22:59nolbatimaging> (.getRGB (get-image rt) 10 20)
22:59nolbat-1
22:59nolbatimaging> (.getRGB (set-pixel (get-image rt) 10 20 212) 10 20)
22:59nolbat-16777004
22:59nolbat-16777004 is also the value iget in java
22:59nolbatbut also for 112 or 212 as setRGB-value
23:05dlonkiok now i can set one pixel
23:05dlonkiit must be something with the looping
23:06dlonkiwhat does for do exactly? form some sort of clouse or soemthing where the image inside is something else than the image outside?
23:16dlonkiok so i can do change one pixel and save it
23:16dlonkii cant use map and ic ant use for
23:16dlonkimaybe loop recur?
23:24dlonkiwow faakkking finally
23:24dlonkiit worked with looop recur
23:24dlonkimap and for-comprehensions dont work, i have to pass along the picture
23:26notallamawhat was it you were trying to do?
23:26dlonkiediting a picture
23:27dlonkiBufferedImage
23:27dlonkiand then give it a range of pixels to change to a specific color
23:27lisppaste8ak annotated #71148 with "loop-recur works!" at http://paste.lisp.org/display/71148#2
23:28dlonkithat took several hours lol
23:28notallamathat sounds lime something you could do with doseq and for.
23:28dlonkiwell for didnt work, maybe i was doing it wrong
23:28notallamawhat was your for?
23:29notallamafor is lazy, so if you were trying to do side effects with it, that's your problem.
23:30dlonkiaha
23:30dlonkiu can see it all^^
23:34notallamawhat's vs?
23:34dlonkioh i changed to vector-pairs
23:34dlonki[[1 2] [2 4]] etc
23:34dlonkior (map vector (range 100) (range 100 200))
23:35dlonkiim trying to do a doseq but dont quite get it
23:38notallama(doseq [[a b] vs] (set-pixel image a b color)) or something. it binds to the first thing in the seq, and does the body, then the second, etc.
23:40notallamathe syntax might be different depending on what version you're using. the old one didn't have the square brackets around the binding forms.
23:53dlonkiah yes doseq is elegant
23:53dlonkiwhat about laziness make for not work?
23:54notallamaonly the first thing in the seq gets evaluated.
23:54notallamathe rest of it waits for something to call "rest" on the seq.
23:56dlonkiso i should what? is there some way force it?
23:58danleiclojurebot: dorun?
23:58clojurebotTitim gan ?ir? ort.
23:58danlei(doc dorun)
23:58clojurebotWhen lazy sequences are produced via functions that have side effects, any effects other than those needed to produce the first element in the seq do not occur until the seq is consumed. dorun can be used to force any effects. Walks through the successive rests of the seq, does not retain the head and returns nil.; arglists ([coll] [n coll])