Re: Mersenne Twister

2010-05-28 Thread Lauri Pesonen
Hi Paul, On 27 May 2010 23:24, Paul Moore p.f.mo...@gmail.com wrote: Can someone recommend a good Mersenne Twister implementation I could use? A web search finds a number of implementations in Java - presumably I can use these via Java interop - is that a sensible thing to do? It is very

Re: autoloading code at repl startup

2010-05-18 Thread Lauri Pesonen
On 11 May 2010 11:59, Lauri Pesonen lauri.peso...@iki.fi wrote: At least in my setup ~/.clojure/user.clj does not get loaded unless ~/.clojure is in the JVM classpath. (replying to myself) So I've made this work with swank-clojure-project by adding this to my emacs config: (add-hook 'swank

autoloading code at repl startup

2010-05-11 Thread Lauri Pesonen
Hi all, How do people autoload code in their repl at startup? I'd like to specify code that would be loaded into each repl that I start with slime. E.g. (use 'clojure.contrib.repl-utils) and (set! *warn-on-reflection* true). Not being able to do this easily means that I don't use e.g. the

Re: autoloading code at repl startup

2010-05-11 Thread Lauri Pesonen
On 11 May 2010 10:55, Tassilo Horn tass...@member.fsf.org wrote: I think ~/.clojure/user.clj is evaluated on each clojure startup, so you could add that code there. At least in my setup ~/.clojure/user.clj does not get loaded unless ~/.clojure is in the JVM classpath. Tassilo -- ! Lauri

Re: Clojure Concurrency Screencast Available

2010-04-20 Thread Lauri Pesonen
On 20 April 2010 15:41, Craig Andera craig.and...@gmail.com wrote: Yep: that's good advice, although I can't say I find much in emacs to be basic, even after using it casually for 20 years :). The one I tended to use in the tutorial (in case someone saw it flash by in the minibuffer) is C-x

Re: Image scaling libraries. Request for recommendations

2009-12-14 Thread Lauri Pesonen
Hi Fred, 2009/12/14 Frédéric Morain-Nicolier f.nicol...@gmail.com: As far as I can tell, ImageJ isn't really suited for headless tasks, which is what I want to do; I want to run some image processing in the backend of a web app. I guess I'm going to try JAI first. Not sure to understand. By

Re: variation of time macro

2009-12-14 Thread Lauri Pesonen
2009/12/14 jan jan.mare...@gmail.com: Shawn Hoover shawn.hoo...@gmail.com writes: I see usages of the time macro that wrap the expression of interest in a call to dotimes. Is there any interest in an overload of time that takes an additional parameter for a number of iterations, evaluates the

Re: Image scaling libraries. Request for recommendations

2009-12-14 Thread Lauri Pesonen
Hi Albert, 2009/12/14 Albert Cardona sapri...@gmail.com: On Mon, Dec 14, 2009 at 10:08 AM, Lauri Pesonen lauri.peso...@iki.fi wrote: IIRC Java AWT-based libraries require a windowing system on the machine. On Windows this is not a big deal since you're always running a windowing system, even

Re: Getting Started in Mac OS X Snow Leopard

2009-12-07 Thread Lauri Pesonen
Thanks everyone for the recommendations. 2009/12/4 Steve Purcell st...@sanityinc.com: Here's what I do (in Cocoa Emacs 23) to make 'option' work the same in Emacs as in other OS X apps:  (setq mac-command-modifier 'meta)  (setq mac-option-modifier 'none)  (setq default-input-method

Re: Getting Started in Mac OS X Snow Leopard

2009-12-04 Thread Lauri Pesonen
2009/12/2 Matthew Williams matthew.d.willi...@gmail.com: Using the Cocoa build of Emacs 23 (http://www.emacsformacosx.com) I was able to get up and running extremely quickly with Technomancy's swank-clojure install. This is very much off-topic, but... How do you type ''#' in the Cocoa build

Re: Query regarding `conj'

2009-11-27 Thread Lauri Pesonen
Hi Nipra, 2009/11/27 nipra prabhakar.nik...@gmail.com: Hi,  (rest *v1) is equal to *v2 in the below mentioned example. Then why  `conj' operation on them is returning different things. user (def *v1 [1 2 3 4 5]) #'user/*v1 user (def *v2 [2 3 4 5]) #'user/*v2 user (= (rest *v1) *v2) true

Re: AOT'd namespaces lose their metadata

2009-11-23 Thread Lauri Pesonen
2009/11/23 Phil Hagelberg p...@hagelb.org: I noticed an odd bug when working on the help command for leiningen. It uses docstrings on metadata for help output, but when AOTing the project, the docstrings (as well as all other metadata) would be lost. Note that this doesn't happen when

Re: swap two elements in an arbitrary collection

2009-11-19 Thread Lauri Pesonen
2009/11/18 Jacek Laskowski ja...@laskowski.net.pl: user= (macroexpand '(- v (assoc i (v j)) (assoc j (v i (assoc (clojure.core/- v (assoc i (v j))) j (v i)) How to expand the macro in the subform above? You can use clojure.walk/macroexpand-all: (clojure.walk/macroexpand-all '(cond

Re: swap two elements in an arbitrary collection

2009-11-13 Thread Lauri Pesonen
Hi Mark, 2009/11/13 Mark Tomko mjt0...@gmail.com: I notice you used the '-' macro.  Perhaps I'm a little dense, but I haven't found the documentation for it to be terribly helpful.  Do you have simple, succinct explanation for what it does? The - macro calls the given forms with the return

Re: Help with anonymous functions

2009-10-25 Thread Lauri Pesonen
Hi John, 2009/10/25 jsrodrigues john.s.rodrig...@gmail.com: When I try the following: user= (into {} (map #([% (* % %)]) [1 2 3 4])) The #(...) form assumes that the is a function call and thus it is implicitly wrapped in parens. That is, #(+ % %) becomes (fn [x] (+ x x)). So in your code

Re: Neophyte question

2009-10-21 Thread Lauri Pesonen
Hi Mark, 2009/10/21 Mark Nutter manutte...@gmail.com: (defn blank? [s] (every? #(Character/isWhitespace %) s)) snip user= (defn hexchar? [c] (re-find #[0-9A-Fa-f] c)) snip user= (defn hex? [s] (every? #(hexchar? %) s)) #'user/hex? nil user= (hex? a) #CompilerException

Re: Neophyte question

2009-10-21 Thread Lauri Pesonen
2009/10/21 John Harrop jharrop...@gmail.com: Like this? (def hexchar? #{\0 \1 \2 \3 \4 \5 \6 \7 \8 \9 \A \a \B \b \C \c \D \d \E \e \F \f}) Yep, that's what I had in mind as well, but I got tired of typing ;-) -- ! Lauri --~--~-~--~~~---~--~~ You received

Re: What does this error mean?

2009-10-09 Thread Lauri Pesonen
2009/10/8 John Harrop jharrop...@gmail.com: java.lang.ClassFormatError: Unknown constant tag 52 in class file queries__init (Trial.clj:0) Almost certainly, it occurs in some part of the code that works on a class's bytecodes either directly on disk or in the form of an unstructured Java

Re: Java translation problem

2009-10-09 Thread Lauri Pesonen
2009/10/9 tommy c wheels...@gmail.com: I'm trying to translate a java lucene indexer to clojure. This java line is bothersome:  writer = new IndexWriter(dir, new SimpleAnalyzer(), true, IndexWriter.MaxFieldLength.UNLIMITED); MaxFieldLength is an inner class in IndexWriter and UNLIMITED is

Re: Two minor typos in the cheatsheet

2009-10-02 Thread Lauri Pesonen
Hi, 2009/10/2 Miron Brezuleanu mbr...@gmail.com: Hello, I assume this is about the cheatsheet at http://clojure.org/cheatsheet The odd/even typos are in the PDF version. Some suggestions: add update-in, assoc-in, get-in in the 'Maps' section;  Add the ignore-next-form #_ reader macro in

Re: minor grievance with arithmetic on characters

2009-09-11 Thread Lauri Pesonen
2009/9/11 Rich Hickey richhic...@gmail.com: We should fix the doc. Patch welcome for this. Ticket #189 - I've provided a patch following Stephen's suggested doc string. Rich -- ! Lauri --~--~-~--~~~---~--~~ You received this message because you are

Re: How do I access a Java list element?

2009-09-11 Thread Lauri Pesonen
2009/9/11 carey carey.pridg...@gmail.com: (. dataLoader  getEnvironmentParticleSet) But what I want is to go through the list that this method returns and get the name of each particle in the list. I now that in Java this would be (inside some form of loop)

Re: How do I access a Java list element?

2009-09-11 Thread Lauri Pesonen
2009/9/11 Richard Newman holyg...@gmail.com: Where I'm stuck is how to get access to the particle names, as I would in the above line of Java code. The final bit, once you have an iterator over particles, would be: (fn [p] (.getName p)) To avoid the use of reflection, you might want

Re: Two possible additions: non-reflective classobject calls support for map-conj on arrays

2009-09-01 Thread Lauri Pesonen
Hi Karl, 2009/8/31 Krukow karl.kru...@gmail.com: 2) I can do: user (into {} '([:k :v])) {:k :v} This works for two-element vectors. However, I cannot do the same for two-element arrays: user (def str_array (.split k=v =)) #'user/str_array user (into {} (list str_array)) ; Evaluation

Re: help with clojure + slime

2009-08-30 Thread Lauri Pesonen
2009/8/30 mlm michael.l.ma...@gmail.com: (setq swank-clojure-extra- classpaths      (list /opt/clojure/clojure-contrib/clojure-contrib.jar:/opt/clojure/swan\ k-clojure/swank/swank.clj)) Try changing the swank-clojure bit to point to the directory rather than the .clj file, i.e. either

Re: Newbie - the method I cannot call

2009-08-25 Thread Lauri Pesonen
Hi, 2009/8/25 icemaze icem...@gmail.com: (.open sdl format (* 48000 2 2)) Add a type hint to the sdl operand: (.open #^SourceDataLine sdl fmt (* 48000 2 2)) -- ! Lauri --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: Overflow by (inc) and (dec) at integer boundaries?

2009-08-20 Thread Lauri Pesonen
Hi Rich, 2009/8/19 Rich Hickey richhic...@gmail.com: On Fri, Aug 14, 2009 at 6:28 AM, David Powelldjpow...@djpowell.net wrote: user= (.getClass (+ 1 Integer/MAX_VALUE)) java.lang.Long Also, user= (def i (Integer/MAX_VALUE)) user= (class (+ 1 i)) java.lang.Long user= (class (inc

Re: Augmenting the defn attr-map

2009-08-13 Thread Lauri Pesonen
2009/8/12 Chas Emerick cemer...@snowtide.com: On Aug 12, 2009, at 3:19 PM, Mark Volkmann wrote: I didn't release it was valid to define names with colons in them. Maybe that shouldn't be allowed. I'd like to be able to specify type hints using UML-like syntax like the second example from

Commenting Code (Was: Re: Clojure as a First Language)

2009-08-09 Thread Lauri Pesonen
2009/8/8 Luc Prefontaine lprefonta...@softaddicts.ca: I totally agree no comments is not good at all but JavaDoc style comments in Clojure ? I pray you all, please stay away of it : I was quite taken by this scheme style guide recently: http://mumble.net/~campbell/scheme/style.txt While

Re: a better reductions?

2009-08-07 Thread Lauri Pesonen
Hi Stuart, 2009/8/6 Stuart Halloway stuart.hallo...@gmail.com: On the plus side, it appears to be faster (as collections grow large), and it doesn't cheat by introducing an atom. On the minus side it isn't as pretty as the one in contrib. While maybe not as pretty as the one in contrib,

Re: Package manager proposal

2009-08-07 Thread Lauri Pesonen
2009/8/6 James Reeves weavejes...@googlemail.com: On Aug 6, 8:31 pm, Howard Lewis Ship hls...@gmail.com wrote: I'm cringing at the sight of XML here. XML is frequently overused, but it is a good format for representing dense, structured data. For example: repository name=third-party  

Re: Clojure as a First Language

2009-08-06 Thread Lauri Pesonen
Seth, 2009/8/6 Seth seth.schroe...@gmail.com: I hope that learning a Lisp first is a good idea for novice programmers, because I intend to inflict Clojure on my poor children. (They didn't take to http://scratch.mit.edu/ and Google's rehash of BASIC is a non-starter). There was a post

Re: Package manager proposal

2009-08-06 Thread Lauri Pesonen
Hi Meikel, 2009/8/5 Meikel Brandmeyer m...@kotka.de: Well, this is independent of whether you have a C or Java library. You can install each C library in its own directory and tell the linker to look there. Then you have basically a .jar like setup: If you don't tell the linker the right

Re: Package manager proposal

2009-08-05 Thread Lauri Pesonen
2009/8/4 Meikel Brandmeyer m...@kotka.de: I think, clojure context is underestimating things. The high integration of external Java libraries makes it necessary that such dependencies can be handled in the same way. Agreed. I was actually going to write that whatever approach is chosen it

Re: Package manager proposal

2009-08-04 Thread Lauri Pesonen
2009/8/4 James Reeves weavejes...@googlemail.com: On Aug 4, 12:51 pm, Krešimir Šojat kso...@gmail.com wrote: In your project you would create standard ivy.xml and ivysettings.xml files as described on Ivy site. Download Ivy (and Ant jars if you will create or use Packagers). After that you

Re: fibonacci sequence using lazy-cat

2009-07-29 Thread Lauri Pesonen
Hi swaroop, 2009/7/29 swaroop belur swaroop.be...@gmail.com: fibonacci sequence using lazy-cat : (def fibs (lazy-cat [0 1]   (map + fibs (rest fibs I am trying to understand how this works ..not sure i fully comprehend it. Can anyone please explain how clojure evaluates this. I'll

Re: simple debugging utility

2009-03-24 Thread Lauri Pesonen
2009/3/24 Mark Volkmann r.mark.volkm...@gmail.com: Thanks! It looks like I don't need the let now. Does a macro have to evaluate to one form? For example, this works, but it seems I can't drop the do. (defmacro dump [expr]  `(do     (print (quote ~expr))     (println = ~expr))) How

Re: Queues

2009-02-03 Thread Lauri Pesonen
2009/2/3 Konrad Hinsen konrad.hin...@laposte.net: Is there any reason to prefer lists over vectors or vice versa for implementing queues? It seems that for both lists and vectors, adding and removing at one end (front for lists, end for vectors) is cheap, whereas it is expensive at the other

Re: DISCUSS: replace (rand)

2008-12-02 Thread Lauri Pesonen
2008/12/2 Stuart Halloway [EMAIL PROTECTED]: Cool, that's much better. Can we establish that all (or all important) Java 5+ VMs use AtomicLong in next? While compare-and-swap is a lot better than a mutex, it's still not free. IIRC a CAS is one (or maybe two) order(s) of magnitude more