Re: Anyone experienced in using clojure as a database
On 26 Mai, 15:24, Andrzej ndrwr...@googlemail.com wrote: I'd love to see a persistent table type together with some common primitives (select, join, union) and optimization capabilities. Currently a set of maps does something like that but I have no idea how to, for example, add an index to some particular field and use it in other operations. Got something around, this is my 3rd or 4th attempt to provide a relational datastructure for clojure. I've often found myself in situations, where I needed some kind of table and look up rows by more than one key, hashmaps don't fit that well. http://gist.github.com/415538 - basically is a hashmap which pretends being a set, and lets you access all 'rows'. Indexes (sorted, hash- map ...), except the primary one, are optional but will of course speed up lookup operations. I have not bothered about persistence yet, maybe in the future, there will be some interface to hook into the clojure STM, or Cells will be become available. Erik -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: promoting contrib.string to clojure, feedback requested
On 26 May 2010 23:09, Eric Schulte schulte.e...@gmail.com wrote: Mark Engelberg mark.engelb...@gmail.com writes: If you're developing a trio, like ltrim, trim, rtrim, wouldn't it be better to call them triml, trim, trimr so that they show up next to each other in the alphabetized documentation? +1 for modifiers at the end Let's not forget those of us who search for functions using tab-completion in the repl. And those who search forlornly in http://bit.ly/bPRHP1 trimX makes sense on those grounds, given the rate of expansion of clojure. regards -- Dave Pawson XSLT XSL-FO FAQ. Docbook FAQ. http://www.dpawson.co.uk -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Todo item annotation in Clojure.
This looks cool. I'll definitely give it a try in my next project. Any chance to get it integrated somehow with eclipse ccw? - Thanks -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: do clojure and la(tex) have something in common ?
Hi Tim, Thanks! for such a detailed response. Really got things in perspective for me, my thinking yet isn't of such large scale. So you say literate programming is for those who are writing code that will live for decades to come and that writing literate programs takes ~3x resources. Is there a stripped down version of literate programming that will benefit the majority of programmers who are just average coders, writing a few APIs etc. that would probably take say ~1.5x resources? I'm just curious as the concept seems really good. I'm not sure how many people are willing to do 3x work for writing their APIs. I absolutely agree with your point of documenting (with the goal of communicating to people) design decisions; and comments are not enough for the same. Very recently I started to get interested in code formalism (i.e. mathematically proving programs), although literate programming is not geared in this direction, it might play its part. - Thanks -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Comparing Cycle
It would be voodoo magic :) and totally awesome might I say if (= a (drop 4 a)) returned true immediately! - Thanks -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Todo item annotation in Clojure.
Nice! The version at Clojars seems to be missing the Leiningen plugin, could you please upload a new version? Many thanks! /Patrik On May 26, 9:27 pm, Thomas thomas.g.kristen...@gmail.com wrote: Thanks to sids, the project now has lein todo functionality. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Some suggestions for transients
On May 26, 5:13 pm, Michael Jaaka michael.ja...@googlemail.com wrote: Hi! I have some suggestions about transients (btw. thehttp://clojure.org/transients is not linked fromhttp://clojure.org). Maybe before you give up reading the whole post I will post as first the digression: vars binding and transient are similar, however in the first case we have thread isolation on reading and writing with reference covering/ hiding ability. Currently operations on transients structures seems to be badly interfaced in Clojure and below is a deal: Why do we have to deal with conj! and rest of foo! operations, when there are much more functions like update-in, assoc-in etc. what about them? In most my code I fail to use transient because of xyz-in operations. More over I know that the code is whole executed by one thread, since I know where the transient structure starts to exist and when it ends. Tracking such code is easy task to do since most fast compuations are free of side effects and thread intercommunication. If the whole talk is about thread isolation (which is great feature), then the interface should be simplified, in the way like - (transient x) - attaches thread (which calls transient) reference to my structure (object), when any other thread tries to modify x then the exception is thrown. When I do (persistent x), the thread reference is detached from the structure, so it becomes persistent and others threads can concurrently modify it. This would eleminate duplication of functions and allow for single threaded computations. This would satisfy most computations related with reduce operation and recurention. So easy to do, so easy to track, yet not in Clojure ;-(. The (transient x) and (persistent x) are required since the are explicit declaration of single thread mutation. Also it would be nice if such transient structures could be used in binding clasues, since I have found other adoption - for example thread is doing computations in a functional way - and with binded transients I'm gathering statistics (time measurement, bytes counting etc. in an imperative, side effecting, more like aspect way.) What are your thoughts? The problem is that the semantics of conj and conj! are quite different. The first promises to return a persistent immutable value and the second promises the opposite. BTW. What does it mean don't bash in place - since for not all people English is not a native language I suggest to use simpler words in such formulations. It means, modify in place by repeated interaction with the same object, as in OO: x.changeThis() x.changeThat() x.changeTheOther() or, in Clojure with a transient: ;;this is bad, don't do this (let [x (transient y)] (conj! x this) (conj! x that) (conj! x theOther)) the above Clojure structure would never arise by following the guidelines of writing it functionally first. Rich -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Newbie (with no Java experience) - how best to learn?
Hi, I'm new to Clojure, and looking for the best way to get going. I've got a pretty broad experience of various programming languages (C, Python, Lua, Factor, JavaScript, Haskell, Perl, ...) including a bit of experience with Lisp-like languages, so the language itself isn't likely to be a huge problem for me. But I've no background with Java (beyond a few toy programs, and knowing the syntax) so the environment (classpaths, compiling, where to find libraries, performance, JVMs, etc) is pretty much a mystery to me. I've browsed a bit online, read some of the wikibook articles, and Mark Volkmann's excellent summary, but I'd like to dig a bit deeper (as I say, particularly around libraries and environment, less on how to program in a lisp-like language). Ideally, in a form that I can read offline (printable/PDF documents, or books) as I've got limited free time I can spend in front of a computer screen. I've got a sample program I have tried porting from Python - the experience was interesting, but limited (the core of the relatively complex multithreaded database monitoring process converted to 47 lines of Clojure...!!!) Has anybody got any good suggestions as to where I should go next? I've considered getting one of the Manning books (The Joy of Clojure or Clojure in Action) but I'm not sure which would be better for me - they seem broadly similar, with Clojure in Action looking like a slightly better fit for my needs, but I'd appreciate any comments/recommendations). Also, I wonder whether there's some Java-based documentation that would be worth my while investigating. I suspect that it'd be very easy to get sucked into a huge amount of detail which is only tangentially related at best, but I'm sure an overview would help. Thanks for any suggestions, Paul. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: NullPointerException on disj
On May 27, 1:10 am, Allen Johnson akjohnso...@gmail.com wrote: Hey everyone. I was playing around with the protocols/deftype stuff and ran into a weird NullPointerException when calling the satisfies? function. Seems to only happen with a java.lang.Object instance. Clojure 1.2.0-master-SNAPSHOT user= (defprotocol Greeter (greet [this])) Greeter user= (satisfies? Greeter nil) false user= (satisfies? Greeter ) false user= (satisfies? Greeter (Object.)) java.lang.NullPointerException (NO_SOURCE_FILE:0) Narrowed it down to this function: ;; core_deftype.clj (defn find-protocol-impl [protocolx] (if (instance? (:on-interfaceprotocol) x) x (let [c (class x) impl #(get (:implsprotocol) %)] (or (impl c) (and c (or (first (remove nil? (map impl (butlast (super-chain c) (when-let [t (reduce pref (filter impl (disj (supers c) Object)))] (impl t)) (impl Object))) More specifically, here: (disj (supers c) Object) Since in this case, `c` is java.lang.Object, supers returns nil which disj doesn't seem to like. Shouldn't disj handle nil gracefully? Yes, could you please enter a ticket for this? Thanks, Rich -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Some suggestions for transients
My 2 cents, I read about transients for the first time (why is the page not linked from clojure.org?) and they seem very promising at a first glance. I'm not sure if I agree with Michael's idea of having the same functions for transients and persistents both. Functions should have easy, reproducible semantics imo. If I take a look at a function call in isolation of its environment, I should be able to predict its semantics exactly, not in 90% cases, but 100% (maybe ideal, given my inexperience). But I do agree with his concern about the multitude of functions for persistents and very few for transients. If I want my bottleneck function to use transients, it should be straightforward. Else most of the energy would be spent to re write things like foo-in etc. But maybe that's a deliberate design decision take by Rich not to make transients popular? On the transients page Rich has given a very simple benchmark - (time (def v (vrange 100))) Elapsed time: 297.444 msecs (time (def v2 (vrange2 100))) Elapsed time: 34.428 msecs But on my system I don't get a ~9x performance boost, it mostly get a ~3x performance boost (1.2). Have there been some changes? What do other people get? (time (def v (vrange 100))) Elapsed time: 261.82 msecs (time (def v2 (vrange2 100))) Elapsed time: 87.3 msecs Michael: bash in place means in-place memory writing, for example in Java we have a Collections.sort(list) method which uses in-place merge sort. That method doesn't return a sorted list, it just changes the original list in place (which is more memory efficient). Hope I've been successful in conveying to you. - Thanks -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: promoting contrib.string to clojure, feedback requested
Stefan Kamphausen writes: sorry, I'm a little late. However, to me it is not clear what the trim functions shall do. If they become a replacement for chomp they are clearly misnamed. In many applications and languages (like Excel, several SQL variants, oh, and Java, ...) trim means stripping of whitespace characters, including but not limited to \n and \r. In contrast to that chomp stands for the removal of the system-specific linebreak. Mark Engelberg mark.engelb...@gmail.com writes: If you're developing a trio, like ltrim, trim, rtrim, wouldn't it be better to call them triml, trim, trimr so that they show up next to each other in the alphabetized documentation? +1. Please keep all chop, chomp, trim* :D Therefore I have a little doubt with the implementation of join. It is a beautiful implementation but not really efficient. Some (nasty looking) implementation directly using a stringbuilder is more efficient. (about 2.5 times according to my measureements) +1 functions in core libs should be efficient first, then beautiful. Thats the price to pay for the limelight :). More generally, i would like to see some overall design principles - does the library accept nil in place of string arguments? - some functions do / some not. When are characters acceptable in place of strings, etc +1 this seems really important. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Problem seeing fn metadata unless I eval or load a file
I've given some functions metadata that I want to use elsewhere. My problem is, I don't see the metadata I've added if I use or require the namespace; I need to explicitly load the file (or eval the function definitions manually in slime/swank) to see the metatada. Here's some simple code that shows my problem. What am I doing wrong, or not understanding about metadata? ;;; src/ctest/funcs.clj (ns ctest.funcs) (defn #^{:wadl {:url /f1 :method GET :doc The f1 function.}} f1 [] 42) (defn #^{:wadl {:url /f2 :method GET :doc The f2 function.}} f2 [] eleventy-seven) ;;; src/ctest/core.clj (ns ctest.core (:use ctest.funcs)) (def wadl-meta (list (meta ctest.funcs/f1) (meta ctest.funcs/f2))) ;;; in the repl (output wrapped) user= (use 'ctest.core) nil user= ; I expect wadl-meta to contain the metadata added in funcs.clj user= ; but it does not. (Note; output is wrapped for this email) user= ctest.core/wadl-meta ({:ns #Namespace ctest.funcs, :name f1} {:ns #Namespace ctest.funcs, :name f2}) user= ; The problem isn't with the definition of wadl-meta. user= (meta ctest.funcs/f1) {:ns #Namespace ctest.funcs, :name f1} user= ; Now I load the file directly (or eval the defn in Emacs) user= (load-file src/ctest/funcs.clj) #'ctest.funcs/f2 user= ; Look! I can see the metadata I defined now. WHY?? user= (meta ctest.funcs/f1) {:ns #Namespace ctest.funcs, :name f1, :file ctest/funcs.clj, :line 3, :arglists ([]), :wadl {:url /f1, :method GET, :doc The f1 function.}} Jim -- Jim Menard, http://www.io.com/~jimm/ -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: promoting contrib.string to clojure, feedback requested
On May 26, 8:12 pm, Mohammad Khan beepl...@gmail.com wrote: personally, I like strip or trim [rather] than chomp/chop. +1 from a mostly-Python programmer :-) On May 26, 8:15 pm, Mark Engelberg mark.engelb...@gmail.com wrote: If you're developing a trio, like ltrim, trim, rtrim, wouldn't it be better to call them triml, trim, trimr so that they show up next to each other in the alphabetized documentation? Good point. I also like the idea of an optional seq argument to specify the characters that should be stripped/trimmed, e.g. (trimr url /) ; or (trimr / url) to support point-free style -- Daniel -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: promoting contrib.string to clojure, feedback requested
On May 27, 2010, at 2:45 AM, Stefan Kamphausen wrote: Hi, On May 26, 11:00 pm, Stuart Halloway stuart.hallo...@gmail.com wrote: The people have spoken! The trims have it! sorry, I'm a little late. However, to me it is not clear what the trim functions shall do. If they become a replacement for chomp they are clearly misnamed. In many applications and languages (like Excel, several SQL variants, oh, and Java, ...) trim means stripping of whitespace characters, including but not limited to \n and \r. In contrast to that chomp stands for the removal of the system-specific linebreak. I disagree that trim is a misnomer for this function. It may be used as shorthand for trim whitespace in some programming languages, but it's not universal even within CS, and it's not what trim by itself means in English. And Clojure has already shown that it is willing to break with established terminology in order to Get Things Right. Usually trim-functions accept an optional list of chars to trim. So if a trim function would be implemented as a char-remover, defaulting to whitespace, and chomp would then be equivalent to (trim foo\n \r \n) -- the second arg should probably something seqable -- everything seems fine to me. I agree with the proposal for a second, optional argument to trim; I'm ambivalent about whether chomp would still be necessary then. I'd prefer the optional trim argument to be an actual set of characters (the semantics are more appropriate, and it might allow a more performant implementation), but I wouldn't object too hard if it accepted any seq of chars instead. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: do clojure and la(tex) have something in common ?
The hope is that since Clojure is all about breaking away from the past, we would consider breaking away from the past method of program development also. Unfortunately, this requires more work from a programmer. Is it a factor of ~1.5? Who knows. I use the factor-of-3. The factor-of-3 comes from the rule of thumb which I've seen somewhere and have been extending as I learn. There is a relation between the unit of work and the task you are trying to do, based mostly on your audience. Programmers never seem to get beyond the 1-unit mindset, write the code and they will come. Software tends to scale as a factor of 3. My current scale is: 1 unit : Something you do for yourself (e.g. 1 week coding) 3 units : package it up to give to another person (involves collecting files, copy, chat, etc) 9 units : package it up for a group (write install instructions, deal with XP/Linux/Mac, handle missing prereq software, phone/email support) 27 units : make it open source (sourceforge/mailing list/web pages/email support/ install scripts/spam/server setup/user support/ floss license debate) 81 units : make it commercial (corporate structure/CEO/lawyers/trademark/copyright/ accounting/reporting) 243 units : make it live forever (deep documentation/literate programming/ finding the right ideas/standards/courses) Clojure isn't commercial so we can skip that power-of-3. My power-of-3 estimate says that for EVERY week of work that Rich does on Clojure it will require 27 weeks of work to keep it viable as open source. It will require 81 weeks to make it live. To make it viable beyond Rich's contribution requires a whole ecosystem which includes standards/books/videos/courses, etc. Literate programming is, by my belief, the way that helps keep the software viable. It is, however, a HUGE amount of work compared with writing the code. Probably a factor of 3 :-) Unfortunately, if the ideas are not written down now then they probably never will be written down. Without a required standard of literacy, programmers will never do it. Even requiring test cases is considered a major innovation (e.g. TDD). Bill Hart, from the Sage project, said: Another thing I've been enjoying lately is literate programming. Amazingly it turns out to be faster to write a literate program than an ordinary program because debugging takes almost no time. (http://axiom-developer.org/axiom-website/documentation.html) so on balance it might be ~1.5 rather than 3. Who knows? If you look at common lisp, the effort to write the code that handles, say string processing, is trivial compared with the effort to document it, make it a standard, get it through the various social aspects and committees. Clojure has a LONG way to go. There is no royal road to viable software. Tim ka wrote: Hi Tim, Thanks! for such a detailed response. Really got things in perspective for me, my thinking yet isn't of such large scale. So you say literate programming is for those who are writing code that will live for decades to come and that writing literate programs takes ~3x resources. Is there a stripped down version of literate programming that will benefit the majority of programmers who are just average coders, writing a few APIs etc. that would probably take say ~1.5x resources? I'm just curious as the concept seems really good. I'm not sure how many people are willing to do 3x work for writing their APIs. I absolutely agree with your point of documenting (with the goal of communicating to people) design decisions; and comments are not enough for the same. Very recently I started to get interested in code formalism (i.e. mathematically proving programs), although literate programming is not geared in this direction, it might play its part. - Thanks -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: var function not documented at clojure.core-api.html
Hi, On May 27, 2:16 pm, Dave Pawson dave.paw...@gmail.com wrote: http://richhickey.github.com/clojure/clojure.core-api.html Doesn't show the (var) function amongst it's 510 options. Any reason why please? Because it's a special form: http://clojure.org/special_forms Sincerely Meikel -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Newbie (with no Java experience) - how best to learn?
Welcome aboard Paul! So, where should you get started? I can think of a couple good things to do to start. 1. Pick an IDE and stick with it. I'd recommend ClojureBox if you're interested in Clojure only, or NetBeans + Enclojure if you want to learn some about Java too. In fact, NetBeans is probably a better place to start. 2. If you're looking for a dead tree reference, Halloway's book Programming Clojure is a great start. I'd recommend it to anyone not named Rich Hickey. Also, I strongly recommend Core Java Volumes I II from Horstmann Cornell to get started with Java. 3. Once you start to play around with the examples in a REPL, take a look at some of the material here: http://news.ycombinator.com/item?id=1033503 4. Find a project start playing. The best way to learn is by doing, after all :) Sean On May 27, 7:53 am, Paul Moore p.f.mo...@gmail.com wrote: Hi, I'm new to Clojure, and looking for the best way to get going. I've got a pretty broad experience of various programming languages (C, Python, Lua, Factor, JavaScript, Haskell, Perl, ...) including a bit of experience with Lisp-like languages, so the language itself isn't likely to be a huge problem for me. But I've no background with Java (beyond a few toy programs, and knowing the syntax) so the environment (classpaths, compiling, where to find libraries, performance, JVMs, etc) is pretty much a mystery to me. I've browsed a bit online, read some of the wikibook articles, and Mark Volkmann's excellent summary, but I'd like to dig a bit deeper (as I say, particularly around libraries and environment, less on how to program in a lisp-like language). Ideally, in a form that I can read offline (printable/PDF documents, or books) as I've got limited free time I can spend in front of a computer screen. I've got a sample program I have tried porting from Python - the experience was interesting, but limited (the core of the relatively complex multithreaded database monitoring process converted to 47 lines of Clojure...!!!) Has anybody got any good suggestions as to where I should go next? I've considered getting one of the Manning books (The Joy of Clojure or Clojure in Action) but I'm not sure which would be better for me - they seem broadly similar, with Clojure in Action looking like a slightly better fit for my needs, but I'd appreciate any comments/recommendations). Also, I wonder whether there's some Java-based documentation that would be worth my while investigating. I suspect that it'd be very easy to get sucked into a huge amount of detail which is only tangentially related at best, but I'm sure an overview would help. Thanks for any suggestions, Paul. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: promoting contrib.string to clojure, feedback requested
Hi, On 27 Mai, 15:35, Michael Gardner gardne...@gmail.com wrote: On May 27, 2010, at 2:45 AM, Stefan Kamphausen wrote: Hi, On May 26, 11:00 pm, Stuart Halloway stuart.hallo...@gmail.com wrote: The people have spoken! The trims have it! sorry, I'm a little late. However, to me it is not clear what the trim functions shall do. If they become a replacement for chomp they are clearly misnamed. In many applications and languages (like Excel, several SQL variants, oh, and Java, ...) trim means stripping of whitespace characters, including but not limited to \n and \r. In contrast to that chomp stands for the removal of the system-specific linebreak. I disagree that trim is a misnomer for this function. It may be used as shorthand for trim whitespace in some programming languages, but it's not universal even within CS, and it's not what trim by itself means in English. And Clojure has already shown that it is willing to break with established terminology in order to Get Things Right. just a few links http://en.wikipedia.org/wiki/Trim_%28programming%29 http://en.wikipedia.org/wiki/String_functions_%28programming%29#trim http://java.sun.com/javase/7/docs/api/java/lang/String.html#trim%28%29 http://php.net/manual/en/function.trim.php According to the first link in that list, a lot of languages have this understanding of trimming a string. However, that doesn't have to be a valid argument. Oh, and, Clojure: (.trimTrim me ) (which is really just Java, of course, but I couldn't withstand) :-) Cheers, Stefan -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Newbie (with no Java experience) - how best to learn?
Hi Paul - I am also a newbie, but have been approaching thsi for the other direction - knowing Java and not knowing Lisp or any other FP language. What I have found is that I really strive to spend most of my time in Clojure, not Java. Hence I only really use java when I *have* to. And even then, all I ever do is instantiate a class or 2 and call a method. I do not use swing (java GUI package) and have not (so far) found the need for much else. I would go online and read an intro tutorial or two for Java just to familiarize yourself with the basic constructs. I would also browse the java API at http://java.sun.com/javase/6/docs/api/ . I think that you will find that you can learn the java you need on the fly. Regarding Clojure I got Stuart Halloway's book Programming Clojure ( http://pragprog.com/titles/shcloj/programming-clojure ) and it was fantastic because it gave me a strong intro really quickly. What I didn't expect is how many times I have fond myself going back to the book. It has more advanced concepts (at least for me... !) that I didn't pick up on when I first was starting. This has been a real bonus for me. Also, I spend a *lot* of time on this site and ask a lot of really dumb questions. Clojure has the best group support by far of any language I have ever seen. The people on this board are truly amazingly helpful and patient - even with us newbies :) The hardest part for me was getting things configured. It is really confusing - particularly if you have no background to java. Most of the users here use emacs for their IDE. If you know emacs you can certainly try that. There is Clojure in a Box that is a self contained package If you do not use emacs ( I do not - it is too damn confusing for me) then i recommend using and IDE that has clojure support. There is one for Netbeans called Enclojure. I use Eclipse and a plugin called CounterClockwise. I really like it. Stu Halloway has a great starting tutorial with instructions on how to get up to speed and has a series of tutorials via a web server (integrated into the app). It is located at: http://github.com/relevance/labrepl This is where I would start. It has helped me out immensely. Cheers Base On May 27, 6:53 am, Paul Moore p.f.mo...@gmail.com wrote: Hi, I'm new to Clojure, and looking for the best way to get going. I've got a pretty broad experience of various programming languages (C, Python, Lua, Factor, JavaScript, Haskell, Perl, ...) including a bit of experience with Lisp-like languages, so the language itself isn't likely to be a huge problem for me. But I've no background with Java (beyond a few toy programs, and knowing the syntax) so the environment (classpaths, compiling, where to find libraries, performance, JVMs, etc) is pretty much a mystery to me. I've browsed a bit online, read some of the wikibook articles, and Mark Volkmann's excellent summary, but I'd like to dig a bit deeper (as I say, particularly around libraries and environment, less on how to program in a lisp-like language). Ideally, in a form that I can read offline (printable/PDF documents, or books) as I've got limited free time I can spend in front of a computer screen. I've got a sample program I have tried porting from Python - the experience was interesting, but limited (the core of the relatively complex multithreaded database monitoring process converted to 47 lines of Clojure...!!!) Has anybody got any good suggestions as to where I should go next? I've considered getting one of the Manning books (The Joy of Clojure or Clojure in Action) but I'm not sure which would be better for me - they seem broadly similar, with Clojure in Action looking like a slightly better fit for my needs, but I'd appreciate any comments/recommendations). Also, I wonder whether there's some Java-based documentation that would be worth my while investigating. I suspect that it'd be very easy to get sucked into a huge amount of detail which is only tangentially related at best, but I'm sure an overview would help. Thanks for any suggestions, Paul. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: var function not documented at clojure.core-api.html
On 27 May 2010 15:10, Meikel Brandmeyer m...@kotka.de wrote: http://richhickey.github.com/clojure/clojure.core-api.html Doesn't show the (var) function amongst it's 510 options. Any reason why please? Because it's a special form: http://clojure.org/special_forms Sincerely Meikel Thanks. Another list to search. 510+17. regards -- Dave Pawson XSLT XSL-FO FAQ. Docbook FAQ. http://www.dpawson.co.uk -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Problem seeing fn metadata unless I eval or load a file
Christophe, Thank you for your research and for opening the ticket. Jim On Thu, May 27, 2010 at 9:59 AM, Christophe Grand christo...@cgrand.net wrote: Hi, On Thu, May 27, 2010 at 3:28 PM, Jim Menard jim.men...@gmail.com wrote: I've given some functions metadata that I want to use elsewhere. My problem is, I don't see the metadata I've added if I use or require the namespace; I need to explicitly load the file (or eval the function definitions manually in slime/swank) to see the metatada. Here's some simple code that shows my problem. What am I doing wrong, or not understanding about metadata? ;;; src/ctest/funcs.clj (ns ctest.funcs) (defn #^{:wadl {:url /f1 :method GET :doc The f1 function.}} f1 [] 42) (defn #^{:wadl {:url /f2 :method GET :doc The f2 function.}} f2 [] eleventy-seven) ;;; src/ctest/core.clj (ns ctest.core (:use ctest.funcs)) (def wadl-meta (list (meta ctest.funcs/f1) (meta ctest.funcs/f2))) There is indeed a bug in how defn copy metadata from the var to the fn: user= (defn foo {:bar :baz} [] 42) #'user/foo user= (meta #'foo) {:ns #Namespace user, :name foo, :file NO_SOURCE_PATH, :line 221, :arglists ([]), :bar :baz} user= (meta foo) {:ns #Namespace user, :name foo} user= (defn foo {:lucy :ethel} [] 43) #'user/foo user= (meta #'foo) {:ns #Namespace user, :name foo, :file NO_SOURCE_PATH, :line 224, :arglists ([]), :lucy :ethel} user= (meta foo) {:ns #Namespace user, :name foo, :file NO_SOURCE_PATH, :line 221, :arglists ([]), :bar :baz} There you see that the fn got the previous metadata and not the current. I'm going to open a ticket. Christophe -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- Jim Menard, http://www.io.com/~jimm/ -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Clojure Screen casts
I was hoping to listen/view the clojure screen casts on my daily commute on my ipod. I have got them on itunes but they will not sync with the ipod. Can anyone help? Martin Roberts -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
No matching method found for javax.mail.internet.MimeMessage
Clojure Users: Could anyone please help me with the problem I am having here? http://clojure.pastebin.com/yR6yPQha Essentially I am running into a situation where the interop operator '.' doesn't work for some instance methods of javax.mail.internet.MimeMessage. I have tried various different constructs and methods but I always get the same exception: No matching method found: setRecipients for class javax.mail.internet.MimeMessage - I have tried using clojure 1.1/contrib 1.1 and also now clojure 1.2 snapshot/contrib 1.2 snapshot - version: Java(TM) SE Runtime Environment (build 1.6.0_16-b01) Windows XP SP3 - I am retrieving jars via lein (project.clj included in pastebin) Any help is appreciated! Thanks, Matthew Elder Novice Clojure Programmer -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: No matching method found for javax.mail.internet.MimeMessage
Judging from the javadoc, setRecipients takes an array of addressses as its second parameter. So try (into-array to), (into-array for), etc. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Which GUI toolkit would you like to see wrapped in an idiomatic Clojure library?
My side project is a fairly complex GUI application written in Clojure. Recently, I've become irritated with using Java interop for everything. It's not that Clojure doesn't have nice java interop - it does. It's just that when interacting with a GUI framework, which is a large part of my app, I have to be back in mutable object-oriented land, worrying about class hierarchies, mutable state, locks, etc. Yucky. So, with a perhaps dangerous lack of sanity and without any guarantee of success, I've decided to try my hand at writing an idiomatic Clojure GUI library. If I have success (which I doubt) I will of course make it available as open source. I intend for it to be mostly declarative, with a nice DSL for defining GUI elements. Each component will also implement map, and use one of Clojure's reference types as an interface for inspecting / updating its state. I may also implement some aspects of Functional Reactive Programming wherever it's convenient to do so. What you all must help me decide is what GUI framework to use as the underpinnings of it. It's genuinely hard to decide. I have at least some experience with all of them, so I have no strong preference, but I'd like to get your input. I did consider trying to make it abstract enough that you could plug in *any* of them under the hood, but there's enough differences between the frameworks that that would get very ugly very fast. Possibilities are: AWT Pros: native widgets, bundled with Java, low-level Cons: few widgets, considered somewhat obselete Swing Pros: bundled with Java, good widget selection Cons: non-native widgets SWT Pros: native widgets, widely used Cons: requires platform-specific libs QT Jambi Pros: native widgets, huge widget selection, highly-regarded framework Cons: requires platform-specific libs, writing custom widgets is hairy, momentum and support seem to be lagging since Nokia dropped official support. Remember, the actual API won't matter - that will be completely abstracted away. So try to focus on the framework's look and feel. Also let me know if I've missed any of the framework's key characteristics. Thanks! -Luke -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Which GUI toolkit would you like to see wrapped in an idiomatic Clojure library?
Although I work with SWT at work, I would say Swing for 2 reasons : * no additional dependency for users of your lib, and *no need* for users of your lib to deliver different final apps binaries for different platforms * may be easier to work with in your implementation (?) 2010/5/27 Luke VanderHart luke.vanderh...@gmail.com My side project is a fairly complex GUI application written in Clojure. Recently, I've become irritated with using Java interop for everything. It's not that Clojure doesn't have nice java interop - it does. It's just that when interacting with a GUI framework, which is a large part of my app, I have to be back in mutable object-oriented land, worrying about class hierarchies, mutable state, locks, etc. Yucky. So, with a perhaps dangerous lack of sanity and without any guarantee of success, I've decided to try my hand at writing an idiomatic Clojure GUI library. If I have success (which I doubt) I will of course make it available as open source. I intend for it to be mostly declarative, with a nice DSL for defining GUI elements. Each component will also implement map, and use one of Clojure's reference types as an interface for inspecting / updating its state. I may also implement some aspects of Functional Reactive Programming wherever it's convenient to do so. What you all must help me decide is what GUI framework to use as the underpinnings of it. It's genuinely hard to decide. I have at least some experience with all of them, so I have no strong preference, but I'd like to get your input. I did consider trying to make it abstract enough that you could plug in *any* of them under the hood, but there's enough differences between the frameworks that that would get very ugly very fast. Possibilities are: AWT Pros: native widgets, bundled with Java, low-level Cons: few widgets, considered somewhat obselete Swing Pros: bundled with Java, good widget selection Cons: non-native widgets SWT Pros: native widgets, widely used Cons: requires platform-specific libs QT Jambi Pros: native widgets, huge widget selection, highly-regarded framework Cons: requires platform-specific libs, writing custom widgets is hairy, momentum and support seem to be lagging since Nokia dropped official support. Remember, the actual API won't matter - that will be completely abstracted away. So try to focus on the framework's look and feel. Also let me know if I've missed any of the framework's key characteristics. Thanks! -Luke -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Which GUI toolkit would you like to see wrapped in an idiomatic Clojure library?
+1 Swing. There's a ton of documentation out there, and it got some serious love from Sun between java 5 and 6. On May 27, 11:27 am, Laurent PETIT laurent.pe...@gmail.com wrote: Although I work with SWT at work, I would say Swing for 2 reasons : * no additional dependency for users of your lib, and *no need* for users of your lib to deliver different final apps binaries for different platforms * may be easier to work with in your implementation (?) 2010/5/27 Luke VanderHart luke.vanderh...@gmail.com My side project is a fairly complex GUI application written in Clojure. Recently, I've become irritated with using Java interop for everything. It's not that Clojure doesn't have nice java interop - it does. It's just that when interacting with a GUI framework, which is a large part of my app, I have to be back in mutable object-oriented land, worrying about class hierarchies, mutable state, locks, etc. Yucky. So, with a perhaps dangerous lack of sanity and without any guarantee of success, I've decided to try my hand at writing an idiomatic Clojure GUI library. If I have success (which I doubt) I will of course make it available as open source. I intend for it to be mostly declarative, with a nice DSL for defining GUI elements. Each component will also implement map, and use one of Clojure's reference types as an interface for inspecting / updating its state. I may also implement some aspects of Functional Reactive Programming wherever it's convenient to do so. What you all must help me decide is what GUI framework to use as the underpinnings of it. It's genuinely hard to decide. I have at least some experience with all of them, so I have no strong preference, but I'd like to get your input. I did consider trying to make it abstract enough that you could plug in *any* of them under the hood, but there's enough differences between the frameworks that that would get very ugly very fast. Possibilities are: AWT Pros: native widgets, bundled with Java, low-level Cons: few widgets, considered somewhat obselete Swing Pros: bundled with Java, good widget selection Cons: non-native widgets SWT Pros: native widgets, widely used Cons: requires platform-specific libs QT Jambi Pros: native widgets, huge widget selection, highly-regarded framework Cons: requires platform-specific libs, writing custom widgets is hairy, momentum and support seem to be lagging since Nokia dropped official support. Remember, the actual API won't matter - that will be completely abstracted away. So try to focus on the framework's look and feel. Also let me know if I've missed any of the framework's key characteristics. Thanks! -Luke -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Newbie (with no Java experience) - how best to learn?
The Full Disclojure video series is targeted more toward the lisp newbie, but it contains a series of videos touring different development environments. http://vimeo.com/channels/fulldisclojure On May 27, 6:53 am, Paul Moore p.f.mo...@gmail.com wrote: Hi, I'm new to Clojure, and looking for the best way to get going. I've got a pretty broad experience of various programming languages (C, Python, Lua, Factor, JavaScript, Haskell, Perl, ...) including a bit of experience with Lisp-like languages, so the language itself isn't likely to be a huge problem for me. But I've no background with Java (beyond a few toy programs, and knowing the syntax) so the environment (classpaths, compiling, where to find libraries, performance, JVMs, etc) is pretty much a mystery to me. I've browsed a bit online, read some of the wikibook articles, and Mark Volkmann's excellent summary, but I'd like to dig a bit deeper (as I say, particularly around libraries and environment, less on how to program in a lisp-like language). Ideally, in a form that I can read offline (printable/PDF documents, or books) as I've got limited free time I can spend in front of a computer screen. I've got a sample program I have tried porting from Python - the experience was interesting, but limited (the core of the relatively complex multithreaded database monitoring process converted to 47 lines of Clojure...!!!) Has anybody got any good suggestions as to where I should go next? I've considered getting one of the Manning books (The Joy of Clojure or Clojure in Action) but I'm not sure which would be better for me - they seem broadly similar, with Clojure in Action looking like a slightly better fit for my needs, but I'd appreciate any comments/recommendations). Also, I wonder whether there's some Java-based documentation that would be worth my while investigating. I suspect that it'd be very easy to get sucked into a huge amount of detail which is only tangentially related at best, but I'm sure an overview would help. Thanks for any suggestions, Paul. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Which GUI toolkit would you like to see wrapped in an idiomatic Clojure library?
+1 Swing. +1 Swing. There's a ton of documentation out there, and it got some serious love from Sun between java 5 and 6. On May 27, 11:27 am, Laurent PETIT laurent.pe...@gmail.com wrote: Although I work with SWT at work, I would say Swing for 2 reasons : * no additional dependency for users of your lib, and *no need* for users of your lib to deliver different final apps binaries for different platforms * may be easier to work with in your implementation (?) 2010/5/27 Luke VanderHart luke.vanderh...@gmail.com My side project is a fairly complex GUI application written in Clojure. Recently, I've become irritated with using Java interop for everything. It's not that Clojure doesn't have nice java interop - it does. It's just that when interacting with a GUI framework, which is a large part of my app, I have to be back in mutable object-oriented land, worrying about class hierarchies, mutable state, locks, etc. Yucky. So, with a perhaps dangerous lack of sanity and without any guarantee of success, I've decided to try my hand at writing an idiomatic Clojure GUI library. If I have success (which I doubt) I will of course make it available as open source. I intend for it to be mostly declarative, with a nice DSL for defining GUI elements. Each component will also implement map, and use one of Clojure's reference types as an interface for inspecting / updating its state. I may also implement some aspects of Functional Reactive Programming wherever it's convenient to do so. What you all must help me decide is what GUI framework to use as the underpinnings of it. It's genuinely hard to decide. I have at least some experience with all of them, so I have no strong preference, but I'd like to get your input. I did consider trying to make it abstract enough that you could plug in *any* of them under the hood, but there's enough differences between the frameworks that that would get very ugly very fast. Possibilities are: AWT Pros: native widgets, bundled with Java, low-level Cons: few widgets, considered somewhat obselete Swing Pros: bundled with Java, good widget selection Cons: non-native widgets SWT Pros: native widgets, widely used Cons: requires platform-specific libs QT Jambi Pros: native widgets, huge widget selection, highly-regarded framework Cons: requires platform-specific libs, writing custom widgets is hairy, momentum and support seem to be lagging since Nokia dropped official support. Remember, the actual API won't matter - that will be completely abstracted away. So try to focus on the framework's look and feel. Also let me know if I've missed any of the framework's key characteristics. Thanks! -Luke -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: var function not documented at clojure.core-api.html
Hi, On Thu, May 27, 2010 at 03:44:46PM +0100, Dave Pawson wrote: Thanks. Another list to search. 510+17. No need to search. From a Repl session: user= (doc var) - var Special Form Please see http://clojure.org/special_forms#var nil Sincerely Meikel -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: promoting contrib.string to clojure, feedback requested
Hi Brian, (1) Other than split-lines, what other non-promoted fns do you think are common enough to deserver promotion? (2) upper-case and lower-case are there for symmetry with capitalize. It's a judgment call, but one I am still comfortable with. (3) nil-handling is on the list of things to be sorted out before the patch is approved. Thanks! Stu On May 26, 8:16 am, Stuart Halloway stuart.hallo...@gmail.com wrote: If you are a user of clojure.contrib.string, please take a look at the proposed promotion to clojure [1]. Feedback welcome! It is my hope that this promotion has enough batteries included that many libs can end their dependency on contrib for string functions. Great to see these bumped into core. But are we now going to have clojure.string, and clojure.contrib.string, with half the string functions in one and half in the other? It's going to be confusing to remember which namespace has which functions (since I often use functions you aren't promoting here), and now I potentially have to depend on two libs instead of just one. split-lines (for example) is something I use constantly. It's also something just annoying/error-prone enough that I don't want to write (split #\r?\n s) over and over. I always trip over core's line-seq because it takes a reader instead of a string as I'd expect. It'd be nice to see that one promoted, if split is being promoted too. What's the point of promoting upper-case and lower-case? I thought Clojure generally avoided thin wrappers around Java methods. I always use the Java methods directly, personally. The comments say it's for mapping over a list of strings, but (map #(.toUpperCase %) xs) isn't that much typing. The only use I see for making these a Clojure function is to improve error-handling. (upper-case nil) gives an unhelpful NPE. --Brian -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: promoting contrib.string to clojure, feedback requested
Thanks to everyone for feedback on this thread. I have updated the ticket to include a list of changes and open questions, and will be working on a patch for review. Stu -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Newbie (with no Java experience) - how best to learn?
I think learn lisp is important to learn clojure. so ansi common lisp, on lisp ,paip is three book must to read. 2010/5/27 Base basselh...@gmail.com: Hi Paul - I am also a newbie, but have been approaching thsi for the other direction - knowing Java and not knowing Lisp or any other FP language. What I have found is that I really strive to spend most of my time in Clojure, not Java. Hence I only really use java when I *have* to. And even then, all I ever do is instantiate a class or 2 and call a method. I do not use swing (java GUI package) and have not (so far) found the need for much else. I would go online and read an intro tutorial or two for Java just to familiarize yourself with the basic constructs. I would also browse the java API at http://java.sun.com/javase/6/docs/api/ . I think that you will find that you can learn the java you need on the fly. Regarding Clojure I got Stuart Halloway's book Programming Clojure ( http://pragprog.com/titles/shcloj/programming-clojure ) and it was fantastic because it gave me a strong intro really quickly. What I didn't expect is how many times I have fond myself going back to the book. It has more advanced concepts (at least for me... !) that I didn't pick up on when I first was starting. This has been a real bonus for me. Also, I spend a *lot* of time on this site and ask a lot of really dumb questions. Clojure has the best group support by far of any language I have ever seen. The people on this board are truly amazingly helpful and patient - even with us newbies :) The hardest part for me was getting things configured. It is really confusing - particularly if you have no background to java. Most of the users here use emacs for their IDE. If you know emacs you can certainly try that. There is Clojure in a Box that is a self contained package If you do not use emacs ( I do not - it is too damn confusing for me) then i recommend using and IDE that has clojure support. There is one for Netbeans called Enclojure. I use Eclipse and a plugin called CounterClockwise. I really like it. Stu Halloway has a great starting tutorial with instructions on how to get up to speed and has a series of tutorials via a web server (integrated into the app). It is located at: http://github.com/relevance/labrepl This is where I would start. It has helped me out immensely. Cheers Base On May 27, 6:53 am, Paul Moore p.f.mo...@gmail.com wrote: Hi, I'm new to Clojure, and looking for the best way to get going. I've got a pretty broad experience of various programming languages (C, Python, Lua, Factor, JavaScript, Haskell, Perl, ...) including a bit of experience with Lisp-like languages, so the language itself isn't likely to be a huge problem for me. But I've no background with Java (beyond a few toy programs, and knowing the syntax) so the environment (classpaths, compiling, where to find libraries, performance, JVMs, etc) is pretty much a mystery to me. I've browsed a bit online, read some of the wikibook articles, and Mark Volkmann's excellent summary, but I'd like to dig a bit deeper (as I say, particularly around libraries and environment, less on how to program in a lisp-like language). Ideally, in a form that I can read offline (printable/PDF documents, or books) as I've got limited free time I can spend in front of a computer screen. I've got a sample program I have tried porting from Python - the experience was interesting, but limited (the core of the relatively complex multithreaded database monitoring process converted to 47 lines of Clojure...!!!) Has anybody got any good suggestions as to where I should go next? I've considered getting one of the Manning books (The Joy of Clojure or Clojure in Action) but I'm not sure which would be better for me - they seem broadly similar, with Clojure in Action looking like a slightly better fit for my needs, but I'd appreciate any comments/recommendations). Also, I wonder whether there's some Java-based documentation that would be worth my while investigating. I suspect that it'd be very easy to get sucked into a huge amount of detail which is only tangentially related at best, but I'm sure an overview would help. Thanks for any suggestions, Paul. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this
Re: Newbie (with no Java experience) - how best to learn?
On 27 May 2010 15:16, Sean Devlin francoisdev...@gmail.com wrote: Welcome aboard Paul! Thanks! 1. Pick an IDE and stick with it. I'd recommend ClojureBox if you're interested in Clojure only, or NetBeans + Enclojure if you want to learn some about Java too. In fact, NetBeans is probably a better place to start. I don't really like IDEs, I'm a text editor sort of person, I'm afraid. I'll be using Vim to write my code, unless someone gives me very strong reasons to do otherwise. And to be honest, if I can't code in clojure using Vim, I'd be assuming clojure isn't for me, I'm afraid. 2. If you're looking for a dead tree reference, Halloway's book Programming Clojure is a great start. I'd recommend it to anyone not named Rich Hickey. Also, I strongly recommend Core Java Volumes I II from Horstmann Cornell to get started with Java. Thanks for the references. I'd been under the impression that Programming Clojure was more a language tutorial. Looks like I was wrong - I'll check it out! While the Java books look good, I'm not sure how useful they will be. I have (a fairly old copy of) Java in a Nutshell and a couple of other ones, and I'm really not a fan of Java the language - so I don't want to invest too heavily in Java books unless they are going to be useful from a clojure point of view. I'll keep them in mind, though. (Basically, I'd rather get Java background from something downloadable for free). 3. Once you start to play around with the examples in a REPL, take a look at some of the material here: http://news.ycombinator.com/item?id=1033503 Nice link, thanks! 4. Find a project start playing. The best way to learn is by doing, after all :) Absolutely - I'm planning on building up my database monitoring app as a starter. I also have a couple of other testbed applications I'd like to try. On that note, are there good (java|clojure) libraries I should look at for: - command line argument handling (getopt style option handling) - simple parsing (suitable for something like a small expression parser) Thanks again, Paul. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Newbie (with no Java experience) - how best to learn?
On 27 May 2010 15:38, Base basselh...@gmail.com wrote: Regarding Clojure I got Stuart Halloway's book Programming Clojure Another recommendation! Looks like that's definite then :-) Thanks. Also, I spend a *lot* of time on this site and ask a lot of really dumb questions. Clojure has the best group support by far of any language I have ever seen. The people on this board are truly amazingly helpful and patient - even with us newbies :) Reassuring to know. As I suspect my dumb questions will be heavily JVM-biased (What's a classpath?) I'll probably need all the patience people can muster! Actually here's a JVM sort of question to start off with. To run my little database monitor script on Windows, I use a command line java -cp clojure.jar;clojure-contrib.jar;D:\Oracle\product\10.2.0\client_1\jdbc\lib\classes12.jar clojure.main db.clj That's a pretty hairy command line, just to run a script with no parameters! What's the best way to tidy this up (on the Windows command line)? I'd prefer not to wrap it in a batch file for a couple of reasons - two files to maintain, and batch files have some irritating properties on Windows. For the script, I can associate java -cp clojure.jar clojure.main %* with the .clj extension and that's OK, But is there a way of adding the references to the other jars from within the script, so I don't need to specify the classpath on the command line? The hardest part for me was getting things configured. It is really confusing - particularly if you have no background to java. Most of the users here use emacs for their IDE. If you know emacs you can certainly try that. There is Clojure in a Box that is a self contained package If you do not use emacs ( I do not - it is too damn confusing for me) then i recommend using and IDE that has clojure support. There is one for Netbeans called Enclojure. I use Eclipse and a plugin called CounterClockwise. I really like it. As a non-Java user, I'm strongly averse to the various IDEs. Personally, I'm a Vim user and I like to do my compiling from the command line. Hopefully, the bare metal approach won't get me into too much trouble! Stu Halloway has a great starting tutorial with instructions on how to get up to speed and has a series of tutorials via a web server (integrated into the app). It is located at: http://github.com/relevance/labrepl This is where I would start. It has helped me out immensely. That looks like a great resource! Thanks! Paul. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Newbie (with no Java experience) - how best to learn?
On 27 May 2010 16:39, eyeris drewpvo...@gmail.com wrote: The Full Disclojure video series is targeted more toward the lisp newbie, but it contains a series of videos touring different development environments. http://vimeo.com/channels/fulldisclojure Ta. Any way of downloading these to watch on my iPod? As I say, I have limited opportunities to sit in front of a PC to read/watch training stuff. Paul. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: var function not documented at clojure.core-api.html
On 27 May 2010 16:43, Meikel Brandmeyer m...@kotka.de wrote: Hi, On Thu, May 27, 2010 at 03:44:46PM +0100, Dave Pawson wrote: Thanks. Another list to search. 510+17. No need to search. From a Repl session: user= (doc var) - var Special Form Please see http://clojure.org/special_forms#var nil Sincerely Meikel Succinct! Tells me which page too. Thanks Meikel regards -- Dave Pawson XSLT XSL-FO FAQ. Docbook FAQ. http://www.dpawson.co.uk -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure Screen casts
I use this software to convert everything for my iPod: http://www.dvdvideosoft.com/products/dvd/Free-Video-to-iPhone-Converter.htm It's a bit nagware, but it works very well. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Newbie (with no Java experience) - how best to learn?
On May 27, 12:26 pm, Paul Moore p.f.mo...@gmail.com wrote: On 27 May 2010 16:39, eyeris drewpvo...@gmail.com wrote: The Full Disclojure video series is targeted more toward the lisp newbie, but it contains a series of videos touring different development environments.http://vimeo.com/channels/fulldisclojure Ta. Any way of downloading these to watch on my iPod? As I say, I have limited opportunities to sit in front of a PC to read/watch training stuff. Paul. I make them available CC BY-NC-SA, so download away. You'll need a vimeo account (free) to download them, though. Sean -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: promoting contrib.string to clojure, feedback requested
Oh, and following the tradition of clojure.java.io, you'll probably want to name it clojure.java.string, since it relies heavily on interop. Sean On May 27, 11:55 am, Stuart Halloway stuart.hallo...@gmail.com wrote: Thanks to everyone for feedback on this thread. I have updated the ticket to include a list of changes and open questions, and will be working on a patch for review. Stu -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Elegant way of expressing this in Clojure?
Assume d w have the same length. Assume load-file loads an indexed doc Assume malformed? tests a doc Assume process-doc takes a doc word as an input (two args) So something like this... (map process-doc (filter malformed? (map (memoize load-file) d)) w) Is this remotely close, or did I misinterpret your request? Sean On May 27, 2:11 pm, CuppoJava patrickli_2...@hotmail.com wrote: Hi, I have a little snippet of Java code that I want to express in Clojure. But all my attempts thus far have been much more unreadable than the equivalent Java. Some help would be greatly appreciated. d and w are arrays of integers, d: [0 0 0 0 0 1 1 1 1 2 2 3 3 3 3 3 4 4 ... ] w: [1 2 3 1 4 1 2 2 1 4 5 1 2 1 3 3 1 1 ... ] int doc = -1; for(int i=0 iw.length; i++){ //Load doc if not already loaded if(doc != d[i]){ doc = d[i]; load(doc); } //Stop if doc is malformed if(malformed(doc)) break; //Process word process(doc, w[i]); } Thank a lot for your help and insight. -Patrick -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Elegant way of expressing this in Clojure?
On May 27, 2010, at 1:11 PM, CuppoJava wrote: Hi, I have a little snippet of Java code that I want to express in Clojure. But all my attempts thus far have been much more unreadable than the equivalent Java. Some help would be greatly appreciated. It might help if we knew the purpose of your code. A higher-level approach might be appropriate, but it's hard to say without knowing what the code is for. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Elegant way of expressing this in Clojure?
Hi, (let [load (memoize load) mal-formed? (memoize mal-formed?)] (doseq [[doc word] (map vector (take-while (complement mal-formed?) (map load d)) w)] (process doc word))) In general it is a bad idea to *translate* code. If you really want to get the most from Clojure (or any other language for that matter) you should look at the big picture and try to do it in the idioms of the target language. Sincerely Meikel -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Which GUI toolkit would you like to see wrapped in an idiomatic Clojure library?
There are really only two mainstream options SWT and Swing. Both will suffice. I preferred SWT just because I like the Eclipse project. As you know SWT is the core GUI library behind SWT. I just feel that SWT has more large applications developed, Eclipse, azureus Swing can be frustrating for the most basic things like working with the layout manager and non-blocking calls. SWT provides mature widgets like the Web Browser widget, the text editor (JFaces), the calendar widget. But yea, Swing does work out of the box, cross platform. I am not really a GUI desktop developer, I like SWT slightly more but I do some quick apps with Swing. On May 27, 11:42 am, Stuart Halloway stuart.hallo...@gmail.com wrote: +1 Swing. +1 Swing. There's a ton of documentation out there, and it got some serious love from Sun between java 5 and 6. On May 27, 11:27 am, Laurent PETIT laurent.pe...@gmail.com wrote: Although I work with SWT at work, I would say Swing for 2 reasons : * no additional dependency for users of your lib, and *no need* for users of your lib to deliver different final apps binaries for different platforms * may be easier to work with in your implementation (?) 2010/5/27 Luke VanderHart luke.vanderh...@gmail.com My side project is a fairly complex GUI application written in Clojure. Recently, I've become irritated with using Java interop for everything. It's not that Clojure doesn't have nice java interop - it does. It's just that when interacting with a GUI framework, which is a large part of my app, I have to be back in mutable object-oriented land, worrying about class hierarchies, mutable state, locks, etc. Yucky. So, with a perhaps dangerous lack of sanity and without any guarantee of success, I've decided to try my hand at writing an idiomatic Clojure GUI library. If I have success (which I doubt) I will of course make it available as open source. I intend for it to be mostly declarative, with a nice DSL for defining GUI elements. Each component will also implement map, and use one of Clojure's reference types as an interface for inspecting / updating its state. I may also implement some aspects of Functional Reactive Programming wherever it's convenient to do so. What you all must help me decide is what GUI framework to use as the underpinnings of it. It's genuinely hard to decide. I have at least some experience with all of them, so I have no strong preference, but I'd like to get your input. I did consider trying to make it abstract enough that you could plug in *any* of them under the hood, but there's enough differences between the frameworks that that would get very ugly very fast. Possibilities are: AWT Pros: native widgets, bundled with Java, low-level Cons: few widgets, considered somewhat obselete Swing Pros: bundled with Java, good widget selection Cons: non-native widgets SWT Pros: native widgets, widely used Cons: requires platform-specific libs QT Jambi Pros: native widgets, huge widget selection, highly-regarded framework Cons: requires platform-specific libs, writing custom widgets is hairy, momentum and support seem to be lagging since Nokia dropped official support. Remember, the actual API won't matter - that will be completely abstracted away. So try to focus on the framework's look and feel. Also let me know if I've missed any of the framework's key characteristics. Thanks! -Luke -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Announcement: SLIME hints blog series
Hi everyone, I've started a series of short (ish) blog posts regarding SLIME (The Superior Lisp Interaction Mode for Emacs). Mostly just highlighting simple stuff that makes working with SLIME a little bit nicer. I try to keep it Lisp-agnostic, but since I'm working almost exclusively with Clojure, some clojure-specific stuff might turn up as well. I've got a few more posts planned at the moment, and I don't know how long the series is going to be, so any remarks or suggestions are welcome. Please note that I've got comments switched off on the blog because of spam, so either send me an email or reply to this thread if you've got something to say :) You can find all the posts in the series in reverse chronological order at the following URL. http://joost.zeekat.nl/category/slime-hints/ Cheers, Joost. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Which GUI toolkit would you like to see wrapped in an idiomatic Clojure library?
+1 Swing. SWT comes with far to many deployment headaches. +1 Swing. +1 Swing. There's a ton of documentation out there, and it got some serious love from Sun between java 5 and 6. On May 27, 11:27 am, Laurent PETIT laurent.pe...@gmail.com wrote: Although I work with SWT at work, I would say Swing for 2 reasons : * no additional dependency for users of your lib, and *no need* for users of your lib to deliver different final apps binaries for different platforms * may be easier to work with in your implementation (?)-- ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining bschlin...@gmail.com -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Newbie (with no Java experience) - how best to learn?
Hallo, What real helped me to start thinking in The Clojure Way are the Talks that Rich gave. You can find some of them here http://clojure.blip.tv/posts?view=archivensfw=dc I think you should check out the Clojure for Lisp Porgrammers Part 1 and 2. In talks he goes deeper because he does not have to explain al the Basics of Lisp (like he head to in Clojure for Java Programmer) The others like Clojure Sequences, Clojure Data Structures or Clojure Concurrency and the really interesting too. Then there are a couple of talks online on InfoQ. Here some links I looked up but there is more. http://www.infoq.com/interviews/hickey-clojure http://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hickey On 27 Mai, 13:53, Paul Moore p.f.mo...@gmail.com wrote: Hi, I'm new to Clojure, and looking for the best way to get going. I've got a pretty broad experience of various programming languages (C, Python, Lua, Factor, JavaScript, Haskell, Perl, ...) including a bit of experience with Lisp-like languages, so the language itself isn't likely to be a huge problem for me. But I've no background with Java (beyond a few toy programs, and knowing the syntax) so the environment (classpaths, compiling, where to find libraries, performance, JVMs, etc) is pretty much a mystery to me. I've browsed a bit online, read some of the wikibook articles, and Mark Volkmann's excellent summary, but I'd like to dig a bit deeper (as I say, particularly around libraries and environment, less on how to program in a lisp-like language). Ideally, in a form that I can read offline (printable/PDF documents, or books) as I've got limited free time I can spend in front of a computer screen. I've got a sample program I have tried porting from Python - the experience was interesting, but limited (the core of the relatively complex multithreaded database monitoring process converted to 47 lines of Clojure...!!!) Has anybody got any good suggestions as to where I should go next? I've considered getting one of the Manning books (The Joy of Clojure or Clojure in Action) but I'm not sure which would be better for me - they seem broadly similar, with Clojure in Action looking like a slightly better fit for my needs, but I'd appreciate any comments/recommendations). Also, I wonder whether there's some Java-based documentation that would be worth my while investigating. I suspect that it'd be very easy to get sucked into a huge amount of detail which is only tangentially related at best, but I'm sure an overview would help. Thanks for any suggestions, Paul. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Newbie (with no Java experience) - how best to learn?
Is there a wiki where all these info sources could be collected please? Sounds really quite useful to the newbie. regards On 27 May 2010 20:06, nickikt nick...@gmail.com wrote: Hallo, What real helped me to start thinking in The Clojure Way are the Talks that Rich gave. You can find some of them here http://clojure.blip.tv/posts?view=archivensfw=dc I think you should check out the Clojure for Lisp Porgrammers Part 1 and 2. In talks he goes deeper because he does not have to explain al the Basics of Lisp (like he head to in Clojure for Java Programmer) The others like Clojure Sequences, Clojure Data Structures or Clojure Concurrency and the really interesting too. Then there are a couple of talks online on InfoQ. Here some links I looked up but there is more. http://www.infoq.com/interviews/hickey-clojure http://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hickey On 27 Mai, 13:53, Paul Moore p.f.mo...@gmail.com wrote: Hi, I'm new to Clojure, and looking for the best way to get going. I've got a pretty broad experience of various programming languages (C, Python, Lua, Factor, JavaScript, Haskell, Perl, ...) including a bit of experience with Lisp-like languages, so the language itself isn't likely to be a huge problem for me. But I've no background with Java (beyond a few toy programs, and knowing the syntax) so the environment (classpaths, compiling, where to find libraries, performance, JVMs, etc) is pretty much a mystery to me. I've browsed a bit online, read some of the wikibook articles, and Mark Volkmann's excellent summary, but I'd like to dig a bit deeper (as I say, particularly around libraries and environment, less on how to program in a lisp-like language). Ideally, in a form that I can read offline (printable/PDF documents, or books) as I've got limited free time I can spend in front of a computer screen. I've got a sample program I have tried porting from Python - the experience was interesting, but limited (the core of the relatively complex multithreaded database monitoring process converted to 47 lines of Clojure...!!!) Has anybody got any good suggestions as to where I should go next? I've considered getting one of the Manning books (The Joy of Clojure or Clojure in Action) but I'm not sure which would be better for me - they seem broadly similar, with Clojure in Action looking like a slightly better fit for my needs, but I'd appreciate any comments/recommendations). Also, I wonder whether there's some Java-based documentation that would be worth my while investigating. I suspect that it'd be very easy to get sucked into a huge amount of detail which is only tangentially related at best, but I'm sure an overview would help. Thanks for any suggestions, Paul. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- Dave Pawson XSLT XSL-FO FAQ. Docbook FAQ. http://www.dpawson.co.uk -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Elegant way of expressing this in Clojure?
The purpose is quite straightforward. I just have to call process() on every word in the w and d array. But I don't want to load docs if they have already been loaded. And I want to stop when it hits the first malformed document. Thanks for the help. Is there a nice efficient way of doing it with loop and recur? The proposed solutions are quite expensive as written as compared to the Java equivalent. -Patrick -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: promoting contrib.string to clojure, feedback requested
You also mention making the string argument first in some of these fns. I believe Will Smith's catch phrase says it best: Aw hell no. String fns are like any other seq fn, and they need to be partial'ed, comp'ed and chained appropriately. I can't even begin to count the number of point free string processing routines I have. Will Smith rarely loses out, especially in summer blockbuster season, but you and he are going to be disappointed on this one. String functions will take strings first, per e.g. [1] http://groups.google.com/group/clojure/browse_frm/thread/8b2c8dc96b39ddd7/3a2b131c225677d7 Stu -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Elegant way of expressing this in Clojure?
Hi, On Thu, May 27, 2010 at 12:07:30PM -0700, CuppoJava wrote: Thanks for the help. Is there a nice efficient way of doing it with loop and recur? The proposed solutions are quite expensive as written as compared to the Java equivalent. No, thanks to memoize my solution does what you want. It loads each document only once. It short-circuits on mal-formed? (in case it is expensive). And it stops as soon as a mal-formed document is found (or the document list is exhausted). Do you have a benchmark, which shows how expensive the solutions are compared to the Java version? Sincerely Meikel -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: promoting contrib.string to clojure, feedback requested
On Thu, May 27, 2010 at 19:28, Sean Devlin francoisdev...@gmail.com wrote: Oh, and following the tradition of clojure.java.io, you'll probably want to name it clojure.java.string, since it relies heavily on interop. If bits of Java poke through the public interface, yes. This is certainly the case for clojure.java.io. But, I can't see a reason the public interface of something as simple and well-understood as strings needs to be host-platform specific. I wouldn't want to see the string library shunted off into the java-only ghetto without good reason. // ben -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Elegant way of expressing this in Clojure?
2010/5/27 CuppoJava patrickli_2...@hotmail.com The purpose is quite straightforward. I just have to call process() on every word in the w and d array. But I don't want to load docs if they have already been loaded. And I want to stop when it hits the first malformed document. Thanks for the help. Is there a nice efficient way of doing it with loop and recur? The proposed solutions are quite expensive as written as compared to the Java equivalent. -Patrick If you really have to keep this mutable for some reason (may I guess performance concerns. Premature, or already measured ?) : Here is my attempt, with this additional trick: since you want to stay in the mutable world, embrace it even more, and make the load() method take care of optimizing the load. If you can't touch the load method, then just add a slight wrapper around it, say load2. Also, let us make some use of the load2 return value. Say it will logical true if not malformed, or logical false if malformed. the code then becomes: (loop [i 0] (let [doc (aget d i)] (when (load2 doc) (process doc (aget w i)) (recur (inc i and load2 could be written like this: (with-local-vars [previous-doc -1] (defn load2 [doc] (if (= (var-get previous-doc) doc) true (do (var-set previous-doc doc) (load doc) (not (malformed doc) I left as an exercise to the reader the correct addition of primitive type hints :) Not that I would encourage this style of programming, of course :) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Elegant way of expressing this in Clojure?
Your solution is very clear Meikel. I don't have a benchmark. I'm just worried about the overhead of creating seqs. You use two map's and one vector (which each create a seq I think). The array's will be several gigabytes in size so it might build up. I forgot to mention that documents can only be loaded in one at a time. Loading a new document releases the currently loaded document. So memoize won't quite work. But I can figure out the details myself. Thanks for the help -Patrick On May 27, 3:24 pm, Meikel Brandmeyer m...@kotka.de wrote: Hi, On Thu, May 27, 2010 at 12:07:30PM -0700, CuppoJava wrote: Thanks for the help. Is there a nice efficient way of doing it with loop and recur? The proposed solutions are quite expensive as written as compared to the Java equivalent. No, thanks to memoize my solution does what you want. It loads each document only once. It short-circuits on mal-formed? (in case it is expensive). And it stops as soon as a mal-formed document is found (or the document list is exhausted). Do you have a benchmark, which shows how expensive the solutions are compared to the Java version? Sincerely Meikel -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: promoting contrib.string to clojure, feedback requested
Stu Halloway, I used the reasoning from your thread to convince Stuart Sierra to switch argument order between str-utils2 str-utils3: http://groups.google.com/group/clojure-dev/browse_thread/thread/7ab69b1d43012917 Args go last. Sean On May 27, 3:16 pm, Stuart Halloway stuart.hallo...@gmail.com wrote: You also mention making the string argument first in some of these fns. I believe Will Smith's catch phrase says it best: Aw hell no. String fns are like any other seq fn, and they need to be partial'ed, comp'ed and chained appropriately. I can't even begin to count the number of point free string processing routines I have. Will Smith rarely loses out, especially in summer blockbuster season, but you and he are going to be disappointed on this one. String functions will take strings first, per e.g. [1]http://groups.google.com/group/clojure/browse_frm/thread/8b2c8dc96b39... Stu -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Elegant way of expressing this in Clojure?
Of course my code below will inevitably throw ArrayIndexOfBoundExceptions if no document is malformed ! I let you figure out how to place the correct loop stopper. 2010/5/27 Laurent PETIT laurent.pe...@gmail.com 2010/5/27 CuppoJava patrickli_2...@hotmail.com The purpose is quite straightforward. I just have to call process() on every word in the w and d array. But I don't want to load docs if they have already been loaded. And I want to stop when it hits the first malformed document. Thanks for the help. Is there a nice efficient way of doing it with loop and recur? The proposed solutions are quite expensive as written as compared to the Java equivalent. -Patrick If you really have to keep this mutable for some reason (may I guess performance concerns. Premature, or already measured ?) : Here is my attempt, with this additional trick: since you want to stay in the mutable world, embrace it even more, and make the load() method take care of optimizing the load. If you can't touch the load method, then just add a slight wrapper around it, say load2. Also, let us make some use of the load2 return value. Say it will logical true if not malformed, or logical false if malformed. the code then becomes: (loop [i 0] (let [doc (aget d i)] (when (load2 doc) (process doc (aget w i)) (recur (inc i and load2 could be written like this: (with-local-vars [previous-doc -1] (defn load2 [doc] (if (= (var-get previous-doc) doc) true (do (var-set previous-doc doc) (load doc) (not (malformed doc) I left as an exercise to the reader the correct addition of primitive type hints :) Not that I would encourage this style of programming, of course :) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Elegant way of expressing this in Clojure?
Hi, On Thu, May 27, 2010 at 12:33:20PM -0700, CuppoJava wrote: Your solution is very clear Meikel. I don't have a benchmark. I'm just worried about the overhead of creating seqs. You use two map's and one vector (which each create a seq I think). The array's will be several gigabytes in size so it might build up. No problem due to laziness. d as well as w will only be traversed once. I forgot to mention that documents can only be loaded in one at a time. Loading a new document releases the currently loaded document. So memoize won't quite work. But I can figure out the details myself. memoize will work as long as d is sorted, ie. your 0 0 0 1 1 1 blocks won't repeat eg. like 0 0 1 1 1 0 1 0 2 ... Sincerely Meikel -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Elegant way of expressing this in Clojure?
Hi Meikel, 2010/5/27 Meikel Brandmeyer m...@kotka.de Hi, On Thu, May 27, 2010 at 12:33:20PM -0700, CuppoJava wrote: Your solution is very clear Meikel. I don't have a benchmark. I'm just worried about the overhead of creating seqs. You use two map's and one vector (which each create a seq I think). The array's will be several gigabytes in size so it might build up. No problem due to laziness. d as well as w will only be traversed once. But you will still have the cost of creating 2 or 3 times several millions of Seq objects, even if they are quickly made GCable. I forgot to mention that documents can only be loaded in one at a time. Loading a new document releases the currently loaded document. So memoize won't quite work. But I can figure out the details myself. memoize will work as long as d is sorted, ie. your 0 0 0 1 1 1 blocks won't repeat eg. like 0 0 1 1 1 0 1 0 2 ... The OP said that arrays will be several gigabytes in size, so even if the set of different docs in much less than that by an order of magnitude (or even 2), memoizing a million of docs and then being forced to kill the VM may not be an option for him ! -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: No matching method found for javax.mail.internet.MimeMessage
This actually helped alot, here is the relevant excerpt (defn plain- message). It is rewritten the original way I wanted to do it. Here it is: (defn plain-message [{:keys [from to cc bcc subject body]}] (doto (new MimeMessage (get-default-session)) (.setRecipients Message$RecipientType/TO (into-array Address to)) (.setRecipients Message$RecipientType/CC (into-array Address cc)) (.setRecipients Message$RecipientType/BCC (into-array Address bcc)) (.setFrom from) (.setSubject subject) (.setContent body text/plain))) On May 27, 8:09 am, Aaron Cohen aa...@assonance.org wrote: On Thu, May 27, 2010 at 11:07 AM, Aaron Cohen aa...@assonance.org wrote: Judging from the javadoc, setRecipients takes an array of addressses as its second parameter. So try (into-array to), (into-array for), etc. Or rather: (into-array [to]). You may need to specify the type which would be: (into-array Address [to]) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: No matching method found for javax.mail.internet.MimeMessage
This actually helped alot, here is the relevant excerpt (defn plain- message). It is rewritten the original way I wanted to do it. Here it is: (defn plain-message [{:keys [from to cc bcc subject body]}] (doto (new MimeMessage (get-default-session)) (.setRecipients Message$RecipientType/TO (into-array Address to)) (.setRecipients Message$RecipientType/CC (into-array Address cc)) (.setRecipients Message$RecipientType/BCC (into-array Address bcc)) (.setFrom from) (.setSubject subject) (.setContent body text/plain))) On May 27, 8:09 am, Aaron Cohen aa...@assonance.org wrote: On Thu, May 27, 2010 at 11:07 AM, Aaron Cohen aa...@assonance.org wrote: Judging from the javadoc, setRecipients takes an array of addressses as its second parameter. So try (into-array to), (into-array for), etc. Or rather: (into-array [to]). You may need to specify the type which would be: (into-array Address [to]) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: No matching method found for javax.mail.internet.MimeMessage
I did try adding type hints and the doto style initially although my type is [InternetAddress], not string. On May 27, 8:09 am, Sean Devlin francoisdev...@gmail.com wrote: Have you tried adding type hints? Sometimes reflection confuses the JVM with interop, especially when there is ambiguity in the type. This is the case for setRecipients. Oh, you'll want to use a doto form as well in plain-message, such as this: (defn plain-message [{:keys [from to cc bcc subject body]}] (doto (MimeMessage. (get-default-session)) (setRecipients Message$RecipientType/TO ^String to) (setRecipients Message$RecipientType/CC ^String cc) (setRecipients Message$RecipientType/BCC ^String bcc) (setFrom from) (setSubject subject) (setContent body text/plain))) Hope that helps, Sean On May 27, 10:45 am, Matthew Elder sse...@gmail.com wrote: Clojure Users: Could anyone please help me with the problem I am having here? http://clojure.pastebin.com/yR6yPQha Essentially I am running into a situation where the interop operator '.' doesn't work for some instance methods of javax.mail.internet.MimeMessage. I have tried various different constructs and methods but I always get the same exception: No matching method found: setRecipients for class javax.mail.internet.MimeMessage - I have tried using clojure 1.1/contrib 1.1 and also now clojure 1.2 snapshot/contrib 1.2 snapshot - version: Java(TM) SE Runtime Environment (build 1.6.0_16-b01) Windows XP SP3 - I am retrieving jars via lein (project.clj included in pastebin) Any help is appreciated! Thanks, Matthew Elder Novice Clojure Programmer -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Newbie (with no Java experience) - how best to learn?
On 27 May 2010 18:26, Sean Devlin francoisdev...@gmail.com wrote: I make them available CC BY-NC-SA, so download away. You'll need a vimeo account (free) to download them, though. Ah, I hadn't realised that signing up got a download option. Thanks! Paul. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
M-X slime
Hello Guys! Yes, i know that i can run lein swank in my project directory and then use M-X + slime-connect in emacs. But all the time with clojure 1.1.0 i used this procedure: M-X cd to project directory and them just M-X slime (classpath is set relative to current emacs dir, so it finds swank-clojure.jar in lib directory). I feel myself very comfortable with that sequence and don't want to change it. Can somebody help me to make my M-X + slime works again, because i don't want to have additional step with lein swank in console. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Tutorial recommendations for C++ programmers?
Good afternoon list, Can anyone recommend me a good tutorial for getting started with Clojure for C++ programmers? I am new to LISP and I mostly use VIM as my editor. Cheers, Daniel -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Tutorial recommendations for C++ programmers?
Hi, http://www.assembla.com/wiki/show/clojure/Getting_Started_with_Vim Sincerely Meikel -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Any issues with launching in clojure, calling Java code, Java code calling clojure
I enjoy clojure and I think I am breaking all the rules. I have an app that I originally created in clojure. It has been a year off and on. And I merged that code with some existing java database code. The clojure code invokes the java code. Now, I want to have a script environment where users can invoke their own clojure code. But I was think the clojure code should run in a completely new, separate environment, via a thread. Basically. 1. Clojure is invokved (clojure.main) 2. I have clojure code that invokes code originally written in Java 3. That java code creates another separate clojure instance, parsing a clojure script. (an embedded dsl) It isn't that confusing. It is almost akin to invoking a JSP page from a running web server. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Which GUI toolkit would you like to see wrapped in an idiomatic Clojure library?
+1 For swing especially since I started this already. Look for clj-swing in github, since this seems quite a load of work I'd be glad for any help so :). Regards, Heinz On May 27, 2010, at 21:30 , Luc Préfontaine wrote: +1 for Swing. On Thu, 2010-05-27 at 11:59 -0700, Brian Schlining wrote: +1 Swing. +1 Swing. +1 Swing. There's a ton of documentation out there, and it got some -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: do clojure and la(tex) have something in common ?
On Thu, 27 May 2010 09:47:58 -0400 Tim Daly d...@axiom-developer.org wrote: Bill Hart, from the Sage project, said: Another thing I've been enjoying lately is literate programming. Amazingly it turns out to be faster to write a literate program than an ordinary program because debugging takes almost no time. (http://axiom-developer.org/axiom-website/documentation.html) so on balance it might be ~1.5 rather than 3. Who knows? Since the discussion of literate programming has continued, I'll chip in and say that I think Tim has understated the case for it, and Bill mentions part of why that is. Literate programming isn't about creating a program that can live forever; it's about communicating the workings of the program to readers. If your readers are people decades in the future, then your result is programs that live forever. If your readers are everyone else who can see the source, then your result is programs that are easy for others to understand and extend. If your reader is you, as you write the program, then your result is programs that have fewer bugs in their first incarnation - which is the point Bill brought up. Chances are, you don't know who the readers of your program are going to be, so you can potentially get all those benefits. mike P.S. Of course, you don't have to use literate programming to get two of these results: Unix is 40 years old, and probably not the oldest code in production; NASA and the airline industry regularly turn out code that's got bug counts comparable to the best literate programs. -- Mike Meyer m...@mired.org http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O ascii ribbon campaign - stop html mail - www.asciiribbon.org -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Which GUI toolkit would you like to see wrapped in an idiomatic Clojure library?
Thanks, Heinz... I may. Right now I'm still exploring what I want the API to be. I was hoping to achieve something a bit thicker that could insulate the user from Java classes completely. The user wouldn't even have to know Swing or handle JObjects or worry about the event thread... In other words, it wouldn't be a wrapper API for Swing, but a Clojure GUI api that, coincidentally, is /backed/ by Swing. This may be an unrealistic goal, but I've got pretty far down the path of designing it, though I definitely don't want to declare victory until I've figured out a strategy for covering every reasonably common use case. -Luke On May 27, 5:54 pm, Heinz N. Gies he...@licenser.net wrote: +1 For swing especially since I started this already. Look for clj-swing in github, since this seems quite a load of work I'd be glad for any help so :). Regards, Heinz On May 27, 2010, at 21:30 , Luc Préfontaine wrote: +1 for Swing. On Thu, 2010-05-27 at 11:59 -0700, Brian Schlining wrote: +1 Swing. +1 Swing. +1 Swing. There's a ton of documentation out there, and it got some -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Mersenne Twister
I want to write a reasonably high-performance simulation program in Clojure. For the random numbers, I'd prefer to use Mersenne Twister (for a number of reasons - it's a well-known, good RNG, and it's commonly used in a number of other languages I use, so it's a good baseline for comparing implementations). The Java RNG, which Clojure uses, is not MT, but Knuth's linear congruential RNG. Can someone recommend a good Mersenne Twister implementation I could use? A web search finds a number of implementations in Java - presumably I can use these via Java interop - is that a sensible thing to do? I'm also looking to parallelise my simulation, so I'd want to have multiple threads all generating random numbers. I'm not an expert in this field, if I just naively generate random numbers in multiple threads is that OK, or could it compromise the randomness? If there is an issue, has anyone got a pointer to a thread-safe MT implementation that I could use? Thanks, Paul. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Elegant way of expressing this in Clojure?
Thanks Laurent! I'll stick to that for now then. On May 27, 3:56 pm, Laurent PETIT laurent.pe...@gmail.com wrote: 2010/5/27 CuppoJava patrickli_2...@hotmail.com Laurent's solution will be suitable for my purposes. I really do need to stay in the mutable world for this application. The Java code is already pushing the limits of acceptable computation time. Just a small question: What is the best performing mutable box that I can use to hold a primitive integer? Laurent uses a local-var. There's also atoms, refs, arrays ...? I'd say an array of one element ? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Which GUI toolkit would you like to see wrapped in an idiomatic Clojure library?
Remember, the actual API won't matter - that will be completely abstracted away. So try to focus on the framework's look and feel. Thanks! -Luke SWT, because of the native look and feel. I really don't like the looks of Swing. As a user of some Swing app, I don't find solace from thinking how convenient it was for the programmers to deliver that thing to me. As a developer, dealing with the packaging/deployment just comes with the job and the results, I think, are well worth the effort. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Which GUI toolkit would you like to see wrapped in an idiomatic Clojure library?
On 28/05/2010, at 9:21 AM, Armando Blancas wrote: Remember, the actual API won't matter - that will be completely abstracted away. So try to focus on the framework's look and feel. Thanks! -Luke SWT, because of the native look and feel. I really don't like the looks of Swing. As a user of some Swing app, I don't find solace from thinking how convenient it was for the programmers to deliver that thing to me. As a developer, dealing with the packaging/deployment just comes with the job and the results, I think, are well worth the effort. +1 SWT. I think arguments that focus on the ease of deployment are misguided because an app is *used* far more times than it is deployed, so one really should focus on the quality of the end application. In any case, deployment and packaging for different platforms is easy to automate. Antony Blakey -- CTO, Linkuistics Pty Ltd Ph: 0438 840 787 The trouble with the world is that the stupid are cocksure and the intelligent are full of doubt. -- Bertrand Russell -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Which GUI toolkit would you like to see wrapped in an idiomatic Clojure library?
Swing seems like a proof of concept UI toolkit. SWT just seems a bit more polished and easier to develop, working apps. That is just an opinion and I like that Swing is built-in. On May 27, 8:13 pm, Antony Blakey antony.bla...@gmail.com wrote: On 28/05/2010, at 9:21 AM, Armando Blancas wrote: Remember, the actual API won't matter - that will be completely abstracted away. So try to focus on the framework's look and feel. Thanks! -Luke SWT, because of the native look and feel. I really don't like the looks of Swing. As a user of some Swing app, I don't find solace from thinking how convenient it was for the programmers to deliver that thing to me. As a developer, dealing with the packaging/deployment just comes with the job and the results, I think, are well worth the effort. +1 SWT. I think arguments that focus on the ease of deployment are misguided because an app is *used* far more times than it is deployed, so one really should focus on the quality of the end application. In any case, deployment and packaging for different platforms is easy to automate. Antony Blakey -- CTO, Linkuistics Pty Ltd Ph: 0438 840 787 The trouble with the world is that the stupid are cocksure and the intelligent are full of doubt. -- Bertrand Russell -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Which GUI toolkit would you like to see wrapped in an idiomatic Clojure library?
Personally, I prefer SWT over Swing mostly because seems a lot more useful and a little more responsive to the user. But then I think Swing is horrible and SWT is just a bit better. I seriously prefer Tk over both (except for the file selection dialogs on Unix). Consider this a + vote for SWT and possibly QT. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: do clojure and la(tex) have something in common ?
See http://www-sop.inria.fr/members/Manuel.Serrano/scribe/ On May 23, 6:55 am, faenvie faen...@googlemail.com wrote: today i read this statement in a blog-post: ... remarkably (La)TeX is much better suited for composing and distributing most types of documents than any other modern word processor on the market that I am aware of. Just like programming languages tend to converge towards Lisp because it got things right the first time around, so do the Word Processors tend to converge towards (La)TeX. what about combining (la=)tex and clojure for implememting extraordinary document-processing ? either by run (A) Clojure scripts from (La)TeX documents and use Clojures output to generate document's content. This can be used to read/convert data, generate tables and figures, do on-the-fly calculations. or by (B) implementing a clojure-based DSL that can produce (La)Tex documents. any thoughts ? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
[ann] ILC-2010
Greetings, The ALU is pleased to announce that the International Lisp Conference 2010 (ILC-2010) will be held mid October in Reno, Nevada. ILC-2010 will be colocated with OOPSLA/SPLASH. http://splashcon.org/ Colocated conferences allow people to explore other sessions; but the ILC itself will be the same independent, lisp-intensive event you've grown to love. More announcements, including the ILC conference website and call for papers, will appear in the coming weeks. Sincerely, p.p. Daniel Herring ALU Board of Directors -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Anyone experienced in using clojure as a database
On Thu, May 27, 2010 at 3:36 PM, Erik Söhnel eriksoeh...@googlemail.com wrote: Got something around, this is my 3rd or 4th attempt to provide a relational datastructure for clojure. I've often found myself in situations, where I needed some kind of table and look up rows by more than one key, hashmaps don't fit that well. They are simply different abstractions. Perhaps at some point general purpose languages will start embedding table/relation types, just like it has happened for hashmaps or sets. There is no one size fits all but there is still a merit for having a reasonable default implementation deeply embedded in the language (just like seqs, vectors, maps are in Clojure), especially if they happen to free people from thinking about side effects. http://gist.github.com/415538 - basically is a hashmap which pretends being a set, and lets you access all 'rows'. Indexes (sorted, hash- map ...), except the primary one, are optional but will of course speed up lookup operations. I have not bothered about persistence yet, maybe in the future, there will be some interface to hook into the clojure STM, or Cells will be become available. I haven't had a chance to play with your code yet but at first glance it looks good. Does the above mean that all set operations are automatically supported and the accelerated? Do you think it is possible to implement join/union etc so that they produce lazy relations (or just lazy-seq of rows)? That would be very useful in many common use cases (instead of cursors). As for the storage persistence - that's a low priority (at least for me), but it would be good to have at least some method for tying a relation to such storage (like a tie function in Perl). Can you tell me more about these hooks to Clojure STM and Cells? Thanks, Andrzej -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Which GUI toolkit would you like to see wrapped in an idiomatic Clojure library?
Why not design it so that it can be backed by Swing or SWT or HTML (perhaps with some AJAX) or whatever? It seems kind of silly to do an abstraction on a single backend, don't you think? On May 27, 4:37 pm, Luke VanderHart luke.vanderh...@gmail.com wrote: Thanks, Heinz... I may. Right now I'm still exploring what I want the API to be. I was hoping to achieve something a bit thicker that could insulate the user from Java classes completely. The user wouldn't even have to know Swing or handle JObjects or worry about the event thread... In other words, it wouldn't be a wrapper API for Swing, but a Clojure GUI api that, coincidentally, is /backed/ by Swing. This may be an unrealistic goal, but I've got pretty far down the path of designing it, though I definitely don't want to declare victory until I've figured out a strategy for covering every reasonably common use case. -Luke On May 27, 5:54 pm, Heinz N. Gies he...@licenser.net wrote: +1 For swing especially since I started this already. Look for clj-swing in github, since this seems quite a load of work I'd be glad for any help so :). Regards, Heinz On May 27, 2010, at 21:30 , Luc Préfontaine wrote: +1 for Swing. On Thu, 2010-05-27 at 11:59 -0700, Brian Schlining wrote: +1 Swing. +1 Swing. +1 Swing. There's a ton of documentation out there, and it got some -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Any issues with launching in clojure, calling Java code, Java code calling clojure
The issue that you'll run into is that there is one lexical scope that is shared by all calls to Clojure. The only ways around this are (1) run it in another process, and (2) load the Clojure JARs into a ClassLoader at runtime, and throw the ClassLoader away after every call. The overhead for option 2 is between 0.5 and 1 second per call, because Clojure has to be re-inited. For option 1, it's even more because you are starting Java, then initing Java. Threads have nothing to do with the Clojure lexical scoping. If you run 100 threads, they normally all share the same variables, namespaces, and functions. For more info, you can check out http://sandflea.googlecode.com/svn/site/maven-clojure-plugin/1.1.0/clojure-commons/apidocs/index.html?sandflea/clojure/scripting/ClojureScripting.html (http://code.google.com/p/sandflea/source/browse/maven-clojure-plugin/ trunk/clojure-commons/src/main/java/sandflea/clojure/scripting/ ClojureScripting.java). On May 27, 3:46 pm, BerlinBrown berlin.br...@gmail.com wrote: I enjoy clojure and I think I am breaking all the rules. I have an app that I originally created in clojure. It has been a year off and on. And I merged that code with some existing java database code. The clojure code invokes the java code. Now, I want to have a script environment where users can invoke their own clojure code. But I was think the clojure code should run in a completely new, separate environment, via a thread. Basically. 1. Clojure is invokved (clojure.main) 2. I have clojure code that invokes code originally written in Java 3. That java code creates another separate clojure instance, parsing a clojure script. (an embedded dsl) It isn't that confusing. It is almost akin to invoking a JSP page from a running web server. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Which GUI toolkit would you like to see wrapped in an idiomatic Clojure library?
Why not design it so that it can be backed by Swing or SWT or HTML (perhaps with some AJAX) or whatever? It seems kind of silly to do an abstraction on a single backend, don't you think? Ideally, yes. In practice, I'd rather implement one framework well than implement only the lowest common denominator of several. We're not just talking creating a window with menus and a few buttons - My project, for example, is a word processor. Having a requirement that it work across multiple GUI toolkits sounds a little bit hellish. That said, I do plan the core API to be abstract enough from the underlying implementation that it could in theory be backed by a different framework. I just don't intend to do the work of providing bindings to multiple implementations and ensuring that behavior is consistent. If some enterprising soul wants to use the same basic interfaces to front an alternative implementation, I'll certainly try to make it conducive to that. But having a API with seamlessly interchangeable back-ends doesn't sound very feasible. By the way, do the SWT people only come out at night? Or is it a US vs Europe issue? Seems somewhat curious that 7 in a row vote for Swing, then the next 4 are all SWT advocates. Should I expect the QT fans to show up tomorrow? :p -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Todo item annotation in Clojure.
ka: I must admit I use Emacs, and I wouldn't know how to integrate it into eclipse. If anybody else have any suggestions on how to accomplish this they are more than welcome to take a look or drop a line. Patrik: My bad, new jar uploaded. Have fun :D Thanks for the feedback! Thomas On May 27, 1:40 pm, Patrik Fredriksson patri...@gmail.com wrote: Nice! The version at Clojars seems to be missing the Leiningen plugin, could you please upload a new version? Many thanks! /Patrik On May 26, 9:27 pm, Thomas thomas.g.kristen...@gmail.com wrote: Thanks to sids, the project now has lein todo functionality. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en