Re: Examining performance on the JVM

2009-07-19 Thread Dimiter "malkia" Stanev
Great question! I've been wondering the same, and I've found great answers here. But here is how I was able to get some of the assembly (in normal JVM, not debug), but for small portions of code - for example this is how I was able to see the point-in-poly algorithm. Basically I put a tight loop

Re: Slime - Clojure Installation

2009-07-19 Thread Dimiter "malkia" Stanev
Here is my script for updating clojure on Mac/Linux - update-clojure.sh or on Windows (uses cygwin git) - update-clojure.bat git clone git://github.com/richhickey/clojure.git cd clojure git pull ant clean ant cd .. git clone git://github.com/richhickey/clojure-contrib.git cd clojure-contrib git

Re: clojure-mode install on Windows XP does not work, for me

2009-05-19 Thread Dimiter "malkia" Stanev
ure-extra-vm-args '("-Xmx102400" "-server" "- Duser.dir=/Users/malkia/p/")) '(swank-clojure-java-path "/System/Library/Frameworks/ JavaVM.framework/Versions/1.6.0/Home/bin/java")) It works :) On May 19, 9:38 pm, "Dimiter \"malkia\"

Re: clojure-mode install on Windows XP does not work, for me

2009-05-19 Thread Dimiter "malkia" Stanev
I have now the same problem, but under Mac OS X 10.5 Things used to work few days ago (if not yesterday) On May 18, 7:32 am, klang wrote: > First things first: > > swank doesn't load and slime can't connect to the *inferior-lisp* > running clojure > > I am missing something obvious, please advi

Re: Help with Type Hint

2009-05-14 Thread Dimiter "malkia" Stanev
This is the best I was able to come up with in Clojure: (defn byte-array-contains? [coll key] "scans a byte array for a given value" (let [c (int (count coll)) k (byte key)] (loop [i (int 0)] (if (< i c) (if (= k (aget coll i)) true (recur (unchec

Re: Stack Overflow problem with Maps

2009-04-27 Thread Dimiter &quot;malkia&quot; Stanev
Unless you provide some kind of isolated source code that reproduces the problem, I don't think it is going to be easy to help you out. But try adding "(doall ..)" to some your "map" calls and others. Even better, look at this excellent explanation why this might be happening by Cristophe Grand:

Re: Bit-level operations

2009-04-23 Thread Dimiter &quot;malkia&quot; Stanev
> Or maybe just: > (defn mo [op & args] (reduce op args)) I believe that won't make clojure make a faster code, but I might be wrong. I think the macroexpansion is the right thing if you want speed, as it seems clojure could optimize well this: (+ a b) while it can't optimize this well (+ a b

Re: Bit-level operations

2009-04-23 Thread Dimiter &quot;malkia&quot; Stanev
Here's even more concise version: (defmacro mo [op & args] (reduce (fn [& ab#] (cons op ab#)) args)) On Apr 23, 9:23 pm, "Dimiter \"malkia\" Stanev" wrote: > You can make your own macro to do that: > > (defmacro mo [op & args] >   (reduce (fn

Re: Bit-level operations

2009-04-23 Thread Dimiter &quot;malkia&quot; Stanev
You can make your own macro to do that: (defmacro mo [op & args] (reduce (fn [a# b#] (cons op [a# b#])) args)) (mo + 1 2 3 4) (print "expanded=" (macroexpand '(mo + 1 2 3 4)) "\n") ;expanded= (+ (+ (+ 1 2) 3) 4) On Apr 23, 5:57 pm, Kevin Van Horn wrote: > I'm writing an application that ne

Swing Java example to Clojure - Question about better translation

2009-04-23 Thread Dimiter &quot;malkia&quot; Stanev
(addContainerGap 21 Short/MAX_VALUE)))))) (. pane setLayout layout) (doto frame (.pack) (.setVisible true Thanks, Dimiter "malkia" Stanev --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Googl

Re: Recursively delete files

2009-04-22 Thread Dimiter &quot;malkia&quot; Stanev
Duh... Ignore me :) - I don't have really an explanation for what I wrote, but I got confused really badly! hehehe On Apr 22, 5:16 pm, "Dimiter \"malkia\" Stanev" wrote: > I think this might come from Common Lisp (or Scheme, not sure). > > In anycase CL also

Re: Recursively delete files

2009-04-22 Thread Dimiter &quot;malkia&quot; Stanev
I think this might come from Common Lisp (or Scheme, not sure). In anycase CL also has "unless" which is exactly the opposite of "when" - e.g. it would do the "else" part of "if". http://www.lispworks.com/documentation/HyperSpec/Body/m_when_.htm Basically some of the Common Lispers are saying t

Re: cannot use swig native shared libraries

2009-04-22 Thread Dimiter &quot;malkia&quot; Stanev
I might be wrong, but shouldn't you compile the .c file to .o with "-fpic", and then link with ld with "-shared"? maybe just adding "-fpic" to: gcc -fpic -shared ${JNI_CFLAGS} swig_test_wrap.c -o libswig_test.so might do it. On Apr 22, 6:41 am, "Antonio, Fabio Di Narzo" wrote: > Hi all. > I'

Re: StackOverflowError Question

2009-04-21 Thread Dimiter &quot;malkia&quot; Stanev
AndOutputCollection)] (trainPerceptron weights inputs outputs))) --- On Apr 21, 12:58 am, jleehurt wrote: > Hi Dimiter, > > Thank you! I'm still a bit confused as to why this was happening. Does > lazy evaluation not work well with recursion? > > On Apr 2

Re: StackOverflowError Question

2009-04-20 Thread Dimiter &quot;malkia&quot; Stanev
t; (time (main 100)) "Elapsed time: 8314.617 msecs" ((0.5 50.5)) user> (time (main 1000)) ; Evaluation aborted. ;; Actually not stack overflow, but HEAP overflow (it took a while though) user> Thanks, Dimiter "malkia" Stanev. On Apr 20, 10:01 pm, jleehurt wrote:

Improving clojure.jar/clojure-contrib.jar compression (ClassLoader alternatives)

2009-04-17 Thread Dimiter &quot;malkia&quot; Stanev
I'm asking here question not directly related to Clojure, but related to the JVM: Is there any alternative (ClassLoader?) to store the .class files in a different compressed format?.NET can store lots of classes in one assembly? Is there something like that for JVM? For example right now clojure

Re: Shouldn't "doto" be named just "with"

2009-03-07 Thread Dimiter &quot;malkia&quot; Stanev
Yes, that's a very good point. For example "with" in Common Lisp is used also when dealing with external resources (with-open-file, etc.). And also the point about other with- usages. On Mar 7, 10:31 am, Dan wrote: > On Fri, Mar 6, 2009 at 7:51 PM, rzeze...@gmail.com wrote: > > > I think good a

Re: Shouldn't "doto" be named just "with"

2009-03-06 Thread Dimiter &quot;malkia&quot; Stanev
Thanks for the explanation guys! Having learned other languages, sometimes makes you wanna have the MEMORY UNDO FEATURE! On Mar 6, 3:37 pm, Meikel Brandmeyer wrote: > Hi, > > Am 07.03.2009 um 00:23 schrieb Laurent PETIT: > > > I'm not sure about this, but I think doto is named after the   > > c

Shouldn't "doto" be named just "with"

2009-03-06 Thread Dimiter &quot;malkia&quot; Stanev
I've just started using doto, after seeing the celsius example on the Clojure page, but It brought back memories from Pascal days - http://csci.csusb.edu/dick/samples/pascal.syntax.html#with_statement It's probably nothing, but to me (with x (.Function1) (.Function2)) seems more readable than (do

Re: pmap slower than map when reducing

2009-03-06 Thread Dimiter &quot;malkia&quot; Stanev
o leave parallelism as an option > to the client of your library. > Are you using the latest build? pmap now uses Java futures and they run in > a cached thread pool. If so, try running the algorithm a few times and see > if it speeds up as the thread pool winds up. > > On Fri, M

Re: What is Clojure NOT good for?

2009-03-06 Thread Dimiter &quot;malkia&quot; Stanev
Clojure is not good for: - Real time application development, due to the JVM being soft-real time. For example it can't be used for high-performance video pc/ console games, but it could be used for lots of turn-based games. Then again anything done with XNA on the XBOX could be done with Cloju

Re: pmap slower than map when reducing

2009-03-06 Thread Dimiter &quot;malkia&quot; Stanev
Hi guys, anyone has an insight into the problem I'm running into? On Mar 4, 2:27 am, "Dimiter \"malkia\" Stanev" wrote: > Hi guys, > > In the example below, if map is replaced with pmap, it goes twice > slower on my MBP (2 CPUs). > > I believe it'

pmap slower than map when reducing

2009-03-04 Thread Dimiter &quot;malkia&quot; Stanev
(pnpoly npol xp yp 0.5 -1.25) (pnpoly npol xp yp -0.5 -2.5))) (range 0 100) Thanks, Dimiter "malkia" Stanev --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Googl

Re: challenge: best fibo implementation under the new laziness?

2009-02-24 Thread Dimiter &quot;malkia&quot; Stanev
And this is by using "java -server", not "java -client", right? On Feb 23, 2:46 pm, Raffael Cavallaro wrote: > On Feb 23, 2:51 pm, "Stephen C. Gilardi" wrote: > > > The fibs implementation in clojure.contrib.lazy-seqs is not a function   > > that returns fib(n) given n. > > I think defining a f

slime (swank-clojure) no longer working

2009-02-18 Thread Dimiter &quot;malkia&quot; Stanev
Hi guys, I've just updated to the latest (1289) version of clojure, and swank- clojure (slime) doesn't work anymore Here is what I'm getting from emacs: (add-classpath "file:Users/malkia/p/swank-clojure/") (require 'swank.swank) (swank.swank/ignore-protocol-version "2009-02-14") (swank.swan

Re: loop [#^Integer c 0] vs. loop [c (int 0)] and optimization question...

2009-02-13 Thread Dimiter &quot;malkia&quot; Stanev
On Feb 13, 5:35 am, Vincent Foley wrote: > Dimiter, > > The latest revision of Clojure is r1278; are you using the Google code > trunk? > > Vincent Thanks, Vincent! I kept wondering why I don't see any more versions, I was till on the sourceforge one. --~--~-~--~~~---

loop [#^Integer c 0] vs. loop [c (int 0)] and optimization question...

2009-02-13 Thread Dimiter &quot;malkia&quot; Stanev
l wanted to see what I can do more with it. For example the same example in Python, Ruby or Perl runs at least for 200s (same with CLISP, haven't tried ECL or GCL). Thanks, Dimiter "malkia" Stanev. --~--~-~--~~~---~--~~ You received this message becau