Re: file io

2009-03-24 Thread Parth
1/d0e286fa0c8ef7d2 http://groups.google.com/group/clojure/browse_thread/thread/d8064dbb94c5cd2c/ba355cfe2c708068 I think it would be nice to have "spit" in the core, especially for people like me who aren't too good with java. But ha

Re: exposing specific functions via namespace

2009-03-25 Thread Parth
On Mar 25, 7:04 pm, Parth Malwankar wrote: > Hello, > > I am trying to organise my code in namespaces and needed a > little help. > > Basically I have created the following namespaces similar to > the following: > > src/org/ppm/foo.clj -> org.ppm.foo > s

Re: exposing specific functions via namespace

2009-03-26 Thread Parth
On Mar 26, 8:35 am, "John D. Hume" wrote: > On Wed, Mar 25, 2009 at 12:05 PM, Parth wrote: > > I have split up the foo namespace across multiple files. So, > > I have the following now: > > > src/org/ppm/foo.clj -> org.ppm.foo > > src/org/ppm/bar

Re: new in duck-streams: with-out-writer / with-in-reader

2009-03-28 Thread Parth
On Mar 29, 7:36 am, Stuart Sierra wrote: > Following a discussion from a few days ago, I've added two new macros > to clojure.contrib.duck-streams: > > (defmacro with-out-writer >   "Opens a writer on f, binds it to *out*, and evalutes body." >   [f & body] >   `(with-open [stream# (writer ~f)]

Re: Threadring Benchmark

2009-06-06 Thread Parth
o login for viewing. The same numbers are available in this published google spreadsheet (hopefully without login). http://tinyurl.com/ofhync Regards, Parth > > On Jun 6, 12:41 am, Parth Malwankar wrote: > > > Hello, > > > In order to understand the agent model of Clojure >

Re: Threadring Benchmark

2009-06-07 Thread Parth
Detailed Log: http://gist.github.com/125614 Updated Clojure Code: http://gist.github.com/125615 Jave Code: http://shootout.alioth.debian.org/u32q/benchmark.php?test=threadring&lang=java&id=4 Scala Code: http://shootout.alioth.debian.org/u32q/benchmark.php?test=threadring&lang=scala&am

Re: macro escapes and passing method names are function arguments

2009-06-09 Thread Parth
e,  I've got "stow" and I want a function > that returns :stow. > The :thing are called keywords in Lisp/Clojure and are very useful. I think what you are looking for is: user=> (keyword "stow") :stow Regards, Parth > Thank you --~--~-~--~~

Re: Performance Penalty Converting from Java Code

2009-06-14 Thread Parth
/parthm/src/clojure/clojure.jar base26 1.75s user 0.11s system 104% cpu 1.784 total While this works well, I more optimization may be possible by choosing an algorithm thats more suited and ideomatic for clojure. I suppose that intent here is to do a micro-benchmark. Regards, Parth > tra...@tr

Re: Dynamically accessing static fields

2009-06-15 Thread Parth
quot; Math/E}) #'user/m user=> (defn foo [n s] [n (get m s :not-found)]) #'user/foo user=> (foo 10 "Math/PI") [10 3.141592653589793] user=> You could also consider writing a function that takes these as parameters and returns the updated container. That way you can a

Re: matlab like clojure

2009-06-15 Thread Parth
nd incanter interesting. http://github.com/liebke/incanter/tree/master Regards, Parth > Regards, --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@

Re: accum

2009-06-16 Thread Parth
=> or "reduce"? user=> (reduce + 0 [1 2 3]) 6 user=> (reduce + 10 [1 2 3]) 16 user=> (reduce + 0 [1 2 3 4 5]) 15 Regards, Parth > Here's a lazy seq of them all: > > (def *tris* (for [i (iterate inc 1)] (tri i))) > > This, however, is more efficient (a

Re: accum

2009-06-16 Thread Parth
seful libs that you will miss out on in case you are not using it. Regards, Parth --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.c

Re: Hash Consing

2009-06-29 Thread Parth
al sharing that Clojure collections have. Quoting the docs[1]: " In particular, the Clojure collections support efficient creation of 'modified' versions, by utilizing structural sharing, and make all of their performance bound guarantees for persistent use. " Do yo

Re: print-base / print-radix?

2009-07-02 Thread Parth
without the pretty part. I suppose what I am hoping is that a feature request for *print-base* sort of a mechanism get considered for Clojure as it makes scenarios like the above very easy to deal with. Any chance of this being somewhere on the Clojue todo? :) I will probably create a poor mans r

Re: print-base / print-radix?

2009-07-02 Thread Parth
On Jul 2, 9:44 pm, Tom Faulhaber wrote: > Hi Parth, > > It is on the agenda to support this for pprint, but I don't know > exactly when. > Thanks Tom. I look forward to this addition to the wonderful pprint function :) Regards, Parth > In the meantime, arbitrary b

Re: print-base / print-radix?

2009-07-02 Thread Parth
On Jul 3, 6:15 am, Parth wrote: > Tom, Chouser, Thanks for your responses. > > As of now I am doing the same thing as suggested. > However, this tends be become painful the moment structures > start to nest. For e.g. I am using Clojure to decode a bit > of assembly and belo

Re: print-base / print-radix?

2009-07-03 Thread Parth
On Jul 3, 11:25 am, Tom Faulhaber wrote: > Parth, > > I was thinking about this a little more today and I came up with a way > to extend the pretty printer easily to support *print-radix* with a > little wrapper. I'll try to get a chance to write it up for you > tomo

Re: print-base / print-radix?

2009-07-05 Thread Parth
On Jul 5, 9:02 pm, Tom Faulhaber wrote: > Parth, > > I've created a little wrapper as promised at:http://gist.github.com/141001. > > It gives you my-pprint: > > user> (binding [*print-base* 2] (my-pprint (range 10))) > (0 1 10 11 100 101 110 111 1000 1001) &

arbitrary partitioning of collection

2009-03-23 Thread Parth Malwankar
esn't support something like a vector of partition sizes. This is a common use case for a handling a binary dump of c structures. Is there any better way to do it than above? Is this a common enough case to have something like (partition coll ns

Re: file io

2009-03-24 Thread Parth Malwankar
!!!"))) nil user=> % cat test.txt hello world !!! % clojure.contrib.duck-stream has an interesting set of functions. Parth > I noticed "slurp" in the api for reading ... but only the whole file at once > (read() but no readline()). Is there s

exposing specific functions via namespace

2009-03-25 Thread Parth Malwankar
ons into foo.clj? I would prefer to keep them in bar and baz if possible as those are logical blocks for me. Thanks. Parth --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this

Re: What's the function that returns the opposite of a predicate?

2009-04-30 Thread Parth Malwankar
returns the opposite truth value. nil user=> Regards, Parth --~--~-~--~~~---~--~~ 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 To unsu

Re: AIML pattern matcher design

2009-05-08 Thread Parth Malwankar
: (doc read) If you decide to go ahead with xml, you can use the xml support in clojure core: http://clojure.org/api#toc673 Regards, Parth --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. T

Threadring Benchmark

2009-06-05 Thread Parth Malwankar
179.2% and 131.34% for scala and clojure respectively. I thought of sharing this in case others are interested. As this is my first program using clojure agents I would appreciate any comments on improving the Clojure implementation (or in case there are any bugs). Thanks. Parth PS: For the Java

Re: Binding dynamically created symbols in the lexical context.

2008-08-24 Thread Parth Malwankar
(3 2 1) user=> (let [[a b c] [1 2 3] z 4] (list z c b a)) (4 3 2 1) user=> (let [z 4 [a b c] [1 2 3]] (list z c b a)) (4 3 2 1) user=> Actually 'let' in Clojure has some really cool pattern matching features keyword matching, :keys, :as and :or clauses. Its different from the '

executing shell command

2008-08-25 Thread Parth Malwankar
(exec "ls")) [EMAIL PROTECTED] I may be doing something really silly here as I don't really know Java. Whats the right way to do this? Thanks. Parth --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups &quo

new wiki section: Employee Record Manipulation

2008-08-25 Thread Parth Malwankar
d20f2007b4 Please feel free to update / modify it in case of inaccuracies. Parth --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.c

Re: idiomatic way of creating a set of records

2008-08-25 Thread Parth Malwankar
On Aug 25, 9:31 pm, Rich Hickey <[EMAIL PROTECTED]> wrote: > On Aug 23, 6:13 am, Parth Malwankar <[EMAIL PROTECTED]> wrote: > > > > > On Aug 23, 12:23 am, Chouser <[EMAIL PROTECTED]> wrote: > > > > On Fri, Aug 22, 2008 at 1:10 PM, P

Re: idiomatic way of creating a set of records

2008-08-25 Thread Parth Malwankar
On Aug 26, 12:08 am, Rich Hickey <[EMAIL PROTECTED]> wrote: > On Aug 25, 1:16 pm, Parth Malwankar <[EMAIL PROTECTED]> wrote: > > > > > On Aug 25, 9:31 pm, Rich Hickey <[EMAIL PROTECTED]> wrote: > > > > On Aug 23, 6:13 am, Parth Malwankar <[EMA

Re: executing shell command

2008-08-25 Thread Parth Malwankar
             (do >                                                                 (. sb (append > (char c))) >                                                                 (recur (. br > (read))) > > On Aug 25, 8:38 am, "Michael Reid" <[EMAIL PROTECTED]> wrote: &

updating nested structure

2008-08-26 Thread Parth Malwankar
(field-write st (last access-spec) `(assoc (-> ~st [EMAIL PROTECTED]) ~k ~v) (butlast access-spec Thanks. Parth --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure&quo

path: some more error info for "Don't know how to create ISeq from..."

2008-08-26 Thread Parth Malwankar
G__2867) (clojure/list (quote clojure/ assoc) (clojure/-> xuser=> java.lang.IllegalArgumentException: Don't know how to create ISeq from: Symbol : G__2716 I am not a Java or Clojure expert so there may be a better way to do this. Patch follows. Parth [parth:~/src/clojure/src/jvm/clojure/lang]% svn up

Re: Greetings

2008-08-26 Thread Parth Malwankar
On Aug 26, 10:05 pm, noahr <[EMAIL PROTECTED]> wrote: > ps - any chance of getting a hold of that ant colony demo? http://clojure.googlegroups.com/web/ants.clj Parth --~--~-~--~~~---~--~~ You received this message because you are subscribed to t

Re: updating nested structure

2008-08-27 Thread Parth Malwankar
On Aug 26, 8:25 pm, Parth Malwankar <[EMAIL PROTECTED]> wrote: > Hello, > > In order to update fields in nested structures/maps easily > I have created a macro 'field-write'. >     (defmacro field-write [st k v access-spec] >       ; st=data, k=key to update

Re: updating nested structure

2008-08-27 Thread Parth Malwankar
soc e.g. fridge-add-item fridge-check-item but then with access-paths as vectors it usage will be cleaner. If you think this is a common enough case it could be considered. Also, thanks for the [m [k & ks] v] destructuring trick. I didn&#

Re: updating nested structure

2008-08-27 Thread Parth Malwankar
On Aug 28, 8:13 am, Chouser <[EMAIL PROTECTED]> wrote: > On Wed, Aug 27, 2008 at 10:37 PM, Parth Malwankar > > <[EMAIL PROTECTED]> wrote: > > In case the access path were vectors the above could become: > > > (mk-get my-fridge (item-path :mango) :quantity

Re: updating nested structure

2008-08-28 Thread Parth Malwankar
On Aug 28, 8:08 pm, Rich Hickey <[EMAIL PROTECTED]> wrote: > On Aug 27, 10:37 pm, Parth Malwankar <[EMAIL PROTECTED]> > wrote: > > > > > On Aug 28, 12:10 am, Rich Hickey <[EMAIL PROTECTED]> wrote: > > > > I posted a variant here: > > &g

Re: New Release of VimClojure: v1.2.0

2008-08-30 Thread Parth Malwankar
like: (defmulti foo :abc [n] (println n)) With (pr.. being aligned with foo instead of ^(d. You might also want to update the completions list as a bunch of stuff has been added in the last few days (lib support, get-in, printf etc) Looking forward to seeing clj being supported by vim

Re: New Release of VimClojure: v1.2.0

2008-08-30 Thread Parth Malwankar
On Aug 30, 5:53 pm, Parth Malwankar <[EMAIL PROTECTED]> wrote: > On Aug 30, 3:35 am, Meikel Brandmeyer <[EMAIL PROTECTED]> wrote: > > > Please test this release since it is due for upstream inclusion in Vim. > Sorry for the double post. Just wondering if you have

Re: Google Code?

2008-08-30 Thread Parth Malwankar
dminister. One thing to note is that they had a 100MB disk space quota (which they apparently increase once you file a ticket - I saw a bunch of such tickets closed in the logs though I personally didn't hit this limit). Personally I would vote for googlecode. Parth > > Thanks, >

Re: The ant simulation

2008-08-30 Thread Parth Malwankar
or takes individual elements as arguments and map returns a list. If we simply (vector (map ..)) the entire list returned by map is seen as a single element. Hence 'apply'. user=> (vector 1 2 3) [1 2 3] user=> (map inc [1 2 3]) (2 3 4) user=> (vector (map in

generating clj docs

2008-08-30 Thread Parth Malwankar
. http://groups.google.com/group/clojure/web/gen-clj-docs.clj Note that its best to run this in a separate folder as it creates 1 txt file for each ns. Parth --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure&q

Re: debugging, logging, ... and code sections

2008-08-31 Thread Parth Malwankar
-decorate [f] (fn [& args] (println (:name (meta (var f))) "called with" args) (apply f args))) clojure.lang.Compiler$CompilerException: foo.clj:5: Unable to resolve var: f in this context Could someone explain what I am doing wrong here? How can I get the function name at

avoiding duplication using multi-methods

2008-08-31 Thread Parth Malwankar
ith a big 'cond' over time. What would be a good way to do something like this? Thanks. Parth --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email t

Re: avoiding duplication using multi-methods

2008-09-01 Thread Parth Malwankar
On Sep 1, 12:26 pm, [EMAIL PROTECTED] wrote: > On Aug 31, 8:48 pm, Parth Malwankar <[EMAIL PROTECTED]> wrote: > > > > > Hello, > > > I have a situation in which different multi-methods > > need similar behavior with different arguments. > > >

Re: clojure/ns and gen-and-save-class

2008-09-05 Thread Parth Malwankar
defmulti or > > something that defines a bunch of functions at once. > > I didn't think about the plural angle - anyone else bothered by that? > The alternative is defnamespace. > I like the idea of having a defxxx to define a name space as its consistent with the rest of

ns usage for multiple clj files

2008-09-07 Thread Parth Malwankar
uot;mycode/test.clj") nil user=> (bar/foo) :foo-called user=> However, when I try to either load-file or load-resources tst-pkg.clj I get errors. [parth:~/code/mycode]% clj Clojure user=> (load-resources "mycode/tst-pkg.clj") java.io.FileNotFound

Re: ns usage for multiple clj files

2008-09-07 Thread Parth Malwankar
t user=> (load-resources "/mycode/mycode.clj") nil user=> (mycode/foo) :foo-called user=> --- interaction end Parth >  smime.p7s > 5KViewDownload --~--~-~--~~~---~--~~ You received this message because you are subscribed to t

Re: local functions?

2008-09-11 Thread Parth Malwankar
gt; > except that the interior defns are public. I like the idea. defn- would also work like this but that won't prevent bar and baz from being used inside the package itself. (let [foo (fn [x] ...)] (foo 42)) Does tend to get a little ugly if fn

Re: Debian package for clojure

2008-09-12 Thread Parth Malwankar
ease. Maybe we could have the following packages: clojure clojure-doc - this could be txt files generated from the deb release clj-vim - VimClojure clj-emacs - emacs + slime stuff My 2c. Thanks for this. Parth > Paul --~--~-~--~~~---~--~~ You received

Re: 20080916 Release

2008-09-16 Thread Parth Malwankar
/2008/09/20080916-release.html > > Rich Very cool. :) Thanks Rich and the all Clojure contributors. This is truly a fantastic language and it keeps getting better. I love using it. Parth --~--~-~--~~~---~--~~ You received this message because you are subscribe

Re: Collection Building Idiom

2008-09-19 Thread Parth Malwankar
ion is maintained by conj here (either a list or a vector) and (2) the order in which elements are added depend on the the type of collection. Conj appends to head of list. 9,10 are used for the initial collection (either vector or list). Parth > > Thanks, > - Mark McGranaghan --~--~

Re: safe navigation operator

2008-10-06 Thread Parth Malwankar
> > getName) > > > "java.lang.Boolean" > > > user=> (?.. System (getenv "FOO") (startsWith "/bin") getClass > > > getName) > > > nil > > I'm not opposed, but we'll need to find another name. Leading ? is a >

Re: slurp is in Clojure, but spit is in Contrib?

2008-10-06 Thread Parth Malwankar
no simple way to save a   > file. This would be a nice addition in my view. It will be especially useful for people from non-java background coming to Clojure. I know I was quite confused about how to write to a file when I was ramping up on C

Re: What "reasoner"?

2008-10-06 Thread Parth Malwankar
I can't find references on anything spelled "ios > reasoner". Could you tell me the actual name of the project. Thanks! I think it was the iris-reasoner datalog, also mentioned on IRC here: http://clojure-log.n01se.net/date/2008-10-02.html#14:45 http://iris-reasoner.org/ Par

Re: Creating a n-length vector filled with zeroes?

2008-10-08 Thread Parth Malwankar
t; (into [] (replicate 10 0)) [0 0 0 0 0 0 0 0 0 0] At the REPL you could use (doc ) to get help on the function. There are a bunch of these useful functions like repeat, replicate, repeatedly etc. Parth > > This is my current code: >   (loop [row [] >          i 0] >     (if (

Re: GUIs in Clojure

2008-10-09 Thread Parth Malwankar
or using   > MiGLayout (http://miglayout.com) from Clojure. It removes some of the   > repetitive code from the task of populating a JPanel and providing   > constraints for miglayout. > Thanks for this Steve. This is definitely useful. I look forward

Re: primitive meta data

2008-10-15 Thread Parth Malwankar
gt; > The clojure version took an average: "Elapsed time: 217.833342 msecs" in my > machine. The following was somewhat faster. (defn dumb-test [] (let [f2 (float 567.09723)] (loop [f (float 1.2), i (long 1000)] (if (zero? i) f (recur (/ f f2) (dec i

toUpperCase on java.lang.String

2008-10-15 Thread Parth Malwankar
.lang.String "hello") (toUpperCase)) "hello" user=> (class (new java.lang.String)) #=java.lang.String Shouldn't this be working? If this is (by design) because strings are immutable (so no doto) shouldn't there be an error message? What am I missing here. Parth --~--

Re: toUpperCase on java.lang.String

2008-10-16 Thread Parth Malwankar
On Oct 16, 4:29 pm, Rich Hickey <[EMAIL PROTECTED]> wrote: > On Oct 15, 11:47 pm, "Stephen C. Gilardi" <[EMAIL PROTECTED]> wrote: > > > > > Hi Parth, > > > > But if I do this in a doto, it doesn't seem to work but > > > I don&#

Re: Ruby => Clojure for Enumerable and Array

2008-10-16 Thread Parth Malwankar
ow much of Ruby so can't really comment on the content, but maybe you can add a link for this to the Clojure Programming wikibook (http://tinyurl.com/5jsvcm). This way more Ruby programmers will be able to find and benefit from it easily at a later date. Parth > > - Mark --~--~

Re: Clojure's first year

2008-10-16 Thread Parth Malwankar
chnically viable and > have wide enough awareness and use. I think Clojure has great > prospects in both of those areas, as it continues to improve and usage > grows. > > Thanks to all for being part of Clojure! > > On to year two, > > Rich Congrats to Rich and the Clojure

Re: offtopic - where are you come from? (poll)

2008-10-17 Thread Parth Malwankar
On Oct 17, 2:27 pm, "Rastislav Kassak" <[EMAIL PROTECTED]> wrote: > Hello Clojurians, > > I think after 1st year of Clojure life it's good to check how far has > Clojure spread all over the world. > > So wherever are you come from, be proud and say it. > > I'm from Slovakia. :) > > RK Bangalore

Re: Callstack from load-file

2008-10-18 Thread Parth Malwankar
oke(Unknown Source) at user.eval__2481.invoke(Unknown Source) at clojure.lang.Compiler.eval(Compiler.java:4106) ... 1 more nil user=> Parth --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups &q

Re: Multiple indexing for vectors/maps

2008-10-18 Thread Parth Malwankar
et (get A 1) 1) get-in is probably what you are looking for. user=> (get-in A [1 1]) 5 There is also, update-in and assoc-in. Parth > I could make a macro for this of course, but I'd kind of like to > change the call semantics for vectors/maps to allow (A 1 1), perhaps > something lik

Re: Fibonacci function performance compare between clojure and scala

2008-10-19 Thread Parth Malwankar
ould be fast enough. Its not considered idiomatic to use coersion and unchecked operation unless absolutely necessary. Parth > Both not tail recursive,both running on Repl (scala's interpreter),but > the difference between two is huge > 10475~263 > My box : Intel core2 cpu 1.86G,2

Re: Suggestions on handling state for a game...

2008-10-20 Thread Parth Malwankar
in as they grow in size. Performance should really be a problem with refs. A good essay by Rich on Clojures approach to state is http://clojure.org/state Parth --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure

Re: Newbie question on the use of functional hash maps

2008-10-20 Thread Parth Malwankar
as some pointers: http://groups.google.com/group/clojure/browse_thread/thread/a60b20955ad47fca Parth > > Thanks in advance for your wisdom. > >     -tree > > -- > Tom Emerson > [EMAIL PROTECTED]://www.dreamersrealm.net/~tree --~--~-~--~~~---~--~--

Re: Multiple return values

2008-10-20 Thread Parth Malwankar
let" are quite nice. A bunch of examples are available in the let reference: http://clojure.org/special_forms Parth > > Cheers, > -- Fredrik > == > What am I up to?http://twitter.com/appelberg --~--~-~--~~~-

importing clojure.contrib.miglayout

2008-10-21 Thread Parth Malwankar
Hello, I am trying to import clojure.contrib.miglayout. The simple "import" seems to work fine, but the moment I use ":require" it fails. Am I doing something wrong here or is this a bug? Seems to work for other modules like pred and command_line. [parth:~]% clj Clojure use

Re: importing clojure.contrib.miglayout

2008-10-21 Thread Parth Malwankar
On Oct 21, 8:30 pm, "J. McConnell" <[EMAIL PROTECTED]> wrote: > On Tue, Oct 21, 2008 at 11:19 AM, Parth Malwankar > > <[EMAIL PROTECTED]> wrote: > > > I am trying to import clojure.contrib.miglayout. The simple "import" > > seems to work f

Re: Reader + Macros on untrusted S Expressions: Security considerations?

2008-10-22 Thread Parth Malwankar
before reading potentially unsafe expressions. Maybe Rich or someone else can comment on how to disable this. I suppose a lot of this is dictated by what you want to do with the s-expressions. Parth > -- > > Brett Morganhttp://brett.morgan.googlepages.com/ --~--~-~--~-

Re: Reader + Macros on untrusted S Expressions: Security considerations?

2008-10-22 Thread Parth Malwankar
On Oct 22, 3:42 pm, Parth Malwankar <[EMAIL PROTECTED]> wrote: > On Oct 22, 1:30 pm, "Brett Morgan" <[EMAIL PROTECTED]> wrote: > > - Recently the #= reader macro was added. This makes the reader >   do the evaluation before using the value. You may want to

Re: Clojure and introspection/reflection analysis?

2008-10-23 Thread Parth Malwankar
llo-world has finished executing. This message also points to one way of doing this: http://groups.google.com/group/clojure/msg/91b028c63ec440d6 Parth --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group

Re: lazy death

2008-10-25 Thread Parth Malwankar
This handles the issue. With: (set! *print-length* 50) (set! *print-level* 10) I get: user=> (lazy-death [1 2 3]) ([1 2 3] nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil

Re: lazy death

2008-10-25 Thread Parth Malwankar
a .cljrc.clj file that has my settings: clj launch script -- start: #!/bin/bash BREAK_CHARS="(){}[],[EMAIL PROTECTED]";:'|\\" CLJRC=~/.cljrc.clj if [ $# -eq 0 ]; then rlwrap --remember -b $BREAK_CHARS -f /home/ parth/.clj_completions \ java -server -cp $CLA

Re: Files in Clojure Google Groups

2008-11-02 Thread Parth Malwankar
iced that the vim_dev google group set up the "pages" section to list patches and their summary. http://groups.google.com/group/vim_dev/web/vim-patches Maybe something like that can be used. Parth > > Rich --~--~-~--~~~---~--~~ You received this message

Re: Patch: callable defstruct (PersistentStructMap$Def extends AFn)

2008-11-06 Thread Parth Malwankar
On Nov 6, 9:19 am, Chouser <[EMAIL PROTECTED]> wrote: > On Wed, Nov 5, 2008 at 12:10 AM, Chouser <[EMAIL PROTECTED]> wrote: > >  The attached patch allows: > > > user=> (point 42 11) > > {:x 42, :y 11} > Seems like a very nice enhancement to me.

Re: Can't get rlwrap to work

2008-11-12 Thread Parth Malwankar
es from Clojure indicate the line with error using the source:line_no format. For the REPL there is no source file hence NO_SOURCE_FILE:5. Parth > > Giacecco --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups &

Re: iterate

2008-11-13 Thread Parth Malwankar
(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 3 0 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 ...) But it doesn't take multiple arguments like your implementation. Thats a nice enhancement. Parth > also, this language is delightful. --~--~-

clojure.zip: replace error

2008-11-13 Thread Parth Malwankar
Hello, While setting ns to clojure.zip, I get the following error: user=> (ns clojure.zip) java.lang.IllegalStateException: replace already refers to: #'clojure.zip/replace in namespace: clojure.zip (NO_SOURCE_FILE:0) clojure.zip=> Is this expected? Th

Re: clojure.zip: replace error

2008-11-14 Thread Parth Malwankar
On Nov 14, 9:47 am, Rich Hickey <[EMAIL PROTECTED]> wrote: > On Nov 13, 11:20 pm, Parth Malwankar <[EMAIL PROTECTED]> > wrote: > > > Hello, > > > While setting ns to clojure.zip, I get the following error: > > > user=> (ns clojure.zip) > > j

Re: Changes for AOT compilation

2008-11-14 Thread Parth Malwankar
Does this mean that at some point clojure.jar would contain precompiled class files for clojure code? I suppose that would mean faster startup of the repl. Parth > > There is now an AOT compiler that can compile .clj files to .class > files on disk. This can be used to save startup time

Re: A value that equals everything, or, ignoring things in multi-dispatch

2008-11-15 Thread Parth Malwankar
(or some custom function) to extract the relevant args user=> (defmulti a #(first [%1 %2])) #'user/a user=> (defmethod a 3 [x y] :three) # user=> (defmethod a 5 [x y] :five) # user=> (a 3 4) :three user=> (a 3 5) :three user=> (a 5 5) :five Parth --~--~-~--~~

printing *command-line-args*

2008-11-20 Thread Parth Malwankar
Hello, I have a single line file (tmp.clj) where I am trying to print *command-line-args*. And I get an exception if I run it. I am not sure what I am doing wrong here. [parth:~]% cat tmp.clj (prn *command-line-args*) [parth:~]% clj tmp.clj hello world nil Exception in thread "

Re: printing *command-line-args*

2008-11-20 Thread Parth Malwankar
On Nov 20, 10:49 pm, "Tom Emerson" <[EMAIL PROTECTED]> wrote: > On Thu, Nov 20, 2008 at 12:37 PM, Parth Malwankar > > <[EMAIL PROTECTED]> wrote: > > I have a single line file (tmp.clj) where I am trying to > > print *command-line-args*. > > And I

File Copy

2008-11-23 Thread Parth Malwankar
while" loop. I would appreciate any pointers on how to do this (or maybe a more ideomatic way). Thanks. Parth --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to thi

Re: File Copy

2008-11-23 Thread Parth Malwankar
t buffer 0 len) (recur (.read in buffer)) Parth > > On Nov 23, 1:35 pm, Parth Malwankar <[EMAIL PROTECTED]> wrote: > > > Hello, > > > I am trying to translate the following Java > > snippet into a file copy routine in Clojure. > > >

Re: NullPointer when just returning nil?

2008-11-29 Thread Parth Malwankar
13) > This is expected. #(nil) is the same as (fn [] (nil)) and hence the failure. (fn [] nil) is what you want. > This works: > user=> #('nil) > # > I am not very clear on whats happening here to comment. Parth > Thanks, > -Ralf --~--~-~--~~--

Re: NullPointer when just returning nil?

2008-11-29 Thread Parth Malwankar
hen once you get it its cleaner. The current syntax fits the common case better where you might do #(foo %1 %2) sort of a thing. I suppose once an FAQ for Clojure comes up this goes there :) Parth > > On Sat, Nov 29, 2008 at 1:48 PM, Parth Malwankar > <[EMAIL PROTECTED]>wrote: &

Re: SVN or release?

2008-11-29 Thread Parth Malwankar
ing just in case there are any intermediate checkins. These are typically marked "Interim checkin - DO NOT USE!!" in the log. I plan to stick to releases post 1.0. Regarding Chimp, maybe you can try Gorilla: http://groups.google.com/group/clojure/browse_thread/thread/c8b7bc3106c39791 I haven&#

Re: Serializing Clojure objects

2008-12-02 Thread Parth Malwankar
so. If the data used java object it may not be serializable so easily. Generally my approach is to stick to data structures at Clojure level as it has reader syntax. Parth > But for other things, like keywords and most PersistentHashMaps, it > throws NotSerializableException. > > My i

Re: Serializing Clojure objects

2008-12-02 Thread Parth Malwankar
much about print-dup and the support for java collections. Thanks. Parth --~--~-~--~~~---~--~~ 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 To unsubscribe fr

Re: Atoms

2008-12-05 Thread Parth Malwankar
r=> (dosync (ref-set b (assoc @b :a 5))) {:c 3, :b 2, :a 5} user=> b # user=> @b {:c 3, :b 2, :a 5} user=> Parth --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this g

Re: Atoms

2008-12-05 Thread Parth Malwankar
Thanks for taking to time for such a detailed explanation Rich. This makes things much clear. And thanks Chouser for the pictorial representation. Parth On Dec 5, 6:24 pm, Rich Hickey <[EMAIL PROTECTED]> wrote: > On Dec 5, 5:51 am, bOR_ <[EMAIL PROTECTED]> wrote: >

Re: Running clojure-contrib.jar

2008-12-06 Thread Parth Malwankar
st svn HEAD, the windows equivalent of the following should work for you: java -server -cp /home/parth/src/clojure/clojure.jar:/home/parth/src/ clojure-contrib/clojure-contrib.jar clojure.main Note that on windows, apart from the path changes you would need to use ";" instead of ":&

Re: memory issue with nth

2008-12-06 Thread Parth Malwankar
e saying you don't have this issue. I am not seeing this problem. I set the heapsize down to 32M but this still works. [parth:~]% java -Xmx32M -cp /home/parth/src/clojure/clojure.jar clojure.main Clojure user=> (nth (repeatedly (fn [] 0)) 1000) 0 user=> (.maxMemory (Runtime/getR

Re: Noob question on strings.

2008-12-09 Thread Parth Malwankar
v\\java\\clojure\\clj-repl.bat" user=> "C:/dev/java/clojure/clj-repl.bat" "C:/dev/java/clojure/clj-repl.bat" user=> "C:" "C:" What release are you using? I am assuming you are on windows based on the string. Maybe you can try with the latest svn s

Re: recur vs. lazy: establishing guidelines

2008-12-09 Thread Parth Malwankar
437 msecs" 98 user=> (time (last (butlast (take 100 (iterate inc 0) "Elapsed time: 1266.704242 msecs" 98 user=> (time (last (lazy-butlast (take 100 (iterate inc 0) "Elapsed time: 701.681986 msecs" 98 user=> (t

Re: How to encapsulate local state in closures

2008-12-21 Thread Parth Malwankar
 With local bindings is failing > and I can't figure just why... > One way to do this would be to use atom. (defn mk-counter [start] (let [n (atom start)] (fn [] (swap! n inc (def counter (mk-counter 0)) user=> (counter) 1 user=> (counter) 2 user=> (counter) 3 Parth

  1   2   >