Re: Memory issues processing large lazy sequences

2012-06-08 Thread David Powell
(dorun (take 2000 (add-layer))) take holds on to the head, because that is what it returns. Try changing take to drop. Take is lazy though, and dorun should drop the head, so that shouldn't be a problem. The problem here is not an holding onto the head issue. Lots of memory is being

Re: Is there a Clojure lib for web scraping?

2012-05-16 Thread David Powell
On Wed, May 16, 2012 at 10:33 AM, Z.A zahmed...@gmail.com wrote: Hi Is there a good Clojure lib for web scraping. I intend to collect story links using regex from a news site's home page, then visit each link to gather photos and text. Check out enlive [1]; it works as both a web templating

Re: Clojurescript One getting started problem

2012-05-10 Thread David Powell
What browser are you using? I don't think browser-repl works in IE at the moment. -- Dave -- 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 -

Re: Clojure.java.jdbc alias

2012-05-10 Thread David Powell
If you are working from the repl, use: (require '[clojure.java.jdbc :as sql]) Or use a similar require declaration in your ns header. (ns example.whatever (:require [clojure.java.jdbc :as sql])) -- Dave -- You received this message because you are subscribed to the Google Groups

Re: Nonprinting characters in string

2012-05-07 Thread David Powell
Clojure doesn't seem to explicitly escape non-printable characters in String literals when you try to print them. You could always do it yourself with something like: (require 'clojure.string) (defn escape-nonprintable [s] (clojure.string/join (map (fn [c] (if (Character/isISOControl c)

Re: Socket Library in Clojure

2012-04-27 Thread David Powell
On Fri, Apr 27, 2012 at 11:12 AM, Murtaza Husain murtaza.hus...@sevenolives.com wrote: Hi, I was looking for socket libraries in clojure. The requirement is to connect via telnet to a mainframe based system and run commands on it. Thanks, Murtaza Note that there is more to telnet protocol

Re: Saving Java objects/Clojure forms to text file

2012-04-16 Thread David Powell
How can I store the date in a text file and read it back without falling back on Java serialization? Upgrade to Clojure 1.4, which includes extensible support for parsing and serializing custom data types, with dates being one of the built-in types. It will all work automatically. -- Dave

Re: Comprehensive ClojureScript Optimizations - Please Try!

2012-04-11 Thread David Powell
On Tue, Apr 10, 2012 at 6:21 PM, David Nolen dnolen.li...@gmail.com wrote: I've merged these changes in master. I've also added another change that results in yet another large perf boost: - direct invocation of known fns instead of going through .call Not sure whether this is of interest,

Re: seeking a lazy way to interleave a constant

2012-04-10 Thread David Powell
As an aside.. I just looked at the source for this, what does the :static tag in the metadata do? From what I can make out... nothing. I think it is left over from an experiment to improve var lookup times prior to dynamic binding being disabled by default. -- You received this message

Re: What's the efficient functional way to computing the average of a sequence of numbers?

2012-03-31 Thread David Powell
As an aside: Fingertrees are an interesting way to keep a collection that can efficiently compute means over its values, or a window of its values. https://gist.github.com/672592 -- Dave -- You received this message because you are subscribed to the Google Groups Clojure group. To post to

Re: Where to post job ad

2012-03-30 Thread David Powell
On Fri, Mar 30, 2012 at 1:35 PM, David Jagoe davidja...@gmail.com wrote: G'day everyone I am increasingly relying on clojure and plan to use clojureclr and clojurescript in production too. I will soon need to hire a clojure developer and was hoping that someone could suggest a good place to

Re: Creating map from string

2012-03-18 Thread David Powell
You could use a regexp to pick out the key and the value - something like this: (into {} (map (fn [[_ x y]] [(keyword x) (clojure.string/trim y)]) (re-seq #(@[^ ]*) *([^@]*) s))) -- Dave -- You received this message because you are subscribed to the Google Groups Clojure group. To post

Re: Why don't extends? and satisfies? require implementation of all protocol methods?

2012-03-07 Thread David Powell
When you create a protocol, as an implementation detail, it also creates a Java interface. When you list protocols in a deftype or defrecord form, the generated class actually implements that Java interface. And protocol calls to that type call through the interface. This gives the best

Re: Why does (= [] (range)) not terminate?

2012-02-17 Thread David Powell
Lazy sequences implement java.util.List, which has a .size method. clojure.lang.APersistentVector/doEquiv (and doEquals) attempts to optimize when it sees it is being compared to something with a .size or .count method, by comparing sizes before doing the hard work of comparing elements. But

Re: Why does (= [] (range)) not terminate?

2012-02-17 Thread David Powell
Not really viable. What if the first item is realized and the rest aren't? Ah yeah - actually there are loads of reasons that it wouldn't work... -- Dave -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: read password from console

2012-02-07 Thread David Powell
If you have Java 6 (and you probably do), then look at: http://docs.oracle.com/javase/6/docs/api/java/io/Console.htmlhttp://docs.oracle.com/javase/6/docs/api/java/io/Console.html#readPassword(java.lang.String, java.lang.Object...) Simple example: (String/valueOf (.readPassword

Re: newline question

2012-02-07 Thread David Powell
\n in Java and Clojure is just line feed. The Windows line ending is \r\n. println and similar now use the platform appropriate line ending. This was changed some time ago. Emacs displays ^M if you have a mix of \n and \r\n in the same buffer. -- Dave -- You received this message because you

Re: filter out null values

2012-02-02 Thread David Powell
On Thu, Feb 2, 2012 at 6:59 PM, Phil Hagelberg p...@hagelb.org wrote: Razvan Rotaru razvan.rot...@gmail.com writes: (filter identity (map myfun myseq)) Is there a better/faster way? Not yet, but there's an open ticket for that: http://dev.clojure.org/jira/browse/CLJ-450 Hmm, the

ClojureScript One bootstrap problem on Windows?

2012-01-25 Thread David Powell
Hmm, I seem to be having a problem with the new bootstrap script. On Windows, I'm running: git version 1.7.7.msysgit.1 This release puts: c:\Program Files (x86)\Git\cmd\ on the PATH, which contains a git.cmd (batch file) which runs the .exe. Unfortunately, Runtime.exec won't run batch files

Domina: html in strings?

2012-01-22 Thread David Powell
Hi, I'm just starting with clojurescript and domina. I have some html in a string, eg: (def s sectiondivh3Hello/h3/div/section) Is it possible to run xpaths over this node? (nodes s) seems to convert it into some sort of dom object... Is it possible to change the text of the h3 element? Am

Re: ClojureScript in IE 9 (does it work?)

2012-01-16 Thread David Powell
On Mon, Jan 16, 2012 at 7:59 AM, gchristnsn gchrist...@gmail.com wrote: I can't even call `(js/alert test)' in IE 9, it compiles into: alert.call(null,test); and says: Invalid calling object (IE 9 standards mode, in IE 8 standards mode it doesn't recognize the `call' method) I need `alert'

Re: How to create an alias of clojure.lang.RT/loadLibrary?

2011-12-20 Thread David Powell
On Tue, Dec 20, 2011 at 6:42 PM, Antonio Recio amdx6...@gmail.com wrote: I would like to use an alias to refer clojure.lang.RT/loadLibrary as lib. Instead to use: (clojure.lang.RT/loadLibrary vtkCommonJava) I woul like to use this: (def lib (clojure.lang.RT/loadLibrary)) (lib

Re: Unexpected behaviour in unchecked-multiply when using vars as arguments

2011-12-05 Thread David Powell
On Mon, Dec 5, 2011 at 5:29 PM, Linus Ericsson oscarlinuserics...@gmail.com wrote: David and Stu to the rescue. Of course that's the way to do it. Not sure if this is what you want, but Clojure 1.3 introduced ^:const. This lets you store a primitive constant value: (def ^:const hash

[lein] Depending on tools.jar

2011-11-27 Thread David Powell
Is there any way in Leiningen to add a dependency on the JDK's tools.jar? Apparently it is possible with maven [1] I was thinking of porting my liverepl[2] utility over to leiningen to make it a bit easier to install, and easier to run without scripts, it uses the JDK's Attach API from tools.jar

Re: Lazy behavior

2011-11-02 Thread David Powell
What would be the best (idiomatic and efficiant) solution then? - wrap my file under a lazy sequence, call take drop recursively with recur - just call readLine method directly when I need more lines and process them. Hi, Have a look at the functions: line-seq and clojure.java.io/reader

Re: Can't take value of a macro aka macro noob needs help

2011-10-30 Thread David Powell
On Sun, Oct 30, 2011 at 2:22 PM, Dennis Haupt d.haup...@googlemail.comwrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 i played around a bit (defmacro times [times exprs] '(let [countdown# ~times] (loop [remaining# countdown#] (when ( 0 remaining#) ~@exprs

Re: Trickiness with protocols and extends (1.3.0)

2011-10-28 Thread David Powell
On Fri, Oct 28, 2011 at 6:46 PM, Howard Lewis Ship hls...@gmail.com wrote: From my perspective, defprotocol appears to create a name (in the current namespace) as well as a Java interface (the real type). It feels to me like I should be able to pass either the interface or the protocol into

ClojureScript interop

2011-10-28 Thread David Powell
I'm struggling at getting started in ClojureScript. One problem I have: I don't have to look far in Closure before I find an API like this: http://closure-library.googlecode.com/svn/docs/class_goog_dom_DomHelper.html#goog.dom.DomHelper.prototype.createDom that takes a JavaScript name/value

Re: Idiomatic record construction in 1.3

2011-10-26 Thread David Powell
Also, the factory fns are available when you require/use the relevant namespace, so the client doesn't have to use import as well. -- Dave -- 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

Re: Is Clojure Simple?

2011-10-22 Thread David Powell
Simplicity was described as being a property of the artefact, not the construct wasn't it? So I'm not sure what it means exactly for Clojure to be simple or complex. Does Clojure allow you to write artefacts that are simple? Yeah, I think so, and I think it often makes it easier. There was a

Re: statistics library?

2011-09-27 Thread David Powell
Again, if I understand correctly, under no circumstances should the p-value ever be outside of the range from 0 to 1. It's a probability, and no value outside of that range makes any sense. But Incanter sometimes returns p-values greater than 1. I see that there was a recent fix made to

Re: heaps in clojure

2011-09-15 Thread David Powell
Does that work? There is no guarantee that the top 10 of the overall list matches the top 10 of earlier prefixes, so the candidates that get discarded might be part of the overall top 10, and the elements that pushed them out could just be local maxima. -- Dave On 15 Sep 2011 08:23, Mark

Re: heaps in clojure

2011-09-15 Thread David Powell
...@gmail.com wrote: If you maintain the invariant that at each point, your sorted set contains the top 10 you've seen so far, then from that invariant you can conclude that at the end of the traversal, your sorted set contains the top 10 for the overall list. On Thu, Sep 15, 2011 at 12:34 AM, David

Re: heaps in clojure

2011-09-15 Thread David Powell
anything about frequency or how many times you've seen a given item in the statement of the problem. When I talk about a best item, I mean it is the first with regard to whatever comparison method you're using. On Thu, Sep 15, 2011 at 1:04 AM, David Powell d...@djpowell.net wrote: But when

Re: ClojureScript keywords

2011-09-02 Thread David Powell
Clojurescript represents symbols and keywords as strings with a one character unicode prefix (as an implementation detail). But, by default it outputs javascript as utf-8, and unless you are serving javascript from a server and have setup the headers accordingly, this will be misinterpreted by

Re: how to create a ordered data structure which would efficiently return the element before and after it

2011-09-01 Thread David Powell
On Thu, Sep 1, 2011 at 11:13 AM, Sunil S Nandihalli sunil.nandiha...@gmail.com wrote: Hi Everybody, I would like to create a sorted-data-structure which would enable me to efficiently 1. insert new elements into it maintaining the sorted-nature of the data structure. 2. query as to which

Re: mini-version of clojure.jar?

2011-08-25 Thread David Powell
The slim jar probably won't work in an applet, because it does classloader stuff (unless you have a signed applet). -- Dave -- 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

Re: mini-version of clojure.jar?

2011-08-25 Thread David Powell
in performance between slim and full? My applet mostly does swing-stuff, http GETS and POSTS - and audio playback and recording. On 25 Aug, 10:40, David Powell d...@djpowell.net wrote: The slim jar probably won't work in an applet, because it does classloader stuff (unless you have a signed

Re: Generating new exception classes in clojure

2011-08-22 Thread David Powell
You can use proxy for this. It doesn't create wrappers, it creates a proper subclass with methods that delegate to clojure functions via var lookup. -- Dave -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: Nasty java interop problem -- ideas?

2011-08-12 Thread David Powell
The simplest so far seems to be to use gen-interface to create a subinterface of Controller with all the methods I need, or gen-class. But that would require AOT compilation. Can I get away without it? Can you use definterface to create an interface with your methods on, and then deftype or

Re: character encoding issue in compiled .js

2011-08-04 Thread David Powell
The character at the beginning of the string isn't a corrupt ':', it is a Unicode control character '\uFDD0' which seems to be output as an internal detail so that clojurescript can distinguish keywords and strings. The clojurescript compiler outputs javascript as utf-8. So technically,

Re: clojurescript advanced compile error

2011-08-02 Thread David Powell
On Mon, Aug 1, 2011 at 5:10 PM, Tero Parviainen ter...@gmail.com wrote: This is a known feature with Closure templates: http://code.google.com/p/closure-templates/issues/detail?id=25 The Closure compiler does name replacement on the template parameters, so that after the compilation the

Including additional js in clojurescript compilation

2011-07-30 Thread David Powell
The closure-template tools let you take a template, and pre-process it to something like: hello3.soy.js: goog.provide('example.templates'); goog.require('soy'); goog.require('soy.StringBuilder'); [...] example.templates.welcome = function(opt_data, opt_sb) { [...] In my clojurescript, I can

Re: Using Clojure To Debug Java Apps

2011-07-13 Thread David Powell
I wrote a tool called liverepl a while ago: https://github.com/djpowell/liverepl It effectively lets you get a repl into a Java or Clojure process, but it has the nice feature that it works with any Java processes without requiring any modifications to the code. It uses the Java Attach API,

Re: Looking for examples of using Java iterators from Clojure...

2011-07-09 Thread David Powell
On Sat, Jul 9, 2011 at 10:10 AM, stu stuart.hungerf...@gmail.com wrote: Hi, I'd like to make use of Java classes implementing the Java2D PathIterator interface: http://download.oracle.com/javase/6/docs/api/java/awt/geom/PathIterator.html Which leads to a serious impedance mismatch

Re: pretty-print by default?

2011-07-01 Thread David Powell
On Fri, Jul 1, 2011 at 2:32 PM, Jeffrey Schwab j...@schwabcenter.comwrote: Is there any way to make the Clojure repl pretty-print by default? I have a bunch of little functions that return things like directory listings and git output, mostly as seqs of lines or Files. I could change the

Re: pretty-print by default?

2011-07-01 Thread David Powell
user.clj is old, and isn't ideally suited for pre-loading handy things into a repl. An alternative might be to put your repl init stuff in a file, such as: /home/repl-init.clj: (require 'clojure.pprint) (clojure.main/repl :print clojure.pprint/pprint) And then change your repl startup script

Re: User.clj and set!

2011-06-19 Thread David Powell
On Sun, Jun 19, 2011 at 11:58 AM, Andreas Liljeqvist bon...@gmail.comwrote: I am trying to set! *printlength* to something not insanity inducing. Problem is that user.clj doesn't support set! Vars normally only have a global root binding. When you use (binding [varname newvalue]) the var gets

Re: Free Compojure Hosting? (or mostly free)

2011-06-10 Thread David Powell
On Fri, Jun 10, 2011 at 3:26 PM, Asim Jalis asimja...@gmail.com wrote: I tried this also and it works quite well. Do you have any pointers to information on how to access the datastore on Heroku through Clojure? The documentation seemed sketchy on their non-Ruby offerings. I've not tried it,

Re: clojure.contrib.sql = clojure.java.jdbc - looking for feedback!

2011-04-26 Thread David Powell
Yes, resultset-seq does lowercase the column names and it doesn't translate between - / _ either. But that's not part of c.j.j so, whilst I may agree with the criticisms of it, I can't actually fix that :) There is justification for resultset-seq's current behaviour, even if it isn't to

Re: Calling .close() on resources -- with-open macro

2011-01-25 Thread David Powell
On 25 Jan 2011 06:04, Shantanu Kumar kumar.shant...@gmail.com wrote: The changed code should catch 'Exception', not 'Throwable' because the latter is a common ancestor of both 'Exception' and 'Error'. An 'Error' must not be swallowed at any point in the system, unless you are writing an app

Re: Calling .close() on resources -- with-open macro

2011-01-25 Thread David Powell
On Tue, Jan 25, 2011 at 1:04 PM, Shantanu Kumar kumar.shant...@gmail.comwrote: I can't see the value in catching Throwable and then re-throwing it; idiomatically Throwable is rarely caught. Looking at code example, the following two snippets below are just the same: (try (.close resource)

Re: Calling .close() on resources -- with-open macro

2011-01-24 Thread David Powell
apache commons io and spring framework, to name 2 things I know for sure, are doing what you say: they swallow any exception that could be thrown within the finally block, for the reasons you mention. True, but if the body doesn't throw an exception, but the close does, I wouldn't want the

Re: Calling .close() on resources -- with-open macro

2011-01-24 Thread David Powell
apache commons io and spring framework, to name 2 things I know for sure, are doing what you say: they swallow any exception that could be thrown within the finally block, for the reasons you mention. True, but if the body doesn't throw an exception, but the close does, I wouldn't want the

Re: Calling .close() on resources -- with-open macro

2011-01-24 Thread David Powell
apache commons io and spring framework, to name 2 things I know for sure, are doing what you say: they swallow any exception that could be thrown within the finally block, for the reasons you mention. True, but if the body doesn't throw an exception, but the close does, I wouldn't want the

Re: Euler 14

2011-01-20 Thread David Powell
This same problem was raised recently: https://groups.google.com/group/clojure/browse_thread/thread/df4ae16ab0952786?tvc=2q=memory It isn't a GC problem, it is an issue in the Clojure compiler. The issue seems to only affect top-level defs. At the top-level: (reduce + (range 1000)) -

Re: almost as dosec

2011-01-20 Thread David Powell
On Thu 20/01/11 13:06 , kony kulakow...@gmail.com sent: Hi, I am looking for something which operates similarly as doseq but in case of more than one binding traverses every sequence only one. I.e. wanted result: (doseq [x '(A B C) y '(1 2 3)] (println (list x y))) should produce:

Re: Enhanced Primitive Support Syntax

2011-01-15 Thread David Powell
Bob Hutchison said: In other words, I'd be very annoyed, and I'd expect others to be annoyed too, if a numerical error was introduced to one of my programs because of an unexpected, silent, compiler optimisation. Just to be clear, Clojure 1.3-alpha does not introduce numerical errors,

Re: Let's see how fast we can make this

2010-12-22 Thread David Powell
Wednesday, December 22, 2010, 6:52:01 PM, you wrote: On my machine, your reduce example (I actually wrote that myself as my first try) runs marginally slower than my loop example. I don't know why you're getting such weird numbers. Your areduce example is worst of all at 74072 on my machine.

Re: struct type info

2010-11-27 Thread David Powell
Hello Sunil, Saturday, November 27, 2010, 11:24:58 AM, you wrote: Hello, I would like to know if it is possible to find out the name of the structure from its instance. my attempt to use the function class is not giving me any useful info. It kept saying that it is a structmap and

Re: hashCode?

2010-11-23 Thread David Powell
On Tue 23/11/10 09:41 , Sunil S Nandihalli sunil.nandiha...@gmail.com sent: Hello everybody, It is really nice that all the clojure-datastructures have a function called hashCode.. I saw it gave the same answer for the same native map/vector/set/list give the same number ... is it meant to

Re: Nested For(s)

2010-10-19 Thread David Powell
On Tue 19/10/10 06:57 , Rising_Phorce josh.fe...@gmail.com sent: Nested For(s) produce lists of lists: =(for [x (range 5)] (for [y (range 5)] y)) ((0 1 2 3 4) (0 1 2 3 4) (0 1 2 3 4) (0 1 2 3 4) (0 1 2 3 4)) I want to use for(s) in order to use the loop counters from the bindings,

Re: resultset-seq

2010-10-15 Thread David Powell
On Thu 14/10/10 20:58 , Mark Engelberg mark.engelb...@gmail.com sent: Since no one chimed in with support or reasoning for resultset-seq's current lower-casing behavior, can we discuss changing it to case-maintaining behavior, or at least make it something you can set with an optional flag?

Re: Clojure 1.3 alpha 1 report - bitwise operations extremely slow

2010-10-01 Thread David Powell
On Fri 01/10/10 06:52 , Mark Engelberg mark.engelb...@gmail.com sent: On Thu, Sep 30, 2010 at 9:13 PM, ataggart agg...@gmail.com wrote: As with most microbenchmarks you're measuring the test more than the subject.  In the above case the seq generation dominates. Compare the following on

Re: Clojure 1.3 alpha 1 report - bitwise operations extremely slow

2010-10-01 Thread David Powell
So, if it is true that range produces objects and dotimes produces primitive longs, then I believe that it is the odd interaction between bit-shift-left's inlining and long objects (as opposed to primitives) that is causing the disparity in your measurements, not something inherent in the

Re: slow raw io

2010-08-09 Thread David Powell
On Sat 07/08/10 14:02 , Stuart Halloway stuart.hallo...@gmail.com sent: No. We want to collect more information and do more comparisons before moving away from the recommended Java buffering. Stu This isn't an issue with the buffering, it is an issue with the massive overhead of doing

Re: slow raw io

2010-08-09 Thread David Powell
This isn't an issue with the buffering, it is an issue with the massive overhead of doing character at a time i/o - it is something that you really should never ever do. I'd say something somewhere doing character at a time i/o is probably the number one cause of crippling performance

Re: slow raw io

2010-08-09 Thread David Powell
Maybe this seems like a low-priority issue but I think slurp is likely to be very commonly used. For instance, the Riak tutorial just posted to Hacker News uses it: http://mmcgrana.github.com/2010/08/riak-clojure.html In the past I've steered clear of using slurp because it didn't hand

newline and println on windows

2010-06-30 Thread David Powell
I raised a ticket a while ago regarding newline and println on Windows. http://www.assembla.com/spaces/clojure/tickets/300-newline-should-output- platform-specific-newline-sequence Currently these functions always output ASCII 10 line feeds. I believe that they should output the platform

Re: Enhanced primitive support - redux

2010-06-26 Thread David Powell
Hi, Re: caching boxed ints: I think I pointed it out, and I reiterate it will probably not improve performance a lot (Except if you use always the 5 same numbers). Reiteration won't make it true. At about 10m - 12m into this video, Cliff Click suggests that Java's caching of Integer objects

Re: cond formatting

2010-06-22 Thread David Powell
(cond (even? a) a ;if a is even return a ( a 7) (/ a 2) ;else if a is bigger than 7 return a/2 ( a 5) (- a 1) ;else if a is smaller than 5 return a-1 t 17) I tend to write the condition and action on separate lines, and put a blank comment in between each, like this:

Re: Enhanced Primitive Support

2010-06-19 Thread David Powell
Personally, I have no real interest in bigints, but I'm glad that they are there, and that arithmetic code supports them polymorphically. I'm not sure what I think regarding non-promoting numeric operators. They are ok, but they seem to add complexity to the language, and they don't look very

Re: Enhanced Primitive Support

2010-06-19 Thread David Powell
I think if we had them, promoting ops should be the primed ones, and they would mostly be used in library Oops, I had meant the non-primed ops should support promotion. But tbh, I have mixed feelings about promotion. I haven't required bitint promotion myself, but having statically typed

Re: Choosing a Clojure build tool

2010-03-26 Thread David Powell
I often want to add a custom task to a build, just as an example, I might want to call a Java method in my code after it has built which will generate a property file to be included in the distribution. If this was just a make file or some sort batch file, then that would just be an extra line

Re: Why I have chosen not to employ clojure

2010-03-22 Thread David Powell
On Mon 22/03/10 11:31 , LucPréfontaine lprefonta...@softaddicts.ca sent: Is my first impression right or wrong ? Is Clojure harder to setup from Windows for beginners ? Would an installer (.msi) help by hiding Java related details and providing some basic scripts to run it ? I think there

Checked exceptions in LazySeq

2009-11-19 Thread David Powell
LazySeq is wrapping my InterruptedExceptions in several layers of RuntimeException, which is a bit awkward, because then my top level code spews pages of exceptions, rather than just reporting that the process was cancelled. Is there anything better that could be done? + Change the

Re: ANN: Clojure live-repl

2009-10-29 Thread David Powell
* Is it OK if live-repl uses one version of Clojure and the attached process uses another? It should be fine. I check to see if Clojure is already on the process's classpath. If it isn't a Clojure process, I use the bundled copy of Clojure; if Clojure is already loaded then I just use that

Re: ANN: Clojure live-repl

2009-10-28 Thread David Powell
Under Linux I had to fix the paths in liverepl.sh to include the build folder: java -cp $LIVEREPL_HOME/build/*:$JDK_HOME/lib/tools.jar net.djpowell.liverepl.client.Main $CLOJURE_JAR $LIVEREPL_HOME/build/liverepl-agent.jar $LIVEREPL_HOME/build/liverepl-server.jar $@ I think liverepl.sh

ANN: Clojure live-repl

2009-10-18 Thread David Powell
Hi, I just posted a project at http://github.com/djpowell/liverepl. It uses the Java Attach API to let you connect a Clojure REPL to any running Java or Clojure process, without them requiring any special startup. It probably requires a Sun 1.6 JDK. And currently the startup script is a

Re: ANN: Clojure live-repl

2009-10-18 Thread David Powell
and I can attach, but if the process I attach to exits, I get a never-ending stream of \xef \xbf \xbf characters: 75 73 65 72 3d 3e 20 ef bf bf ef bf bf ef bf bf |user= .| 0010 ef bf bf ef bf bf ef bf bf ef bf bf ef bf bf ef || 0020 bf bf

Re: Single method interface proxies

2009-09-18 Thread David Powell
Hi, I was thinking can we do some magic to easily implement single method interfaces? What i mean how can we reduce the noise in the following: (proxy [java.lang.Runnable] [] (run [] (println running))) FYI: For this specific case, the answer is fairly simple. Clojure fn's implement

Re: Overflow by (inc) and (dec) at integer boundaries?

2009-08-14 Thread David Powell
user= (.getClass (+ 1 Integer/MAX_VALUE)) java.lang.Long Also, user= (def i (Integer/MAX_VALUE)) user= (class (+ 1 i)) java.lang.Long user= (class (inc i)) java.math.BigInteger I'd expect inc to overflow to a Long rather than a BigInteger. -- Dave

Re: easiest JMX API ever, in Clojure...

2009-07-23 Thread David Powell
A remote process (process not running on the same machine as JMX client) can usually be accessed through an RMI connection. I might be totally wrong here, but jconsole lets you connect to any java process on Java 1.6, without needing jmxremote properties. I got the impression, that this is

Re: Clojure for high-end game development

2009-05-22 Thread David Powell
On Fri 22/05/09 09:50 , jdz yohoho...@gmail.com sent: On May 21, 9:35 pm, tcg tomgu...@g mail.com wrote: You would think with Clojure's ability to make use of mutli cpu hardware it would be a good choice for high-end game development. Clojure is not the only language which provides

Re: Bit-Shift without Sign-Extend?

2009-05-22 Thread David Powell
On Fri 22/05/09 03:39 , CuppoJava patrickli_2...@hotmail.com sent: Hi everyone, I'm just wondering where the equivalent of the operator is forClojure. I need it to do a divide-by-power-of-2 on unsigned bytes. Java doesn't have this either. Its operator doesn't work properly on

Re: Clojure at JavaOne

2009-05-22 Thread David Powell
On Thu 21/05/09 17:43 , Rich Hickey richhic...@gmail.com sent: I'd like to do something modest but distinguishing. I have a vague notion of showing some Clojure data originating in some XML off the web, being passed to some filtering/walking code, getting displayed, stored in a DB, all

Re: Clojure as a Java lib documentation / examples?

2009-05-22 Thread David Powell
On Fri 22/05/09 02:23 , Brett Morgan brett.mor...@gmail.com sent: Hi guys, I have some evil thoughts of using Clojure as a java library so that i can use both the STM and the persistent data structures in projects that my team of java developers can work with. As much as I'd like to

Re[2]: hash-map based on identity

2009-03-08 Thread David Powell
Identity is tested first in equality, if identical, equal, full stop. That's what I'd assumed (it's what the JDK collections do), but looking at the code, to say, APersistentVectory, I can't see where the identity test is done? Am I looking in the wrong place? -- Dave

Re: stopping a computation done in a future object

2009-03-07 Thread David Powell
Hello, Sometimes, one wants to answer to an event by starting a (potentially long) computation in the background. But if the same event is received again, one may want to stop the computation currently running in the background, and relaunch one in the background with newest data. Is

Re: Laziness madness

2009-03-02 Thread David Powell
I felt the same way at first. I think it would help if the group shared some common, non-mathematical cases, where laziness is helpful. I've been using multiple resultset-seq to collect together matching data from different databases and stream it on through some existing Java code. It is

StringSeq

2009-02-28 Thread David Powell
I noticed the other day that StringBuffers aren't seq-able. Would it make sense to allow StringSeq to work on any CharSequence implementation, not just Strings? -- Dave --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: A pipe macro for left-to-right coll streams

2009-02-10 Thread David Powell
I like the pipe macro. I get a bit cognitively overloaded when map/filter/reduce are nested, I think it is made worse because they have 2 or more arguments, so you have to do a lot of jumping around to follow them. The left-to-right style is much easier to follow. I'm not sure about let-

Re: What profilers are you using?

2009-02-07 Thread David Powell
Newer versions of JDK 1.6, eg Update 11, have an application called 'jvisualvm' in the bin directory. It lets you attach to any running Java process and it has a profiler that you can switch on at runtime. It seems quite good. It does profiling via instrumentation, and yet doesn't slow the app

Re: Lazy living, without variables

2008-12-02 Thread David Powell
Hi, On the subject of with-local-vars, I noticed that I could use @ to deference them in addition to var-get. Is that intended behaviour? I didn't see it documented anywhere. -- Dave --~--~-~--~~~---~--~~ You received this message because you are subscribed

<    1   2