Re: Handling of unsigned bytes

2011-02-11 Thread Andy Fingerhut
What can you not do with the signed byte type and arrays of bytes (Java byte[] and Clojure (byte-array ...))? I believe these are frequently used for Java I/O, and can be used for Clojure I/O as well. Andy On Feb 11, 2011, at 9:22 AM, timc wrote: How on earth is one supposed to do

Re: Anyone want to take a crack at making the fasta shootout program faster?

2011-02-11 Thread Andy Fingerhut
that question - Both the C++ program and the Clojure program use a much more efficient algorithm than the other programs. That may violate the rules. But what about that fasta Java 6 -server #3 program? On Feb 10, 1:02 pm, Andy Fingerhut andy.finger...@gmail.com wrote: It would be easier

Re: Handling of unsigned bytes

2011-02-12 Thread Andy Fingerhut
On Feb 12, 2011, at 6:53 AM, Aaron Cohen wrote: On Sat, Feb 12, 2011 at 8:28 AM, timc timgcl...@gmail.com wrote: Further investigation reveals that (def b (byte i)) is doing something equivalent to this internally: byte b = Byte.parseByte(String.format(%d,i)); which does indeed throw a

Re: Pimp my algorithm: finding repeating subsequences

2011-02-13 Thread Andy Fingerhut
On Feb 13, 2011, at 10:11 AM, Mark Fredrickson wrote: Hello friends, I am writing a program to generate directions for humans to read. The directions are composed of a collection with a series of steps, some of which may be duplicated: [:a :b :c :a :b :c] I would like to compress them by

Can gen-class create classes with native methods?

2011-02-14 Thread Andy Fingerhut
i.e. is there a way in a Clojure source file to generate a class like the one named GmpUtil in this Java program? http://shootout.alioth.debian.org/u32/program.php?test=pidigitslang=javaid=4 (class GmpUtil is near the end of the program -- here is a copy) class GmpUtil { static {

Re: binarytrees benchmark 1.3

2011-03-13 Thread Andy Fingerhut
I'm no expert on the new way of doing things in 1.3, but I found that if you remove the ^long type hint on the return value from item-check, it compiles without errors or warnings. Andy On Mar 13, 2011, at 10:36 AM, Nick Zbinden wrote: Hallo all, I have been looking at the binary-trees in

Re: binarytrees benchmark 1.3

2011-03-13 Thread Andy Fingerhut
Oh, one other thing, although it might actually be slower than 1.3's primitive goodness: If you want to keep the unchecked operations, and make them on 32-bit ints, I've been using macros like this so that the same file can compile with both 1.2 and 1.3: (defmacro my-unchecked-inc-int [ args]

Re: clojure not using CPU on binarytree benchmark

2011-03-14 Thread Andy Fingerhut
On a MacBook Pro with 2.4 GHz Intel Core 2 Duo and 3 GB of RAM (although the program only used about half a gig at most), that program finished in about 33 seconds, using 38.5 sec of user + system CPU time. The average CPU utilization was 126% (all of one CPU core, and 26% of another, on

Re: clojure not using CPU on binarytree benchmark

2011-03-15 Thread Andy Fingerhut
AM, Nick Zbinden wrote: Hi, I did not mention that earlier but the benchmark sais no change in heapsize. See here: http://shootout.alioth.debian.org/u32/performance.php?test=binarytrees Does Clojure just have a much smaller heapsize in the standart case? On Mar 15, 5:19 am, Andy

Re: clojure not using CPU on binarytree benchmark

2011-03-15 Thread Andy Fingerhut
on the shootout. On Mar 15, 7:06 pm, Andy Fingerhut andy.finger...@gmail.com wrote: Well, if the default max heap of your JVM is not enough to run the program successfully to completion, then I don't think that you will be very happy in getting the program to complete :-) Which JVM are you using

Re: http://build.clojure.org/releases - no alpha5 alpha6.. ?

2011-03-24 Thread Andy Fingerhut
I've been using a project.clj file like this in Leiningen to get 1.3 alpha1 through alpha6: (defproject clj-1.3.0-alpha5 1.0.0-SNAPSHOT :description FIXME: write :dependencies [[org.clojure/clojure 1.3.0-alpha5]]) Leiningen uses Maven under the hood, so if you have any Maven pom.xml file

Re: Java Interop - Generics - Hmmm...

2011-03-24 Thread Andy Fingerhut
I'm not an expert on this, but I believe that whenever you have generics in Java, they have no effect on the bytecode, e.g. a HashMapString,String has the same type in the bytecode as any other HashMap. The String,String part is only used in some checks made by the Java compiler when compiling

Re: http://build.clojure.org/releases - no alpha5 alpha6.. ?

2011-03-24 Thread Andy Fingerhut
There was a recent discussion on clojure-dev about this question. I don't understand the details myself, so I'll point you at the thread. The relevant part starts about 2/3 of the way through this 51-message thread, around March 19, between Sean Corfield and Stuart Sierra (sorry, I don't know

Leiningen capabilities (was Re: A newbie's summary - what worked, what didn't)

2011-03-28 Thread Andy Fingerhut
Changing subject line for this one. On Mar 28, 2011, at 5:38 PM, Mike Meyer wrote: Consider this a features request for cake/leiningen: 1) A task to search clojars. 2) A task take a name from #1 and add the appropriate data to project.clj. 3) Extend the deps task to install libraries

Re: ANN: Clojure Atlas (preview!)

2011-04-19 Thread Andy Fingerhut
I'm signed up for future notices. Think of it like a book about Clojure and some of its libraries on a web site, except it is more index than prose. People seem to give books a chance quite often, if they are informative enough. (Chas, feel free to use an analogy like that on the web site.

Re: Clojure performance optimization

2011-04-20 Thread Andy Fingerhut
There is a significant time required to run Hello, world on a JVM, significantly more so than the corresponding C program on the same machine, due to all kinds of initialization to start up the JVM, even if the compile time is negligible. There is additional initialization time when you start

Re: Eval destroys equality

2011-05-06 Thread Andy Fingerhut
Caveat: The following fact may already be well known to those discussing this issue, and I may not be clear on the goal of this effort. If the goal is to have functions compare as equal whenever they are equivalent in some sense, then that is an undecidable problem, even if the two functions

Re: Efficient moving average

2011-05-09 Thread Andy Fingerhut
of Clojure code for readability or maintainability, but for squeezing run time out of the inner loop. Andy Fingerhut (ns movavg (:gen-class)) (set! *warn-on-reflection* true) (defn sliding-window-moving-average [window lst] (let [w (int window) w-1 (int (dec w))] (loop [rolling-sum

Re: Much longer build time for Clojure on HDD vs. SSD (4 min vs 30s)

2012-07-16 Thread Andy Fingerhut
There are links to older discussions on this topic in the description of ticket CLJ-703: http://dev.clojure.org/jira/browse/CLJ-703 Also proposed patches to Clojure, although I don't know whether some of those may lead to incorrect behavior. Andy On Jul 16, 2012, at 12:48 PM, Raju Bitter

Re: Immutability rules when it comes to Ref type

2012-08-10 Thread Andy Fingerhut
Hussein: If you ignore the ref for the moment, making any change to a map, or a map nested inside a map however many levels deep you wish, does not mutate the original map. Instead it creates a brand new map with the new set of keys and values. It is as if the original was copied, and the

Re: recursion question

2012-08-14 Thread Andy Fingerhut
An additional step on top of Raoul's: Take the first #, subtract it from the goal, recursively ask if the remaining #s can sum to the now-lesser goal. If so, return yes, or the set of numbers that worked (which should include whatever was returned from the recursive call, plus the first #)

Re: What is the meaning of :while in a for ?

2012-08-23 Thread Andy Fingerhut
I've added some examples of :when and :while, including those given by Herwig and Tassilo in this thread, at ClojureDocs: http://clojuredocs.org/clojure_core/clojure.core/for Note: Anyone with a free account can add/edit examples on that site. Andy On Aug 21, 2012, at 8:34 AM,

Re: A Performance Comparison of SBCL Clojure

2012-08-28 Thread Andy Fingerhut
I've written several of the Clojure programs on the site. I'm not omniscient when it comes to writing efficient Clojure code, but I know a few of the techniques. Several, if not most, of the Clojure solutions already take advantage of mutable data structures, for example. There are some

Re: Deprecation of Swank Clojure, long live nrepl.el

2012-08-28 Thread Andy Fingerhut
The issue with an exception when trying to find the doc of a namespace is a known issue, and should be fixed in Clojure 1.5 when it is released: http://dev.clojure.org/jira/browse/CLJ-902 You could try out clojure-1.5.0-alpha4 to see if it fixes the problem for you, if that happens to be

Re: assoc with uneven arguments

2012-08-29 Thread Andy Fingerhut
On Aug 29, 2012, at 12:17 PM, Chas Emerick wrote: On Aug 29, 2012, at 2:20 PM, Ambrose Bonnaire-Sergeant wrote: I think assoc should throw an error when applied with uneven arguments. Currently, the missing value is just replaced with nil. (assoc {} :a 1 :b) ;= {:a 1, :b nil}

Re: Question about sets

2012-09-04 Thread Andy Fingerhut
I have created a dev page for this issue. It isn't a JIRA ticket because it isn't clear to me yet exactly what the changes should be. http://dev.clojure.org/display/design/Allow+duplicate+map+keys+and+set+elements A couple of questions there for people that dislike the current behavior. You

Re: Question about sets

2012-09-04 Thread Andy Fingerhut
think anyone is against consistency... Jim ps: IMO sets should always remove duplicates quietly...that is the whole point of using them programmatically! On 04/09/12 17:30, Andy Fingerhut wrote: I have created a dev page for this issue. It isn't a JIRA ticket because it isn't clear

Re: Question about sets

2012-09-04 Thread Andy Fingerhut
On Sep 4, 2012, at 4:53 PM, Jim - FooBar(); wrote: On 04/09/12 21:02, Andy Fingerhut wrote: Stuart Halloway mentioned the idea of having two kinds of set/map constructor functions, one kind which quietly eliminates duplicates, another which throws an exception on duplicates

Re: Question about sets

2012-09-05 Thread Andy Fingerhut
sure this is on the wiki. Stu On Tue, Sep 4, 2012 at 9:30 AM, Andy Fingerhut andy.finger...@gmail.com wrote: I'm just trying to get the argument for change as clearly as possible. The major bullet points: 1. It's a bug that should be fixed. The change to throw-on-duplicate behavior

Re: A Performance Comparison of SBCL Clojure

2012-09-07 Thread Andy Fingerhut
in C? Andy On Aug 28, 2012, at 7:02 AM, Ben Mabey wrote: Thanks Andy for the insightful report! I knew you and others have worked hard on the benchmarks so this kind of analysis is very helpful. Thanks for all your work on them, Ben On 8/28/12 12:07 AM, Andy Fingerhut wrote: I've

Re: Question about sets

2012-09-08 Thread Andy Fingerhut
The new ticket CLJ-1065 has a patch that I think implements the desired behavior on the dev wiki page. i.e. set/map literals with duplicates are invalid (status quo) All constructor functions for sets and maps allow duplicates, and for maps, always take the value associated with the last

Re: Question about sets

2012-09-09 Thread Andy Fingerhut
I think I may have figured it out. New patch attached to ticket CLJ-1065 that should eliminate run-time checks for duplicate map keys, for those maps whose keys are all compile-time constants. Andy On Sep 8, 2012, at 4:38 PM, Andy Fingerhut wrote: Rich: I'm not sure what you mean

Re: ClojureDocs and Clojure 1.4

2012-09-11 Thread Andy Fingerhut
Except for the fact that github is down right now, you can get the source code for ClojureDocs linked to from the home page (links near the bottom). I haven't heard anything definitive from the creators of ClojureDocs, but I would guess they are busy with other things, and adding Clojure 1.4 to

Re: Question about sets

2012-09-11 Thread Andy Fingerhut
are compile-time detectable unique constants I'd like to see all three recommendations go into a release as a set. On Sep 8, 2012, at 2:22 AM, Andy Fingerhut wrote: The new ticket CLJ-1065 has a patch that I think implements the desired behavior on the dev wiki page. i.e. set/map

Re: ClojureDocs and Clojure 1.4

2012-09-12 Thread Andy Fingerhut
Your offers of help are certainly welcome, but I think the kinds of changes desired require the help of the ClojureDocs site creators to make. That is, they do, unless you want to take a copy of their code from github and create another site with a different name running the same code, then

Re: Using println inside a for print out some nil

2012-09-16 Thread Andy Fingerhut
println is a function that has the side effect of printing a string to the output, but it also has a return value of nil. When working at the REPL, these can sometimes be mingled together due to the order of evaluation. If you want to do something like 'for' but only for the purposes of side

Re: Evolving the Clojure contribution process and goals

2012-09-18 Thread Andy Fingerhut
On Tue, Sep 18, 2012 at 9:01 PM, Paul deGrandis paul.degran...@gmail.comwrote: 1.) Clojure.org should have a better host of documentation, especially for newcomers. We saw from the Clojure Survey, as well as threads here on the mailing list, that documentation is still something on which we

Re: Evolving the Clojure contribution process and goals

2012-09-19 Thread Andy Fingerhut
On Sep 19, 2012, at 12:11 AM, kovas boguta wrote: On Wed, Sep 19, 2012 at 1:12 AM, Andy Fingerhut andy.finger...@gmail.com wrote: On Tue, Sep 18, 2012 at 9:01 PM, Paul deGrandis paul.degran...@gmail.com wrote: 1.) Clojure.org should have a better host of documentation, especially

Re: ref to array suddenly changes type

2012-09-20 Thread Andy Fingerhut
Piotr: The most direct answer to your specific question is that aset-int modifies the array, and returns the value 9. The return value 9 is what the ref r is being set to after the (dosync (alter ...)) call. However, there is a bigger issue here. Even if you replace aset-int with a

Re: Which power function is right for Clojure?

2012-10-01 Thread Andy Fingerhut
It depends. Are you trying to optimize for speed? Teaching a particular style of programming? Code size? Range of input values handled correctly? Time to write it? Something else? Andy On Oct 1, 2012, at 4:45 PM, Grant Rettke wrote: (ns power.examples) (defn non-acc-pow [base exp]

Re: performance in versions = 1.4.0

2012-10-02 Thread Andy Fingerhut
I'm not aware of what changes made in 1.4 could cause this performance degradation. Out of curiosity, are you willing to share your code for performance profiling of future Clojure versions? i.e. is it open source already and so that wouldn't be a problem, or is it closed source? Have you

Re: interleave

2012-10-03 Thread Andy Fingerhut
I don't know the reason for the current implementation rather than your suggested one, but at least on the comment about 0 or 1 arguments has a ticket for it: http://dev.clojure.org/jira/browse/CLJ-863 Andy On Oct 3, 2012, at 11:03 AM, Marc Dzaebel wrote: clojure.core/interleave could be

Re: Question about sets

2012-10-04 Thread Andy Fingerhut
was committed. Andy On Sep 12, 2012, at 3:22 AM, Rich Hickey wrote: On Sep 8, 2012, at 7:38 PM, Andy Fingerhut wrote: Rich: I'm not sure what you mean by the not-fastest-path possible that exists in today's Clojure code, so if you get a chance, see if the below is what you mean. As far

Re: ANN: a Clojure docs site, and github organization

2012-10-05 Thread Andy Fingerhut
On Oct 4, 2012, at 1:34 PM, Michael Klishin wrote: There are pretty specific plans about the guides and moving clojuredocs.org forward to 1.4 and (hopefully, at some point) multi-version support. Michael, are these specific plans described anywhere that we could read? Or would you be able

Re: ANN: a Clojure docs site, and github organization

2012-10-06 Thread Andy Fingerhut
I don't always remember how to create a patch, either, but I do remember where to go to get the short instructions to do so in case I forget. In case you are curious, the process for creating a patch is documented here, under the heading Developing and submitting patches to Clojure and Clojure

Re: ANN: a Clojure docs site, and github organization

2012-10-06 Thread Andy Fingerhut
I would agree that the CA pain is overemphasized if the submitter lives in the USA or Canada. It isn't difficult at all. I have since heard that to get a letter from Russia to the USA, there are several methods, but they range from inexpensive-but-can-take-months-and-are-unreliable, to

Re: lein run deadlocking?

2012-10-08 Thread Andy Fingerhut
Which OS are you using? Which JVM? (i.e. output of java -version) Andy On Oct 8, 2012, at 5:25 PM, Brian Craft wrote: I'm noticing that very regularly lein run will hang. Where it hangs is variable. At the moment it's right here: lein run Compiling downsample.core Though

Slightly updated Clojure cheatsheet available

2012-10-08 Thread Andy Fingerhut
http://jafingerhut.github.com The only changes since the previous version are to add a mention of *unchecked-math*, and the following new symbols in Clojure 1.4 are now mentioned. These 1.4-specific symbols have (1.4) just before them to indicate that they are only available in Clojure 1.4:

Re: Slightly updated Clojure cheatsheet available

2012-10-08 Thread Andy Fingerhut
to modify the program for that purpose, unless it is very similar to one of those. Andy On Oct 8, 2012, at 7:25 PM, Grant Rettke wrote: On Mon, Oct 8, 2012 at 8:41 PM, Andy Fingerhut andy.finger...@gmail.com wrote: The only changes since the previous version are to add a mention of *unchecked

Re: lein run deadlocking?

2012-10-09 Thread Andy Fingerhut
!)) On Monday, October 8, 2012 6:37:57 PM UTC-7, Brian Craft wrote: CentOS release 5.5 (Final) java version 1.6.0_11 Java(TM) SE Runtime Environment (build 1.6.0_11-b03) Java HotSpot(TM) 64-Bit Server VM (build 11.0-b16, mixed mode) On Monday, October 8, 2012 5:32:43 PM UTC-7, Andy

Re: Bug: incorrect stack trace for function names containing -

2012-10-09 Thread Andy Fingerhut
Clojure itself creates symbols with - in them (I think defrecord creates functions named by such symbols). Andy On Oct 9, 2012, at 6:12 AM, Mauricio Aldazosa wrote: Hi there. According to the reader documentation (http://clojure.org/reader), it seems that '' is not a valid character for

Re: What is this function?

2012-10-09 Thread Andy Fingerhut
It is not in the Clojure API because it is declared private in the source file core.clj where it is defined. If you want to study Clojure's core code, it is essential in cases like this that you get a full source tree and search through it for such things: git clone

Re: ANN: a Clojure docs site, and github organization

2012-10-10 Thread Andy Fingerhut
Michael, thanks for the detailed response, and I appreciate the effort you are putting forth in the clojure-doc.org site. I do have some followup questions on clojuredocs.org, since you gave some description of what you hope and/or expect to happen there. On Oct 5, 2012, at 1:52 PM, Michael

Re: where is pvmap?

2012-10-13 Thread Andy Fingerhut
On Oct 13, 2012, at 6:49 AM, Jim - FooBar(); wrote: I am struggling to find the namespace in which 'pvmap' lives! Can anyone help? I am pretty sure that it was implemented on a branch of the Clojure source tree, but never merged into the master branch. You can use git to check out a version

ANN: Clojure 1.3 and 1.4 Cheat Sheet v7

2012-10-14 Thread Andy Fingerhut
My recent updates prompted me to go through my to do list of enhancement ideas for the Clojure cheat sheet, and I did some of them. It is now up in the usual places: http://clojure.org/cheatsheet Several other versions, including ones with tooltips containing doc strings:

Re: ANN: Clojure 1.3 and 1.4 Cheat Sheet v7

2012-10-14 Thread Andy Fingerhut
, Andy Fingerhut andy.finger...@gmail.com wrote: My recent updates prompted me to go through my to do list of enhancement ideas for the Clojure cheat sheet, and I did some of them. It is now up in the usual places: http://clojure.org/cheatsheet Several other versions, including ones

Re: Evaluating an anonymous function with closure

2012-10-15 Thread Andy Fingerhut
On Oct 15, 2012, at 5:41 PM, Jim - FooBar(); wrote: On 15/10/12 22:44, Alan Malloy wrote: You add the numbers at compile time, and then time how long it takes to...do nothing to them, at runtime. You are comparing N to zero, not to some smaller factor of N. yes but this seems almost

Re: ANN: Clojure 1.3 and 1.4 Cheat Sheet v7

2012-10-16 Thread Andy Fingerhut
Yes, the PDF versions of the cheat sheet used to fit into 2 A4 or US letter sized pages quite nicely, before I started adding more things to it. Now I'm sure they can fit into 3 such pages quite nicely, but to fit into 2 would require reducing the font size. Since it no longer fit into 2, I

Re: Cdr car

2012-10-16 Thread Andy Fingerhut
Curtis: You can do this if you want: (def car first) (def cdr rest) but most people accustomed to Clojure would be much more familiar with first and rest. The Content of the Address and Data Registers haven't been applicable for a long time, but it wasn't only the names that are changed --

Re: Cdr car

2012-10-17 Thread Andy Fingerhut
This works just fine, and as you would expect from Common Lisp: user= (cons 1 '()) (1) Clojure does not have improper lists as Scheme and Common Lisp allow. You can't have a cons pair of arbitrary pairs of things, but you can create vectors of 2 arbitrary things if you want such a pair.

Re: UTF-8 behavior ClojureScript (vs. Clojure)

2012-10-18 Thread Andy Fingerhut
Hopefully someone else can answer why there is a difference in the output of the str function. I suspect in ClojureScript's case, it is simply the default behavior to use \x and two hex digits to display a character in a string with a code point in the range 128 through 255, inherited from

Re: How to Aliasing Java Class Names?

2012-10-21 Thread Andy Fingerhut
As mentioned in a recent thread class name clashes on importing classes of same name from different Java package, you can use the classes with fully qualified names without importing them at all. I am not aware of any way to alias them. Andy On Oct 21, 2012, at 6:57 PM, JvJ wrote: I'm

Re: core.logic for constraint logic programming

2012-10-24 Thread Andy Fingerhut
Nathan: I don't know core.logic's capabilities, and I haven't looked at the kinds of constraints you describe in enough detail to say for sure, but my initial reaction is that linear/integer programming might be a better fit. It has been about 5-10 years, but in the past I've had success with

Re: (if (io/file path-to-session-file) -- returns false though file exists

2012-10-25 Thread Andy Fingerhut
The only modern Clojure methods I'm aware of for checking for the existence of a file are the Java method (.exists (io/file filename-string)), or using something like the fs library: https://github.com/Raynes/fs I'm surprised if the if (io/file path-to-session-fie) always returns false in your

Re: monads

2012-10-26 Thread Andy Fingerhut
I can't say I grok monads completely yet, but was one of the tutorials you read this one? http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html I like the style of showing how they solve problems that arise naturally in the context of purely functional programming, with

Re: with-open and line-seq

2012-10-26 Thread Andy Fingerhut
Devin, did you mean read-line from the old clojure.contrib.io? http://clojuredocs.org/clojure_contrib/clojure.contrib.io/read-lines Click the + symbol next to Source to see source code, also available here:

Re: Cdr car

2012-10-29 Thread Andy Fingerhut
I typed up the transcript, and as a result of this message decided to republish the transcript in a place that isn't gone yet: http://jafingerhut.github.com/clojure-info/clojure-for-lispers-transcript.txt If anyone has permission to update the link to the transcript beneath part 1 of the video

Re: Clojure CA over email thread on clojure-dev

2012-10-30 Thread Andy Fingerhut
The concept of selection bias is only applicable when you are trying to get a representative sample of a population. I don't think the idea of the discussion is to go by majority vote. It is to find a process that meets the criteria decided upon by the Clojure/core members. I'm not one of

Re: Clojure CA over email thread on clojure-dev

2012-10-30 Thread Andy Fingerhut
On Oct 30, 2012, at 3:58 PM, Michael Klishin wrote: 2012/10/31 Andy Fingerhut andy.finger...@gmail.com I don't think the idea of the discussion is to go by majority vote It's not about making decisions by majority vote, Andy. It is about making sure many members of the community can

Re: Fail to run dynamic binding code with Clojure1.4

2012-10-30 Thread Andy Fingerhut
The code works as written in Clojure 1.2 and 1.2.1. It doesn't in 1.3 and later, unless you change the definition of twice to annotate that it is a dynamic var, like so: (defn ^:dynamic twice [x] (println original function) (* 2 x)) With that change, it works in Clojure 1.3 and later.

Re: What's the difference between `seq` and `lazy-seq`?

2012-11-02 Thread Andy Fingerhut
lazy-seq is used, typically within functions, to create a lazy sequence. seq is used wherever you want to take a collection or a sequence, and traverse through its contents. It takes the collection or sequence and returns an object, called a seq, that you can call first or next/rest on. seq

Re: Java-to-Clojure source translation?

2012-11-04 Thread Andy Fingerhut
On Nov 4, 2012, at 1:10 PM, Stuart Sierra wrote: Hello, It is not really possible to make a direct translation from Java to Clojure. Java has mutable variables and imperative flow-control, for which there is no equivalent in Clojure. -S First, some suggestions that are not

Re: Proposal/request: Give clojure.core/conj a unary implementation

2012-11-04 Thread Andy Fingerhut
I created CLJ-1103 and attached a patch that makes this change, as well as related changes to conj! assoc assoc! and dissoc! (dissoc, disj and disj! already handled these cases). http://dev.clojure.org/jira/browse/CLJ-1103 Andy On Nov 4, 2012, at 5:52 AM, Jonathan Fischer Friberg wrote: It

Re: Slow image convolution

2012-11-09 Thread Andy Fingerhut
I haven't determined exactly why that particular code is slow for you, but I have looked at it for a few minutes and have some suggestions: 1. In Clojure 1.3 and later, the default integer type for primitive arithmetic is long, not int. Declaring things int means that they are really longs in

Re: Slow image convolution

2012-11-09 Thread Andy Fingerhut
Having worked on Clojure benchmarks on the Computer Language Benchmarks Game web site, that is sometimes the kind of Clojure code one needs to write if you want it to be as fast as it can be. http://shootout.alioth.debian.org/u64q/compare.php?lang=clojure Also, splitting it out into

Can anyone explain this behavior of clojure.java.shell/sh ?

2012-11-09 Thread Andy Fingerhut
This issue may be specific to Linux, or even to a particular version of Linux that I am using (Ubuntu 11.10 32-bit desktop), although I doubt it is. If others try this out, I'd be curious to know what your results are, especially if you know why it is happening, and how it can be fixed.

Re: Can anyone explain this behavior of clojure.java.shell/sh ?

2012-11-10 Thread Andy Fingerhut
to test the second by writing your own shell script that forks and then exits (at least, I assume that's what xdg-open is doing). On Nov 9, 2012, at 19:26 , Andy Fingerhut andy.finger...@gmail.com wrote: This issue may be specific to Linux, or even to a particular version of Linux

Re: Why does re-matcher return a mutable object?

2012-11-14 Thread Andy Fingerhut
I didn't design the API, but my guess would be that re-matcher, re-find, and re-groups are a thin wrapper around what the Java libraries provide in the way of regex matching, and to do so they make the mutable Matcher object visible to the caller. Reimplementing regex matching code from

Re: Proposed change to let- syntax

2012-11-15 Thread Andy Fingerhut
Check git commit logs from a month or so ago. Rich Hickey committed it. Andy Sent from my iPhone On Nov 15, 2012, at 2:41 PM, Mark Engelberg mark.engelb...@gmail.com wrote: Where did you find the proposal? I can't find any info about let- -- You received this message because you are

Re: [ANN] lein-clojuredocs 1.0.2, cadastre 0.1.1, and Eisago

2012-11-16 Thread Andy Fingerhut
Very cool stuff, Lee! And my sincere thanks for all the work you are doing to make ClojureDocs.org even more useful than it is already. I tried out clojuredocs on a project that depended on Clojure 1.3.0. When I first tried lein2 clojuredocs, I got an exception like this: Exception in thread

Re: Clojure to Haskell Compiler

2012-11-17 Thread Andy Fingerhut
There have been several projects where people have begun developing Clojure to C or C++ translations, but I don't know how fleshed out those are. ClojureC - https://github.com/schani/clojurec Ferret - http://nakkaya.com/2011/06/29/ferret-an-experimental-clojure-compiler/ These do not have the

Re: Clojure Recursion (loop-recur) Questions

2012-11-19 Thread Andy Fingerhut
If you are familiar with tail recursion, then loop/recur this is Clojure's way to achieve tail recursion. http://en.wikipedia.org/wiki/Tail_call The general tail call optimization mechanism as implemented in the programming language Scheme, for example, means that tail-position calls must not

Re: Primitive function boxes and unboxes result value

2012-11-20 Thread Andy Fingerhut
Any relationship to CLJ-701, other than similar symptoms? http://dev.clojure.org/jira/browse/CLJ-701 Andy On Nov 20, 2012, at 9:15 AM, Christophe Grand wrote: Hi, It looks like, because of the recur, the compiler fails to notice that if returns a primitive. As far as I understand in

Re: Sorted Sets With Duplicate Elements

2012-11-20 Thread Andy Fingerhut
I would be surprised if you are still happy with that solution a few minutes after doing some testing with it. I've added some examples to ClojureDocs.org at the link below, with a suggested better comparison function. Take a look and let me know if it seems clear:

Re: Efficiency of Dijkstra's algorithm

2012-11-20 Thread Andy Fingerhut
Have you tried using first to get the smallest item from the set, and then create a new sorted set with the item remove by using (disj my-sorted-set item) ? Andy On Nov 20, 2012, at 9:46 AM, JvJ wrote: I've just implemented Dijkstra's algorithm, and as far as I can tell, it works.

Re: Efficiency of Dijkstra's algorithm

2012-11-20 Thread Andy Fingerhut
UTC-5, Andy Fingerhut wrote: Have you tried using first to get the smallest item from the set, and then create a new sorted set with the item remove by using (disj my-sorted-set item) ? Andy On Nov 20, 2012, at 9:46 AM, JvJ wrote: I've just implemented Dijkstra's algorithm

Re: Sorted Sets With Duplicate Elements

2012-11-20 Thread Andy Fingerhut
On Nov 20, 2012, at 10:12 AM, Mark Engelberg wrote: Clojure's sorted collections must be provided with a sorting function where items tie if and only if they are equal. (sorted-set-by #(compare [(second %) %] [(second %2) %2]) [:a 1] [:b 1] [:c 1])) Mark, I like the brevity of this way

Re: Sorted Sets With Duplicate Elements

2012-11-20 Thread Andy Fingerhut
On Nov 20, 2012, at 11:04 AM, Alan Malloy wrote: On Tuesday, November 20, 2012 10:29:18 AM UTC-8, Andy Fingerhut wrote: On Nov 20, 2012, at 10:12 AM, Mark Engelberg wrote: Clojure's sorted collections must be provided with a sorting function where items tie if and only

Re: Clojure source code - negligent?

2012-11-23 Thread Andy Fingerhut
I'm not advocating all of the Java coding practices that cause warnings in IDEA, but my guess would be that most folks looking at the Java code used to implement Clojure don't use IDEA. It all compiles without warnings using javac and ant or Maven. Also, in looking at some of these warnings

Re: Can I safely put that Clojure will Primarily remain a JVM language in the future as it is now?

2012-11-24 Thread Andy Fingerhut
Such questions make one wonder Why are you asking? For example, if it is simply curiosity, then I would answer that Clojure's primary platform has been the JVM since before it was released 5 years ago, and there are no signs I have seen that the developers who add features to and fix bugs in

Re: Subsequent deliver to promise doesn't seem to throw exception ?

2012-11-24 Thread Andy Fingerhut
The comments on this ticket should answer your questions: http://dev.clojure.org/jira/browse/CLJ-1038 Andy On Nov 24, 2012, at 3:21 PM, Frank Siebenlist wrote: I'm confused by the promised behaviour of the documentation of deliver: --- user= (doc deliver) -

Clojure expression benchmarks

2012-11-24 Thread Andy Fingerhut
I've just published some results of measuring the run time of many Clojure expressions on 5 different JVMs and over a dozen different Clojure versions at the link below. http://jafingerhut.github.com/clojure-benchmarks-results/Clojure-expression-benchmarks.html You can click on the

Re: Can I safely put that Clojure will Primarily remain a JVM language in the future as it is now?

2012-11-25 Thread Andy Fingerhut
On Nov 24, 2012, at 9:24 PM, Leon Adler wrote: This post was not meant for any queries on the release schedules of the various Clojure versions, but for a curious question -- Will Clojure (take all the upcomming versions back-to-back) remain to be known as the JVM language anytime in the

Re: REPL behavior different from running from a file

2012-11-25 Thread Andy Fingerhut
The won't terminate part is due to background threads being created by the call to pmap, and by default it will wait 60 seconds before exiting. If you don't wait that long, it definitely appears like it is hung. If you look on the ClojureDocs entry for pmap, the last example says to see the

Re: Clojure Recursion (loop-recur) Questions

2012-11-27 Thread Andy Fingerhut
On Nov 27, 2012, at 8:17 PM, Curtis wrote: Thank you Andy - This was fabulously helpful - I really appreciate your explanation. Would you permit me to include your answer in a blog post about the above question? Sure, use it however you like. Andy -- You received this message

Re: Clojure Recursion (loop-recur) Questions

2012-11-27 Thread Andy Fingerhut
: On Mon, Nov 19, 2012 at 6:24 PM, Andy Fingerhut andy.finger...@gmail.com wrote: Clojure's loop/recur only implements tail recursion, not general tail-call optimization. tail recursion is far more commonly used in languages that have it than the general tail-call optimization to arbitrary

Re: Proposed change to let- syntax

2012-12-01 Thread Andy Fingerhut
I don't have suggestions for the best names for these new things, but one good example in the doc string would go a long way to making it clearer what they *do* and how they are intended to be used. The doc strings are written once, but read thousands of times, and are your most reliable line

Re: small error on clojure.org/reader

2012-12-02 Thread Andy Fingerhut
The full sentence is this: Syntax-quote (`, note, the backquote character), Unquote (~) and Unquote-splicing (~@) It looks like perhaps someone started writing this: Syntax-quote (`), Unquote (~) and Unquote-splicing (~@) and then added some more explanatory text inside the

Re: Is There An Upcoming Book On Clojure Macros?

2012-12-06 Thread Andy Fingerhut
Paul Graham's On Lisp is available for free here: http://www.paulgraham.com/onlisp.html It is definitely focused on Common Lisp, not Clojure, and there are differences between the way symbols and namespaces (Clojure) and packages (Common Lisp) are handled in those two languages that make some

Re: abysmal multicore performance, especially on AMD processors

2012-12-07 Thread Andy Fingerhut
Lee: I'll just give a brief description right now, but one thing I've found in the past on a 2-core machine that was achieving much less than 2x speedup was memory bandwidth being the limiting factor. Not all Clojure code allocates memory, but a lot does. If the hardware in a system can

<    1   2   3   4   5   6   7   8   9   >