Re: Infinite sequences hang sets and maps

2009-10-29 Thread John Harrop
On Wed, Oct 28, 2009 at 9:35 PM, Alex Osborne a...@meshy.org wrote:

 John Harrop wrote:
  Probably the seq .hashCode should consider only the first N elements
  for some maximum N and if two longer (or even infinite) sequences
  collide so be it.

 I strongly disagree.  Choosing some arbitrary magic cutoff point just
 seems cause for trouble and much confusion.


For the specific case of hashCode, no; identical values must have identical
hashes but different values need not have different hashes. Collisions due
to the hypothetical cutoff get exponentially less likely with each
additional increment of 1 of the cutoff length.

You're right though that they still won't work in hashmaps and hashsets
because the equals test will hang when the sequences are actually equal.
This also stops them working in treemaps and treesets (even if we added
Comparable to ISeq to use lexicographic order and comparisons of the
elements, or supplied a comparator that did so; and even if the seq-compare
function gave up after N identical pairs of elements, resulting in hash
collisions).

A workaround if you want to index something by infinite (or just very large)
seqs might be to use (take n the-seq) for some constant n chosen large
enough for the truncated sequences to tend not to collide in practice, with
some contingency for the case of collisions.

--~--~-~--~~~---~--~~
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Constructing Java Interop calls

2009-10-29 Thread John Harrop
On Wed, Oct 28, 2009 at 10:15 PM, Alex Osborne a...@meshy.org wrote:


 Tiago Antão wrote:
  Again, the point here is to be able to construct method names (full
  call signatures, really) on runtime.
 
  I am lost. As in newbie clueless :(

 As others have suggested you need to use either Java's reflection or
 Clojure's eval.


Not quite -- this works as long as the Bla part is a constant:

(defmacro setProperty [field obj value]
  (let [cct (symbol (.concat .set (str field)))]
`(~cct ~obj ~value)))

user= (macroexpand-1 '(setProperty Bla x 1))
(.setBla x 1)

--~--~-~--~~~---~--~~
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: ANN: Clojure live-repl

2009-10-29 Thread ngocdaothanh

I think it would be great if JLine is integrated in live-repl.

I have some questions:
* Why not use maven and clojure-maven-plugin?
* Is it OK if live-repl uses one version of Clojure and the attached
process uses another?


On Oct 29, 9:35 am, David Powell djpow...@djpowell.net wrote:
  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 gets copied to the build folder, so the intent is to run 
 that copy of the liverepl.sh script.  (Though I haven't really tested the .sh 
 script)

 --
 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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Infinite sequences hang sets and maps

2009-10-29 Thread Miron Brezuleanu

Hello,

On Thu, Oct 29, 2009 at 3:35 AM, Alex Osborne a...@meshy.org wrote:

 John Harrop wrote:
 Probably the seq .hashCode should consider only the first N elements
 for some maximum N and if two longer (or even infinite) sequences
 collide so be it.

 I strongly disagree.  Choosing some arbitrary magic cutoff point just
 seems cause for trouble and much confusion.  Putting something in a hash
 set or using it as a map key implies evaluating it -- you'd expect
 summing or printing an infinite sequence to hang, so why shouldn't
 hashing it also hang?

+1, I also disagree. If there is a need to compare parts of infinite
sequences, just truncate them and compare the resulting finite parts.
This is something that belongs in the application, not in the
language, as the value for N depends on the application and there is
no N that fits everyone (other than infinity).

-- 
Miron Brezuleanu

--~--~-~--~~~---~--~~
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Infinite sequences hang sets and maps

2009-10-29 Thread Alex Osborne

John Harrop wrote:
 On Wed, Oct 28, 2009 at 9:35 PM, Alex Osborne wrote:
 
 Choosing some arbitrary magic cutoff point just
 seems cause for trouble and much confusion.
 
 For the specific case of hashCode, no; identical values must have 
 identical hashes but different values need not have different hashes. 
 Collisions due to the hypothetical cutoff get exponentially less likely 
 with each additional increment of 1 of the cutoff length.

Yeah, that's true, but I meant in the usual context where you fall back 
to equality in the event of a collision (like, as you say, sets and 
maps).  I think it would be very confusing if when you put an infinite 
sequence in one set it works (because there's no collision so it uses 
the cutoff) while putting the exact same sequence in a different set it 
hangs (because of a collision it falls back to equality).  I can imagine 
that being a nightmare to debug particularly because in most programs it 
will only happen very rarely.

--~--~-~--~~~---~--~~
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Infinite sequences hang sets and maps

2009-10-29 Thread Mark Engelberg

On Wed, Oct 28, 2009 at 11:08 PM, John Harrop jharrop...@gmail.com wrote:
 For the specific case of hashCode, no; identical values must have identical
 hashes but different values need not have different hashes. Collisions due
 to the hypothetical cutoff get exponentially less likely with each
 additional increment of 1 of the cutoff length.

I see your point that hashCode could be made to work on infinite
sequences, but since hashing is almost always a prelude to testing for
equality, I'm hard pressed to think of an example of why you'd want to
be able to do this.  Can you illustrate with an example?

--~--~-~--~~~---~--~~
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Scientific computing

2009-10-29 Thread Konrad Hinsen

On 28 Oct 2009, at 22:21, Rock wrote:

 Your analysis is crystal clear and very helpful Konrad. But you
 haven't addressed the issue of dealing with useful information
 regarding the data structure itself. What if, for example, a function
 wanted to know the rank and dimensions of a multidimensional array it
 was being passed, and that array were represented by means of a nested
 vector?

I didn't address such issues because there is no point in discussing  
them before making the fundamental decision whether to use an abstract  
or an exposed data type for array data. That choice dictates the  
priorities for everything that follows.

 Suppose we're dealing with rank n objects. Do you think it
 would be an easy task to figure all that out dealing with nested
 vectors?

If you can assume the array is well-formed, it is rather easy.  
Otherwise it isn't.

 And by the way, How would you go about implementing in detail
 a check to see if a nested vector is actually an authentic
 multidimensional array or not?

That's a rather simple recursive function. The only problem is its run- 
time cost.

 I honestly prefer your first case scenario. Seems much more efficient,
 less resource-consuming, and just straightforward. But I really would
 like to know what your preference is. If you had to choose, which way
 would you go?

If I were to design an array interface for Clojure, it would consist  
of multimethods implemented for both an efficient array data structure  
for internal use and for nested vectors. The implementation for the  
latter would convert the nested vectors to the efficient structure and  
do all the necessary checks. It would be there for convenience and  
clarity in user code. Ideally I would then implement the same  
interface for Colt arrays and netCDF arrays as well, both for having  
an effcient structure for large data sets and for interoperability.  
And once we are at it, why not have another implementation for sparse  
arrays, using a suitable data structure?

Unfortunately, a good design and implementation represents a lot of  
work. At the moment I am not sure if we have the critical mass of  
people interested in working on this to get the job done in a  
reasonable amount of time.


On 28 Oct 2009, at 23:07, harrison clarke wrote:

 maps could also be an option. you can use vectors of ints as keys.  
 (and you can stick dimensions and such in there with keywords)

 i'm not sure how that compares to nested vectors for perforance. you  
 have the overhead of the hash function, but you don't have any  
 nesting.
 it's also pretty handy if you want to represent a sparse matrix.

Maps could be a good choice for sparse arrays. For dense ones, they  
would represent an enormous waste of memory, and probably time as well.

Konrad.


--~--~-~--~~~---~--~~
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Clojure QuickLook for Mac OS X?

2009-10-29 Thread perdalum

Hi there!

Has anyone been able to use QuickLook wich Clojure source files?

Regards,

Per
--~--~-~--~~~---~--~~
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Embedding Clojure in NetKernel

2009-10-29 Thread Roman Roelofsen

Do you mind sharing the links? I am interested in it as well.

Thanks!

Roman

2009/10/28 Tony Butterfield t...@1060.org:

 Tom Hicks has just pointed me to an old thread which answers
 questions about namespaces and isolation. Let me read and
 absorb all that work first - I suspect it answers a lot of my
 questions.

 Cheers, Tony

 On Oct 28, 11:43 am, Tony Butterfield t...@1060.org wrote:
 Hi Everybody

 this is my first post to this group so please tell me If I'm posting
 in the wrong place. I've been looking at integrating Clojure into
 NetKernel as language runtime library but I'm struggling a bit for a
 lack of examples. There are two things I'm trying to achieve:

 1) start and stop the Clojure runtime on demand. I need to do this so
 that new versions can be deployed whilst the server is live. Looking
 at the latest version (1.0.0) I see that I no longer need to call
 RT.init() and that startup is done statically. That's fine but is
 there a way to cleanly shutdown. I.e. stop threads, and enable a full
 garbage collection of the Clojure libraries?

 2) is there a way to ensure isolation of functionality in one runtime?
 I can see how I can use namespaces to avoid naming collisions but is
 it possible to enforce tighter security across namespaces or is there
 another technique? I'm quite new to closure so sorry if that is a
 stupid question - the trouble is I want to get it running inside
 NetKernel as good environment to explore the language - horse before
 the cart! When Clojure scripts execute inside NetKernel environment it
 is important that they act like pure functions with no side-effects on
 others.

 Thanks in advance for you advice,

 Tony

 


--~--~-~--~~~---~--~~
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Clojure QuickLook for Mac OS X?

2009-10-29 Thread Konrad Hinsen

On 29.10.2009, at 10:30, perdalum wrote:

 Has anyone been able to use QuickLook wich Clojure source files?

I use the QLColorCode plugin (version 2.02):

http://code.google.com/p/qlcolorcode/

To make it treat Clojure files (*.clj) like Lisp source code, open the  
Info.plist file in the package using the property list editor and open  
the item Imported Type UTIs. You should find an item called  
org.n8gray.lisp, it's number 17 in my configuration. Open it and  
click on Equivalent Types followed by public.filename-extension.  
Add a row containing clj. Log out and in again - and enjoy QuickLook  
on Clojure code!

Konrad.


--~--~-~--~~~---~--~~
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: cannot cast error java char-array to java string

2009-10-29 Thread Chick Corea

Yes, they both work - and the #^chars is much more legible.

Many thanks!

FYI, to whom it may concern...I think it's worth noting that this
simple
case gives confusing output from the repl.

 user= (new String #^chars (make-array Character/TYPE 3))
 user=

And this:

user= (def asdf (new String #^chars (make-array Character/TYPE
3)))
#'user/asdf
user= asdf


That's the exact output except for the indentation.  The dangling
string
w/ its single double-quote followed by the prompt.  The prompt is not
even displayed w/ the second example.

As you can see from this example, non-empty strings are displayed
as expected.

user= (def qwer (let [x (make-array Character/TYPE 3 )] (aset x 0
\a) (aset x 1 \b) (aset x 2 \c) (new String #^chars x)))
#'user/qwer
user= qwer
abc

CHICKEE

On Oct 28, 10:31 pm, ataggart alex.tagg...@gmail.com wrote:
 Also you can substitute #^[C with the more legible #^chars.

 On Oct 28, 7:27 pm, Alex Osborne a...@meshy.org wrote:

  Chick Corea wrote:
   What is wrong with this code?  I want to instantiate a Java String
   from a Java character-array.
   But I want it to be fast, hence the need to cast per the warn on
   reflection message.

       user= (set! *warn-on-reflection* true)
       true
       user=  (new String #^[C (make-array Character/TYPE 3 \a ))
       java.lang.ClassCastException: [[C cannot be cast to [C
   (NO_SOURCE_FILE:0)

  Note the exception, [[C means a two-dimensional arary.  (make-array
  Character/TYPE 3 \a) actually means (make-array Character/TYPE 3 97) so
  a 3 by 97 two-dimensional array (new char[3][97] in java syntax).  What
  you probably want is:

  user (String. #^[C (into-array Character/TYPE (repeat 3 \a)))
  aaa

--~--~-~--~~~---~--~~
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Clojure in a big Java solution

2009-10-29 Thread vanallan

Ok thanks for the answer :)

I have now began to implement the Java parts. The data that is going
to be processed in Clojure is mapped to clojure structs, but I now
have another question. How should I update the values in the structs?
Since functions are going to run in parallel and a function may need
the updated value from another function I though that I should put the
struct members that is going to be updated in refs or maybe atoms. Is
this a good way or how should I manage the updated values in structs?

Thanks :)

On Oct 26, 4:11 pm, Shantanu Kumar kumar.shant...@gmail.com wrote:
 You can probably settle for a set ofJavadata structures that are
 inter-operable withClojure.

 1. Use interfaces (becauseClojureimplements them too) such 
 asjava.util.List,java.util.Set,java.util.Map etc.
 2. Use type hints and enable warn on reflection.
 3. When inClojure, first convert toClojuredata structure before
 doing any processing.
 4. Try to minimize the cross-section surface area that connects 
 theJavaandClojureparts and keep it clean.

 This may not answer all of your questions (such as concurrency), but I
 coded something inJava+Clojure, and the result I guess is pretty
 good. URL below:

 Taimen --http://code.google.com/p/bitumenframework/

 Regards,
 Shantanu

 On Oct 26, 12:55 pm, vanallan vanal...@gmail.com wrote:

  Hi
  thanks for the replies :)
  The whole system consists of a couple of hundreds of thousands lines
  ofJavacode. The part i am investigating is a validation sub system
  that validates a number of input parameters given from the user
  against various predefined values and rules, and against databases and
  such. These methods don't just validate the input, they also set up a
  couple of objects based on the input given.

  I want these methods to run its own task in parallel, but sequential
  to the rest of the system. The reason i am doing this is to see if
  there is some improvements in performance and to see if it is possible
  at all to implement parts of abigsystem in a functional language.
  The same object is sent as an argument to all methods, and this object
  consist of a lot of other objects.

  On Oct 24, 5:54 pm, eyeris drewpvo...@gmail.com wrote:

   It's difficult to provide advice without more information about your
   current code. You say that you want a part of your system, which
   manipulates a lot of objects, to run in parallel. Do you mean that you
   want this part of the system to run parallel to the other parts -or-
   do you mean that this part will remain in sequence with the other
   parts of the system, but it will run its own tasks in parallel?
   Furthermore, what do you expect to gain from the parallelism? If it's
   simple divide-and-conquer parallelism to process a chunk of data
   faster, then that is pretty easy to implement inJava, so long as the
   data is dividable. On the other hand, if you want this part of your
   system to run in parallel with the other parts, then there's a wide
   spectrum ofClojure/Javamixes that could make sense. Like I said
   above, we'll need much more information before we can provide any
   valuable advice.

   On Oct 23, 7:41 am, vanallan vanal...@gmail.com wrote:

Hi!
I am currently investigating if it is possible to convert a part of a
   bigJavasystem toClojure. The reason for this is to make this part
run in parallel and hence ease the implementation by porting it to
   Clojure. The problem is that these parts of the system is today
setting and changing a lot mutable data in a lot of different objects.

Which approach do you think i should have when i try to port these
   Javamethods? Should i try to retain theJavastructure and change
these objects or is it better to create my own data structure and
somehow manage them? Does anyone have any experience in integrating
   Clojurein abigJavasolution? Also i should mention that i'm quite
new toClojure, and functional programming overall. :)

Thanks



--~--~-~--~~~---~--~~
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Scriptjure, Parenscript - why not generate code in other languages

2009-10-29 Thread Miron Brezuleanu

Hi,

earlier today I was wondering about the best way to write some
Transact-SQL code. I normally write code in C#, Python and lately
Clojure. Even though TSQL is a decent procedural extension to SQL, it
still feels very cumbersome to the languages I use daily. Having done
some C# code generation lately (using ScriptTemplate), I was thinking
about doing the same thing for SQL.

At which point I remembered Scriptjure (and Parenscript) and thought
about writing something similar for TSQL.

Google didn't reveal any already written such generators - I guess
I'll have to come up with one, which I expect to be kind of fun.

The bigger question is, why isn't this way (generate a Lisp
datastructure that describes in a convenient way the syntax tree of
the code to emit, then emit the actual code by walking the
datastructure) of abstracting away syntax problems in programming
languages more common? I can understand why it's not available for C#
- losing code completion is a big disadvantage, but what about (T)SQL
and others? Or it is actually an often used trick, but the tools used
are written 'in-house' and not made public?

I'll be very grateful for any input on the pros and cons of such an approach.

The pros I see are the ability to construct the data structure using
all the tools Clojure/Lisp offer in this area (quasiquotation and its
many friends, for instance). The ability to output code that is pretty
printed in a customized way is also a big plus (I care a great deal
about the readability of the generated code). Also, the SQL flavor
could be a pretty printing parameter - thus making it possible to
write code that will run on many RDBMSs - but I'm not very hopeful
about this, as differences between SQL dialects often go beyond
syntax.

Cons: I'm afraid of getting the SQL generating syntax wrong and making
the data structures used for generation ugly. But I guess that can be
fixed by iterating a little. :-)

Thanks,
-- 
Miron Brezuleanu

--~--~-~--~~~---~--~~
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Scientific computing

2009-10-29 Thread John Harrop
On Thu, Oct 29, 2009 at 4:49 AM, Konrad Hinsen
konrad.hin...@fastmail.netwrote:

 On 28 Oct 2009, at 22:21, Rock wrote:
  I honestly prefer your first case scenario. Seems much more efficient,
  less resource-consuming, and just straightforward. But I really would
  like to know what your preference is. If you had to choose, which way
  would you go?

 If I were to design an array interface for Clojure, it would consist
 of multimethods implemented for both an efficient array data structure
 for internal use and for nested vectors. The implementation for the
 latter would convert the nested vectors to the efficient structure and
 do all the necessary checks. It would be there for convenience and
 clarity in user code. Ideally I would then implement the same
 interface for Colt arrays and netCDF arrays as well, both for having
 an effcient structure for large data sets and for interoperability.
 And once we are at it, why not have another implementation for sparse
 arrays, using a suitable data structure?


One issue with using multimethods is the resolution overhead. I don't think
the JIT can optimize this to the extent it can optimize a normal polymorphic
Java call.

So you might want to use a Java interface for this instead, and Clojure's
Java interop with macros to wrap a nice Clojury API around it.

A second problem is boxing of primitives, and a third is noncontiguous
storage. The Java for the nonsparse stuff should probably use and expose
Java arrays of primitives. If you can live without runtime polymorphism,
having only compile-time polymorphism, the polymorphism can move back to the
Clojure side but live in a macro; then a sugar-coated API call directly
translates at macroexpand time into manipulation of Java arrays in either
Java calls or a Clojure function that uses loop/recur with primitives and is
loaded with type hints for the array type used (likely double[]).

--~--~-~--~~~---~--~~
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Scientific computing

2009-10-29 Thread Rock


 I didn't address such issues because there is no point in discussing  
 them before making the fundamental decision whether to use an abstract  
 or an exposed data type for array data. That choice dictates the  
 priorities for everything that follows.

Yes, I agree.

  Suppose we're dealing with rank n objects. Do you think it
  would be an easy task to figure all that out dealing with nested
  vectors?

 If you can assume the array is well-formed, it is rather easy.  
 Otherwise it isn't.

Can you give an example in code? I really would like to see it.

  And by the way, How would you go about implementing in detail
  a check to see if a nested vector is actually an authentic
  multidimensional array or not?

 That's a rather simple recursive function. The only problem is its run-
 time cost.

Please provide an example. In the meantime, I'll give it a shot
myself.

  I honestly prefer your first case scenario. Seems much more efficient,
  less resource-consuming, and just straightforward. But I really would
  like to know what your preference is. If you had to choose, which way
  would you go?

 If I were to design an array interface for Clojure, it would consist  
 of multimethods implemented for both an efficient array data structure  
 for internal use and for nested vectors. The implementation for the  
 latter would convert the nested vectors to the efficient structure and  
 do all the necessary checks. It would be there for convenience and  
 clarity in user code. Ideally I would then implement the same  
 interface for Colt arrays and netCDF arrays as well, both for having  
 an effcient structure for large data sets and for interoperability.  
 And once we are at it, why not have another implementation for sparse  
 arrays, using a suitable data structure?

Yes, indeed I like your design. Makes sense.

 Unfortunately, a good design and implementation represents a lot of  
 work. At the moment I am not sure if we have the critical mass of  
 people interested in working on this to get the job done in a  
 reasonable amount of time.

Well. I'm willing to contribute. We can get this started. It won't
hurt to give it a try. You never know ...
I feel Clojure can and actually should become a language well-suited
for scientific computation. It may not have all the prerequisites now,
but, hey, this is Lisp, and it can be done, always! :)

 On 28 Oct 2009, at 23:07, harrison clarke wrote:

  maps could also be an option. you can use vectors of ints as keys.  
  (and you can stick dimensions and such in there with keywords)

  i'm not sure how that compares to nested vectors for perforance. you  
  have the overhead of the hash function, but you don't have any  
  nesting.
  it's also pretty handy if you want to represent a sparse matrix.

 Maps could be a good choice for sparse arrays. For dense ones, they  
 would represent an enormous waste of memory, and probably time as well.

Well sparse arrays should always be treated more specifically I
suppose (no use wasting all those resources!), One thing at a time :)

Rock
--~--~-~--~~~---~--~~
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Scriptjure, Parenscript - why not generate code in other languages

2009-10-29 Thread Chouser

On Thu, Oct 29, 2009 at 8:15 AM, Miron Brezuleanu mbr...@gmail.com wrote:

 Hi,

 earlier today I was wondering about the best way to write some
 Transact-SQL code. I normally write code in C#, Python and lately
 Clojure. Even though TSQL is a decent procedural extension to SQL, it
 still feels very cumbersome to the languages I use daily. Having done
 some C# code generation lately (using ScriptTemplate), I was thinking
 about doing the same thing for SQL.

 At which point I remembered Scriptjure (and Parenscript) and thought
 about writing something similar for TSQL.

Are you thinking of something like this?

http://www.gitorious.org/clojureql/

--Chouser

--~--~-~--~~~---~--~~
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Constructing Java Interop calls

2009-10-29 Thread Tiago Antão

On Thu, Oct 29, 2009 at 2:15 AM, Alex Osborne a...@meshy.org wrote:

 Using eval (which will also work for dynamically calling Clojure functions):

   (let [obj some string
         fname .substring]
     (eval (list (symbol fname) obj 2)))

Thanks a lot. I was trying to avoid reflection (ie, looking for a
clojure idiom), especially to get an understanding on what are clojure
limitations.

The eval form still shows some problems, if I do this preparation:

(import javax.swing.JFileChooser)
(def jfc (new JFileChooser))

And then do:

user= (.setFileSelectionMode jfc 1)
nil

All good here, but, if I do the eval variation,
user= (eval (list (symbol .setFileSelectionMode) jfc 1))
I get:
#CompilerException java.lang.RuntimeException: Can't embed object in
code, maybe print-dup not defined


In theory it should work? What basic mistake am I doing here? BTW:

user= (println (list (symbol .setFileSelectionMode) jfc 1))
(.setFileSelectionMode #JFileChooser
javax.swing.JFileChooser[,0,0,0x0,invalid,layout=ja...] 1)

So the list for the eval looks good...

Many thanks,
Tiago

-- 
The hottest places in hell are reserved for those who, in times of
moral crisis, maintain a neutrality. - Dante

--~--~-~--~~~---~--~~
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Scientific computing

2009-10-29 Thread Konrad Hinsen

On 29.10.2009, at 14:01, Rock wrote:

 Suppose we're dealing with rank n objects. Do you think it
 would be an easy task to figure all that out dealing with nested
 vectors?

 If you can assume the array is well-formed, it is rather easy.
 Otherwise it isn't.

 Can you give an example in code? I really would like to see it.

(defn rank
   [item]
   (if (vector? item)
   (inc (rank (nth item 0)))
   0))

(rank 0)
(rank [1 2 3])
(rank [[1 2] [3 4]])

(defn shape
   [item]
   (if (vector? item)
 (let [element (nth item 0)
  n   (count item)]
   (cons n (shape element)))
 (list)))

(shape 0)
(shape [1 2 3])
(shape [[1 2] [3 4]])

 And by the way, How would you go about implementing in detail
 a check to see if a nested vector is actually an authentic
 multidimensional array or not?

 That's a rather simple recursive function. The only problem is its  
 run-
 time cost.

 Please provide an example. In the meantime, I'll give it a shot
 myself.

(defn check-multiarray
   [item]
   (and (vector? item)
(apply = (map shape item

; true
(check-multiarray [1 2 3])
(check-multiarray [[1 2] [3 4]])
; false
(check-multiarray 1)
(check-multiarray [[1 2] 3])
(check-multiarray [[1 2] [3]])

 I feel Clojure can and actually should become a language well-suited
 for scientific computation. It may not have all the prerequisites now,
 but, hey, this is Lisp, and it can be done, always! :)

I completely agree. I don't think Clojure will become a mainstream  
language for science any time soon, for that it is too exotic for a  
community that still sticks to Fortran. But it can find its niche, and  
perhaps not even a small one.

Konrad.


--~--~-~--~~~---~--~~
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Scientific computing

2009-10-29 Thread Konrad Hinsen

On 29.10.2009, at 13:48, John Harrop wrote:

 One issue with using multimethods is the resolution overhead. I  
 don't think the JIT can optimize this to the extent it can optimize  
 a normal polymorphic Java call.

That's worth exploring - while keeping in mind that the JIT improves  
all the time.

 So you might want to use a Java interface for this instead, and  
 Clojure's Java interop with macros to wrap a nice Clojury API around  
 it.

Maybe. For now I would consider this premature optimization. The big  
negative impact of using a Java interface is the impossibility to work  
with existing Java classes, such as Colt arrays. They would have to be  
wrapped in another object layer just for implementing the interface.

 A second problem is boxing of primitives, and a third is  
 noncontiguous storage. The Java for the nonsparse stuff should  
 probably use and expose Java arrays of primitives.

I can see a role both for an implementation based on Clojure vectors  
and for one using Java arrays. With a multimethod interface, both can  
coexist.

 If you can live without runtime polymorphism, having only compile- 
 time polymorphism, the polymorphism can move back to the Clojure  
 side but live in a macro;

Indeed. One could implement a polymorphic interface in one namespace  
and a compile-time polymorphic interface in another namespace, making  
it possible to switch easily between the two.

What is nice about Clojure is that many of these implementation  
decisions can be changed later on without modifying the client-side API.

Konrad.


--~--~-~--~~~---~--~~
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Clojure in a big Java solution

2009-10-29 Thread Shantanu Kumar


On Oct 29, 4:50 pm, vanallan vanal...@gmail.com wrote:
 Ok thanks for the answer :)

 I have now began to implement the Java parts. The data that is going
 to be processed in Clojure is mapped to clojure structs, but I now
 have another question. How should I update the values in the structs?
 Since functions are going to run in parallel and a function may need
 the updated value from another function I though that I should put the
 struct members that is going to be updated in refs or maybe atoms. Is
 this a good way or how should I manage the updated values in structs?

This, I think depends on your use case. If the parallel functions are
in Clojure, then atoms and refs may help. If some functions are in
Java and some in Clojure, and both sets of functions work in parallel
to update commonly stored data then you should stick to concurrent
Java collections (java.util.concurrent.*). But again, this depends on
the use case.

I think as long as the Java consumer class is ready to accept
java.util.Map you can simply return a modified struct and it will be
understood. But there is a pitfall to watch for -- the struct you
return from Clojure will be immutable, so none of put(), remove() etc
will work in Java then. When you are integrating Java with Clojure you
should remember this aspect, and probably you will benefit
tremendously if you code the Java part in a functional style, for
example:

1. Go Immutable -- use the final keyword a lot (ensures at least
immutable references)

2. Go Functional -- pass objects and anonymous functions (Strategy and
Mediator patterns may help)

3. Don't presume data structures to be mutable


HTH

Regards,
Shantanu
--~--~-~--~~~---~--~~
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Clojure in a big Java solution

2009-10-29 Thread Shantanu Kumar

 2. Go Functional -- pass objects and anonymous functions (Strategy and
 Mediator patterns may help)

I meant anonymous objects that implement some interface or extend a
class (Template pattern), not anonymous functions really. :-)

Regards,
Shantanu
--~--~-~--~~~---~--~~
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: pointfree library

2009-10-29 Thread harrison clarke

there are a few on git already:
http://github.com/hclarke/pointfree-clojure/tree/master/src/

i'll add more soon.
also, this could be worth looking at: http://www.haskell.org/arrows/
there will be some differences, but it's pretty much the same idea.

On Oct 28, 9:09 pm, Paul Barry pauljbar...@gmail.com wrote:
 Would love to see some examples usages of these

 On Sun, Oct 25, 2009 at 4:16 PM, harrison clarke notall...@gmail.comwrote:





  so i was using haskell, and the pointfree stuff is fun, so naturally i
  had to implement some of it in clojure.

  this is what i have so far. library and examples within:
 http://github.com/hclarke/pointfree-clojure

  it has , , ***, +++, |||, and others
  they take functions as arguments and return functions

  for those that don't know:
   composes functions in reverse order. it basically pipes them together
  left to right
   maps functions over a single value (haskell's takes two functions,
  this takes any number)
  *** maps functions over a sequence (as above, this takes any number of
  functions)
  +++ takes a choice ([bool, x]), and applies f1 if f2 if false ([bool,
  (f x)])
  ||| same as above, but just returns the (f x) part. drops the bool

  there's also:
  fst applies function to the first element. same as (*** f id id id...)
  snd applies function to the second element. same as (*** id f id id
  id...)
  ttt same as (+++ f id). same as haskell's left
  fff same as (+++ id f). same as haskell's right
  III takes [i x] and applies the ith function (starting from 0),
  returning [i (f x)]
  iii same as above, but drops the bool

  curry makes a function keep returning a function until you pass it
  enough arguments to evaluate (default is 2 args)
  see curry example on github for how it works

  at this point, names, and pretty much everything, are likely to
  change.
  thoughts, questions, suggestions, etc.?
--~--~-~--~~~---~--~~
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Is it time to move the mailing list off of Google Groups?

2009-10-29 Thread Garth Sheldon-Coulson
+1

On Wed, Oct 28, 2009 at 4:47 PM, Michael Wood esiot...@gmail.com wrote:


 2009/10/28 Kyle Schaffrick k...@raidi.us:
 
  Don't forget those of us who dislike web-forum software and prefer to
  interact with the group via email: I very seldom use the GG site itself.
  I find threaded email is a *very* good way of following discussions. I
  can have a I didn't know that moment delivered to my inbox every day,
  without having to visit a website and contend with the interface of
  yet-another-web-forum.

 +1

 --
 Michael Wood esiot...@gmail.com

 


--~--~-~--~~~---~--~~
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Timing, JIT, Heisen-code

2009-10-29 Thread Matt Brown

Hello all.

Thanks everyone for the comments. This was the kind of info I was
looking for.

I'll play around with this some more when I get a chance. (Too many
grants due / conferences in October.)

cheers
Matt

On Oct 1, 10:08 am, Jonathan Smith jonathansmith...@gmail.com wrote:
 On Sep 30, 1:18 pm, Matt Brown mrbrow...@gmail.com wrote:

  Hi.

  Thanks all, for your comments.

   You need to use a bigger number than 1000 for these results to be 
   meaningful.

  Out of curiousity, why is this?
  Does the JIT do something different after 1000 iterations?
  Or is the concern simply that the variance of the mean estimate is too
  high with 1000 vs. 10^6 iterations (due to OS background processes,
  etc.)? I originally reported ranges for average execution times (over
  about a dozen runs) to address this particular concern.

 Generally you get some error introduced by the GC and OS background
 processes.

 Doing it over 12 processes is similar to doing it like 10^5, but that
 still would run for less than a second total, and is still subject to
 interpretation.

 But anyway, doing it for different periods of time also lets you see
 that there is something else going on, and gets you more meaningful
 questions. Why do i do this a 10million times and get the same (close
 enough) result as doing it 1000 times?.



   FWIW, I've run both on my Toshiba dual core laptop with ubuntu, and
   they return approximately the same values.

   (and there is some JIT trickery going on, as I got:
   user= (myavgtime (+ 1 2 3) 1000 mytime1)
   (myavgtime (+ 1 2 3) 1000 mytime1)
   0.002981158000306
   user= (myavgtime (+ 1 2 3) 10 mytime1)
   (myavgtime (+ 1 2 3) 10 mytime1)
   0.001742611283846
   user= (myavgtime (+ 1 2 3) 1e8 mytime1)
   (myavgtime (+ 1 2 3) 1e8 mytime1)
   0.0015456479935035251

   Although the last one ran for quite a bit longer than ,0015)

  Thanks for posting this!
  One explanation for a decreasing mean execution time with an
  increasing number of iterations is this: The first iteration's
  execution time is relatively large because it's not JIT optimized
  (0.018 msec on my system). Increasing the number of iterations means
  you're averaging a larger number of small, JIT optimized individual
  execution times (reported as 0.000-0.001 msec on my system) into that
  initial larger value. The mean therefore becomes asymptotically
  smaller with larger numbers of iterations. Is there something else
  going on here as well though (eg: JIT stuff)?

 Most likely it is because the JIT compiler has completely eliminated
 the operation.
 You are measuring the time elapsed between system/nano calls.

 System/nano has some granularity, so it could be that doing a print
 forces it to always be worth at least 1 tick of system/nano, where-as
 not doing a print it can somehow call multiple calls to measure all
 within the same tick of system/nano?

 Meaning system/nano incrementing counter isn't necessarily synchronous
 with calls to measure? But doing the print forces it to do count on at
 least 1 seperate tick per measurement.

  Using a million iterations, I got:
  (myavgtime (+ 1 2 3) 1e6 mytime1) - 0.00027 - 0.00029 msec (over a
  dozen repeats)
  (myavgtime (+ 1 2 3) 1e6 mytime2) - 0.00068 msec (single run,
  printing 10^6 lines takes a long time, I was too impatient for
  repeats)

  So, using mytime1 is still just over 2x faster than mytime2 with 10^6
  iterations.

  cheers
  Matt

 Perhaps you could retry with some other side-effecting function, like
 making a java array of 1 boolean and flipping the boolean back and
 forth? (and also something with a longer timeframe)

 In cases of measurement, I think it makes more sense to time the loop
 itself than to time the individual calls and sum them.

 Looping overhead is small, and with a non-trivial operation, it should
 be outweighed by whatever else is going on.



   On Sep 29, 12:08 pm, Matt mrbrow...@gmail.com wrote:

Hi. I'm getting a three-fold difference in timing results when I add a
seemingly trivial println to observe what's going on. Consider:

(defmacro mytime1
  Returns execution time of expr in millisecs
  [expr]
  `(let [time0# (. System nanoTime)
         exprval# ~expr
         time1# (/ (double (- (. System nanoTime) time0#)) 100.0)]
    time1#))

(defmacro mytime2
  Prints out execution time of expr in millisecs and returns it
  [expr]
  `(let [time0# (. System nanoTime)
         exprval# ~expr
         time1# (/ (double (- (. System nanoTime) time0#)) 100.0)]
    (println elapsed time (msec):  time1#)
    time1#))

Timing macros mytime1 and mytime2 differ only in that mytime2 has the
println expression in the second last line. The println in mytime2
comes after time1# is assigned, so the println expression's execution
time shouldn't be counted. I confirmed this assumption by testing.
(mytime1 (+ 1 2 3)) and (mytime2 (+ 1 

Re: pointfree library

2009-10-29 Thread Sean Devlin

I'm a huge fan of point free code.  Some of you functions already
exist in Clojure under different names, and I have a few questions.

 is the same as (reverse (comp x)) right?

 is called juxt
*** - I believe this (map (juxt f-coll) coll)

curry is called partial

Still, good to see the comparison.

On Oct 29, 10:20 am, harrison clarke notall...@gmail.com wrote:
 there are a few on git 
 already:http://github.com/hclarke/pointfree-clojure/tree/master/src/

 i'll add more soon.
 also, this could be worth looking at:http://www.haskell.org/arrows/
 there will be some differences, but it's pretty much the same idea.

 On Oct 28, 9:09 pm, Paul Barry pauljbar...@gmail.com wrote:

  Would love to see some examples usages of these

  On Sun, Oct 25, 2009 at 4:16 PM, harrison clarke notall...@gmail.comwrote:

   so i was using haskell, and the pointfree stuff is fun, so naturally i
   had to implement some of it in clojure.

   this is what i have so far. library and examples within:
  http://github.com/hclarke/pointfree-clojure

   it has , , ***, +++, |||, and others
   they take functions as arguments and return functions

   for those that don't know:
composes functions in reverse order. it basically pipes them together
   left to right
maps functions over a single value (haskell's takes two functions,
   this takes any number)
   *** maps functions over a sequence (as above, this takes any number of
   functions)
   +++ takes a choice ([bool, x]), and applies f1 if f2 if false ([bool,
   (f x)])
   ||| same as above, but just returns the (f x) part. drops the bool

   there's also:
   fst applies function to the first element. same as (*** f id id id...)
   snd applies function to the second element. same as (*** id f id id
   id...)
   ttt same as (+++ f id). same as haskell's left
   fff same as (+++ id f). same as haskell's right
   III takes [i x] and applies the ith function (starting from 0),
   returning [i (f x)]
   iii same as above, but drops the bool

   curry makes a function keep returning a function until you pass it
   enough arguments to evaluate (default is 2 args)
   see curry example on github for how it works

   at this point, names, and pretty much everything, are likely to
   change.
   thoughts, questions, suggestions, etc.?
--~--~-~--~~~---~--~~
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Scriptjure, Parenscript - why not generate code in other languages

2009-10-29 Thread Miron Brezuleanu

Hello,

On Thu, Oct 29, 2009 at 3:06 PM, Chouser chou...@gmail.com wrote:
 earlier today I was wondering about the best way to write some
 Transact-SQL code. I normally write code in C#, Python and lately
 Clojure. Even though TSQL is a decent procedural extension to SQL, it
 still feels very cumbersome to the languages I use daily. Having done
 some C# code generation lately (using ScriptTemplate), I was thinking
 about doing the same thing for SQL.

 At which point I remembered Scriptjure (and Parenscript) and thought
 about writing something similar for TSQL.

 Are you thinking of something like this?

        http://www.gitorious.org/clojureql/

Thanks! clojureql seems to be very close to what I need.

-- 
Miron Brezuleanu

--~--~-~--~~~---~--~~
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: pointfree library

2009-10-29 Thread harrison clarke

it does look like  is pretty much the same as juxt.

partial isn't the same as curry, though. (curry uses thunk, which is
the same as partial, but can take a function and no args)
curry waits for a specific number of args before it evals. so if you
keep evaluating a curried fn with 0 args, you'll keep getting a
curried fn back.
(default is 2 args, but you can specify any number)

On Oct 29, 12:42 pm, Sean Devlin francoisdev...@gmail.com wrote:
 I'm a huge fan of point free code.  Some of you functions already
 exist in Clojure under different names, and I have a few questions.

  is the same as (reverse (comp x)) right?

  is called juxt
 *** - I believe this (map (juxt f-coll) coll)

 curry is called partial

 Still, good to see the comparison.

 On Oct 29, 10:20 am, harrison clarke notall...@gmail.com wrote:



  there are a few on git 
  already:http://github.com/hclarke/pointfree-clojure/tree/master/src/

  i'll add more soon.
  also, this could be worth looking at:http://www.haskell.org/arrows/
  there will be some differences, but it's pretty much the same idea.

  On Oct 28, 9:09 pm, Paul Barry pauljbar...@gmail.com wrote:

   Would love to see some examples usages of these

   On Sun, Oct 25, 2009 at 4:16 PM, harrison clarke 
   notall...@gmail.comwrote:

so i was using haskell, and the pointfree stuff is fun, so naturally i
had to implement some of it in clojure.

this is what i have so far. library and examples within:
   http://github.com/hclarke/pointfree-clojure

it has , , ***, +++, |||, and others
they take functions as arguments and return functions

for those that don't know:
 composes functions in reverse order. it basically pipes them 
 together
left to right
 maps functions over a single value (haskell's takes two functions,
this takes any number)
*** maps functions over a sequence (as above, this takes any number of
functions)
+++ takes a choice ([bool, x]), and applies f1 if f2 if false ([bool,
(f x)])
||| same as above, but just returns the (f x) part. drops the bool

there's also:
fst applies function to the first element. same as (*** f id id id...)
snd applies function to the second element. same as (*** id f id id
id...)
ttt same as (+++ f id). same as haskell's left
fff same as (+++ id f). same as haskell's right
III takes [i x] and applies the ith function (starting from 0),
returning [i (f x)]
iii same as above, but drops the bool

curry makes a function keep returning a function until you pass it
enough arguments to evaluate (default is 2 args)
see curry example on github for how it works

at this point, names, and pretty much everything, are likely to
change.
thoughts, questions, suggestions, etc.?
--~--~-~--~~~---~--~~
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Error messages

2009-10-29 Thread Gorsal

Often , i get error messages like
#CompilerException java.lang.IllegalStateException: Var
swank.core.connection/*current-connection* is unbound. (NO_SOURCE_FILE:
358)

My question is how do i know what the source file name is? Do i
somehow need to include it when compiling or what? If i know where the
error is, life would be much easier!
--~--~-~--~~~---~--~~
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Error messages

2009-10-29 Thread Sean Devlin

Where did you get this from?  Were you using SLIME at the time?

On Oct 29, 12:22 pm, Gorsal s...@tewebs.com wrote:
 Often , i get error messages like
 #CompilerException java.lang.IllegalStateException: Var
 swank.core.connection/*current-connection* is unbound. (NO_SOURCE_FILE:
 358)

 My question is how do i know what the source file name is? Do i
 somehow need to include it when compiling or what? If i know where the
 error is, life would be much easier!
--~--~-~--~~~---~--~~
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Error messages

2009-10-29 Thread Gorsal

Sorry. I was just compiling everything and changing some code so it
broke. Where it actually came from is probably irrelevant, i have
gotten the phrase 'NO_SOURCE_FILE' when compiling before.
--~--~-~--~~~---~--~~
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Error messages

2009-10-29 Thread Gorsal

Oh, my actual question was to ask why the general NO_SOURCE_FILE would
appear and how to fix it, the specific error message was just an
example.
--~--~-~--~~~---~--~~
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Error messages

2009-10-29 Thread Sean Devlin

In my experience, the NO_SOURCE_FILE shows up when I make a mistake at
the REPL/SLIME.  When I have a precompiled .JAR, then I get a
reference to a specific file w/ a mistake in it.

That's why I was asking about what environment you used.

On Oct 29, 1:30 pm, Gorsal s...@tewebs.com wrote:
 Oh, my actual question was to ask why the general NO_SOURCE_FILE would
 appear and how to fix it, the specific error message was just an
 example.
--~--~-~--~~~---~--~~
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Error messages

2009-10-29 Thread Gorsal

My environment is enclojure on netbeans. Ive compiled all of the code
for swank-clojure. However, when i call a function which produces a
certain error (in a new case, attempting to call some invalid java
method on a java object) i get the no source file thing. So im
guessing that somehow i have to tell clojure where my source files
are? Also,  (.printStackTrace *e) produces nil.
--~--~-~--~~~---~--~~
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Newcomer's question about Clojure's compatibility with common lisp

2009-10-29 Thread bal...@gmail.com

Hello,

First let me congratulate the clojure team on this wonderful
initiative: porting lisp to the jvm.

Next is my question: can I run common lisp programs on the jvm using
clojure? I was thinking specifically to Maxima - (the formal calculus
program)?

And finally another question: are there any ubuntu packages for
clojure available at this time?

Thanks in advance,

Julien.

--~--~-~--~~~---~--~~
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Scriptjure, Parenscript - why not generate code in other languages

2009-10-29 Thread Meikel Brandmeyer

Hi,

On Oct 29, 1:15 pm, Miron Brezuleanu mbr...@gmail.com wrote:

 The pros I see are the ability to construct the data structure using
 all the tools Clojure/Lisp offer in this area (quasiquotation and its
 many friends, for instance). The ability to output code that is pretty
 printed in a customized way is also a big plus (I care a great deal
 about the readability of the generated code). Also, the SQL flavor
 could be a pretty printing parameter - thus making it possible to
 write code that will run on many RDBMSs - but I'm not very hopeful
 about this, as differences between SQL dialects often go beyond
 syntax.

 Cons: I'm afraid of getting the SQL generating syntax wrong and making
 the data structures used for generation ugly. But I guess that can be
 fixed by iterating a little. :-)

ClojureQL[1] does that to some extent. Currently MySQL and Derby are
supported as backends, Postgres to some extent (so it has issues,
IIRC). The generation part consists of multimethods compiling the
defined queries into JDBC PreparedStatements. Up to now we managed to
hide the backend as much as possible, but the feature set of ClojureQL
is still limited. So my suspicion is that the backend will leak
through eventually... But we'll see.

Nice effect: ClojureQL allows FULL JOINs with a Derby backend. Derby
does not support FULL JOIN.

Sincerely
Meikel

[1]: http://gitorious.org/clojureql

--~--~-~--~~~---~--~~
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Clojure in a big Java solution

2009-10-29 Thread vanallan

All the parallel work will be done in Clojure, so I think I will go
with the refs and atom path. When the processing in Clojure is done
the data is passed as XML to another system so Java doesn't need to
change it anymore, so the immutability when it's done is not a
problem.

Thank you very much for your answer, it really helped :)



On Oct 29, 2:43 pm, Shantanu Kumar kumar.shant...@gmail.com wrote:
 On Oct 29, 4:50 pm, vanallan vanal...@gmail.com wrote:

  Ok thanks for the answer :)

  I have now began to implement theJavaparts. The data that is going
  to be processed inClojureis mapped toclojurestructs, but I now
  have another question. How should I update the values in the structs?
  Since functions are going to run in parallel and a function may need
  the updated value from another function I though that I should put the
  struct members that is going to be updated in refs or maybe atoms. Is
  this a good way or how should I manage the updated values in structs?

 This, I think depends on your use case. If the parallel functions are
 inClojure, then atoms and refs may help. If some functions are inJavaand some 
 inClojure, and both sets of functions work in parallel
 to update commonly stored data then you should stick to 
 concurrentJavacollections (java.util.concurrent.*). But again, this depends on
 the use case.

 I think as long as theJavaconsumer class is ready to acceptjava.util.Map you 
 can simply return a modified struct and it will be
 understood. But there is a pitfall to watch for -- the struct you
 return fromClojurewill be immutable, so none of put(), remove() etc
 will work inJavathen. When you are integratingJavawithClojureyou
 should remember this aspect, and probably you will benefit
 tremendously if you code theJavapart in a functional style, for
 example:

 1. Go Immutable -- use the final keyword a lot (ensures at least
 immutable references)

 2. Go Functional -- pass objects and anonymous functions (Strategy and
 Mediator patterns may help)

 3. Don't presume data structures to be mutable

 HTH

 Regards,
 Shantanu

--~--~-~--~~~---~--~~
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Observations from a real-world Clojure project

2009-10-29 Thread Jamie

First, thank you Rich  Co for doing Clojure.

We've been using Clojure for a real-world project, and I thought I'd
share some observations.

The project does some large-scale (but not really huge) data
analysis.  Example: ~10M records are processed and transformed,
various computations occur, and ~100K records are spit out.  Lots of
statistics.  One type of run takes 12 hours on an 8GB, 4-core Linux
box.  A few thousand lines of our Clojure code in total.

My background: I'm an old (?) Lisp hacker.  I've used Symbolics, ACL,
CMUCL, schemes (including JScheme and SISC).  Also Java since its
early days.  And my share of C, C++, SQL, Perl, etc.

So here are some observations.  None are news flashes.

1. Clojure works.  We were obviously cautious about using a relatively
new system for real work.  We tried Clojure, and then we tried some
more.  Everything* just worked.  We took a snapshot at 1.1.0, and we
didn't update it.  [* The JVM does SEGV on us occasionally.  Internal
error, which we have not diagnosed.  Probably a GC issue.  Java
1.6.0_14 with HotSpot 14.0-b16 64-bit server.  But this problem is
another topic.]

2. Clojure-the-language is a good fit for real work.  The language has
a distinct DWIM feel, which I like.  Destructuring everywhere, auto-
gensym-ing, various syntactic sugar, and the advanced features (e.g.,
concurrency primitives with STM, tries) are all convenient, effective,
and useful.  Clojure is practical.

3. We dropped into Java once to implement an LRU cache to back custom
memoization.  We presumably could have implemented the cache in
Clojure, but Java seemed simpler.  Probably mostly due to our
inexperience with Clojure.  Clojure's Java interop is of course
excellent -- as claimed and widely reported.

4. Reminder: concurrent work on distinct datastructures uses memory
concurrently!  Obvious and obviously not specific to Clojure.  But
Clojure makes it so easy to do things in parallel that it's easy to
forget the implications.  We found ourselves having to do some
judicious doall's and such to avoid running out of memory in a
subsequent -- so to speak -- stage.  (Imagine a parallel aggregation
of a lot of data that results in a small object, which is then
subsequently used with different big data.  Might not be able to work
on the former and latter at the same time.)  So watch out when you
work on distinct data in stages in parallel on that 100-core Tilera
board.  Aside: We might like the option of selective non-laziness, but
we're not sure.  That's yet another topic.

5. The functionality of the docs hasn't kept up with Clojure.  We
often resorted to text searches of the various sources.  Need links
and see-also's.  Clojure has grown/matured so much that it needs a doc
system of some sort.

6. Debugging facilities also have not kept up with the state of
Clojure.  We use Slime and JDB and some contributed tools, but the
result isn't that convenient.  I miss the good Lisp debuggers, but I'm
old-fashioned I guess.  We need to re-survey what's available for
tracing, logging, restarts, etc.  A state-of-the-art tutorial would be
great.

7. We use Incanter (http://incanter.org/), which worked well for some
of the statistics we need.  BTW, for different work, we still use
Mathematica, but we haven't yet needed the slick-looking Clojuratica
(http://clojuratica.weebly.com/).  We probably will, and I'm eager to
use it.  For us, Clojure is becoming the application-level, all-
purpose glue.  We can't throw away Mathematica or Matlab or R, and we
don't need to.

That's it for now.  We'll look for ways we can contribute.

Thanks again for the excellent system.

--Jamie


--~--~-~--~~~---~--~~
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Constructing Java Interop calls

2009-10-29 Thread Meikel Brandmeyer

Hi,

On Oct 29, 2:07 pm, Tiago Antão tiagoan...@gmail.com wrote:

 The eval form still shows some problems, if I do this preparation:

 (import javax.swing.JFileChooser)
 (def jfc (new JFileChooser))

 And then do:

 user= (.setFileSelectionMode jfc 1)
 nil

 All good here, but, if I do the eval variation,
 user= (eval (list (symbol .setFileSelectionMode) jfc 1))

Another example which shows that eval is not worth the trouble. It is
better to use reflection. You cannot embed the JFileChooser as a
object into the code. You have to construct it in your eval. (eval `
(let [chooser# (JFileChooser.)] (~(symbol .setFileSelectionMode)
chooser# 1) chosser#)).

Hopes this helps.

Sincerely
Meikel

--~--~-~--~~~---~--~~
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Constructing Java Interop calls

2009-10-29 Thread Kevin Downey

user= ((eval `(fn [x#] (~(symbol .setFileSelectionMode) x# 1))) jfc)
nil
user=


On Thu, Oct 29, 2009 at 6:38 AM, Meikel Brandmeyer m...@kotka.de wrote:

 Hi,

 On Oct 29, 2:07 pm, Tiago Antão tiagoan...@gmail.com wrote:

 The eval form still shows some problems, if I do this preparation:

 (import javax.swing.JFileChooser)
 (def jfc (new JFileChooser))

 And then do:

 user= (.setFileSelectionMode jfc 1)
 nil

 All good here, but, if I do the eval variation,
 user= (eval (list (symbol .setFileSelectionMode) jfc 1))

 Another example which shows that eval is not worth the trouble. It is
 better to use reflection. You cannot embed the JFileChooser as a
 object into the code. You have to construct it in your eval. (eval `
 (let [chooser# (JFileChooser.)] (~(symbol .setFileSelectionMode)
 chooser# 1) chosser#)).

 Hopes this helps.

 Sincerely
 Meikel

 




-- 
And what is good, Phaedrus,
And what is not good—
Need we ask anyone to tell us these things?

--~--~-~--~~~---~--~~
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Generalizing - -

2009-10-29 Thread AndrewC.

Here's a macro that generalizes the two 'threading' macros - and -.

It works by using the idea of 'nesting marker' (from Oz) to specify
where the result of the previous form should be nested in the
subsequent form.

(defmacro -$
  Threads the expr through the forms. Inserts x into
  the first form at the position marked by the $ symbol.
  If the second form is not a list then it behaves as -.
  If there are more forms, inserts the first form into the second
  form at the position marked by the $ symbol, etc.
  ([x form] (if (seq? form)
  (let [split (split-with (partial (complement =) '$)
form)]
`(~@(first split) ~x ~@(rest (second split
  (list form x)))
  ([x form  more] `(-$ (-$ ~x ~form) ~...@more)))

If this is any use to anyone (esp. anyone who has a CA) then consider
it public domain.

Any improvements appreciated!


--~--~-~--~~~---~--~~
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Embedding Clojure in NetKernel

2009-10-29 Thread Tony Butterfield

Hi Roman,
sure. Tom sent me a link to this thread:

http://groups.google.com/group/clojure/browse_thread/thread/d98cedb860f16a34/

and also he sent me a tgz of his NetKernel module. I believe he has
licensed it to be freely available:

/**
 * CloNK4 Project : Clojure for NetKernel 4.
 * Copyright (C) 2008 by Tohono Consulting LLC. All rights reserverd.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 */

However I'll need him to confirm that before distributing it. Tom did
a great job of getting it working and solving a lot of the integration
issues. But things seem to have changed a bit in both the NetKernel
world and Clojure world since this code was written and it doesn't
work now. I'm working through it try
to get it on its feet again. Though my knowledge of Clojure is very
limited.

I'll post again on this group when I get something working or need to
ask for help.

Cheers,
Tony


On Oct 29, 9:58 am, Roman Roelofsen roman.roelof...@googlemail.com
wrote:
 Do you mind sharing the links? I am interested in it as well.

 Thanks!

 Roman

 2009/10/28 Tony Butterfield t...@1060.org:



  Tom Hicks has just pointed me to an old thread which answers
  questions about namespaces and isolation. Let me read and
  absorb all that work first - I suspect it answers a lot of my
  questions.

  Cheers, Tony

  On Oct 28, 11:43 am, Tony Butterfield t...@1060.org wrote:
  Hi Everybody

  this is my first post to this group so please tell me If I'm posting
  in the wrong place. I've been looking at integrating Clojure into
  NetKernel as language runtime library but I'm struggling a bit for a
  lack of examples. There are two things I'm trying to achieve:

  1) start and stop the Clojure runtime on demand. I need to do this so
  that new versions can be deployed whilst the server is live. Looking
  at the latest version (1.0.0) I see that I no longer need to call
  RT.init() and that startup is done statically. That's fine but is
  there a way to cleanly shutdown. I.e. stop threads, and enable a full
  garbage collection of the Clojure libraries?

  2) is there a way to ensure isolation of functionality in one runtime?
  I can see how I can use namespaces to avoid naming collisions but is
  it possible to enforce tighter security across namespaces or is there
  another technique? I'm quite new to closure so sorry if that is a
  stupid question - the trouble is I want to get it running inside
  NetKernel as good environment to explore the language - horse before
  the cart! When Clojure scripts execute inside NetKernel environment it
  is important that they act like pure functions with no side-effects on
  others.

  Thanks in advance for you advice,

  Tony
--~--~-~--~~~---~--~~
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



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 and don't use the bundled copy
to avoid the risk of any conflicts.

A side effect of this is that if the process doesn't have Clojure
loaded, and you connect multiple liverepls, then they all get isolated
copies of Clojure. It would probably be better if they could have a
shared instance of Clojure, but I'm not sure if that is possible...


 I think it would be great if JLine is integrated in live-repl.

Could be good, but it is also nice to be able to do C-M-x run-lisp,
and then use liverepl to connect Emacs's inferior-lisp mode to a
running process, and I don't know whether jline might interfere with
that.


 * Why not use maven and clojure-maven-plugin?

I don't know anything about maven.

You could always make a symlink of clojure.jar from your preferred
Clojure install location?


I do plan to add a feature so that it loads all jars from a lib
directory, that way you'll be able to use, eg, clojure-contrib, even
if it isn't loaded by the process.

-- 
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Java 7, nio, and createFile

2009-10-29 Thread youngblood.carl

Works beautifully. Thank you sir.

On Oct 28, 10:40 pm, Alex Osborne a...@meshy.org wrote:
 youngblood.carl wrote:
  When I try and call createFile from clojure:
  (.createFile path)

  I get an exception that there is no field named createFile.

 If I remember correctly variable argument Java methods, which is what
 that ... syntax means:

    abstract Path createFile(FileAttribute?... attrs) {}

 are actually just syntactic sugar for an array argument:

    abstract Path createFile(FileAttribute?[] attrs) {}

 so try:

    (.createFile path (make-array FileAttribute 0))
--~--~-~--~~~---~--~~
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Newcomer's question about Clojure's compatibility with common lisp

2009-10-29 Thread Rayne

You can't use Clojure to run Common Lisp programs on the JVM. Clojure
is it's own Lisp, and has nothing to do with Common Lisp. There are
some implementations of Common Lisp on the JVM, the most popular of
which I believe is ABCL.

I believe there are some experimental Ubuntu packages available, but I
would highly recommend that you just pull it from the github
repository.

On Oct 29, 7:09 am, bal...@gmail.com bal...@gmail.com wrote:
 Hello,

 First let me congratulate the clojure team on this wonderful
 initiative: porting lisp to the jvm.

 Next is my question: can I run common lisp programs on the jvm using
 clojure? I was thinking specifically to Maxima - (the formal calculus
 program)?

 And finally another question: are there any ubuntu packages for
 clojure available at this time?

 Thanks in advance,

 Julien.
--~--~-~--~~~---~--~~
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Newcomer's question about Clojure's compatibility with common lisp

2009-10-29 Thread Daniel Simms

On Thu, Oct 29, 2009 at 4:34 PM, Rayne disciplera...@gmail.com wrote:
 but I would highly recommend that you just pull it from the github
 repository.

Especially if you're going to use clojure-contrib ...or is there some
release of contrib synch'd to clojure releases that I missed
somewhere?

--~--~-~--~~~---~--~~
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Newcomer's question about Clojure's compatibility with common lisp

2009-10-29 Thread Alex Osborne

Daniel Simms wrote:
 On Thu, Oct 29, 2009 at 4:34 PM, Rayne disciplera...@gmail.com wrote:
 but I would highly recommend that you just pull it from the github
 repository.
 
 Especially if you're going to use clojure-contrib ...or is there some
 release of contrib synch'd to clojure releases that I missed
 somewhere?

There's a 1.0 compatible branch on github.  You get it with:

git clone git://github.com/richhickey/clojure-contrib.git
cd clojure-contrib
git checkout origin/clojure-1.0-compatible

Or download a tarball from:

http://github.com/richhickey/clojure-contrib/archives/clojure-1.0-compatible

--~--~-~--~~~---~--~~
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: ANN: Clojure live-repl

2009-10-29 Thread Ngoc Dao

 I do plan to add a feature so that it loads all jars from a lib directory

This is a nice feature!

 I don't know anything about maven

I'm brand new to maven, but let me introduce some advantages if maven
were used. Take
http://github.com/ngocdaothanh/telchat-clojure
as an example:
* Run mvn compile and all needed .jar files are automatically
downloaded, then .java files are compiled
* Run mvn clojure:run to start, clojure-maven-plugin will
automatically load all dependency .jar files as specified in pom.xml
(this file is very short, have a look at it)
* To load all jars from a lib directory, you don't have to manually
download and copy .jar files, you only have add a dependency to
pom.xml.

The manually download .jar files job may become very hard and time
consuming if library A needs library B, C, D etc., you have to go
everywhere to collect all .jar files yourselve. To add a dependency,
in most cases all you have to do is go to mvnrepository.com and
search.

CPAN brings convention to Perl, RubyGem brings convention to Ruby.
This kind of convention can make Clojure move forward faster. Maven
can do it, as long as we community make a consensus to give it a
chance. The point of using Clojure instead of other Lisps is that you
can use too many existing Java things right away. Then why not use
Maven right away?


On Fri, Oct 30, 2009 at 7:37 AM, David Powell d...@djpowell.net wrote:


 * 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 and don't use the bundled copy
 to avoid the risk of any conflicts.

 A side effect of this is that if the process doesn't have Clojure
 loaded, and you connect multiple liverepls, then they all get isolated
 copies of Clojure. It would probably be better if they could have a
 shared instance of Clojure, but I'm not sure if that is possible...


 I think it would be great if JLine is integrated in live-repl.

 Could be good, but it is also nice to be able to do C-M-x run-lisp,
 and then use liverepl to connect Emacs's inferior-lisp mode to a
 running process, and I don't know whether jline might interfere with
 that.


 * Why not use maven and clojure-maven-plugin?

 I don't know anything about maven.

 You could always make a symlink of clojure.jar from your preferred
 Clojure install location?


 I do plan to add a feature so that it loads all jars from a lib
 directory, that way you'll be able to use, eg, clojure-contrib, even
 if it isn't loaded by the process.

 --
 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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---