print-base / print-radix?

2009-07-02 Thread Parth Malwankar
I frequently deal with hex and binary numbers. As of now when I need to view a list of numbers I just map a little hex function to it to translate it into a list of hex strings at the repl. Having something like *print-base* / *print-radix* [1] may be valuable in such a scenario Or maybe an enh

Threadring Benchmark

2009-06-05 Thread Parth Malwankar
Hello, In order to understand the agent model of Clojure better I wrote the alioth shootout threadring benchmark [1]. I ran some tests to compare it with the Java and Scala implementation [2, 3] which I picked from the published benchmarks. The clojure code can be found here: http://gist.github.

Re: AIML pattern matcher design

2009-05-08 Thread Parth Malwankar
On Fri, 08 May 2009 22:20:13 +0530, dhs827 wrote: > > > ; First thing to learn is XML parsing with Clojure. > > > Other comments, tips, disses? > > Dirk In case you don't expect end users or other languages to access the configuration, one option you have is to save the configuration directly

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

2009-04-30 Thread Parth Malwankar
On Thu, 30 Apr 2009 23:20:14 +0530, samppi wrote: > > I know there's a core function that takes a predicate and returns its > opposite: > > (defn mystery [predicate] > (fn [x] (not (predicate x > > I'm having a lot of trouble finding the name of it in the docs, > though. Could anyone give

exposing specific functions via namespace

2009-03-25 Thread Parth Malwankar
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 src/org/ppm/foo/ src/org/ppm/foo/bar.clj -> org.ppm.foo.bar src/org/ppm/foo/baz.clj -> org.ppm.foo.baz f

Re: file io

2009-03-24 Thread Parth Malwankar
e wrote: > is there something as simple as this in clojure? > > whole python program: > > of = open(filename,"w") > of.write("hello") > of.close() > > I checked the api and looked around the wiki and google quickly and saw how > to use java's stuff to do it ... but, welll... > There

arbitrary partitioning of collection

2009-03-23 Thread Parth Malwankar
Hello, I have a use case for reading binary data from a file into a C equivalent structure. I read the binary date into a byte array before processing. I came up with a split-byte-array function for this: (defn split-byte-array "takes a byte-array and returns its various fields as a list of

dot and nums in keywords

2009-01-23 Thread Parth Malwankar
Hello, As per the docs for keywords ( http://clojure.org/reader ), keywords cannot contain '.'. "They cannot contain '.' or name classes." However, the following works on the repl: user=> :.. :.. user=> (keyword? :..) true Are '.'s allowed and the docs need updating? Or should we see an excep

Re: How to encapsulate local state in closures

2008-12-22 Thread Parth Malwankar
On Dec 22, 12:25 pm, "Mark Engelberg" wrote: > I misspoke; it's the call to counter that's the problem.  Let's say > you want to use a counter to count the number of times a ref is set, > something like this: > > (dosync (counter) (ref-set r 1)) > > If your var-set causes the transaction to ret

Re: How to encapsulate local state in closures

2008-12-21 Thread Parth Malwankar
On Dec 22, 5:45 am, "Mark Engelberg" wrote: > But if mk-counter is called twice because it's retried in part of a > transaction, then you're in big trouble when you use atom.  Better to > use a ref here.  atom needs to be reserved for the very few cases when > retries don't matter (like a cache

Re: How to encapsulate local state in closures

2008-12-21 Thread Parth Malwankar
google.com/group/clojure/msg/fd0371eb7238e933 In case you don't want multiple counters but just one, the following can also be done. user=> (let [n (atom 0)] (defn counter [] (swap! n inc))) #'user/counter user=> (counter) 1 user=> (counter) 2 user=> (counter) 3 Parth > &

Re: clojure.lang.Script

2008-12-21 Thread Parth Malwankar
On Dec 21, 8:21 pm, Emeka wrote: > > java -cp clojure.jar clojure.lang.Script yourapp.clj > > In my SciTe I added  java -cp clojure.jar clojure.lang.Script $(FilePath) > plus others and when I click 'GO' or F5 instead of running the code and > printing result. I have > > > > > java -cp clojure.

Re: How to encapsulate local state in closures

2008-12-21 Thread Parth Malwankar
On Dec 21, 11:47 pm, chris wrote: > I would like to be able to encapsulate local state in a closure. > Specifically, I would like a function that returns an incrementing > integer, thus: > (test_func) > 1 > (test_func) > 2 > What is the best way to go about this?  With local bindings is failing

Re: recur vs. lazy: establishing guidelines

2008-12-09 Thread Parth Malwankar
On Dec 9, 11:18 pm, Stuart Halloway <[EMAIL PROTECTED]> wrote: > Hi all, > > I am working on the functional programming chapter for the book this   > week, and I have been reviewing uses of loop/recur vs. lazy-cat/lazy- > cons in Clojure to come up with some guidelines. > > Here is where I am: I

Re: Noob question on strings.

2008-12-09 Thread Parth Malwankar
On Dec 9, 4:47 pm, Ant <[EMAIL PROTECTED]> wrote: > Hi all, > > I've just started looking with interest at the language, and have > decided to port some of my smaller programs and scripts to Clojure as > a way of getting to know the language. I am stumbling over Strings at > the moment, as I am

Re: memory issue with nth

2008-12-06 Thread Parth Malwankar
On Dec 7, 11:18 am, Paul Mooser <[EMAIL PROTECTED]> wrote: > I also have this problem, unless I set my heap to be substantial - > going up in increments of 128M, I need to have at least a 768M heap > for this to not occur. That seems completely crazy, but the rest of > you are saying you don't

Re: Running clojure-contrib.jar

2008-12-06 Thread Parth Malwankar
On Dec 7, 3:51 am, janus <[EMAIL PROTECTED]> wrote: > All, > > It is my mistake, this is the error once again. Failed to load Main- > Class manifest attribute from C:\clojure\clojure\clojure-contrib.jar. > I did what Shulz said , however , I still have the same problem. > Could you copy the err

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: > > > Are there any screencasts

Re: Atoms

2008-12-05 Thread Parth Malwankar
On Dec 5, 6:02 am, Rich Hickey <[EMAIL PROTECTED]> wrote: > I've added a new reference type - atom. > > Docs here: > > http://clojure.org/atoms > > Feedback welcome, > > Rich Are the following equivalent or is one recommended over the other? The first (using atoms) is definitely more convenient

Re: Serializing Clojure objects

2008-12-02 Thread Parth Malwankar
On Dec 2, 11:52 pm, Rich Hickey <[EMAIL PROTECTED]> wrote: > As part of AOT I needed to enhance print/read to store constants of > many kinds, and restore faithfully. This led to a new multimethod - > print-dup, for high-fidelity printing. You can get print-dup behavior > by binding *print-dup*:

Re: Serializing Clojure objects

2008-12-02 Thread Parth Malwankar
Tayssir John Gabbour wrote: > Hi! > > How should I approach serialization? I made a little test function > which serializes and deserializes Clojure objects. It works for > strings, integers, symbols, LazilyPersistentVectors and.. oddly.. > PersistentHashMaps that have exactly one element. (My C

Re: SVN or release?

2008-11-29 Thread Parth Malwankar
Kyle Schaffrick wrote: > Hi all, > > I've been playing with Clojure for a few days now, following the mailing > list, searching and tinkering, etc. I'm really excited about this > language! > > I'm running the latest packaged release, and I'd like to start writing > some more serious "spikes" in

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: NullPointer when just returning nil?

2008-11-29 Thread Parth Malwankar
On Nov 29, 5:29 pm, "Ralf Bensmann" <[EMAIL PROTECTED]> wrote: > Hi, > > is this the intended behavior? > > user=> #(nil) > java.lang.NullPointerException (NO_SOURCE_FILE:12) > user=> (def b #(nil)) > java.lang.NullPointerException (NO_SOURCE_FILE:13) > This is expected. #(nil) is the same as (

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

File Copy

2008-11-23 Thread Parth Malwankar
Hello, I am trying to translate the following Java snippet into a file copy routine in Clojure. public static void copy(InputStream in, OutputStream out)throws IOException { byte[] buffer = new byte[1024]; while (true) { int bytesRead = in.read(buffer); if (bytesRead ==

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

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 "main" java.io.Fil

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

2008-11-15 Thread Parth Malwankar
On Nov 16, 12:36 am, samppi <[EMAIL PROTECTED]> wrote: > Is there a way to get a value—call it 'anything—so that (isa? anything > x) is always true for any x? > > I need this for multimethod dispatch—sometimes, I want a method to > ignore some of the stuff its dispatch function returns: > >   (d

Re: Changes for AOT compilation

2008-11-14 Thread Parth Malwankar
On Nov 13, 11:43 pm, Rich Hickey <[EMAIL PROTECTED]> wrote: > We're coming around the other side of the few breaking changes I > wanted to get done before release 1.0. > > The changes are: > > New regex format: > > http://groups.google.com/group/clojure/msg/eddd7f0d292da683 > > Uniform binding s

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

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? Thanks. Parth --~--~-~--~~-

Re: iterate

2008-11-13 Thread Parth Malwankar
On Nov 13, 12:25 pm, notallama <[EMAIL PROTECTED]> wrote: > i put this at the end of my boot.clj for added fun: > > (defn iterate >   "returns a lazy seq of arg1, arg2 ... argn, (f arg1 ... argn), (f > arg2 ... argn (f arg1 ... argn)), etc." >   [f & [x & rest :as all]] >   (lazy-cons x (apply i

Re: Can't get rlwrap to work

2008-11-12 Thread Parth Malwankar
On Nov 13, 2:38 am, Giacecco <[EMAIL PROTECTED]> wrote: > Hi all, > I am trying setting up clojure to use rlwrap as described > athttp://en.wikibooks.org/wiki/Clojure_Programming#Enhancing_Clojure_RE... > on a MacOS 10.5.5. > > I have prepared the clj-completions.clj the instructions describe,

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. It would make the code more terse. Parth > The

Re: Files in Clojure Google Groups

2008-11-02 Thread Parth Malwankar
Rich Hickey wrote: > On Oct 30, 3:57 pm, bc <[EMAIL PROTECTED]> wrote: > > Hi all, > > > > Is there any way to enter an annotation or comments when a file is > > uploaded to the Clojure Google Groups file area? I've recently had a > > look at a few things there and it would be nice to have some

Re: lazy death

2008-10-25 Thread Parth Malwankar
On Oct 25, 5:27 pm, Timothy Pratley <[EMAIL PROTECTED]> wrote: > > (set! *print-length* 50) > > Ah perfect. Thanks! Is there a way to make this default? clojure.lang.Repl will run all the files listed before it goes to the prompt. So I have my clj script updated to accept a .cljrc.clj file that

Re: lazy death

2008-10-25 Thread Parth Malwankar
On Oct 25, 4:55 pm, Timothy Pratley <[EMAIL PROTECTED]> wrote: > When I screw up a lazy-cons (which happens quite a lot to me), > my repl goes nuts and appears to corrupt the box it lives in. If I > leave it running my monitor blanks out periodically... like some > system register got reset. I c

Re: Clojure and introspection/reflection analysis?

2008-10-23 Thread Parth Malwankar
On Oct 24, 3:42 am, BerlinBrown <[EMAIL PROTECTED]> wrote: > I asked this on common lisp thread but I want to work with clojure as > well: > > With clojure and I am assuming the introspection properties.  How > can I add code to clojure code that will tell me when a function > is called and when

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: Reader + Macros on untrusted S Expressions: Security considerations?

2008-10-22 Thread Parth Malwankar
On Oct 22, 1:30 pm, "Brett Morgan" <[EMAIL PROTECTED]> wrote: > Hi all, > > I am thinking about a potential architecture for a webapp where in the > server gets s expressions posted from an ajax web client. > > From a security standpoint, the s expressions are coming from an untrusted > computer

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

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 user=> (ns test (:refer-

Re: Multiple return values

2008-10-20 Thread Parth Malwankar
On Oct 20, 3:51 pm, "Fredrik Appelberg" <[EMAIL PROTECTED]> wrote: > Hi all, > > The CL feature for handling multiple return values from a function come in > really handy sometimes and make for cleaner APIs. For example, the ROUND > function returns the integer part of a float as the regular val

Re: Newbie question on the use of functional hash maps

2008-10-20 Thread Parth Malwankar
On Oct 20, 6:16 am, "Tom Emerson" <[EMAIL PROTECTED]> wrote: > Hi all, > > I have a somewhat embarassing newbie question on the use of hash maps > in a functional environment. > > Consider a little utility that counts the number of unique words in a > file. A hash map mapping strings to integers

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

2008-10-20 Thread Parth Malwankar
On Oct 20, 1:38 am, Adam Jones <[EMAIL PROTECTED]> wrote: > I'm starting up work again on my Clojure-based game. Up until this > point I've been doing things the "dirty" way by re-defing a bunch of > global variables and/or storing the values in the Java objects I need > to use to get access to

Re: Fibonacci function performance compare between clojure and scala

2008-10-19 Thread Parth Malwankar
On Oct 19, 7:49 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Clojure's > > (defn fib [n] >(if (or (zero? n) (= n 1)) >1 > (+ (fib (dec n) ) (fib (- n 2) > > (time (fib 36)) > > "Elapsed Time: 10475.325226 msecs" > 24157817 > > Scala's > > def fib(n:Int):Int=if (

Re: Multiple indexing for vectors/maps

2008-10-18 Thread Parth Malwankar
On Oct 19, 3:12 am, kwatford <[EMAIL PROTECTED]> wrote: > Sorry if this has been asked before, but I couldn't find anything on > it. > If I have: (def A [ [ 1 2 3 ] [ 4 5 6 ] ] ) > then if I want to access a specific element, I have to do: > ((A 1) 1)   -or-  (get (get A 1) 1) get-in is probabl

Re: Callstack from load-file

2008-10-18 Thread Parth Malwankar
On Oct 18, 9:40 pm, jim <[EMAIL PROTECTED]> wrote: > Hey all, > > I had a situation where a source file wouldn't load and the error > message was unhelpful: > > java.lang.IllegalArgumentException: Too many arguments to struct > constructor (source-file.clj:0) > > So, I threw together a quick hac

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: Clojure's first year

2008-10-16 Thread Parth Malwankar
On Oct 16, 9:36 pm, Rich Hickey <[EMAIL PROTECTED]> wrote: > A year ago today I 'released' Clojure, by sending a message to my jFli > and Foil mailing lists. It got blogged, picked up by Planet Lisp and > redditted in the course of a day or so, and has been a wild ride ever > since. I couldn't h

Re: Ruby => Clojure for Enumerable and Array

2008-10-16 Thread Parth Malwankar
On Oct 17, 3:14 am, Mark McGranaghan <[EMAIL PROTECTED]> wrote: > When I first started working with Clojure a while back I tried to get > my bearings by figuring out how to do some basic things in Clojure > that I had previously done in Ruby.  With all the recent talk about > the seq api, I thou

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't get any error message. > > > > user=> (doto (new java.lang.String "h

toUpperCase on java.lang.String

2008-10-15 Thread Parth Malwankar
Calling a java method on a string directly works. user=> (.toUpperCase "hello") "HELLO" user=> (class "hello") #=java.lang.String But if I do this in a doto, it doesn't seem to work but I don't get any error message. user=> (doto (new java.lang.String "hello") (toUpperCase)) "hello" user=> (cla

Re: primitive meta data

2008-10-15 Thread Parth Malwankar
On Oct 15, 8:34 am, Islon <[EMAIL PROTECTED]> wrote: > Hi. > > I've made a dumb (very dumb) performance comparison function just to play > with the language. > I wanted to mark some symbols with a float primitive type but the compiler > complained so I had to annotate it with the Float class. >

Re: GUIs in Clojure

2008-10-09 Thread Parth Malwankar
On Oct 9, 6:11 am, "Stephen C. Gilardi" <[EMAIL PROTECTED]> wrote: > On Oct 8, 2008, at 6:19 PM, Michael Beauregard wrote: > > Possibly of interest for the layout part of that, I recently checked   > in clojure.contrib.miglayout which provides support for using   > MiGLayout (http://miglayout.co

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

2008-10-08 Thread Parth Malwankar
On Oct 8, 8:35 am, CuppoJava <[EMAIL PROTECTED]> wrote: > Hi, > I'm very new to clojure, and I'm just wondering what's the most > efficient way of creating a vector of zeroes. This is one way. user=> (vec (replicate 10 0)) [0 0 0 0 0 0 0 0 0 0] also user=> (into [] (replicate 10 0)) [0 0 0 0

Re: What "reasoner"?

2008-10-06 Thread Parth Malwankar
Josip Gracin wrote: > Hi! > > Rich, in the Boston talk you mentioned that you're considering some > kind of a "reasoner" (if I understood correctly) for working with > databases. You also mentioned a project whose name sounded like "ios > reasoner". I can't find references on anything spelled

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

2008-10-06 Thread Parth Malwankar
On Oct 6, 6:40 pm, Stuart Halloway <[EMAIL PROTECTED]> wrote: > Hi all > > For consistency, I would like to see spit moved into the boot.clj. > > This will play well with the Java crowd. For years I have poked fun of   > Java for having megabytes of core library and no simple way to save a   > f

Re: safe navigation operator

2008-10-06 Thread Parth Malwankar
On Oct 6, 7:00 pm, Rich Hickey <[EMAIL PROTECTED]> wrote: > On Oct 6, 9:36 am, Stuart Halloway <[EMAIL PROTECTED]> wrote: > > > > > Yes, that's better. Glad you like the idea. > > > Does anybody not named Stuart also want to see this added to > > Clojure? ;-) > > > Stuart > > > > On Oct 3, 3:13

Re: Collection Building Idiom

2008-09-19 Thread Parth Malwankar
On Sep 19, 5:49 am, Mark McGranaghan <[EMAIL PROTECTED]> wrote: > Hi all, > > I was wondering if there was an idiomatic functional way to accomplish > the following: > > We have some parameters, and we want to build a collection based on > those parameters.  The collection could have as many as

Re: 20080916 Release

2008-09-16 Thread Parth Malwankar
On Sep 16, 7:00 pm, Rich Hickey <[EMAIL PROTECTED]> wrote: > http://sourceforge.net/project/showfiles.php?group_id=137961 > > Added: validators for vars/refs/agents, delay/force, isa-based > multimethods and a la carte hierarchies, require/use/load, namespace > aliases and many more functions an

Re: Debian package for clojure

2008-09-12 Thread Parth Malwankar
On Sep 11, 6:22 pm, "Paul Stadig" <[EMAIL PROTECTED]> wrote: > I have created a debian package for clojure. I've basically packaged > up the JAR with the bin script > fromhttp://github.com/jochu/clojure-extra/tree/master. It's still a > work-in-progress, but if there are any debian users out th

Re: local functions?

2008-09-11 Thread Parth Malwankar
On Sep 11, 3:01 am, Allen Rohner <[EMAIL PROTECTED]> wrote: > > For very short functions one can use the cut notation: #(...). In case > > there are several functions or functions going over several lines, this > > is a sign that they should go into an own defn(-) with appropriate > > docstring.

Re: ns usage for multiple clj files

2008-09-07 Thread Parth Malwankar
On Sep 7, 1:00 pm, Meikel Brandmeyer <[EMAIL PROTECTED]> wrote: > I think your problems should be solved now, since in my understanding > they arise due to the non-adherence to the required file layout.> > java.io.FileNotFoundException: Could not locate Clojure resource > > on classpath: bar/my

ns usage for multiple clj files

2008-09-07 Thread Parth Malwankar
Hello, I am trying to use the latest ns/in-ns functionality from HEAD. I don't seem to be getting it right. Here is what I am tring to do. 1. test.clj - contains a function foo 2. tst-pkg.clj - contains the ns definition (so I can get my dependencies right in a multi-file

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

2008-09-05 Thread Parth Malwankar
On Sep 6, 12:23 am, Rich Hickey <[EMAIL PROTECTED]> wrote: > On Sep 5, 7:06 am, Christopher Taylor <[EMAIL PROTECTED]> wrote: > > > > > Hi, > > > this is my first post to the list (though I've been lurking for a > > while) and I'm not yet actively working with Clojure, so take what I > > say her

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

avoiding duplication using multi-methods

2008-08-31 Thread Parth Malwankar
Hello, I have a situation in which different multi-methods need similar behavior with different arguments. So they call the same function (one-or-two below) with the arguments. E.g. (defmulti what-num (fn [x] x)) (defn one-or-two [x] (println "saw one or two: " x)) (defmethod what

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

2008-08-31 Thread Parth Malwankar
Frantisek Sodomka wrote: > Hello! > It is very common pattern to include parts of code which are used for > specific purposes - for example debugging, logging, etc. While these parts > can be used when developing code, they can be removed from finished > application. One way is to comment these

generating clj docs

2008-08-30 Thread Parth Malwankar
Hello, I have uploaded a script gen-clj-docs.clj in the file area that goes through all the clojure and clojure-contrib modules and dumps out the latest docs from sources as txt files. It leverages clojure.contrib.ns-utils for this (thanks!). Thought that some people might find this useful. http

Re: The ant simulation

2008-08-30 Thread Parth Malwankar
On Aug 30, 7:52 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > In the ant simulation the world function looks like this > > (def world >      (apply vector >             (map (fn [_] >                    (apply vector (map (fn [_] (ref (struct cell 0 0))) >                                

Re: Google Code?

2008-08-30 Thread Parth Malwankar
On Aug 30, 6:53 pm, Rich Hickey <[EMAIL PROTECTED]> wrote: > Google has recently opened up Google Code to hosting projects using > the Eclipse Public License, the successor to the CPL used by Clojure. > > Right now I'm only using SF for SVN, as the web interface on SF for > anything else is quit

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: New Release of VimClojure: v1.2.0

2008-08-30 Thread Parth Malwankar
On Aug 30, 3:35 am, Meikel Brandmeyer <[EMAIL PROTECTED]> wrote: > Dear Clojurians, > > a new version of VimClojure is available. I tried to fix also the string > handling for the indenting. This should work now. Please note that there > is still some issue with a line ending in a comment contai

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: 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-27 Thread Parth Malwankar
On Aug 28, 12:10 am, Rich Hickey <[EMAIL PROTECTED]> wrote: > I posted a variant here: > > http://paste.lisp.org/display/65964 > Rich, It works very nicely. Thanks. Just one thought in case the functions args are still being decided on. Could we consider taking access path as a vector rather

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: 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 the Google Group

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

2008-08-26 Thread Parth Malwankar
Hello, Attached is a patch to give a little more information for "java.lang.IllegalArgumentException: Don't know how to create ISeq from:" error. The current behavior is: user=> (map identity 1) java.lang.IllegalArgumentException: Don't know how to create ISeq from: Integer java.lang

updating nested structure

2008-08-26 Thread Parth Malwankar
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, v=val to put, access-spec=access vector ; ... code listing after interaction user=> nx {:a {:b {:

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

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

new wiki section: Employee Record Manipulation

2008-08-25 Thread Parth Malwankar
Hello, I have added a new section on "Mutation Facilities" -> "Employee Record Manipulation" http://en.wikibooks.org/wiki/Clojure_Programming#Employee_Record_Manipulation This is based on the discussion: http://groups.google.com/group/clojure/browse_thread/thread/2d3eb5d20f2007b4 Please feel f

executing shell command

2008-08-25 Thread Parth Malwankar
I want to run a shell command through Clojure so I tried the following which doesn't work: user=> (.. Runtime (getRuntime) (exec "vim")) [EMAIL PROTECTED] user=> (.. Runtime (getRuntime) (exec "/usr/bin/vim")) [EMAIL PROTECTED] user=> (.. Runtime (getRuntime) (exec "ls")) [EMAIL PROTECTED] I may

Re: Binding dynamically created symbols in the lexical context.

2008-08-24 Thread Parth Malwankar
budu wrote: > Hi, I've been having a great time using Clojure in the last few month. > But this week I've come accross something that is blocking me. I'm > trying to write a very simple pattern matching macro to use in other > macros for matching forms. I've based my macro on one posted in this