Re: ANN: Clojure Libraries
Another correction: there are too fleet mentions: http://clojure-libraries.appspot.com/show/27049 http://clojure-libraries.appspot.com/show/32017 On Wed, Mar 2, 2011 at 1:00 AM, Glen Stampoultzis gst...@gmail.com wrote: Changed. 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: Serialising functions...
So, Just a quick update. I gave the client-side ClassLoader encapsulation idea some more thought and rejeted it (sorry) for the reasons that : - I've lived through J2EE ClassLoader hell and don't want to repeat the experience - I'm looking towards an architecture where I can define new types on any node of my Clojure data-grid and have them accessible in any other node. This might be done by keeping my class-name:bytecode table in a clustered cache and inserting a single ClusteredClassLoader (NYI) into the client's ClassLoader hierarchy. Each client would be able to mix classes from multiple server JVMs without having to be concerned about keeping them all segregated. So, I introduced the concept of a per-jvm id and hacked it into RT, Compiler and LispReader. There were not too many places that needed to be changed. The result is, I can now create a type in one jvm, create an instance of the type, serialise it, ship the bytes to another jvm and deserialise it, at which point the instance's class is pulled from the original jvm. No more nasty exceptions because of name collisions etc. I have plumbed this infrastructure in underneath my app and, with the exception of some unrelated bugs that I am chasing down, everything seems to work beautifully :-) There are some limitations with this technique that I haven't looked into too deeply yet - the most obvious one is that whilst remote types can be made available within a local jvm, this is only at the java level, so extra things that defrecord might do for you like intern the classname as a symbol in your current namespace are not being done - which, I can currently live with, but I can see this being a tripping point to a completely transparent solution. For me, this is a great leap forward as I have found each Clojure JVM an island until I got this working, but now I should be able to build a distributed app in Clojure without having to sacrifice Clojure's dynamicity in the process - I can have my cake and eat it :-) I'm going to play with it for a few days, iron out all my other issues and investigate exactly what I have achieved, then I will post back a proper description in case anyone else is trying to build distributed Clojure apps in a similar manner. cheers Jules On Mar 3, 2:30 pm, Jules jules.gosn...@gmail.com wrote: On Mar 3, 1:22 pm, Alessio Stalla alessiosta...@gmail.com wrote: On Thursday, March 3, 2011 11:46:03 AM UTC+1, Jules wrote: Thanks, Alessio, I did know this, but it is a welcome addition to the thread. Ok. Classloaders are a tricky matter and many people don't have clear ideas about them - sorry for assuming you were one of those people :) np :-) I reread my last posting and it was a bit confused - I've done a little research in the Compiler class and can now clarify what I think is happening. Clojure 1.3.0-alpha4 user= (type (fn [])) user$eval1$fn__2 user= Here I have created a new function and asked it for its class. Clojure has emitted bytecode on the fly to implement this and packed this into a Java Class. A Class has a name unique - as you pointed out - within its ClassLoader, so to avoid name collisions, Clojure attempts to create a unique name for the class. This is composed, amongst other things from its namespace and RT.nextID() (I'm assuming RT = RunTime). RT.nextID seems to start at 0 and allocate ids sequentially - lets create another fn : user= (type (fn [])) user$eval5$fn__6 user= I suspect that the gap between 2 and 6 is due to other processes going on behind the scenes which require ids, rather than some intentional design - but haven't checked. This all works fine in a single JVM - no two functions will end up creating types with the same name - however if I take the class for a function from [a ClassLoader in] one clojure runtime and copy it across to another clojure runtime that has already allocated this classes id to another [in the receiving ClassLoader] then I would see a collision. I think that this is what is happening above. I am serialising an object in one jvm, putting it into a message and sending the message to another jvm. Upon receipt I attempt to deserialise the object contained in the message. This involves looking up its class by name [within the scope of a ClassLoader] - but the name has already been allocated to a local class [within the same ClassLoader] which is mistakenly then used to try to deserialise the object. The object's data is not presented in the format that the local class expects for one of its own instances - hence the Exception in my posting above. This is currently only theory. Makes sense. I think that the easiest way to fix it is to use not just a jvm-local uid as part of the class name, but also an id which uniquely identifies this jvm amongst all the jvms involved in my cluster. It looks like not too many
Re: unchecked-divide etc being replaced in 1.3 - no more support for longs?
On Mar 2, 2:05 am, Jason Wolfe ja...@w01fe.com wrote: But I don't know what the plan is if you really do want truncating arithmetic on longs. On 1.3 alpha 4: user= (+ Long/MAX_VALUE Long/MAX_VALUE) ArithmeticException integer overflow clojure.lang.Numbers.throwIntOverflow (Numbers.java:1581) user= (set! *unchecked-math* true) true user= (+ Long/MAX_VALUE Long/MAX_VALUE) -2 Looks good, only it doesn't seem to work for division: (set! *warn-on-reflection* true) (set! *unchecked-math* true) (/ 1 2) Reflection warning, NO_SOURCE_FILE:1 - call to divide can't be resolved. 1/2 What I want in this particular program is a truncating, unchecked division on longs, but there doesn't seem to be any way of getting that using these constructs. Even for ints you need to explicitly call unchecked-divide-int: (/ (int 1) (int 2)) Reflection warning, NO_SOURCE_FILE:1 - call to divide can't be resolved. 1/2 (unchecked-divide-int (int 1) (int 2)) 0 I'm guessing the problem here is that compared to the other unchecked* functions, unchecked-divide-int does two additional things: it gets rid of the fractional results and it truncates the result to int. I can't find any way to do that with longs. ps: I realize that in these examples, I could use a bit-shift. -- 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: Tranforming an ACL file: Comparing Clojure with Ruby
On Thu, Mar 3, 2011 at 9:15 PM, Stefan Rohlfing stefan.rohlf...@gmail.com wrote: I personally find Stuart's suggestion to be the most readable. The use of the - macro makes the workflow quite easy to follow. Yes, both the - and - macros are useful. Unfortunately, about half of Clojure's functions put the object you're operating on first, and the other half put it last. - works best with the former, and - with the latter. This is hardly unfortunate! The API is carefully designed: object args come first, seq args come last. Stuart's code is readable because he found a way to structure it all in terms of functions that put the main object last. I find that in most code, you end up with a mixture of the two types of functions, and then those macros aren't quite so useful. I didn't have to find a way to structure the code. Knowing I was working with seqs, the use of - was automatic. The mixing happens when you are doing mixed things. Stuart Halloway Clojure/core http://clojure.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: Tranforming an ACL file: Comparing Clojure with Ruby
On Fri, Mar 4, 2011 at 4:50 AM, Stuart Halloway stuart.hallo...@gmail.com wrote: This is hardly unfortunate! The API is carefully designed: object args come first, seq args come last. I didn't mean to imply that the first/last choice is random or arbitrary. I understand that the seq functions trace their history to languages in which order was chosen to ease currying, and the object functions are derived more from the OO part of the programming world. There's certainly a logic to it. I still find it unfortunate in terms of being able to leverage - - macros to maximize readability. Perhaps I mix the styles more than you. Also, let's be honest -- it's not always clear whether something is considered a seq or an object. As a case in point, consider strings. There has been endless argument over what order the various string library functions should be, precisely because there's a tension between wanting the functions to mirror their seq counterparts, and wanting them to mirror their Java OO counterparts. Strings, in some sense, are both. -- 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: Tranforming an ACL file: Comparing Clojure with Ruby
On Fri, Mar 4, 2011 at 7:50 AM, Stuart Halloway stuart.hallo...@gmail.com wrote: This is hardly unfortunate! The API is carefully designed: object args come first, seq args come last. Eh, not always: conj, nth, and several others put seq args first, though cons can be used on seqs in place of conj and has the seq arg last. -- 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: unchecked-divide etc being replaced in 1.3 - no more support for longs?
On Fri, Mar 4, 2011 at 6:43 AM, Joost jo...@zeekat.nl wrote: On Mar 2, 2:05 am, Jason Wolfe ja...@w01fe.com wrote: But I don't know what the plan is if you really do want truncating arithmetic on longs. On 1.3 alpha 4: user= (+ Long/MAX_VALUE Long/MAX_VALUE) ArithmeticException integer overflow clojure.lang.Numbers.throwIntOverflow (Numbers.java:1581) user= (set! *unchecked-math* true) true user= (+ Long/MAX_VALUE Long/MAX_VALUE) -2 Looks good, only it doesn't seem to work for division: (set! *warn-on-reflection* true) (set! *unchecked-math* true) (/ 1 2) Reflection warning, NO_SOURCE_FILE:1 - call to divide can't be resolved. 1/2 What I want in this particular program is a truncating, unchecked division on longs, but there doesn't seem to be any way of getting that using these constructs. Even for ints you need to explicitly call unchecked-divide-int: (/ (int 1) (int 2)) Reflection warning, NO_SOURCE_FILE:1 - call to divide can't be resolved. 1/2 (unchecked-divide-int (int 1) (int 2)) 0 I'm guessing the problem here is that compared to the other unchecked* functions, unchecked-divide-int does two additional things: it gets rid of the fractional results and it truncates the result to int. I can't find any way to do that with longs. ps: I realize that in these examples, I could use a bit-shift. Is the quot function unchecked if you (set! *unchecked-math* true)? Also, I have a (new!) performance concern. If all the math operators check the current binding of *unchecked-math* at run-time that's going to be very slow. Is this checked instead at compile time? Because then it will work at the REPL as expected, but e.g. (defn foo [a b] (binding [*unchecked-math* true] (+ a b))) won't behave as expected, as the compile-time value of *unchecked-math* won't be affected. I'd think the best design here (other than what we have in 1.2 where we can just call unchecked-add etc. when we want unchecked math!) would be to have the value have its effect at *macroexpansion time* -- + and other affected functions are inline, so their expansion code should run at macroexpansion time and can check the current binding and expand into unchecked or checked code, depending. The trouble is how do you set the value at macroexpansion time? It seems you'd have to wrap whole defns, like (binding [*unchecked-math* true] (defn foo [a b] (+ a b))) This prevents mixing checked and unchecked in a single function, and it's somewhat ugly (and may confuse some IDE tools) to have the def form not at top level anymore. Ideally, there'd be an unchecked macro you could wrap around an expression to make it compile using unchecked math: (defn foo [a b] (unchecked (+ a b))) but this presents its own difficulties. (defmacro unchecked [ body] (binding [*unchecked-math* true] body)) obviously isn't going to work (the binding reverts before the macro's return value is subjected to further expansion). We'd need a macroexpand-all in core and (defmacro unchecked [ body] (binding [*unchecked-math* true] (macroexpand-all body))) or else something along those lines. I think this a real mess compared to the situation we have in 1.2... -- 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: CLR classpath
You might be interested in the difference between the 1.2 version (available as binary download) and the current master branch (1.3- alpha) regarding handling of the AOT-compiled assemblies. In 1.2, ClojureCLR matches directory structure with ClojureJVM: compile clojure/core.clj, the assembly is in the clojure subdirectory, clojure/core.clj.dll. That directory structure has to be maintained below your application's base directory. In the 1.3-alpha version, classpath information (JVM notion) is backed into the assembly name (CLR notion), so that clojure/core.clj compile into clojure.core.clj.dll. This dll can go directly into the application's base directory. This change solves some problems that I won't bore anyone with. -David On Mar 3, 8:23 pm, Timothy Pratley timothyprat...@gmail.com wrote: On Wed, Mar 2, 2011 at 8:39 AM, dmiller dmiller2...@gmail.com wrote: (1) I think the copy solution is the easiest. Ok sounds good (2) I'll have to look at the ambiguous match problem. User error on my part; I figured out that mixing .NET versions is bad... switch to compiled from source and it is working beautifully now. Thanks! Regards, Timothy -- 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: Serialising functions...
On Fri, Mar 4, 2011 at 4:48 AM, Jules jules.gosn...@gmail.com wrote: So, I introduced the concept of a per-jvm id and hacked it into RT, Compiler and LispReader. There were not too many places that needed to be changed. Why not just use the machine's MAC address? user= (defn mac [] (if-let [ni (java.net.NetworkInterface/getByInetAddress (java.net.InetAddress/getLocalHost))] (seq (.getHardwareAddress ni #'user/mac user= (mac) (17 148 207 11 74 113) user= (do (doseq [m (mac)] (printf %02x m)) (println)) 1194cf0b4a71 Note: only works with Java 6, not Java 5. But it should be unique for each of your nodes. -- 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: Tranforming an ACL file: Comparing Clojure with Ruby
On Fri, Mar 4, 2011 at 12:34 PM, Stuart Halloway stuart.hallo...@gmail.com wrote: This is hardly unfortunate! The API is carefully designed: object args come first, seq args come last. Eh, not always: conj, nth, and several others put seq args first, though cons can be used on seqs in place of conj and has the seq arg last. You may be right, but so far your chosen examples support my point: * conj is *not* a sequence fn -- it builds the type of thing passed in, not a seq * nth is *not* a sequence fn -- it knows about random access collections and navigates them appropriately Oh, I'm sorry, I naturally interpreted sequence fn to mean fn that can perform a sequence operation on a sequence arg rather than fn that is *exclusive* to sequences and won't work on anything else. Apparently you meant the latter? Which still doesn't matter since someone operating on sequences might very well want to call nth or similar at some point. -- 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: Tranforming an ACL file: Comparing Clojure with Ruby
This is hardly unfortunate! The API is carefully designed: object args come first, seq args come last. Eh, not always: conj, nth, and several others put seq args first, though cons can be used on seqs in place of conj and has the seq arg last. You may be right, but so far your chosen examples support my point: * conj is *not* a sequence fn -- it builds the type of thing passed in, not a seq * nth is *not* a sequence fn -- it knows about random access collections and navigates them appropriately Oh, I'm sorry, I naturally interpreted sequence fn to mean fn that can perform a sequence operation on a sequence arg rather than fn that is *exclusive* to sequences and won't work on anything else. Apparently you meant the latter? Which still doesn't matter since someone operating on sequences might very well want to call nth or similar at some point. In the context of chaining operators such as -, it is logical to consider both the input and output of the function. The functions listed under the Seq In, Seq Out section at http://clojure.org/sequences should all take their seq arg last. There is a ticket in JIRA for making - and - more flexible, but I couldn't trivially find it because you can't search for punctuation. Feel free to respond with a link... Stuart Halloway Clojure/core http://clojure.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
Matching balanced text?
Hi! I would like to parse text like some ${mpw${next}abc} tata in order to find all ${...} occurrences. What is interesting that in that string there are nested ${ ... } expressions. Is there any way to easily reg-ex (or parse) such groups in Clojure? I have checked perl reg-ex and here is the answer: http://perldoc.perl.org/perlfaq6.html It would be nice if expression ${ ... } could be escaped so it would be grabbed for example with \, like ala \${some} nice Bye! -- 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: Tranforming an ACL file: Comparing Clojure with Ruby
On Fri, Mar 4, 2011 at 12:53 PM, Stuart Halloway stuart.hallo...@gmail.com wrote: In the context of chaining operators such as -, it is logical to consider both the input and output of the function. The functions listed under the Seq In, Seq Out section at http://clojure.org/sequences should all take their seq arg last. The conj function is listed in the seq in, seq out section of the cheat-sheet and doesn't. ;) But it seems to be the only one there, and cons can be used with - instead. There is a ticket in JIRA for making - and - more flexible, but I couldn't trivially find it because you can't search for punctuation. Feel free to respond with a link... I hate broken search tools that made unwarranted assumptions about what people would put in, or would search for. Some code was posted here recently for more flexible - like macros. I posted one such. Most of them would thread through a placeholder, e.g. (-% 3 (- 1 %) (/ % 2)) threading through %s or (-- [x 3] (- 1 x) (/ x 2)) actually specifying a symbol to thread through and the initial value in a binding-like syntax. (Both of those examples have -1 as the desired output.) -- 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: Serialising functions...
It's always tempting to use the MAC address, and while in physical hardware it's unique, in networking it's only required to be unique within a single L2 domain. Some virtualized environments, including EC2, play games with the MAC address and rendering it useless as a global ID. -C Ken Wesson wrote: On Fri, Mar 4, 2011 at 4:48 AM, Jules jules.gosn...@gmail.com wrote: So, I introduced the concept of a per-jvm id and hacked it into RT, Compiler and LispReader. There were not too many places that needed to be changed. Why not just use the machine's MAC address? user= (defn mac [] (if-let [ni (java.net.NetworkInterface/getByInetAddress (java.net.InetAddress/getLocalHost))] (seq (.getHardwareAddress ni #'user/mac user= (mac) (17 148 207 11 74 113) user= (do (doseq [m (mac)] (printf %02x m)) (println)) 1194cf0b4a71 Note: only works with Java 6, not Java 5. But it should be unique for each of your nodes. -- 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
[Code Bounty] Implementing ClojureScript - command-line/sys-admin scripting with Clojure
Hi all, I've decided to offer a 200 USD bounty for implementing ClojureScript (a tentative name), a Clojure API and a convenient command line utility for performing quick system admin tasks, text manipulation tasks, command line scripting, etc. similar to the use cases of bash/awk/sed or bash along with /usr/bin/perl . If you're interested in doing this let me know. Motivation: --- For a long time, I've desired a usable and popular dialect of Lisp, which was the promise of Paul Graham's Arc ( http://www.paulgraham.com/arc.html ) and of several other attempts, including some of my own attempts nicknamed Park and Spark. Now, it seems that the most trendy dialect of Lisp has become Clojure, and while I challenge some of its design decisions, it seems pretty nice. One of the things that make a language popular and likable is its utility for quick-and-dirty tasks. For further motivation please see: * http://www.paulgraham.com/popular.html * http://www.paulgraham.com/power.html * http://www.shlomifish.org/philosophy/computers/perl/joy-of-perl/ * http://xoa.petdance.com/Stop_saying_%22script%22 * http://www.joelonsoftware.com/articles/FiveWorlds.html - see what he says about throwaway code vs. inhouse code vs. shrinkwrap code. * http://www.perl.com/pub/2007/12/06/soto-11.html - Larry Wall's Programming is Hard, Let's Go Scripting. * http://perl.org.il/presentations/larry-wall-present-continuous-future- perfect/transcript.html (short URL - http://xrl.us/bhks6t ). * http://perl.plover.com/yak/12views/samples/notes.html#sl-39 - titled Why Lisp Will Never Win - comparing and contrasting Common Lisp to Awk and Perl. --- How to do it: - The one who will perform the task, will look at the scripting capabilities of Perl 5, Ruby, Perl 6, Python, Bash and zsh (one can use Freenode for asking questions about them) and will devise a specification for implementing something similar in Clojure. Afterwards, they will implement it as a user-land, high-level API above Clojure with a simple command line front-end tentatively called lurk, which will be useful for it. Once completed, they will get the money, and credit. The licence of the newly written code has to be the MIT/X11 licence (see: http://en.wikipedia.org/wiki/MIT_License ) or a similar permissive licence compatible with both the GPLv2 and the GPLv3. Please let me know if you have further questions. You can contact me in various ways here: http://www.shlomifish.org/me/contact-me/ (I prefer either one of my Jabber accounts or MSN as IM, and I don't always have IRC on.) Regards, Shlomi Fish -- - Shlomi Fish http://www.shlomifish.org/ Why I Love Perl - http://shlom.in/joy-of-perl Modern Perl - the 3-D Movie. In theatres near you. Please reply to list if it's a mailing list post - http://shlom.in/reply . -- 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: [Code Bounty] Implementing ClojureScript - command-line/sys-admin scripting with Clojure
There are difficulties with using Clojure -- or any JVM language -- for system administration. The first and biggest is the JVM startup time, making it impractical for command-line use without a separate server process. The second is that Java was explicitly designed to be OS-independent. Many common OS-level features -- launching processes and sending signals, for example -- are not available in the standard Java APIs, and require the use of native code or implementation-specific APIs. I'm not saying it can't be done, just that there may be better tools for the job. -Stuart Sierra clojure.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: trunk
swank-clojure breaks in a number of small ways on Clojure 1.3 alphas, mostly because of moved/renamed functions. -Stuart Sierra clojure.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
Fwd: websockets w/ clojure
I finally got around to writing this: http://blog.jayfields.com/2011/02/clojure-web-socket-introduction.html Cheers, Jay -- Forwarded message -- From: Sean Allen s...@monkeysnatchbanana.com Date: Dec 24 2010, 11:58 pm Subject: websockets w/ clojure To: Clojure Jay, Do you have any publicly released code I could take a look at? I've only found a couple of jetty/clojure/websocket examples and would love to have more I could study. -Sean- On Fri, Dec 24, 2010 at 7:53 PM, Jay Fields j...@jayfields.com wrote: I've written a few Clojure websocket apps and used Jetty. Things worked out fine and there wasn't much code at all to integrate. I'd recommend it. Sent from my iPhone On Dec 24, 2010, at 11:58 AM, Sean Allen s...@monkeysnatchbanana.com wrote: We did a prototype application using websockets for work using node.js as the server. Websocket client connects, sending some basic info... said info is used to repeatedly get new data from a database that is pushed down as it arrives in the db to the client which displays. There will be more than 1 client, each with its own data constraints that are used to get the data to send. If it goes into production we need to run on the jvm so I've been rewriting in clojure. I spent a couple hours yesterday trying to figuring out the best websockets option to use w/ the clojure based server before I gave up. I realized w/o any background I'm just running blind. Given the basic idea of the application, what is the best websockets abstraction to use w/ clojure? Aleph? The jetty websocket support? Something else? Pointers from anyone will more experience doing a websocket server in clojure greatly appreciated. Thanks, 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 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 clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en 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.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: [Code Bounty] Implementing ClojureScript - command-line/sys-admin scripting with Clojure
I've decided to offer a 200 USD bounty for implementing ClojureScript I think you are missing a couple zeros in your offer price ;) Seriously though, these things tend to go better when you say something like I've decided to work on this new project, who wants to help?, instead of offering a very small reward and seeming as though you are not willing to do any of the work. On Fri, Mar 4, 2011 at 4:29 AM, Shlomi Fish shlo...@iglu.org.il wrote: Hi all, I've decided to offer a 200 USD bounty for implementing ClojureScript (a tentative name), a Clojure API and a convenient command line utility for performing quick system admin tasks, text manipulation tasks, command line scripting, etc. similar to the use cases of bash/awk/sed or bash along with /usr/bin/perl . If you're interested in doing this let me know. Motivation: --- For a long time, I've desired a usable and popular dialect of Lisp, which was the promise of Paul Graham's Arc ( http://www.paulgraham.com/arc.html ) and of several other attempts, including some of my own attempts nicknamed Park and Spark. Now, it seems that the most trendy dialect of Lisp has become Clojure, and while I challenge some of its design decisions, it seems pretty nice. One of the things that make a language popular and likable is its utility for quick-and-dirty tasks. For further motivation please see: * http://www.paulgraham.com/popular.html * http://www.paulgraham.com/power.html * http://www.shlomifish.org/philosophy/computers/perl/joy-of-perl/ * http://xoa.petdance.com/Stop_saying_%22script%22 * http://www.joelonsoftware.com/articles/FiveWorlds.html - see what he says about throwaway code vs. inhouse code vs. shrinkwrap code. * http://www.perl.com/pub/2007/12/06/soto-11.html - Larry Wall's Programming is Hard, Let's Go Scripting. * http://perl.org.il/presentations/larry-wall-present-continuous-future- perfect/transcript.html (short URL - http://xrl.us/bhks6t ). * http://perl.plover.com/yak/12views/samples/notes.html#sl-39 - titled Why Lisp Will Never Win - comparing and contrasting Common Lisp to Awk and Perl. --- How to do it: - The one who will perform the task, will look at the scripting capabilities of Perl 5, Ruby, Perl 6, Python, Bash and zsh (one can use Freenode for asking questions about them) and will devise a specification for implementing something similar in Clojure. Afterwards, they will implement it as a user-land, high-level API above Clojure with a simple command line front-end tentatively called lurk, which will be useful for it. Once completed, they will get the money, and credit. The licence of the newly written code has to be the MIT/X11 licence (see: http://en.wikipedia.org/wiki/MIT_License ) or a similar permissive licence compatible with both the GPLv2 and the GPLv3. Please let me know if you have further questions. You can contact me in various ways here: http://www.shlomifish.org/me/contact-me/ (I prefer either one of my Jabber accounts or MSN as IM, and I don't always have IRC on.) Regards, Shlomi Fish -- - Shlomi Fish http://www.shlomifish.org/ Why I Love Perl - http://shlom.in/joy-of-perl Modern Perl - the 3-D Movie. In theatres near you. Please reply to list if it's a mailing list post - http://shlom.in/reply . -- 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: Implementing ClojureScript - command-line/sys-admin scripting with Clojure
Have you look at Scsh? http://www.scsh.net/about/what.html It's not the most trendy, but being a Scheme at least is nice. Anyone capable of doing the job properly either won't take any money or won't come cheap, so you might be better of offering a round of beer or request bids. On Mar 4, 1:29 am, Shlomi Fish shlo...@iglu.org.il wrote: Hi all, I've decided to offer a 200 USD bounty for implementing ClojureScript (a tentative name), a Clojure API and a convenient command line utility for performing quick system admin tasks, text manipulation tasks, command line scripting, etc. similar to the use cases of bash/awk/sed or bash along with /usr/bin/perl . If you're interested in doing this let me know. Motivation: --- For a long time, I've desired a usable and popular dialect of Lisp, which was the promise of Paul Graham's Arc (http://www.paulgraham.com/arc.html) and of several other attempts, including some of my own attempts nicknamed Park and Spark. Now, it seems that the most trendy dialect of Lisp has become Clojure, and while I challenge some of its design decisions, it seems pretty nice. One of the things that make a language popular and likable is its utility for quick-and-dirty tasks. For further motivation please see: *http://www.paulgraham.com/popular.html *http://www.paulgraham.com/power.html *http://www.shlomifish.org/philosophy/computers/perl/joy-of-perl/ *http://xoa.petdance.com/Stop_saying_%22script%22 *http://www.joelonsoftware.com/articles/FiveWorlds.html- see what he says about throwaway code vs. inhouse code vs. shrinkwrap code. *http://www.perl.com/pub/2007/12/06/soto-11.html- Larry Wall's Programming is Hard, Let's Go Scripting. *http://perl.org.il/presentations/larry-wall-present-continuous-future- perfect/transcript.html (short URL -http://xrl.us/bhks6t). *http://perl.plover.com/yak/12views/samples/notes.html#sl-39- titled Why Lisp Will Never Win - comparing and contrasting Common Lisp to Awk and Perl. --- How to do it: - The one who will perform the task, will look at the scripting capabilities of Perl 5, Ruby, Perl 6, Python, Bash and zsh (one can use Freenode for asking questions about them) and will devise a specification for implementing something similar in Clojure. Afterwards, they will implement it as a user-land, high-level API above Clojure with a simple command line front-end tentatively called lurk, which will be useful for it. Once completed, they will get the money, and credit. The licence of the newly written code has to be the MIT/X11 licence (see:http://en.wikipedia.org/wiki/MIT_License) or a similar permissive licence compatible with both the GPLv2 and the GPLv3. Please let me know if you have further questions. You can contact me in various ways here: http://www.shlomifish.org/me/contact-me/ (I prefer either one of my Jabber accounts or MSN as IM, and I don't always have IRC on.) Regards, Shlomi Fish -- - Shlomi Fish http://www.shlomifish.org/ Why I Love Perl -http://shlom.in/joy-of-perl Modern Perl - the 3-D Movie. In theatres near you. Please reply to list if it's a mailing list post -http://shlom.in/reply. -- 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: Serialising functions...
I like that - I'm using ip at the moment - you'd need to combine it with pid aswell, since you may be running more than one jvm per box. thanks for the idea/code, Jules On Mar 4, 5:37 pm, Ken Wesson kwess...@gmail.com wrote: On Fri, Mar 4, 2011 at 4:48 AM, Jules jules.gosn...@gmail.com wrote: So, I introduced the concept of a per-jvm id and hacked it into RT, Compiler and LispReader. There were not too many places that needed to be changed. Why not just use the machine's MAC address? user= (defn mac [] (if-let [ni (java.net.NetworkInterface/getByInetAddress (java.net.InetAddress/getLocalHost))] (seq (.getHardwareAddress ni #'user/mac user= (mac) (17 148 207 11 74 113) user= (do (doseq [m (mac)] (printf %02x m)) (println)) 1194cf0b4a71 Note: only works with Java 6, not Java 5. But it should be unique for each of your nodes. -- 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: [Code Bounty] Implementing ClojureScript - command-line/sys-admin scripting with Clojure
On Fri, Mar 4, 2011 at 1:41 PM, Stuart Sierra the.stuart.sie...@gmail.com wrote: There are difficulties with using Clojure -- or any JVM language -- for system administration. The first and biggest is the JVM startup time, making it impractical for command-line use without a separate server process. Or you could just hoist the entire shell up into the JVM ... Let's see ... (def wd (atom (java.io.File. /))) (defn pwd [] @wd) (defn file [thing] (if (instance? java.io.File thing) thing (File. (pwd) thing))) (defn cwd [f] (let [f (file f)] (if (.isDirectory f) (reset! wd f) (throw (IllegalArgumentException. (str No such directory: f)) (defn ls [ opts] ... :) Many common OS-level features -- launching processes and sending signals, for example -- are not available in the standard Java APIs, and require the use of native code or implementation-specific APIs. Er, (.exec (Runtime/getRuntime) foo) anyone? And that includes (.exec (Runtime/getRuntime) (str kill -s SIGALRM get-some-pid)) of course. :) I'm not saying it can't be done, just that there may be better tools for the job. After a little macro wizardry, that might actually turn out not to be true. I certainly wouldn't categorically rule it out. :) -- 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: [Code Bounty] Implementing ClojureScript - command-line/sys-admin scripting with Clojure
On Fri, Mar 4, 2011 at 2:32 PM, Chas Emerick cemer...@snowtide.com wrote: I've actually come to think that perl may be a great Clojure host language Talk about Beauty and the Beast ... ;) -- 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: Serialising functions...
On Fri, Mar 4, 2011 at 1:09 PM, Christopher Brown cjbrown...@gmail.com wrote: It's always tempting to use the MAC address, and while in physical hardware it's unique, in networking it's only required to be unique within a single L2 domain. Some virtualized environments, including EC2, play games with the MAC address and rendering it useless as a global ID. Is there any such environment where a JVM can run inside of which NetworkInterface.getHardwareAddress() won't actually return a physical hardware address, though? -- 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: using records in Java
Aaron, Daniel, I appreciate your help with this. Yes, the problem was the package and class name collision. Daniel's solution to remove the :gen-class worked for me. Thanks, -Earl On Mar 3, 2:47 pm, Aaron Cohen aa...@assonance.org wrote: On Thu, Mar 3, 2011 at 2:24 PM, Daniel Solano Gomez cloj...@sattvik.comwrote: On Thu Mar 3 13:48 2011, Aaron Cohen wrote: On Wed, Mar 2, 2011 at 11:38 PM, Earl J. Wagner dont.spam.e...@gmail.comwrote: Well, t.core exists because in his ns declaration he included :gen-class. Now, this isn't necessary for compiling records. As for why it isn't compiling, I am not sure. I tried replicating the problem (albiet without Leiningen), but was unable to. Hmm, it's illegal to have a class name that collides with a package name, isn't it? If :gen-class creates a class named t.core, then you won't be able to have a record named t.core.TRecord, at least not in a way that actually works consistantly. Clojure should probably prevent this from compiling. For reference:https://bugs.eclipse.org/bugs/show_bug.cgi?id=63668 -- 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: [Code Bounty] Implementing ClojureScript - command-line/sys-admin scripting with Clojure
On Fri, 4 Mar 2011 10:41:20 -0800 (PST) Stuart Sierra the.stuart.sie...@gmail.com wrote: There are difficulties with using Clojure -- or any JVM language -- for system administration. The first and biggest is the JVM startup time, making it impractical for command-line use without a separate server process. One possibility to improve Clojure startup time would be to compile it into a native binary with GCJ. Yet the current version of GCJ fails to compile Clojure. Also this will likely degrade overall performance as JIT allows more optimizations. -- Mikhail -- 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: [Code Bounty] Implementing ClojureScript - command-line/sys-admin scripting with Clojure
The first and biggest is the JVM startup time, I agree. Maybe newlisp (which starts up blazingly fast) will fit the bill better. -- 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: Writing a generic function for getting any value for a key
Here is the file: http://dl.dropbox.com/u/3630641/wizard-game.clj On Mar 4, 4:24 am, HB hubaghd...@gmail.com wrote: Sorry, it is: Exception in thread main java.lang.IllegalArgumentException: Wrong number of args (1) passed to: user$describe-place (wizard-game.clj: 0) On Mar 4, 4:12 am, HB hubaghd...@gmail.com wrote: Yes indeed, it runs on my REPL too! However, if I save the code to a file and try to run it, I got this exception: Exception in thread main java.lang.IllegalArgumentException: Wrong number of args (1) passed to: user$describe-location (wizard-game.clj: 0) On Mar 4, 3:59 am, Alan a...@malloys.org wrote: Copied and pasted straight from your post to my REPL it works fine. Maybe verify that you're actually doing what you think you're doing? That said, this function already exists: it's called get. user= (def *places* {:room Nice room :basement what ever}) #'user/*places* user= (defn describe-place [place places] (places place)) #'user/describe-place user= (describe-place :room *places*) Nice room user= (get *places* :room) Nice room On Mar 3, 5:33 pm, HB hubaghd...@gmail.com wrote: Hi, I'm trying to write a function that gets the value for a key of a map. (def *places* {:room Nice room :basement what ever}) (defn describe-place [place places] (places place)) (describe-place :room *places*) Of course it isn't running :) What should I do? Thanks for help and time. -- 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: Writing a generic function for getting any value for a key
On Mar 4, 4:53 pm, HB hubaghd...@gmail.com wrote: Here is the file:http://dl.dropbox.com/u/3630641/wizard-game.clj On Mar 4, 4:24 am, HB hubaghd...@gmail.com wrote: Sorry, it is: Exception in thread main java.lang.IllegalArgumentException: Wrong number of args (1) passed to: user$describe-place (wizard-game.clj: 0) On Mar 4, 4:12 am, HB hubaghd...@gmail.com wrote: Yes indeed, it runs on my REPL too! However, if I save the code to a file and try to run it, I got this exception: Exception in thread main java.lang.IllegalArgumentException: Wrong number of args (1) passed to: user$describe-location (wizard-game.clj: 0) On Mar 4, 3:59 am, Alan a...@malloys.org wrote: Copied and pasted straight from your post to my REPL it works fine. Maybe verify that you're actually doing what you think you're doing? That said, this function already exists: it's called get. user= (def *places* {:room Nice room :basement what ever}) #'user/*places* user= (defn describe-place [place places] (places place)) #'user/describe-place user= (describe-place :room *places*) Nice room user= (get *places* :room) Nice room On Mar 3, 5:33 pm, HB hubaghd...@gmail.com wrote: Hi, I'm trying to write a function that gets the value for a key of a map. (def *places* {:room Nice room :basement what ever}) (defn describe-place [place places] (places place)) (describe-place :room *places*) Of course it isn't running :) What should I do? Thanks for help and time. Does my answer to your StackOverflow question also resolve this issue? -- 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: trunk
On Mar 4, 1:45 pm, Stuart Sierra the.stuart.sie...@gmail.com wrote: swank-clojure breaks in a number of small ways on Clojure 1.3 alphas, mostly because of moved/renamed functions. This seems not the case. I'm aware of print-doc and pprint caused breaks. All fixed in my local swank clone. The same code works fine for this commit. macair:clojure houf$ git log -1 commit 174bd5001264f5c43276922505ba526aae471028 Author: Stuart Halloway stu@Stuart-Halloways-MacBook-Air.local Date: Fri Feb 25 16:24:21 2011 -0500 tests for #737 Go to the very next commit lazy defn loading, it breaks. I couldn't find any moved/renamed functions in that commit. Stacktrace and Var value clearly show it has something to do with FnLoaderThunk. It's ok master branch break things. I just want to report this early so that it won't become too hard later to narrow down which commit caused it. Regards, - Feng -Stuart Sierra clojure.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: Writing a generic function for getting any value for a key
Yes, it did and I was about resolving this post. Thanks. The issue is solved guys, thank you all for passing. On Mar 5, 3:05 am, Alan a...@malloys.org wrote: On Mar 4, 4:53 pm, HB hubaghd...@gmail.com wrote: Here is the file:http://dl.dropbox.com/u/3630641/wizard-game.clj On Mar 4, 4:24 am, HB hubaghd...@gmail.com wrote: Sorry, it is: Exception in thread main java.lang.IllegalArgumentException: Wrong number of args (1) passed to: user$describe-place (wizard-game.clj: 0) On Mar 4, 4:12 am, HB hubaghd...@gmail.com wrote: Yes indeed, it runs on my REPL too! However, if I save the code to a file and try to run it, I got this exception: Exception in thread main java.lang.IllegalArgumentException: Wrong number of args (1) passed to: user$describe-location (wizard-game.clj: 0) On Mar 4, 3:59 am, Alan a...@malloys.org wrote: Copied and pasted straight from your post to my REPL it works fine. Maybe verify that you're actually doing what you think you're doing? That said, this function already exists: it's called get. user= (def *places* {:room Nice room :basement what ever}) #'user/*places* user= (defn describe-place [place places] (places place)) #'user/describe-place user= (describe-place :room *places*) Nice room user= (get *places* :room) Nice room On Mar 3, 5:33 pm, HB hubaghd...@gmail.com wrote: Hi, I'm trying to write a function that gets the value for a key of a map. (def *places* {:room Nice room :basement what ever}) (defn describe-place [place places] (places place)) (describe-place :room *places*) Of course it isn't running :) What should I do? Thanks for help and time. Does my answer to your StackOverflow question also resolve this issue? -- 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: Writing a generic function for getting any value for a key
On Fri, Mar 4, 2011 at 8:25 PM, HB hubaghd...@gmail.com wrote: On Mar 5, 3:05 am, Alan a...@malloys.org wrote: Does my answer to your StackOverflow question also resolve this issue? Yes, it did and I was about resolving this post. Thanks. The issue is solved guys, thank you all for passing. Please post either the solution or a link to the StackOverflow question and answer for the edification of everyone else who reads this in the list archives. -- 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: Writing a generic function for getting any value for a key
http://stackoverflow.com/questions/5200169/code-run-in-repl-but-not-if-saved-to-a-file/5200885#5200885 On Mar 4, 5:54 pm, Ken Wesson kwess...@gmail.com wrote: On Fri, Mar 4, 2011 at 8:25 PM, HB hubaghd...@gmail.com wrote: On Mar 5, 3:05 am, Alan a...@malloys.org wrote: Does my answer to your StackOverflow question also resolve this issue? Yes, it did and I was about resolving this post. Thanks. The issue is solved guys, thank you all for passing. Please post either the solution or a link to the StackOverflow question and answer for the edification of everyone else who reads this in the list archives. -- 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: Writing a generic function for getting any value for a key
For those who don't like clicking on links: his program had too many parentheses, but it worked in the REPL because he was typing different code. On Mar 4, 6:41 pm, Alan a...@malloys.org wrote: http://stackoverflow.com/questions/5200169/code-run-in-repl-but-not-i... On Mar 4, 5:54 pm, Ken Wesson kwess...@gmail.com wrote: On Fri, Mar 4, 2011 at 8:25 PM, HB hubaghd...@gmail.com wrote: On Mar 5, 3:05 am, Alan a...@malloys.org wrote: Does my answer to your StackOverflow question also resolve this issue? Yes, it did and I was about resolving this post. Thanks. The issue is solved guys, thank you all for passing. Please post either the solution or a link to the StackOverflow question and answer for the edification of everyone else who reads this in the list archives. -- 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: Writing a generic function for getting any value for a key
Sorry, my mistake. I will do this in the future, sorry for any inconvenience that may happened. On Mar 5, 3:54 am, Ken Wesson kwess...@gmail.com wrote: On Fri, Mar 4, 2011 at 8:25 PM, HB hubaghd...@gmail.com wrote: On Mar 5, 3:05 am, Alan a...@malloys.org wrote: Does my answer to your StackOverflow question also resolve this issue? Yes, it did and I was about resolving this post. Thanks. The issue is solved guys, thank you all for passing. Please post either the solution or a link to the StackOverflow question and answer for the edification of everyone else who reads this in the list archives. -- 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: Summer of Code 2011
I can tell you the tools that I'm investigating: A) From what I can tell, there's no standard (E)BNF parser generator for clojure. There are a few projects trying to fill the gap (thinking of fnparse https://github.com/joshua-choi/fnparse), but nothing standard that I've found. Could be an interesting project. B) I'm also investigating Genetic algorithms, which would be a good fit for clojure. There's actually a thread here, from 2 days prior, titled *Request for review: GAHelloWorld*. He's exploring the topic as well and it looks like fun. Good-luck, and HTH :) Tim Washington twash...@gmail.com 416.843.9060 On Tue, Feb 15, 2011 at 1:58 AM, Brian Gruber br...@iheardata.com wrote: I know in the past there's been interest in the Clojure community in participating in Google's Summer of Code program. LispNYC has been a mentoring organization for SoC a number of times, and though we missed the last couple of years, we're gearing up to participate again in 2011. Right now we're looking for project ideas and I want to make sure that the Clojure community is involved. For those not familiar with this program, each year since 2005 Google has sponsored students from all over the world to work on open source software during their summer break. Rather than work directly with Google however, students work with a mentoring organization, like LispNYC. Students give their project proposals to us, we rank them, and Google grants us funding for the top n projects, where n is a number decided by Google. The program's primary goal is to get students involved with open source, and I can think of few projects more apt for this purpose than Clojure. I'm making a personal appeal to the Clojure community for project ideas because I think it's an ideal place for a young developer to get introduced to the open source and lisp communities. The Clojure community is one of the friendliest and welcoming of these kinds of groups. Furthermore, the state of Clojure as a rapidly maturing but still quite young platform means more opportunity for students to make a substantial contribution they can be proud of. We're interested in project ideas of all types: fun projects and practical projects; projects for Clojure newbies and projects for Clojure mavens. Is there a library you wish existed for Clojure? Support missing for your favorite IDE? A feature that's been missing from your favorite Clojure project? Or maybe if you hack on clojure.core you have ideas for projects that involve changes to the language itself. Whatever your idea is, we want to hear it. You may be wondering why I'm talking about a summer program in February; the answer is that the organization application period is the first week in March. If you'd like to contribute a project idea, please use the form at http://lispnyc.org/soc/idea. If you have any questions, please participate in the discussion on our mailing list ( http://www.lispnyc.org:8080/mailman/listinfo/summeroflisp-discuss/) or in #summeroflisp on freenode. We're also starting to look for mentors, so if you're interested in that, please let me know. Thanks, and here's looking forward to a great summer. /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: Writing a generic function for getting any value for a key
On Fri, Mar 4, 2011 at 10:07 PM, HB hubaghd...@gmail.com wrote: Sorry, my mistake. I will do this in the future, sorry for any inconvenience that may happened. Oh I wasn't accusing anyone of a mistake, just asking for the link (or the actual solution) to be posted for the benefit of readers of this list (or searchers of its archive, further in the future). -- 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: Serialising functions...
It will always return a MAC address, but in a virtualized environment those are a fiction and under the control of the VM creator (and hence, not real physical hardware). Since those MAC addrs are only required to be unique within the L2 domain, two separate private clouds in the same organization, routable at L3 but in separate L2, can have VMs with conflicting MAC addrs. Admittedly, it's a nit to pick, but who would want to debug that? -C Ken Wesson wrote: On Fri, Mar 4, 2011 at 1:09 PM, Christopher Brown cjbrown...@gmail.com wrote: It's always tempting to use the MAC address, and while in physical hardware it's unique, in networking it's only required to be unique within a single L2 domain. Some virtualized environments, including EC2, play games with the MAC address and rendering it useless as a global ID. Is there any such environment where a JVM can run inside of which NetworkInterface.getHardwareAddress() won't actually return a physical hardware address, though? -- 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: [Code Bounty] Implementing ClojureScript - command-line/sys-admin scripting with Clojure
Hi Mark, On Friday 04 Mar 2011 21:08:03 Mark Rathwell wrote: I've decided to offer a 200 USD bounty for implementing ClojureScript I think you are missing a couple zeros in your offer price ;) :-) . Well, code bounties do not tend to cover all of the time of writing the program, and are more of a motivation. I worked on several O'ReillyNet articles for about that amount, and again it was not enough to reimborse me for all the work, but it was good enough for me. Randal Schwartz (of Perl 5 fame) said that working on a technical book is a lot of work and earns only slightly above minimum wage: http://www.perlmonks.org/?parent=458151;node_id= Recently, a translator I contacted on the hebtranslators YahooGroups mailing list volunteered to copy-edit the Hebrew version of my story The Enemy and How I Helped to Fight it, which is pretty long, in exchange for a shirt and less than 100 USD (but naturally also other possible perks like giving her thanks and credit and a link), and she detected many problems. As Paul Graham notes here: http://www.paulgraham.com/opensource.html - the word amateur used to mean someone who loves what he does, and many people, including many open source enthusiasts and most bloggers do, despite the fact that they don't always get paid for what they do. What I'm trying to say is that I don't expect my 200 USD to cover all the work, but I expect it to be a nice motivation for someone, who is more knowledgable in Clojure and its good style, than I am, to perform some of the work . Seriously though, these things tend to go better when you say something like I've decided to work on this new project, who wants to help?, instead of offering a very small reward and seeming as though you are not willing to do any of the work. You may be right. I should note that I'm willing to offer some ongoing help with the project (contact me via IM at http://www.shlomifish.org/me/contact-me/ ), but I still don't feel confident enough in doing it myself. I am a capable programmer, but I'm also kinda lazy and think someone here could benefit from it. I've seen much smaller bug bounties than 200 USD, BTW, and I may opt to increase the amount, given enough interest. Regards, Shlomi Fish On Fri, Mar 4, 2011 at 4:29 AM, Shlomi Fish shlo...@iglu.org.il wrote: Hi all, I've decided to offer a 200 USD bounty for implementing ClojureScript (a tentative name), a Clojure API and a convenient command line utility for performing quick system admin tasks, text manipulation tasks, command line scripting, etc. similar to the use cases of bash/awk/sed or bash along with /usr/bin/perl . If you're interested in doing this let me know. Motivation: --- For a long time, I've desired a usable and popular dialect of Lisp, which was the promise of Paul Graham's Arc ( http://www.paulgraham.com/arc.html ) and of several other attempts, including some of my own attempts nicknamed Park and Spark. Now, it seems that the most trendy dialect of Lisp has become Clojure, and while I challenge some of its design decisions, it seems pretty nice. One of the things that make a language popular and likable is its utility for quick-and-dirty tasks. For further motivation please see: * http://www.paulgraham.com/popular.html * http://www.paulgraham.com/power.html * http://www.shlomifish.org/philosophy/computers/perl/joy-of-perl/ * http://xoa.petdance.com/Stop_saying_%22script%22 * http://www.joelonsoftware.com/articles/FiveWorlds.html - see what he says about throwaway code vs. inhouse code vs. shrinkwrap code. * http://www.perl.com/pub/2007/12/06/soto-11.html - Larry Wall's Programming is Hard, Let's Go Scripting. * http://perl.org.il/presentations/larry-wall-present-continuous-future- perfect/transcript.html (short URL - http://xrl.us/bhks6t ). * http://perl.plover.com/yak/12views/samples/notes.html#sl-39 - titled Why Lisp Will Never Win - comparing and contrasting Common Lisp to Awk and Perl. --- How to do it: - The one who will perform the task, will look at the scripting capabilities of Perl 5, Ruby, Perl 6, Python, Bash and zsh (one can use Freenode for asking questions about them) and will devise a specification for implementing something similar in Clojure. Afterwards, they will implement it as a user-land, high-level API above Clojure with a simple command line front-end tentatively called lurk, which will be useful for it. Once completed, they will get the money, and credit. The licence of the newly written code has to be the MIT/X11 licence (see: http://en.wikipedia.org/wiki/MIT_License ) or a similar permissive licence compatible with both the GPLv2 and the GPLv3. Please let me know if you have further questions. You can contact me in various ways here:
Re: [Code Bounty] Implementing ClojureScript - command-line/sys-admin scripting with Clojure
On Friday 04 Mar 2011 22:11:13 Ken Wesson wrote: On Fri, Mar 4, 2011 at 2:32 PM, Chas Emerick cemer...@snowtide.com wrote: I've actually come to think that perl may be a great Clojure host language Talk about Beauty and the Beast ... ;) :-) Well, to quote Larry Wall from here: http://perl.org.il/presentations/larry-wall-present-continuous-future- perfect/transcript.html (short URL - http://xrl.us/bhks6t ) quote I simultaneously believe that languages are wonderful and awful. You have to hold both of those. Ugly things can be beautiful. And beautiful can get ugly very fast. You know, take Lisp. You know, it's the most beautiful language in the world. At least up until Haskell came along. (laughter) But, you know, every program in Lisp is just ugly. I don't figure how that works. /quote Cheers. Regards, Shlomi Fish -- - Shlomi Fish http://www.shlomifish.org/ Star Trek: We, the Living Dead - http://shlom.in/st-wtld Oh! I wish you could see the look on his face! Actually, I would have also liked to see the look on his face, but just then I woke up from the dream. -- The Enemy and how I Helped to Fight It Please reply to list if it's a mailing list post - http://shlom.in/reply . -- 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: [Code Bounty] Implementing ClojureScript - command-line/sys-admin scripting with Clojure
Hi Chas, On Friday 04 Mar 2011 21:32:31 Chas Emerick wrote: FYI, ClojureScript is generally taken to be the name of a Javascript-hosted runtime for Clojure. Anyway… Yes, well, it was just a tentative name. I thought of calling it lurk or lurking as well (descended from Arc - Park - Spark - lurk). But a rose by any other name, etc. On Mar 4, 2011, at 4:29 AM, Shlomi Fish wrote: a Clojure API and a convenient command line utility for performing quick system admin tasks, text manipulation tasks, command line scripting, etc. similar to the use cases of bash/awk/sed or bash along with /usr/bin/perl I've actually come to think that perl may be a great Clojure host language; the result would presumably be useful in the ways you've described. I presume someone who actually knows perl well will beat me to implementing it. Do you mean perl 5 or Parrot (the VM for Rakudo Perl 6 and many other languages)? Maybe both naturally. Good luck with your project, Thanks! :-). Regards, Shlomi Fish -- - Shlomi Fish http://www.shlomifish.org/ List of Portability Libraries - http://shlom.in/port-libs Chuck Norris is the greatest man in history. He killed all the great men who could ever pose a competition. Please reply to list if it's a mailing list post - http://shlom.in/reply . -- 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: Implementing ClojureScript - command-line/sys-admin scripting with Clojure
On Mar 5, 2:17 am, Shlomi Fish shlo...@iglu.org.il wrote: Hi Chas, On Friday 04 Mar 2011 21:32:31 Chas Emerick wrote: FYI, ClojureScript is generally taken to be the name of a Javascript-hosted runtime for Clojure. Anyway… Yes, well, it was just a tentative name. I thought of calling it lurk or lurking as well (descended from Arc - Park - Spark - lurk). But a rose by any other name, etc. On Mar 4, 2011, at 4:29 AM, Shlomi Fish wrote: a Clojure API and a convenient command line utility for performing quick system admin tasks, text manipulation tasks, command line scripting, etc. similar to the use cases of bash/awk/sed or bash along with /usr/bin/perl I've actually come to think that perl may be a great Clojure host language; the result would presumably be useful in the ways you've described. I presume someone who actually knows perl well will beat me to implementing it. Do you mean perl 5 or Parrot (the VM for Rakudo Perl 6 and many other languages)? Maybe both naturally. There are some interesting alternatives to JVM worth considering to implement (a viable subset of) Clojure: 1. V8 JavaScript Engine 2. Parrot VM 3. Guile 2.0 (Clojure can be a front end) Regards, Shantanu -- 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: Summer of Code 2011
On Fri, Mar 4, 2011 at 10:50 PM, Timothy Washington twash...@gmail.com wrote: I can tell you the tools that I'm investigating: A) From what I can tell, there's no standard (E)BNF parser generator for clojure. Who needs an (E)BNF parser generator when you've got defmacro? ;) -- 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: Serialising functions...
On Fri, Mar 4, 2011 at 8:07 PM, Christopher Brown cjbrown...@gmail.com wrote: It will always return a MAC address, but in a virtualized environment those are a fiction and under the control of the VM creator (and hence, not real physical hardware). Since those MAC addrs are only required to be unique within the L2 domain, two separate private clouds in the same organization, routable at L3 but in separate L2, can have VMs with conflicting MAC addrs. Admittedly, it's a nit to pick, but who would want to debug that? Define L2 domain. Of course, if you consider cases like this, there can *be* no sure-fire way to generate a node-unique number. IP addresses are right out, thanks to local network addresses like 192.168.1.1. There must be millions of machines out there that think their name is 192.168.1.1 in particular. :) MAC address probably gets you as close as you can get without having manually-assigned node IDs, or requiring every node have a domain name registered (yum! expensive! Verisign would love that suggestion!) :) -- 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: Serialising functions...
On 5 March 2011 07:38, Ken Wesson kwess...@gmail.com wrote: On Fri, Mar 4, 2011 at 8:07 PM, Christopher Brown cjbrown...@gmail.com wrote: It will always return a MAC address, but in a virtualized environment those are a fiction and under the control of the VM creator (and hence, not real physical hardware). Since those MAC addrs are only required to be unique within the L2 domain, two separate private clouds in the same organization, routable at L3 but in separate L2, can have VMs with conflicting MAC addrs. Admittedly, it's a nit to pick, but who would want to debug that? Define L2 domain. e.g. an ethernet network. Machines that are directly connected to each other (possibly via a bridge/hub/switch). Somewhere where ARP makes sense. If you have something like this: [A]---[B]---[C] where B has two network cards and is an IP router. Then (A-B) and (B-C) would be two separate layer 2 domains. A and C could have the same MAC address without any confusion, because layer 2 traffic can't get from one side of B to the other. For that you need layer 3 (e.g. IP), where the IP packet would be removed from the ethernet frame when received by B and then encapsulated in a new ethernet frame before sending it on its way. A and B's left interface would have to have different MAC addresses, as would B's right interface and C. Of course, if you consider cases like this, there can *be* no sure-fire way to generate a node-unique number. IP addresses are right out, thanks to local network addresses like 192.168.1.1. There must be millions of machines out there that think their name is 192.168.1.1 in particular. :) MAC address probably gets you as close as you can get without having manually-assigned node IDs, or requiring every node have a domain name registered (yum! expensive! Verisign would love that suggestion!) :) Well, MAC address and IP address together would get you closer, and probably close enough. Is 22 bytes short enough? :) -- Michael Wood esiot...@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