Re: I cannot scroll up down REPL in konsole

2011-07-06 Thread Perry Trolard
Antonio, Apologies if this is obvious to you, but screen eats your scrollback lines. You can't use the terminal program's scroll bars; you've got to enter screen's copy mode to view history. It's a little jarring at first, but with the vim-style navigation keys & the ease of copying it allows, cop

Re: User defined extensions with Xpath

2011-03-02 Thread Perry Trolard
Hi Andrei, I'm the author of the saxon wrapper library at https://github.com/pjt/saxon. User-defined XPath functions are indeed desirable but I haven't done anything special in the library to help in implementing them. What's available by default in Saxon is the ability to call Java methods. For

Re: do clojure and la(tex) have something in common ?

2010-05-29 Thread Perry Trolard
On May 28, 10:35 pm, Dave Pawson wrote: > > Which Saxon have you wrapped please? > saxon655 or Saxon9he? Currently I'm wrapping the last Saxon 9B before the switch to the three-way split. I plan to stick with it until there's a reason not to; there are some features of B I'd rather not be witho

Re: do clojure and la(tex) have something in common ?

2010-05-28 Thread Perry Trolard
Hi Mike, On May 25, 9:04 am, Mike Meyer wrote: > I find the reference to "old fashioned xslt" amusing, considering that > how new it is. Or maybe how old I am. Of course, part of the point of > XML is that you have a wide variety of tools to pick from for working > with it; xslt is just one of t

Re: Leiningen uberjar: excluding dev-dependencies; new minus-clojure task

2010-01-28 Thread Perry Trolard
On Jan 28, 12:09 am, Phil Hagelberg wrote: > Perry Trolard writes: > Any time you have dependencies that aren't in repositories, it's going > to cause pain. It's much better to put them in a repository, even if > it's a private/local one, than to bend Leiningen t

Re: Dependency management

2010-01-22 Thread Perry Trolard
On Jan 21, 7:21 pm, Richard Newman wrote: > Now, I like to keep track of Clojure master. Right now, Clojure   > reports "Clojure 1.2.0-master-SNAPSHOT". > > (I don't see that in Maven Central or in Clojars, so I guess I have to   > put it in my local repository...?) Richard, this doesn't address

Re: What's the best way to do this?

2010-01-21 Thread Perry Trolard
I think it's easier to think about combining predicates separately from your file-filtering code. I'd use a higher-order function like the following (defn combine-preds [& preds] (fn [& args] (every? #(apply % args) preds))) then filter files like (filter (combine-preds pred1 pred2)

Re: Bug with Clojure 1.2 REPL (aka master branch) ?

2010-01-14 Thread Perry Trolard
On Jan 12, 8:58 pm, aria42 wrote: > I was seeing this error too and I reckoned it was because my > clojure.contribwas not compatible with clojure core. I think if > you're using1.2master of clojure you need 1.1 master ofcontrib. Is that right? The 1.1 new branch of Contrib is compatible, at least

Re: Leiningen uberjar: excluding dev-dependencies; new minus-clojure task

2010-01-06 Thread Perry Trolard
On Jan 2, 12:35 am, Phil Hagelberg wrote: > I'm a little reluctant to make calculating the classpath any more > complicated than it currently is since that logic needs to be duplicated > in a few places, but I agree that the current situation is not great. > > Another idea would be to write a h

Leiningen uberjar: excluding dev-dependencies; new minus-clojure task

2009-12-27 Thread Perry Trolard
Greetings, Currently for the Leiningen uberjar task, all dev-dependencies are included in the resulting standalone jar. In a comment in uberjar.clj, there's a note that excluding these is on the todo list. I wonder if there are any ideas on how best to do it? I tried to tackle this in a naive way

Re: clojure / ruby yield comparison

2009-10-26 Thread Perry Trolard
> For example, the macro '->' changes this: > > (-> x (foo y) (bar z)) > > Into this: > > (foo (bar x z) y) Small correction. The result above should be: (bar (foo x y) z) user=> (macroexpand '(-> x (foo y) (bar z))) (bar (clojure.core/-> x (foo y)) z) Perry --~--~-~--~~

Re: ANN: VimClojure v2.1.2 released

2009-07-28 Thread Perry Trolard
On Jul 26, 4:09 am, Meikel Brandmeyer wrote: > I'd like to announce a bugfix release for VimClojure. Thanks, as ever, Miekel. > * Fixed annoying o/O delay bug A dream cometrue! Perry --~--~-~--~~~---~--~~ You received this message because you are subscribed to

Re: HTTP clients in clojure

2009-05-11 Thread Perry Trolard
> Let me know if you find it useful. I would love to get some comments. > -Phil Hi Phil, I'm trying out clojure-http-client, & thus far I like the idea of it quite a bit: a simple but clever wrapper on built-in JDK APIs, so provides convenience w/o the burden of external jars. Quickly, I ran in

Re: UTF-8

2009-04-29 Thread Perry Trolard
For those on OS X -- who probably don't want the default MacRoman -- or anyone else who wants to override the system default, I wanted to point out that setting the "file.encoding" system property when invoking java (e.g. `java -Dfile.encoding=UTF-8 ... clojure.main`) will set the encoding for in,

Compojure's decorate-with into contrib?

2009-04-16 Thread Perry Trolard
I'm trying to figure out the best way to use clojure.core/memoize while retaining the original function's docstrings, tags, etc. for the memoized function. The best way I've seen to do this is James Reeves' decorate-with function from Compojure, which applies a "decorator" -- Python's name for a h

Re: reading properties file: does this helper already exist?

2009-04-09 Thread Perry Trolard
Hi Stu, > Too late :-). I have already committed (r659) -- take a look and see > if you are happy with the changes I made. > Stu Thanks -- looks great to me. One remark: how about returning a map from read-properties (by wrapping the body with (into {} ) )? I know you can just destructure t

Re: reading properties file: does this helper already exist?

2009-04-09 Thread Perry Trolard
As of 12:30 (Central Standard), a better props.1.5.clj is in Groups -- sorry for the revision if you've already looked. Perry On Apr 9, 10:55 am, Perry Trolard wrote: > I think the consensus is that 1.5 is the target, so I've attached > props.1.5.clj to the group, which is 1.5

Re: reading properties file: does this helper already exist?

2009-04-09 Thread Perry Trolard
I think the consensus is that 1.5 is the target, so I've attached props.1.5.clj to the group, which is 1.5 compatiblle (i.e. uses streams, not readers or writers). Best, Perry On Apr 8, 6:49 pm, Stuart Halloway wrote: > Perry, > > Cool -- I will add this pending the result of the Java 6 thread

Re: reading properties file: does this helper already exist?

2009-04-08 Thread Perry Trolard
Hi Stuart, Not sure if you saw my post at http://bit.ly/sRnfG (links to list), or the props.clj file in the Google Group. In short, it's got a Properties reader & writer function. It tries to make Properties look like more native Clojure maps (i.e.keywords for keys), & it also uses duck-streams f

Re: proposed new contrib: java-utils

2009-04-06 Thread Perry Trolard
Hi Stuart, I had occasion to wrap java.util.Properties. If there's interest, may be a good candidate for c.c.java-utils. It's pasted in below, & attached in the group at http://clojure.googlegroups.com/web/props.clj Feel free to change as you see fit. Best, Perry (ns props ; Conv

Re: Proposed Change to str-utils

2009-03-25 Thread Perry Trolard
Whatever it's worth as a datum, my experience is that I usually find myself writing upcase, downcase, titlecase functions in most applications, because (1) they're prettier & more succinct when passed as first-class (downcase vs. #(.toLowerCase %)) (2) I can add type hints once, in the downcase

Re: clojure.core.read-line broken - can we please fix it?

2009-03-09 Thread Perry Trolard
Just for the record, this problem with read-line was fixed at SVN r1321. (Thanks for packaging up the patch, Chouser.) Perry --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, se

Re: Problems with read-line

2009-03-09 Thread Perry Trolard
Hi, This was fixed at SVN revision 1321 on Mar 3: http://code.google.com/p/clojure/source/detail?r=1321 David, the lazy branch was merged into trunk (at r1287) -- track trunk & you'll have what you need (lazy-seq, not lazy-cons). Best, Perry --~--~-~--~~~---~--~-

contrib build errors after javadoc => repl-utils

2009-03-03 Thread Perry Trolard
Hi Christophe Grand or other contrib committers, clojure.contrib.javadoc should be removed from the list of libs to compile in the build.xml file; as it stands, building with ant throws the Exception that fires when c.c.javadoc is compiled. Best, Perry --~--~-~--~~~--

Re: "Adding" strings

2009-02-26 Thread Perry Trolard
> Is there any reason that str is limited to 2 arguments? It would be > nice to do (str "foo" "bar" "baz") --> "foobarbaz". Try it! (Hint: "With more than one arg, returns the concatenation of the str values of the args.") > Is there a good reason that + can't do the right thing as with other >

Re: dorun and map

2009-02-25 Thread Perry Trolard
The dynamic resource consumption discussion is interesting & I'm curious about scope, but just to be clear about side-effects in the case of: (dorun (map #(println %) my-vector)) The idiomatic way to do this is (doseq [i my-vector] (println i)) Perry --~--~-~--~~~--

Re: :use feature requests

2009-02-23 Thread Perry Trolard
+1 from me, too. As to an :all shortcut that's synonymous with :exclude (), I think convenience at the REPL is a good argument for :all. (I'm assuming that the `require` macro would disappear, too.) For Cosmin's thought (:as mutually exclusive with :exclude, :only, & :rename), it does seem to me

Re: clojure.core.read-line broken

2009-02-20 Thread Perry Trolard
Hope I didn't imply by the above that I was suggesting a name change. I know my proposed version is ugly, but since BufferedReader & LineNumberingPR can't be unified, special-case-ing for the latter strikes me as an acceptable fix. But removing the type hint so that the function works out of the

Re: clojure.core.read-line broken

2009-02-18 Thread Perry Trolard
On Feb 18, 12:27 pm, "Stephen C. Gilardi" wrote: > This is from issue 47, svn 1229. It's unfortunate that a class can't   > be both a BufferedReader and a PushbackReader simultaneously. Those   > classes were implemented using class inheritance rather than via   > interfaces. In this case, the d

clojure.core.read-line broken

2009-02-18 Thread Perry Trolard
On the most recent svn (r1293), read-line throws a ClassCastException when called: user=> (read-line) java.lang.ClassCastException: clojure.lang.LineNumberingPushbackReader cannot be cast to java.io.BufferedReader (NO_SOURCE_FILE:0) Removing the type hint solves the issue: user=> (source read-l

Re: Fully lazy sequences are coming - feedback wanted!

2009-02-16 Thread Perry Trolard
> cursor moving to the "next" item rather than the abstracted "rest of > the coll" (where you think about a cursor). Correction: where you *don't* think about a cursor... Perry --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Googl

Re: Fully lazy sequences are coming - feedback wanted!

2009-02-16 Thread Perry Trolard
I agree with the majority of posters that the breaking changes in the service of optimal names is the right way to go. I found the explanation & recipe for porting at clojure.org/lazier clear & easy to follow. I didn't do full ports of any projects, but I did some selective porting & found it to

Re: why (seq? [1 2 3]) yields false?

2009-02-14 Thread Perry Trolard
wubbie, In case you're asking because you're trying to test for collection- like objects, there are (at least) two ways to do so: 1. coll? tests if its arg implements IPersistentCollection, i.e. is one of the native Clojure persistent collections: user=> (map coll? [{} [] '() #{}]) (true tr

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

2009-02-14 Thread Perry Trolard
Hi Timothy, On Feb 12, 8:08 pm, Timothy Pratley wrote: > What should happen when/if the seq arg doesn't contain the symbol? I > believe how you currently handle it is correct and in the spirit of > let-> (alternatively it could be reported as an error) however it may > raise yet another possibi

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

2009-02-12 Thread Perry Trolard
Sorry to keep revising things; here's an improved version of let->, which better supports (as near as I can tell -- please try to break) arbitrary let-style destructuring. (The previous version favored single-symbol bindings, but I can imagine use cases where [a b :as all] kinds of destructuring a

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

2009-02-12 Thread Perry Trolard
Let me amend: Instead of pipe-as, I think the symbol-binding version of the macro should be derived from the more common macro, which is -> & not pipe. So I'd vote for pipe & a let-> that takes a bindings vector as its first argument (sample implementation below). Perry (defmacro let-> "Like

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

2009-02-12 Thread Perry Trolard
On Feb 12, 12:15 pm, Meikel Brandmeyer wrote: > > I dislike this strategy for two related reasons: (1) It cannont be > > nested. Here is a pseudo-example: > > > (?-> 2 ... some computations ... (f (?-> ... I don't have access to > > the outer "?" anymore... ))) > > > (2) Shadowing user bindings

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

2009-02-11 Thread Perry Trolard
+1 for something like (let->). I don't imagine myself being confused by the reserved symbol being bound to different values in each successive form, or, in any case, would gladly trade that possibility for the advantage of being able to place the special symbol anywhere in the forms. Somewhat al

Re: proposal for shell-out: option to return articulated out, err, & exit code

2009-02-06 Thread Perry Trolard
I've updated this patch, eliminating the performance hit I introduced for concatenation of stdout & stderr when they're byte arrays (turns out it was significant). Let me know if there's anything else I can do. Perry http://code.google.com/p/clojure-contrib/issues/detail?id=23 --~--~-~-

Re: Got a Clojure library?

2009-02-03 Thread Perry Trolard
Name: saxon Author: Perry Trolard URL: http://github.com/pjt/saxon/tree/master Category: XML, XPath, XQuery License: MIT Depends: Michael Kay's Saxon XSLT and XQuery Processor (http:// saxonica.com); included in distribution saxon is a simple functional wrapper around Saxon's high-

Re: clojure.contrib.command-line patch: multiple option format

2009-01-29 Thread Perry Trolard
Patch attached to issue at http://code.google.com/p/clojure-contrib/issues/detail?id=24 On Jan 28, 7:55 pm, Chouser wrote: > Please make the 'justify' fn (whatever you want to call it) private > for now so that it doesn't become another API to be maintained.  If it > proves to be more gener

Re: proposal for shell-out: option to return articulated out, err, & exit code

2009-01-29 Thread Perry Trolard
Patch submitted to the issue tracker: http://code.google.com/p/clojure-contrib/issues/detail?id=23 Thanks, Perry --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email t

Re: proposal for shell-out: option to return articulated out, err, & exit code

2009-01-28 Thread Perry Trolard
> Sounds good.  Is ':verbose' the best name for this option?  What about > ':return-map'?  I'm okay with ':verbose' if we can't reach consensus > on something else. I agree that :verbose isn't right -- :return-map's not bad at all. Perry --~--~-~--~~~---~--~~ You

proposal for shell-out: option to return articulated out, err, & exit code

2009-01-28 Thread Perry Trolard
Hi Users of Shell-out, I'd sometimes like to have the exit status from system commands, so I patched clojure.contrib.shell-out to accept a :verbose option which, when turned on, returns a map with :exit, :out, & :err (where :exit's value is the exit code int, & :out & :err name either byte arrays

Re: New functions and possible bugs

2009-01-28 Thread Perry Trolard
> I'd also like function? and macro? as an alternative to checking the > metadata for :macro set to true. Forgive my parital answer to the intial query of the thread, but regarding a function? predicate, it's already included: user=> (doc fn?) - clojure.core/fn? ([x]) R

Re: clojure.contrib.command-line patch: multiple option format

2009-01-28 Thread Perry Trolard
Hi Chouser, Is there anything I can do to help get the proposed change above, or something like it, included in c.c.command-line? I'd be happy to modify the patch: removing the somewhat orthogonal alignment code, etc. Thanks, Perry --~--~-~--~~~---~--~~ You receiv

Re: Pretty printing a function's symbol

2009-01-26 Thread Perry Trolard
Hi Daniel, You can get the symbol that names the function from the Var's metadata, like: user=> (:name (meta (var =))) = user=> Best, Perry --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post t

Re: pmap memory hogging

2009-01-21 Thread Perry Trolard
Thanks for testing, Mark. If I understand what you did correctly, the reason it worked for you is that Rich committed a fix to SVN in the meantime! > The last (count result-p) call takes a few seconds (probably > because there's a one-to-one mapping of tasks to sequence > elements) but it finish

Re: pmap memory hogging

2009-01-20 Thread Perry Trolard
> Doesn't pmap have to construct the whole sequence explicitly in order > to map its execution across more than one processor?  or does it take > in a lazy fashion? Semi-lazy, according to the doc: Like map, except f is applied in parallel. Semi-lazy in that the parallel computation stays ahe

pmap memory hogging

2009-01-20 Thread Perry Trolard
Hi All, Yesterday I had a strange case of pmap (parallel map) eating up all of the heap space I'd make available -- from 256M up to a Gig. I track SVN, & I know for sure this wasn't happening last Wednesday (the 14th). Calling map in place of pmap caused the code to run fine inside of a 256M heap

Re: clojure.contrib.command-line patch: multiple option format

2009-01-14 Thread Perry Trolard
A thought: if you end up using the patch, I gave the 'justify' function an inappropriate name. It should be 'align' or 'align-cols' or some such. (No one in their right mind would justify text on the console!) Perry On Jan 14, 3:16 pm, Perry Trolard wrote: > Hi

Re: clojure.contrib.command-line patch: multiple option format

2009-01-14 Thread Perry Trolard
Hi Chouser, Thanks for checking out the patch. > It's a good idea.  Any sane way to allow the single-letter variety to > be specified with a single leading dash, instead of a double-dash? Single or double dashes should work for both kinds of options (long- or short-style), based on your code. T

clojure.contrib.command-line patch: multiple option format

2009-01-13 Thread Perry Trolard
Hi Chouser & list, I like clojure.contrib.command-line -- thanks for it! -- but I wanted to be able to specify multiple forms for an option, e.g. --help, -h, -?, etc. Here (in the Files section) http://bit.ly/fIVH is a patch to enable it (the values are bound only to the first form given --

Re: Newbie: Creating a macro that just calls a function but evaluates its arguments lazily

2009-01-13 Thread Perry Trolard
Hi sampii, The problem, as I see it (& as Konrad suggested above), is that you're not passing *functions* to (alt); you're passing values returned from function calls, even though in the case of the sub-functions you define those returned values are functions. Functions evaluate to themselves, so

Re: What is this function called?

2009-01-02 Thread Perry Trolard
I did something similar using (iterate rest coll), which I called iter- rest: (defn iter-rest "Takes the first (count coll) items from call to (iterate rest coll). If passed function as first argument, calls it on each invocation of rest, i.e. (iterate #(func (rest %)) coll)." ([coll]

clojure wrapper for Saxon XSLT 2.0 library

2008-12-16 Thread Perry Trolard
Hi All, For any of you who do XSLT 2.0 processing, I've written a simple Clojure wrapper around Saxon's (saxonica.com) high-level Java API. It's at http://github.com/pjt/saxon/tree/master Best, Perry --~--~-~--~~~---~--~~ You received this message because

Re: Misplaced doc strings in clojure.contrib.seq-utils

2008-12-12 Thread Perry Trolard
Here's the patch: http://clojure.googlegroups.com/web/seq-utils-doc-strings.patch Perry --~--~-~--~~~---~--~~ 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: distributing a clojure application as self contained .jar - guide

2008-12-12 Thread Perry Trolard
+ 1 on curiosity re: this question. In my limited Java experience, I find it more common to see a directory full of jars accompanying an application, but the benefits of a self-contained executable jar seem pretty self-evident, especially for an app who's only dependencies are clojure.jar & cloju

Misplaced doc strings in clojure.contrib.seq-utils

2008-12-08 Thread Perry Trolard
In clojure.contrib.seq-utils, partition-by & group-by have docstrings following their arglists, so (doc parition-by) prints - clojure.contrib.seq-utils/partition-by ([f coll]) nil nil I'd submit a patch, but I'm sure it's easier if Stuart Sierra or another of the contri

Re: clojure.main default print function

2008-12-02 Thread Perry Trolard
Clarification: clojure.lang.Repl's behavior hasn't changed, it's just that the clojure.main default REPL behaves differently from it. Those who don't call clojure.main in their clj scripts won't notice a difference. Perry --~--~-~--~~~---~--~~ You received this mes

clojure.main default print function

2008-12-02 Thread Perry Trolard
With the adoption of the clojure.main at SVN r1127, the print behavior of the REPL changed from prn-style to println-style, e.g. ;r1126 user=> (list "hey" 'hey) ("hey" hey) ;r1127 & on user=> (list "hey" 'hey) (hey hey) I missed it when looking over Stephen's clojure.main code when proposed, bu

Re: Patch: universal main() with repl/script/compile

2008-11-26 Thread Perry Trolard
That's great -- happy it's in. Quick impression: I like the improvements to clojure.main, especially that forms from stdin & -e are evaluated after init files are loaded & *command-line-args* is set. Now that clojure.lang.Compile is official, I'll post a cleaned up version of my cljc script (but

Re: Patch: universal main() with repl/script/compile

2008-11-26 Thread Perry Trolard
Thanks for untangling the Ant black magic, Stefan. Forking a separate VM seems the simplest way to go. With that in mind, here ( http://bit.ly/17N0M ) is a patch (against r1125) that includes all of Stephen & Stuart's additions for the clojure.main function, plus the modifications to clojure.lang

Re: Patch: universal main() with repl/script/compile

2008-11-25 Thread Perry Trolard
> Is the classpath set up in the Ant task?  It should look > something like this: > > Near the top: >     > > In the compile_clojure task: >                  classpath="${build}:${cljsrc}"> >         >         >         ...and so on... > > There have been so many patches on this, I'm not sure

Re: Patch: universal main() with repl/script/compile

2008-11-25 Thread Perry Trolard
Sorry -- inadvertent send: the Ant task is the first case that's gotta work, so I think the best option is to catch the ClassNotFound exception, unless there's another alternative I'm not thinking of (& given my small amount of knowledge of Java proper, the chances of that are high!). Perry --~-

Re: Patch: universal main() with repl/script/compile

2008-11-25 Thread Perry Trolard
On Nov 25, 8:42 am, Stuart Sierra <[EMAIL PROTECTED]> wrote: > I think it's because of different string representations of the path > (e.g. the path variable may be "./classes" but the classpath (under > Ant) is "/home/bob/project/classes".  It probably need something like > this: > ... Yeah, I

Re: Patch: universal main() with repl/script/compile

2008-11-24 Thread Perry Trolard
I've written a preliminary cljc script -- a shell script for compiling Clojure libs -- against Stephen's patched Clojure (specifically using the clojure.lang.Compile class). Configure the script with the locations of the clojure.jar & clojure- contrib.jar & running cljc w/o options calls clojure.

Re: Patch: universal main() with repl/script/compile

2008-11-24 Thread Perry Trolard
On Nov 24, 4:03 pm, Stuart Sierra <[EMAIL PROTECTED]> wrote: > Hi Perry, Stephen, > I like the "convention over configuration"-ness of defaulting to ./ > classes.  One thought: Weird errors might result if ./classes is not > on classpath.  Is there an easy way to check that, and display a > helpf

Re: Patch: universal main() with repl/script/compile

2008-11-24 Thread Perry Trolard
Very cool. The two main use cases work well (REPL, script), & the others -- loaded files, evaluation -- are real bonuses. (It's also really nice to have an extensible REPL implemented in Clojure). I think a flag for file loading (-l, --load) to make clear the distinction b/w the file that's a scr