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-

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: 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

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[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: 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: 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

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: running command when lein repl starts

2013-11-19 Thread David Powell
Hmm, maybe you need to use this: https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L209 -- Dave On Tue, Nov 19, 2013 at 5:51 PM, Andy Smith the4thamig...@googlemail.comwrote: Ok valid point, but I still get the same kind of errors? -- -- You received this message

Re: running command when lein repl starts

2013-11-19 Thread David Powell
)} ) You had closed the opening paren on the :dependencies line. And :dependencies isn't allowed inside :repl-options, which was causing the org.clojure error. -- Dave On Tue, Nov 19, 2013 at 5:56 PM, David Powell djpow...@djpowell.net wrote: Hmm, maybe you need to use this: https

Re: running command when lein repl starts

2013-11-19 Thread David Powell
I tend to work on files in emacs or an IDE, with a linked repl, rather than at a raw repl, so the file I'm working on will tend to have an ns directive that will require the appropriate namespaces, so I just eval that when I open the file. On Tue, Nov 19, 2013 at 6:05 PM, Andy Smith

Re: [ClojureScript] Re: Next ClojureScript Release: 1 more ticket

2013-11-20 Thread David Powell
It still isn't working on Windows. At https://github.com/clojure/clojurescript/blob/047dbb3d2bd7c3a2e00805ec2f2480e449451521/src/clj/cljs/closure.clj#L750 path is either a file:// url or something like: /C:/Temp/cstest2/out/cljs/core.js - which is a bit mangled, and is caused by calling .getPath

Re: [ClojureScript] Re: Next ClojureScript Release: 1 more ticket

2013-11-20 Thread David Powell
I think a good approach might be to: Keep everything as file:// urls given that we need to use urls anyway for.jar references. Never call .getPath on a URI / URL - it undoes the URL escaping that we want, and it returns weird /c:/ things on Windows that don't work as anything. Write our own URL

Re: IE compatibility of clojurescript, Element undefined problem

2013-12-16 Thread David Powell
The clojure.browser namespace does try to extend a protocol to js/EventType - which IE6 doesn't have, but if you use third party alternatives, raw javascript DOM manipulation, or Google Closure, then things should work in IE6. On Mon, Dec 16, 2013 at 12:59 PM, Xiangtao Zhou tao...@gmail.com

Re: map and lazy sequence

2014-02-28 Thread David Powell
Not everything is chunked, but data-structures like vectors produce chunked-seqs. On Fri, Feb 28, 2014 at 5:06 PM, Jim - FooBar(); jimpil1...@gmail.comwrote: Clojure works on a chunked basis for performance reasons...THe size of a chunk is 32 elements - thus you would actually get 32

Re: transient map bug?

2014-03-06 Thread David Powell
Something like this would work: (persistent! (reduce (fn [r x] (assoc! r x -)) (transient {}) (range 100))) Which is just: (reduce (fn [r x] (assoc r x -)) {} (range 100)) ...but with transient applied to the input, and persistent! applied to the output. On Thu,

Re: dependencies from github

2014-03-27 Thread David Powell
If you checkout the package to checkouts/not-really-trusted-package, then that version will automatically be used instead. https://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md#checkout-dependencies -- Dave On Thu, Mar 27, 2014 at 9:16 AM, t x txrev...@gmail.com wrote: Hi,

Re: dependencies from github

2014-03-27 Thread David Powell
On Thu, Mar 27, 2014 at 10:23 AM, David Powell d...@djpowell.net wrote: If you checkout the package to checkouts/not-really-trusted-package, then that version will automatically be used instead. https://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md#checkout-dependencies

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: 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: 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

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: 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

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

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: 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

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: 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: 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 - 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: Simple FIFO cache for memoize

2013-01-23 Thread David Powell
Specifically, core.memoize uses core.cache to provide more flexible replacements for memoize: https://github.com/clojure/core.memoize -- Dave On Wed, Jan 23, 2013 at 8:12 AM, Baishampayan Ghose b.gh...@gmail.comwrote: Take a look at core.cache - https://github.com/clojure/core.cache ~BG

Re: Installing Clojure on Windows 7

2013-01-24 Thread David Powell
I don't think there should are any problems with Clojure on Windows 7. lein trampoline cljsbuild repl-rhino didn't work for me on old versions of leiningen, but on the release version of lein 2 it works perfectly. I use a mix of IntelliJ+LaClojure Emacs+clojure-mode and they also work

Re: Best practice - (:keyword map) versus (map :keyword)

2013-01-29 Thread David Powell
Generally, if the map is behaving like small struct, and you are accessing fields of it, (:keyword map) is idiomatic, and mirrors (.fields object). If the map is used like a data-structure, or a mapping function, then (map :keyword) is more idiomatic. Note that if you are using defrecords,

Re: ANN: babbage 1.0.0, a library for easily gathering data and computing summary measures in a declarative way

2013-02-02 Thread David Powell
I'm sure these libraries do the job better, but just for interest, here is a fun example of using finger-trees to maintain stats for a collection as it gets updated: https://gist.github.com/672592 -- Dave -- -- You received this message because you are subscribed to the Google Groups Clojure

Re: leiningen dependencies plugin

2013-02-06 Thread David Powell
I wrote this recently to copy your dependencies to a specific directory in your project: https://github.com/djpowell/lein-libdir Or you could just use lein-uberjar? Or lein-tar to bundle everything up? -- Dave On Wed, Feb 6, 2013 at 11:41 AM, Maris maris.orbid...@gmail.com wrote: Is

Re: Why is this so difficult?

2013-02-15 Thread David Powell
Just for the record, I've had problems with lein trampoline on the past, but the latest version of lein is fine. I do all my clojure on Windows 7. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: does lein2 use repositories defined in ~/.m2/settings.xml?

2013-02-21 Thread David Powell
Just wondering; if you want to specify an internal nexus repo in one place, can you specify it in ~/.lein/profiles.clj ? It's possible, but highly discouraged. If your project requires certain repositories in order to operate, you should declare them in project.clj. Specifying

Re: Module For COM Objects

2013-02-21 Thread David Powell
There is an example here of using JACOB: http://en.wikibooks.org/wiki/Clojure_Programming/Examples/Talking_to_Excel (I think this only works for IDispatch stuff?) On Fri, Feb 22, 2013 at 1:02 AM, Kevin Downey redc...@gmail.com wrote: The are a few tools for doing interop with COM from the

Re: was there a time when clojure empty seqs were falsy?

2013-02-25 Thread David Powell
Some time before the release of Clojure 1.0, there didn't used to be any such thing as an empty sequence. You either had a (lazy) sequence, or nil. This made it easy to use sequences as emptiness tests, but had the cost that a lazy sequence wasn't fully lazy because anything that returned one

Re: ANN: Clojure 1.5

2013-03-01 Thread David Powell
works for me... do you have some sort of version conflict perhaps? user= (clojure-version) 1.5.0 user= (require '[clojure.core.reducers :as r]) nil user= (r/fold + (range 1000)) 499500 On Fri, Mar 1, 2013 at 4:46 PM, Tassilo Horn t...@gnu.org wrote: Stuart Halloway stuart.hallo...@gmail.com

Re: Wrong clojure version depending on lein dependencies (was: ANN: Clojure 1.5)

2013-03-04 Thread David Powell
On Mon, Mar 4, 2013 at 2:01 PM, Meikel Brandmeyer (kotarak) m...@kotka.dewrote: Hi Chas, Am Montag, 4. März 2013 14:33:29 UTC+1 schrieb Chas Emerick: There are a lot of reasons for this, but #1 for me is that few people understand the implications of version ranges, either downstream of

Re: Wrong clojure version depending on lein dependencies (was: ANN: Clojure 1.5)

2013-03-04 Thread David Powell
On Mon, Mar 4, 2013 at 2:55 PM, Wolodja Wentland babi...@gmail.com wrote: On Mon, Mar 04, 2013 at 14:42 +, David Powell wrote: 1.2 in this case is a soft dependency on 1.2. This is probably what you want. http://docs.codehaus.org/display/MAVEN/ Dependency+Mediation+and+Conflict

Re: Clojurescript bug

2013-03-05 Thread David Powell
You could try the lein-outdated plugin. https://github.com/ato/lein-outdated It looks at your project.clj, and tells you if there are newer versions of any of your dependencies, and if so, what they are. Eg: lein outdated [org.clojure/clojurescript 0.0-1586] is available but we use

Re: Hello World not found

2013-03-05 Thread David Powell
It looks like the (unofficial) Clojure chocolatey package, installs its own clj.bat file. The -m package.name syntax only works for clojure packages that are on your classpath, and that script doesn't put the current directory on the classpath. You might have better luck with something like:

Re: Windows Installation

2013-03-10 Thread David Powell
I've made installers for clojure-based programs using InnoSetup before, and wouldn't mind doing it if people think it is a good idea. There would be a few choices around Java... a) Assume that a JDK is installed b) Check for java and direct the user to Oracle's site to download JDK 7 if it is

Re: strange interop behaviour/issue

2013-03-12 Thread David Powell
It looks like: public String[] tag(String[] sentence, Object[] additionaContext); wasn't originally present in the API, and was added in: http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/postag/POSTaggerME.java?r1=1245855r2=1294177 It sounds like you might

Re: What causes the text that I print to the terminal to become mangled garbage?

2013-03-13 Thread David Powell
pprint uses refs internally rather than vars. I was always a bit suspicious about that... Perhaps transaction retries are happening? On Wed, Mar 13, 2013 at 3:19 PM, larry google groups lawrencecloj...@gmail.com wrote: tl;dr concurrency is hard Jason, if it was just a concurrency issue,

Re: Using transients within fold

2013-03-14 Thread David Powell
As a temporary hack, perhaps you could implement a deftype ReduceToTransient wrapper that implements CollReduce by calling reduce on the parameter, and then calling persistent! on the return value of reduce. You'd also need to implement CollFold so that the partitioning function produces wrapped

Re: cannot get more than 94 fibonacci numbers - integer overflow

2013-03-25 Thread David Powell
On Mon, Mar 25, 2013 at 3:24 PM, Jim foo.bar jimpil1...@gmail.com wrote: On 25/03/13 15:22, Ben Wolfson wrote: The 94th fibonacci number is greater than Long/MAX_VALUE, so it overflows. It is using longs. I seeshouldn't Clojure auto-promote it to a BigInt then? It doesn't by default.

Re: why am I hitting the 64k method limit on a var?

2013-03-25 Thread David Powell
You might be better off putting the config into a file, and then read-ing it. That way it never gets compiled into a class, and just stays as a data structure. On Mon, Mar 25, 2013 at 9:23 PM, larry google groups lawrencecloj...@gmail.com wrote: Are vars subject to Java's 64k limit on

Re: why am I hitting the 64k method limit on a var?

2013-03-26 Thread David Powell
On Tue, Mar 26, 2013 at 10:40 AM, Marko Topolnik marko.topol...@gmail.comwrote: What exactly is getting compiled into a class here? Not the map itself, I believe; that wouldn't even cause this error. From general clues, the code that builds your config map is being compiled into a method.

Re: why am I hitting the 64k method limit on a var?

2013-03-26 Thread David Powell
On Tue, Mar 26, 2013 at 5:48 PM, larry google groups lawrencecloj...@gmail.com wrote: I'd guess that this would be a pretty big map to run to over 64k though - though I think Clojure has a single initialiser method that initialises all vars in the namespace, so it is tha total that is

Re: Reader bug?

2013-03-28 Thread David Powell
Internally they might be the same thing, but lexically they aren't; eg, Clojure string literals can wrap over multiple lines, and Java strings can't. On Thu, Mar 28, 2013 at 8:19 PM, Mark Engelberg mark.engelb...@gmail.comwrote: According to the Java docs, Java strings support eight escape

Re: Getting array length

2013-03-30 Thread David Powell
It seems that .length isn't a real field at the JVM level - it is just part of the Java - the language. The JVM has a special arraylength op-code for getting the length of arrays. On Sat, Mar 30, 2013 at 5:17 PM, Alice dofflt...@gmail.com wrote: Why doesn't (.length (int-array 5)) work? Why

ANN: Windows installer for Leiningen

2013-03-30 Thread David Powell
Hi, I've put together an installer for Leiningen on Windows: http://leiningen-win-installer.djpowell.net/ Hopefully it should make it a bit easier for Windows people to get Leiningen and a Clojure repl up and running. It requires a JDK to be installed first, but other than that there aren't any

Re: ANN: Windows installer for Leiningen

2013-03-31 Thread David Powell
Interesting. Yes this is a problem with lein.bat rather than the installer. Leiningen recently added support for powershell because it was assumed that powershell would always be installed, but in fact that isn't the case. The installer bundles curl as a fallback for when powershell isn't

Re: ANN: Windows installer for Leiningen

2013-03-31 Thread David Powell
Also, can you check what version of powershell you have? powershell -Command echo $host.version -- 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

Re: ANN: Windows installer for Leiningen

2013-03-31 Thread David Powell
powershell -Command {param($a,$f) (new-object System.Net.WebClient).DownloadFile($a, $f)} %~2 %~1 Ah, yeah. %~1 and %~2 strip the quotes off the parameters, which isn't a good idea. Something like this should work: powershell -Command {param($a,$f) (new-object

Re: ANN: Windows installer for Leiningen

2013-03-31 Thread David Powell
Hi, But there is a second problem. It (apparently) tries two save the jar file in C:\Users\Username\.lein\self-installs\leiningen-x.y.z-standalone.jar But it looks like it doesn't deal correctly with spaces in the path. If your Username were to be John Doe, only the part in front of the

Re: ANN: Windows installer for Leiningen

2013-03-31 Thread David Powell
That's correct, now it works! :) Great. The patch has been accepted by leiningen, so it should be in the next release. IMHO the patch should be just the line 83 of your file, the other quoted variables are URLs (which cannot have spaces). Note that :DownloadFile, when calls powershell,

Re: why can I re-use local variables if Clojure is immutable?

2013-04-02 Thread David Powell
On Tue, Apr 2, 2013 at 8:09 PM, larry google groups lawrencecloj...@gmail.com wrote: Does anyone actually write Clojure code like this, or is it considered bad form? I do quite often. I think the new 1.5 threading macros are probably considered better form where they are appropriate, but

Re: Analog to Scheme's partition in Clojure?

2013-04-04 Thread David Powell
I thought about map destructuring but I don't think it works with boolean keys. I think this is good enough though: You could use the long-form of map destructuring: (let [{odd true even false} (group-by odd? (range 1 10))] (println odd) (println even)) -- Dave -- -- You received

Re: Where is clojure.inspector namespace

2013-04-07 Thread David Powell
On Sun, Apr 7, 2013 at 10:36 AM, Josh Kamau joshnet2...@gmail.com wrote: I keep getting this : ClassNotFoundException clojure.inspector java.net.URLClassLoader$1.run (URLClassLoader.java:366) when i try to do this : (clojure.inspector/inspect (range 10)) Do i need to require/use or add

Re: [ANN] Instaparse 1.0.0

2013-04-09 Thread David Powell
Looks awesome. Would it be possible to plug in support for the ABNF[1] notation that the IETF use? Might be useful for implementing standards. Mostly just a different syntax for repetition, and has support for comments. [1] http://www.rfc-editor.org/std/std68.txt -- Dave -- -- You

Re: Disable undocumented #= reader macro to prevent unsafe code injection?

2013-04-09 Thread David Powell
On Tue, Apr 9, 2013 at 6:03 PM, rebcabin bc.beck...@gmail.com wrote: Hello -- I would like to use Clojure to build a safe code-remoting application for query injection (moving queries closer to the data for affinity and privacy). One alternative for this application is to read Clojure code

Re: Disable undocumented #= reader macro to prevent unsafe code injection?

2013-04-09 Thread David Powell
Also - take a look at: https://github.com/flatland/clojail -- 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 - please be patient

Re: Leiningen exception when run inside a project

2013-04-10 Thread David Powell
Btw - I have created an installer for leiningen on Windows, that makes sure that your JDK is set up properly. http://leiningen-win-installer.djpowell.net On Wed, Apr 10, 2013 at 10:30 AM, Dmytro Kozhukhar dkozhuk...@gmail.comwrote: SOLVED Just installed JDK instead of JRE and it works ok.

Re: [ANN] Instaparse 1.0.0

2013-04-13 Thread David Powell
Would it be possible to have an option to tag the parse tree with meta-data indicating the character offset (or line column)? -- 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 there a way to use clojure.main/repl from lein?

2013-05-27 Thread David Powell
The project.clj files in pedestal contain an alias definition: :aliases {dumbrepl [trampoline run -m clojure.main/main]} You could try something like that. -- Dave On Mon, May 27, 2013 at 6:48 PM, Stuart Halloway stuart.hallo...@gmail.comwrote: I thought I wanted some of the affordances,

Re: [ANN] alpacas: a new Clojure source viewer

2013-06-05 Thread David Powell
Personally, I think there is too much guesswork involved in understanding what the LGPL means re Java. For example, from http://jtds.sourceforge.net/license.html, a Java library: Using jTDS is considered to be dynamic linking; hence our interpretation of the LGPL is that the use of the

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: 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: 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,

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: 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

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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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

[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: 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

  1   2   >