Re: Concerns About Pushing Clojure 1.0.0 to Maven Central Repo?

2009-05-12 Thread ataggart
I use Maven indirectly via Ivy, so I just wanted to request that, whatever the choice of naming, the artifact and module names should parallel. The reason for this request is that Ivy can resolve dependencies in maven by creating URLs from a pattern. For example: dependency org=org.clojure

Re: integer overflow behavior multiply

2009-05-30 Thread ataggart
Yes, the reason the larger one works is because the parameters to * just happen to overflow to values that let the result of * not go out of bounds. As for doing bounds checking during (int), I think that would be a net loss. Generally speaking, casting to a primitive is intended to aid

Re: Currying / Partial Application macro

2009-05-31 Thread ataggart
On May 30, 12:58 pm, eyeris drewpvo...@gmail.com wrote: The ubiquity of these anonymous functions in clojure code is evidence that partial application is just as needed in clojure as it is in haskell. Doesn't that depend entirely on whether or not the anonymous functions are being used for

Re: Currying / Partial Application macro

2009-05-31 Thread ataggart
On further consideration, having partial so the arity handling in non- trivial cases is where it trumps an anonymous function. On May 31, 2:04 am, ataggart alex.tagg...@gmail.com wrote: On May 30, 12:58 pm, eyeris drewpvo...@gmail.com wrote: The ubiquity of these anonymous functions

Re: Currying / Partial Application macro

2009-05-31 Thread ataggart
On May 31, 5:20 am, Meikel Brandmeyer m...@kotka.de wrote: Am 31.05.2009 um 11:11 schrieb ataggart: (partial f a b) is equivalent to #(apply f a b %). So anonymous functions are the more general, more powerful concept. Ah, beautiful! Somehow I missed the % form when reading the docs

Where does the language end and the libraries begin?

2009-06-03 Thread ataggart
Tonight Rich made a comment (related to distributed computing) about not wanting to include things in the language that should belong in libraries. This led me to wonder (only after leaving the meeting), where does that boundary live? Is clojure.core language or library? Is it the java

Re: Clojure, GridGain and serialization error

2009-06-09 Thread ataggart
What was the solution? On Jun 9, 1:03 pm, prhlava prhl...@googlemail.com wrote: I am playing with GridGainhttp://www.gridgain.comfrom Clojure and I am getting exception related to serialization. Never mind, I tool a wrong approach at first. Now I have it running, apologies for the

Re: (Simple) Neural Net Simulation

2009-06-09 Thread ataggart
On Jun 9, 11:07 am, alfred.morgan.al...@gmail.com alfred.morgan.al...@gmail.com wrote: Thanks for the advice, but at present I'm simply aiming to get the very basics of a neural net up and running without having to worry about a training algorithm at all.  Here's what I have so far (again,

Re: why is io! not enforced?

2009-06-22 Thread ataggart
On Jun 20, 4:59 pm, Rowdy Rednose rowdy.redn...@gmx.net wrote: On a side-note: I actually think it can make sense to do io in transactions in Clojure, and I believe (knowing that transactions can be replayed) it is possible to use that to e.g. implement a transaction log written to disk

Re: The API docs are gone!

2009-06-26 Thread ataggart
On Jun 26, 9:12 pm, Four of Seventeen fsevent...@gmail.com wrote: Not that it really matters why it is/was down. The API docs going down for any amount of time longer than a minute or so is bad bad news. ... By contrast, in over a decade of usinghttp://java.sun.com/javase/6/docs/api/ and

Re: executing tasks on a schedule

2009-06-27 Thread ataggart
What do you need that a cron job wouldn't provide? On Jun 26, 8:43 am, Stuart Halloway stuart.hallo...@gmail.com wrote: I am working on a Clojure project that is becoming more and more   schedule-oriented. So far I have been using Clojure's native   concurrency constructs, but I am becoming

Re: sanity check needed

2009-07-05 Thread ataggart
A set might be better to hold the player-refs, then you can just call (disj player-refs player-ref) without doing any extra checking. Also you can access ref values without needing to be in a dosync. Things being immutable, the value you get from, say, @team-ref won't change once you have it.

Re: sanity check needed

2009-07-05 Thread ataggart
I should have been more clear when I said to use (disj ...); I meant sending that via an alter. On Jul 5, 6:05 pm, ataggart alex.tagg...@gmail.com wrote: A set might be better to hold the player-refs, then you can just call (disj player-refs player-ref) without doing any extra checking. Also

Re: Dependency management

2009-07-07 Thread ataggart
Phil, it might be worthwhile to look at Ivy (http://ant.apache.org/ ivy). It has real good interop with ant and can easily pull from a maven repo and read pom files. On Jul 7, 9:28 pm, Phil Hagelberg p...@hagelb.org wrote: I've been noodling on the problem of dependency management for a while

Does anyone need any clojure work done?

2009-07-07 Thread ataggart
After having spent the last decade doing server-side java, lots of infrastructure level code which I enjoy), and going blind on xml, I'd really like to get more into clojure. I've been playing with it off and on for about a year now, reading whatever FP-related material I can get my hands on,

Re: Simple data structure access macro

2009-07-20 Thread ataggart
How about: (get-in nestedDS [1 hello 0]) http://clojure.org/api#toc279 On Jul 20, 1:31 pm, Moses mosesam...@gmail.com wrote:   I come primarily from a perl programming background, but am trying to learn Clojure.   I'm looking for a clojure equivalent to the following.   Perl:    my

Logging functions delegated to java logging systems

2009-07-21 Thread ataggart
I've written up a small set of logging functions to output from clojure what I'm already doing from my production java code. Currently it checks for the presence of commons-logging, log4j, and finally java.util.logging. The clojure code doesn't actually do any logging itself; instead everything

Re: Logging functions delegated to java logging systems

2009-07-22 Thread ataggart
         - its nice to be able to log an expression and what its evaluated to while leaving it in place (+ (debug (+ 1 2)) 3) current-function-name (Stephen C. Gilardi posted)  - optionally including the function and thread id Regards, Tim. On Jul 22, 3:13 pm, ataggart alex.tagg...@gmail.com

Re: Logging functions delegated to java logging systems

2009-07-23 Thread ataggart
] Redirects writes of System.out and System.err to the logs log-uncapture! Restores the System.out and System.err to their defaults. with-logs [log-name body] Evaluates the body with *out* and *err* redirected to the logs On Jul 22, 11:53 am, ataggart alex.tagg...@gmail.com wrote: Tim

Re: Logging functions delegated to java logging systems

2009-07-23 Thread ataggart
part. I find both forms useful. Unfortunately the naming gives no clue as to the differences between them. Regards, Tim. On Jul 23, 7:27 pm, Laurent PETIT laurent.pe...@gmail.com wrote: Hello, 2009/7/23 ataggart alex.tagg...@gmail.com Ok, I've updated the code with some of Tim's

Re: Logging functions delegated to java logging systems

2009-07-23 Thread ataggart
Hmm, I like spy since it doesn't mimic a logging level like debug and trace do. Making the change now, thanks. On Jul 23, 11:01 am, Laurent PETIT laurent.pe...@gmail.com wrote: What about 'spy instead of 'debug ? Or 'trace ? 2009/7/23 ataggart alex.tagg...@gmail.com Tim is correct

Re: Logging functions delegated to java logging systems

2009-07-27 Thread ataggart
Ok the patch file has been languishing on assembla for a few days, so I've uploaded it to the files section here if anyone wants to use the latest version. logging.clj at http://groups.google.com/group/clojure/files http://groups.google.com/group/clojure/files On Jul 23, 11:20 am, ataggart

Re: Clojure performance tests and clojure a little slower than Java

2009-07-27 Thread ataggart
On Jul 27, 10:06 am, BerlinBrown berlin.br...@gmail.com wrote: So far I have found that clojure is about 5-10 times as slow as comparable code in Clojure. I infer you mean clojure execution times are about 5-10 times longer than in java. It depends on what you're doing, but that sounds

Re: Parallel garbage collection worthwhile?

2009-07-29 Thread ataggart
I threw this together, how does it measure up? (defn prime? [x primes] (not (first (filter #(zero? (rem x %)) primes (defn next-prime [xs primes] (lazy-seq (let [xs (drop-while #(not (prime? % primes)) xs) prime (first xs) primes (conj primes prime)] (cons

Re: Converting seqs to vectors caching lazyseqs

2009-08-01 Thread ataggart
On Aug 1, 9:37 am, Garth Sheldon-Coulson g...@mit.edu wrote: Hi there, I have a program that produces multidimensional LazySeqs, i.e. seqs of seqs of seqs of... I would like to write a function to convert these multidimensional LazySeqs to vectors. This is in case a user needs constant

Re: What happened to clojure.contrib web site ?

2009-08-03 Thread ataggart
Here's the well-hidden, auto-generated docs for clojure-contrib: http://richhickey.github.com/clojure-contrib/ On Aug 3, 5:41 pm, James Sofra james.so...@gmail.com wrote: I think he may mean thishttp://code.google.com/p/clojure-contrib/wiki/OverviewOfContrib Is it still being updated? It

Re: Reflection warning: reference to field getClass can't be resolved.

2009-08-05 Thread ataggart
On Aug 4, 4:46 pm, Vagif Verdi vagif.ve...@gmail.com wrote: When reflection warning is on, i get 2 warnings on every my file: reference to field getClass can't be resolved. reference to field getClassLoader can't be resolved. Is this something i should be worried about ? Probably not. It

gen-class not capturing the expected *ns*

2009-08-05 Thread ataggart
In testing out clojure.contrib.logging within a generated servlet, I noticed that the value of *ns* is always clojure.core, and not the ns of the code. I just wanted to make sure I wasn't missing something obvious. The servlet code: (ns com.example.servlet (:require (clojure.contrib

Re: gen-class not capturing the expected *ns*

2009-08-06 Thread ataggart
On Aug 5, 9:11 pm, Richard Newman holyg...@gmail.com wrote: In testing out clojure.contrib.logging within a generated servlet, I noticed that the value of *ns* is always clojure.core, and not the ns of the code. I have observed this too (running in SailFin, which is based on  

Re: gen-class not capturing the expected *ns*

2009-08-06 Thread ataggart
On Aug 5, 11:24 pm, Richard Newman holyg...@gmail.com wrote: Bah! I tried to simplify the example code, and missed conveying the actual problem.  Your example code (and sadly, mine) pulls *ns* at runtime, the logging macro doesn't; it writes the value of the *ns* at macro-expansion-time

Re: with-out-str assumes Unix line ends

2009-08-06 Thread ataggart
Anne, please don't threadjack. Now my original subject appears missing, since you renamed it. On Aug 6, 1:03 am, Anne Ogborn annie6...@yahoo.com wrote: (use 'clojure.contrib.duck-streams) (spit C:\\test.txt     (with-out-str       (println foo)       (println bar)       (flush))) On my

Re: gen-class not capturing the expected *ns*

2009-08-06 Thread ataggart
Restoring this thread's original subject. On Aug 6, 10:40 am, ataggart alex.tagg...@gmail.com wrote: Anne, please don't threadjack.  Now my original subject appears missing, since you renamed it. On Aug 6, 1:03 am, Anne Ogborn annie6...@yahoo.com wrote: (use 'clojure.contrib.duck

Re: gen-class not capturing the expected *ns*

2009-08-06 Thread ataggart
Ok, yes, I will blame my idiocy on sleep deprivation. In every case the name used by the log is the runtime *ns*, which really defeats the purpose of naming the specific usages of log. I'm surprised no one mentioned this (imo wrong) behavior. I'll get to work on fixing it so it behaves

Re: gen-class not capturing the expected *ns*

2009-08-06 Thread ataggart
Ah, very well. I find it useful to print out so I know which code is doing the logging, since stack inspection is very expensive, and in the case of clojure, looks like a mess of underscores and dollar signs. ;) On Aug 6, 12:31 pm, Richard Newman holyg...@gmail.com wrote: In every case the

Re: gen-class not capturing the expected *ns*

2009-08-06 Thread ataggart
Restoring subject again On Aug 6, 12:48 pm, Anniepoo annie6...@yahoo.com wrote: Sorry for the confusion - I read this list on an email feed. Turns out replying to a message from there and changing the subject isn't sufficient to start a new thread. Apparently it renames the thread.

Re: Can Clojure be as fast as Java?

2009-08-11 Thread ataggart
On Aug 11, 11:55 am, fft1976 fft1...@gmail.com wrote: I feel that this question is important enough to warrant its own thread. http://groups.google.com/group/clojure/search?group=clojureq=%22as+fast+as+java%22qt_g=Search+this+group If you use Java's arrays and declare all types, should

Re: minor grievance with arithmetic on characters

2009-09-10 Thread ataggart
I'd like to second all of this. The very first time I had to fix someone else's bug was when the dev used a.compareTo(b) == -1. On Sep 9, 1:37 am, B Smith-Mannschott bsmith.o...@gmail.com wrote: On Tue, Sep 8, 2009 at 23:35, Stephen C. Gilardisquee...@mac.com wrote: On Sep 8, 2009, at 2:14

Re: How can a clojure script recognise it is running as a script?

2009-09-18 Thread ataggart
Just for my own edification (not being versed in python), what's the point of knowing that? On Sep 18, 3:46 am, Kelvin Ward kelvin.d.w...@googlemail.com wrote: java -cp clojure.jar clojure.main foo.clj I'm wondering if the code in foo.clj has anyway to know it is being executed as a script.

Re: Finding elements in 2 sequences that match (indexwise)

2009-10-14 Thread ataggart
How about something like this: (filter #(not= % :nomatch) (map #(if (= %1 %2) %1 :nomatch) [1 2 3 4] [1 3 3 3])) Or cleaned up for general use: (defn filter-map Returns the results of map, but filtered to contain only those items whose inputs to f have satisfied pred. pred takes the same

Re: Finding elements in 2 sequences that match (indexwise)

2009-10-14 Thread ataggart
is not a possible values within the compared seqs :-( 2009/10/14 ataggart alex.tagg...@gmail.com How about something like this: (filter #(not= % :nomatch) (map #(if (= %1 %2) %1 :nomatch) [1 2 3 4] [1 3 3 3])) Or cleaned up for general use: (defn filter-map  Returns the results of map

Re: feedback on this code

2009-10-28 Thread ataggart
I second Tim's comment regarding holding onto calculated values. That's at best a performance optimization, and likely an unnecessary one. Also, by using the product itself as a key simplifies the case where you try to add the same product as multiple line-items (though this may be what you want

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

2009-10-28 Thread ataggart
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

Re: Applying static java method to seq

2009-11-02 Thread ataggart
If (Integer/parseInt 5) works, then not all functions need be an implementation of IFn; or perhaps more precisely, clojure knows when a call is being made to an IFn vs a static java method. It would be nice for consistency if whatever makes that work also treated Integer/ parseInt as a function

Re: Applying static java method to seq

2009-11-02 Thread ataggart
Good point about type-hinting. On Nov 2, 11:42 am, Chouser chou...@gmail.com wrote: On Mon, Nov 2, 2009 at 3:32 PM, ataggart alex.tagg...@gmail.com wrote: If (Integer/parseInt 5) works, then not all functions need be an implementation of IFn; or perhaps more precisely, clojure knows when

Re: (into) improvement

2009-11-03 Thread ataggart
(into [] (concat [1 2] [3 4])) Different tools for different jobs. And Mark makes a great point about assuming too much from a particular usage. On Nov 3, 7:56 pm, mbrodersen morten.broder...@gmail.com wrote: Currently (into) takes 2 parameters (destination and source): (into [] [1 2]) =

Re: Language request: make key and val work on vector pairs too

2009-11-11 Thread ataggart
Just use first and second for both cases. On Nov 11, 9:52 am, samppi rbysam...@gmail.com wrote: Clojure 1.1.0-alpha-SNAPSHOT user= (conj (first {1 2}) 3) [1 2 3] user= (conj {1 2} [2 5]) {2 5, 1 2} user= (key (first {1 2})) 1 user= (key [1 2]) java.lang.ClassCastException:

Re: repeatedly forcing the evaluation of a lazy seq

2009-11-20 Thread ataggart
The sequence returned from the filter would need to be rescanned to get the nth element, but the filtering itself should only need to happen when the next element in the sequence is sought. For cases such as the one you describe, I think it's common to fully realize the sequence into a vector,

Re: Clojure Scoping Rules

2009-11-21 Thread ataggart
Getting back to the initial post, this would be the (almost) equivalent code in java: public class Test{ static int x = 1; void bindingX(int val){ x = val; } int dummyFn2(){ return x + 1; } void dummyFn(){ System.out.println(entering function:

Re: initialization of clojure.contrib.logging library

2009-11-23 Thread ataggart
The c.c.logging library delegates to an underlying implementation, thus for any configuration help you'll need to check the documentation of the actual logging system, e.g., log4j. On Nov 21, 7:21 am, Alex Ott alex...@gmail.com wrote: Hello all I have one question about logging library from

Re: swing: efficiently updating a listbox from a clojure list

2009-11-25 Thread ataggart
Bear in mind that when going from the slow to the fast, you not only removed the repeated calls to to-array, but also removed the overhead of words-with, since the lazy seq returned from the let doesn't get fully realized. Try changing your fast version to: (def update-wlist #(let [w (doall

Re: swing: efficiently updating a listbox from a clojure list

2009-11-25 Thread ataggart
On Nov 25, 11:09 am, Martin DeMello martindeme...@gmail.com wrote: On Thu, Nov 26, 2009 at 12:31 AM, Jonathan Smith To display you would want to use 'into-array' and your 'setListData' function, because you seem to have a homogeneous collection of strings; while to-array makes you an array

Re: inverse of interleave = unravel

2009-12-02 Thread ataggart
On Dec 2, 9:10 am, Konrad Kułakowski (kony) kulakow...@gmail.com wrote: Recently I need something which works as inverse of interleave I did something like that: (defn unravel [expr-list]         (loop [flist () slist () tic-tac 0 olist expr-list]                 (let [item (first olist)]

Re: Space usage of lazy seqs

2009-12-02 Thread ataggart
On Dec 2, 10:50 am, Johann Hibschman joha...@gmail.com wrote: I don't understand Clojure's space requirements when processing lazy sequences. Are there some rules-of-thumb that I could use to better predict what will use a lot of space? I have a 5.5 GB pipe-delimited data file, containing

Re: Space usage of lazy seqs

2009-12-02 Thread ataggart
On Dec 2, 10:50 am, Johann Hibschman joha...@gmail.com wrote: I don't understand Clojure's space requirements when processing lazy sequences. Are there some rules-of-thumb that I could use to better predict what will use a lot of space? I have a 5.5 GB pipe-delimited data file, containing

Re: What about contains? for lists

2009-12-02 Thread ataggart
On Dec 2, 7:10 am, Stefan Kamphausen ska2...@googlemail.com wrote: Hi, while studying the collection types and trying to find out which functions work on all collection types (i.e. lists, vectors, maps, sets) I was flabbergasted by the following user (contains? (list 1 2 3) 3) false OK,

Re: What about contains? for lists

2009-12-02 Thread ataggart
On Dec 2, 12:06 pm, ataggart alex.tagg...@gmail.com wrote: On Dec 2, 7:10 am, Stefan Kamphausen ska2...@googlemail.com wrote: Hi, while studying the collection types and trying to find out which functions work on all collection types (i.e. lists, vectors, maps, sets) I

Re: What about contains? for lists

2009-12-02 Thread ataggart
On Dec 2, 1:32 pm, Stefan Kamphausen ska2...@googlemail.com wrote: Hi, On Dec 2, 10:24 pm, ataggart alex.tagg...@gmail.com wrote: My guess is that String and array, while not implementing the IAssociative interface, all have the O(1) lookup performance guarantees of associative data

Re: Java Class Factory

2009-12-02 Thread ataggart
On Dec 2, 8:15 pm, lazy1 miki.teb...@gmail.com wrote: Hello, I'm trying to create a factory method for Java classes, however I'm doing something wrong. (import '(java.util Dictionary HashMap)) (def *containers* { :dict Dictionary :hash HashMap}) (defn new-container   [type]   (new

Re: Remove Value From Vector at Given Index

2009-12-03 Thread ataggart
There's take-nth in core, but no drop-nth (which sounds like what you need), so I wrote it: (defn drop-nth [n coll] (lazy-seq (when-let [s (seq coll)] (concat (take n s) (drop-nth n (next (drop n s))) So, in your example: (vec (drop-nth 2 [2 4 5 8 6 4])) On Dec 1, 7:06 pm, Don

Re: Remove Value From Vector at Given Index

2009-12-03 Thread ataggart
On Dec 3, 2:10 pm, ataggart alex.tagg...@gmail.com wrote: There's take-nth in core, but no drop-nth (which sounds like what you need), so I wrote it: (defn drop-nth [n coll]   (lazy-seq     (when-let [s (seq coll)]       (concat (take n s) (drop-nth n (next (drop n s))) So, in your

Re: API pages

2009-12-03 Thread ataggart
Looks fine in Safari 4.0.3. On Dec 2, 9:24 pm, Sean Devlin francoisdev...@gmail.com wrote: Hey, the API page doesn't look right in Firefox 3.5 The cut off around halfway through the page. I think this also happens in Safari, but I'm not sure right now. Oh, and IE 6... YUCK! (But that's

Re: create java class instance from type selected at runtime

2009-12-06 Thread ataggart
On Dec 5, 11:48 am, Christopher Wicklein chr...@wicklein.org wrote: Greetings! I'd like to create an instance of a Java class like this: let [foo (Bar.)] but, I'd like the type specified by Bar to not be static, e.g. something like this: let [foo (:type params).] but, I can't seem to

Re: Code improvement: Can this loop be expressed as higher-level function calls?

2009-12-06 Thread ataggart
On Dec 6, 11:28 am, samppi rbysam...@gmail.com wrote: I've read that loop/recur is less preferable to using higher-level function calls like reduce and for and map, especially when chunked seqs are implemented. But is can the loop below be rewritten to use those functions instead? It's a

Re: The new deftype and multimethod dispatching

2009-12-06 Thread ataggart
On Dec 6, 12:29 pm, Bob Hutchison hutch-li...@recursive.ca wrote: Hi, I'm new to Clojure, not new to lisp (CL and scheme), and having a   thoroughly good time. I've been having a go at the new deftype stuff   and using a clone of the new branch from the git repository (up-to- date as of this

Re: Hooks library. (Is this clojure-y?)

2009-12-06 Thread ataggart
On Dec 6, 7:33 pm, Allen Rohner aroh...@gmail.com wrote: I started playing with the idea of a hooks library for Clojure, similar to Emacs hooks. You can see the code athttp://gist.github.com/250575 Does this library have the Tao of Clojure? If hooks aren't a clojure-y way of doing

Re: Hooks library. (Is this clojure-y?)

2009-12-06 Thread ataggart
On Dec 6, 9:22 pm, Allen Rohner aroh...@gmail.com wrote: What is it supposed to do?  What's the usage look like? Oh right, a description would be useful. The point is to build up the functionality of a function from several places. You define a hook function: (defhook foo [a b])

Re: Multiple dispatch with Multimethods

2009-12-07 Thread ataggart
On Dec 7, 1:21 am, Tzach tzach.livya...@gmail.com wrote: Hello What is the idiomatic way to implement the classic collide-with function in Clojure? I would like to implement something similar to the following (pseudo code ahead): (defmulti collide-with foo) (defmethod collide-with

Re: How to use/refer to multiple Clojure classes

2009-12-07 Thread ataggart
On Nov 30, 9:21 am, Dan Kefford dan_keff...@hotmail.com wrote: OK... I'm trying to take Clojure for a spin on Project Euler problems. I have source files for each problem that I have solved and although I can refer to and invoke any one of them explicitly from a main class, I cannot seem to

Re: Datatypes and protocols - update

2009-12-07 Thread ataggart
On Dec 7, 9:07 am, Laurent PETIT laurent.pe...@gmail.com wrote: 2009/12/7 Hugo Duncan hugodun...@users.sourceforge.net On Mon, 07 Dec 2009 06:53:38 -0500, Rich Hickey richhic...@gmail.com wrote: Yes, methods are not really functions. Thinking about them as closures over the object

Re: Datatypes and protocols - update

2009-12-07 Thread ataggart
On Dec 7, 11:23 am, ataggart alex.tagg...@gmail.com wrote: On Dec 7, 9:07 am, Laurent PETIT laurent.pe...@gmail.com wrote: 2009/12/7 Hugo Duncan hugodun...@users.sourceforge.net On Mon, 07 Dec 2009 06:53:38 -0500, Rich Hickey richhic...@gmail.com wrote: Yes, methods

Re: The new deftype and multimethod dispatching

2009-12-07 Thread ataggart
On Dec 7, 12:37 pm, Bob Hutchison hutch-li...@recursive.ca wrote: On 7-Dec-09, at 12:17 PM, Laurent PETIT wrote: 2009/12/6 Bob Hutchison hutch-li...@recursive.ca On 6-Dec-09, at 3:46 PM, Meikel Brandmeyer wrote: Hi, Am 06.12.2009 um 21:29 schrieb Bob Hutchison: It turns out

Re: new API webpage format

2009-12-07 Thread ataggart
While we're throwing requests at Tom, it'd be nice if the special forms were included in the api. On Dec 7, 5:21 pm, Tom Faulhaber tomfaulha...@gmail.com wrote: Yup, I heard that the first time :-) It's coming, but not right this sec. Tom On Dec 7, 4:57 pm, Howard Lewis Ship

Re: Trouble implementing Dijkstra algorithm in Clojure

2009-12-07 Thread ataggart
On Dec 7, 4:19 pm, ajay ajgop...@gmail.com wrote: Hi all, I am new to FP in general and I am trying to pick up Clojure. I am having trouble thinking in FP terms. I am trying to implement the Dijkstra algorithm for shortest paths in Graph in Clojure. If this succeeds, I will implement all

Re: Trouble implementing Dijkstra algorithm in Clojure

2009-12-08 Thread ataggart
myself as part of an exercise (I implemented a simple Huffman-coder), but I'm not sure it's release quality.  Otherwise, I'd be happy to donate it to contrib.  Maybe I'll try to clean it up and send it off for a review. Mark On Dec 7, 11:29 pm, ataggart alex.tagg...@gmail.com wrote: On Dec

Re: Trouble implementing Dijkstra algorithm in Clojure

2009-12-08 Thread ataggart
-- From: ataggart alex.tagg...@gmail.com Date: Tue, Dec 8, 2009 at 6:22 PM Subject: Re: Trouble implementing Dijkstra algorithm in Clojure To: Clojure clojure@googlegroups.com On Dec 8, 11:38 am, Mark Tomko mjt0...@gmail.com wrote: A priority queue implemented over a heap would be more

Re: How to internally refer to other keys in a hashmap?

2009-12-09 Thread ataggart
On Dec 9, 10:20 am, bOR_ boris.sch...@gmail.com wrote: Hi all, I want to make a hash-map where the value of one key depends on the values of other keys in the hash-map. Is there a way to do this, without needing an external reference to the hash-map? {:a 1 :b 2 :c #(+ :a :b)} Similarly,

Re: lazy sequence question

2009-12-09 Thread ataggart
On Dec 9, 9:46 pm, Mark Engelberg mark.engelb...@gmail.com wrote: There are only 9 items that satisfy your predicate.  (take 10 ...) demands a 10th, and it keeps searching the (iterate inc 1) stream forever, endlessly searching for that 10th item it will never find. Aww. You make it sound so

Re: update-in and get-in why no default?

2009-12-10 Thread ataggart
Seconded; I like the intention of both changes, and do something similar in a lot of my code (e.g., parsing functions that take an extra arg if the parse is unsuccessful). Also, testing the type of update-in2's second arg is a bad idea, imo. As for the breaking change of adding another arg to

Re: Code arrangement for understandability

2009-12-10 Thread ataggart
On Dec 10, 11:02 am, Richard Newman holyg...@gmail.com wrote: They're especially useful for inserting println calls for seeing the value of something when I'm debugging; in fact, this is the primary way I do debugging. (defn tee (x)    (println Debug: (prn-str x))    x) (let [x (tee

Re: Code arrangement for understandability

2009-12-11 Thread ataggart
On Dec 11, 1:14 am, ngocdaothanh ngocdaoth...@gmail.com wrote: Do you come from a Python background? For the sake of this discussion, I would say I come from Erlang. Judging by you examples, I looks like you're still getting used to the lisp style of coding.  Everything is a chained

Re: AbstractMethodError question

2009-12-11 Thread ataggart
On Dec 11, 12:27 pm, Keith Irwin keith.ir...@gmail.com wrote: Folks-- I've got a class I can't change which has an abstract method I'd like to override using the proxy macro in Clojure. The class looks something like: public abstract class Foo {    private Map stuff;    private void

Re: AbstractMethodError question

2009-12-11 Thread ataggart
On Dec 11, 12:44 pm, Keith Irwin keith.ir...@gmail.com wrote: On Fri, Dec 11, 2009 at 12:27 PM, Keith Irwin keith.ir...@gmail.com wrote: public abstract class Foo {    private Map stuff;    private void initStuff() {        stuff = new HashMap();        stuff.put(a, new Object());

Re: Idiomatic way to return the key of a map, which matches a vector containing a search value.

2009-12-11 Thread ataggart
On Dec 11, 10:44 am, mudphone kyle...@gmail.com wrote: Thanks for the suggestions. I think since the original version short circuits when it finds a result (using some), that's probably what I have to stick with. Sean's solution does as well. -- You received this message because you are

Re: Code arrangement for understandability

2009-12-11 Thread ataggart
On Dec 11, 10:33 pm, Richard Newman holyg...@gmail.com wrote: (reduce (fn [model f] (assoc model f (inc (get model f 1        {} features)) Do Clojurians usually arrange like that? Can it be rearrange for more understandability? I can't speak for everyone, but I don't think it's

Re: Datatypes and protocols - update

2009-12-11 Thread ataggart
On Dec 11, 4:14 pm, Jason Wolfe jawo...@berkeley.edu wrote: I've been trying out the new branch, and on the whole I like it a lot.  I know it'll take some time to learn how do things properly the new way, and I've figured out how to do most of the things I want to do thus far.  Thanks, Rich!

Re: Datatypes and protocols - update

2009-12-11 Thread ataggart
On Dec 11, 11:44 pm, ataggart alex.tagg...@gmail.com wrote: On Dec 11, 4:14 pm, Jason Wolfe jawo...@berkeley.edu wrote: I've been trying out the new branch, and on the whole I like it a lot.  I know it'll take some time to learn how do things properly the new way, and I've figured

Re: Datatypes and protocols - update

2009-12-12 Thread ataggart
On Dec 11, 11:56 pm, ataggart alex.tagg...@gmail.com wrote: On Dec 11, 11:44 pm, ataggart alex.tagg...@gmail.com wrote: On Dec 11, 4:14 pm, Jason Wolfe jawo...@berkeley.edu wrote: I've been trying out the new branch, and on the whole I like it a lot.  I know it'll take some time

Re: more dumb noob pain (2dplot.clj)

2009-12-12 Thread ataggart
If it's a java project, then you can just select the jars, right- click, choose Build Path Add to Build Path. You can also do it through Project Properties Java Build Path. On Dec 12, 6:32 pm, rebcabin bc.beck...@gmail.com wrote: I got a lot closer thanks to the great hints above; the current

Re: Heap implementation in Clojure

2009-12-15 Thread ataggart
On Dec 14, 5:48 am, Mark Tomko mjt0...@gmail.com wrote: I wrote this implementation of a heap (or priority queue) in pure Clojure: http://pastebin.com/m2ab1ad5a It's probably not of any quality sufficient to be make it to the contrib package, but it seems to work.  Any thoughts on how it

Re: struct-maps and key removal

2009-12-15 Thread ataggart
On Dec 14, 11:23 pm, Richard Newman holyg...@gmail.com wrote: Something I keep bumping into: the SQL library returns rows as struct- maps. Often I want to do things like rename keys (:foo_bar = :foo- bar), strip out :id columns, etc. Nope!    java.lang.Exception: Can't remove struct key

Re: Heap implementation in Clojure

2009-12-15 Thread ataggart
On Dec 15, 1:49 am, ataggart alex.tagg...@gmail.com wrote: On Dec 14, 5:48 am, Mark Tomko mjt0...@gmail.com wrote: I wrote this implementation of a heap (or priority queue) in pure Clojure: http://pastebin.com/m2ab1ad5a It's probably not of any quality sufficient to be make

Re: How to modify the last few elements of a vector

2009-12-16 Thread ataggart
On Dec 16, 10:33 am, samppi rbysam...@gmail.com wrote: I'm using a vector as a stack. I want to apply a function–let's call it modify-element, one argument—to the elements from k to (- (count a- vector) k). Right now, I have something like (not tested yet):   (reduce #(update-in %1 [%2]

Re: A tale of cond, clauses, and the docs

2009-12-20 Thread ataggart
On Dec 19, 8:02 pm, Mike K mbk.li...@gmail.com wrote: [:foo] evaluates to true by virtue of being a keyword. To be precise, it evaluates to true by virtue of it not being nil nor boolean false; being a keyword doesn't really have anything to do with it. user= (cond nil :n false :f (Object.)

Re: Why use monads

2009-12-23 Thread ataggart
I'd appreciate any added detail, since I had a similar reaction to Chouser, thus wasn't really grokking the monad (wikipedia's description is no more helpful). On Dec 22, 2:10 pm, jim jim.d...@gmail.com wrote: Chouser, You're right that maybe-comp is simpler. Once you realize that the

Re: Log4j not detected when using recent jars

2010-01-12 Thread ataggart
Without looking too deeply, I think this is an issue with AOT compiling. As the c.c.logging docs note, the logging impl is chosen at macro-expansion-time. If contrib is fully AOTC'd, then that's when the logging impl will be chosen. There's an assembla ticket on it:

Re: Contrib Logging change

2010-01-12 Thread ataggart
On Jan 12, 12:19 pm, Chris Dean ctd...@sokitomi.com wrote: One downside of the new macros is that there is now one more check done at runtime for every use.  There used to be just the impl-enabled? and now there is a instance? call as well. True. One optimization I could make is to cover the

Re: Contrib Logging change

2010-01-12 Thread ataggart
On Jan 12, 4:46 pm, Timothy Pratley timothyprat...@gmail.com wrote: My thought would be to drop exceptions from normal logging calls. You mean dropping it from the level-specific macros such as error and fatal? I'm inclined to disagree; being able to access the exception instance itself is a

Re: Log4j not detected when using recent jars

2010-01-12 Thread ataggart
On Jan 12, 2:16 pm, Stuart Halloway stuart.hallo...@gmail.com wrote: Is the performance impact of a runtime function call so critical for logging that we need to do this at macro-expansion-time? Yes, insofar as I don't want performance impact to discourage people from peppering their code with

Re: NullPointerException from #' et al.

2010-01-14 Thread ataggart
What do you think should be the boolean result of ( nil 1)? Since the inequality functions only work with Numbers, and nil is not a Number. The only way to make that work would be to impute some default numerical value to nil, which would probably introduce more problems than it solved. On Jan

Compilation-aware code?

2010-01-14 Thread ataggart
Some people have had issues with c.c.logging in that it looks for a suitable logging implementation at macro-expansion-time (by simply trying to import the necessary classes), which thus also occurs during AOT compilation; the down-side is that if the desired logging lib is not on the classpath

  1   2   3   >