Re: eval performance

2009-12-21 Thread Graham Fawcett
On Mon, Dec 21, 2009 at 6:07 PM, Gabi wrote: > The problem with is that I need to execute the same function with > different bindings each time. So caching won't help me > For example I need to do something like: > > (dotimes [_ 1000] >  (intern  'user 'x (rand)) >  (eval '(prn (+(* x x) 5 So

Re: Clojure + Music Notation

2009-12-21 Thread James Sofra
HI, You could look at the Zippers library http://clojure.org/other_libraries which is useful for editing nested structures in a functional way... or perhaps you might use one of the Clojure reference types to hold the notes? Cheers, James On Dec 22, 8:09 am, PM wrote: > I'm a new Clojure user.

Re: eval performance

2009-12-21 Thread kyle smith
Here's the macro I used when I dabbled in Genetic Programming: user> (time (dotimes [_ 1000] (intern 'user 'x (rand)) (eval '(+ (* x x) 5 "Elapsed time: 425.754877 msecs" user> (defmacro capture-vars [vars expr] `(fn [...@vars] ~(first (next expr #'use

Re: eval performance

2009-12-21 Thread Gabi
The problem with is that I need to execute the same function with different bindings each time. So caching won't help me For example I need to do something like: (dotimes [_ 1000] (intern 'user 'x (rand)) (eval '(prn (+(* x x) 5 On Dec 21, 11:53 pm, AlexK wrote: > What eval does, is wra

Re: eval performance

2009-12-21 Thread Meikel Brandmeyer
Hi, Am 21.12.2009 um 22:53 schrieb AlexK: > (defn form->fn [list-to-eval] > (eval (list 'fn [] list-to-eval))) ;this returns a fn Please, make it a habit of writing even such simple code as `(fn [] list-to-eval) (or `(fn [] ~...@list-to-eval) if list-to-eval is a Var or a local). If you make

Re: eval performance

2009-12-21 Thread Gabi
Experimenting with GeneticProgramming with Clojure.. On Dec 21, 11:23 pm, rob wrote: > Sorry, I somehow accidentally sent it before I was done typing.  The > rest of my sentence was "what are you trying to do thar requires the > use of evals in that way". > > On Dec 21, 4:22 pm, rob wrote: > > >

Clojure + Music Notation

2009-12-21 Thread PM
I'm a new Clojure user. I've been working my way through SICP and the videos that accompany it, and I've also read the Clojure book. I already do a lot of work with a music notation library (JMSL) in Java, and I'd like to see if I could do some tasks more simply in Clojure. One of the issues I r

A Help Macro

2009-12-21 Thread Nicolas Buduroi
Hi everybody, I wrote a help macro to make getting help easier within the REPL and thought others might also find it useful. It regroups into one command various helpers found in clojure-contrib: * classpath: classpath * ns-utils: docs, dir, vars * repl-utils: expression-info, show, source The

Re: Eval question

2009-12-21 Thread AlexK
clojure is a lisp, so it has a "real" eval, that works on datastructures, not strings eg. (eval '(+ 1 2)) ; => 3 (eval (list (symbol "+") 1 2)) ; => 3 whenever you write someting like (def x 3), it gets turned into a list with the symbol 'def, the symbol 'x and the number 3, which then is passed

Re: text flow - a trivial generator of RFC like ASCII call flows (sequence diagrams)

2009-12-21 Thread Richard Newman
> Thanks Newman > Useful link! > I'm doing a lot of SIP as well, and I even have a (not so) secret plan > to extend this to create a simple SIP UA simulation. You might be interested in http://github.com/rnewman/clj-sip -- You received this message because you are subscribed to the Google Group

Eval question

2009-12-21 Thread Base
Hi All - I am trying to create a quick and dirty to import all java classes in a directory tree (i.e. - the classes directory) I am able to create the import statements and was thinking of using eval to execute the import. However I cannot get this to work. key line is: (eval (str "(imp

Eval question

2009-12-21 Thread Base
Hi All - I am trying to create a quick and dirty to import all java classes in a directory tree (i.e. - the classes directory) I am able to create the import statements and was thinking of using eval to execute the import. However I cannot get this to work. key line is: (eval (str "(imp

Re: Parenthesis Inference

2009-12-21 Thread ajay gopalakrishnan
I was watching "Pleasantville" again and it reminded me of this whole argument. On Mon, Dec 21, 2009 at 6:39 PM, Joost wrote: > On 21 dec, 15:38, kyle smith wrote: > > Martin, you're trying to argue that some hypothetical 'unwashed > > masses' of programmers won't like clojure because of parent

Why use monads

2009-12-21 Thread jim
Just posted a short piece on why monads are useful. This was prompted by some conversations last week with some folks. Comments, questions and criticisms welcome. http://intensivesystems.net/tutorials/why_monads.html Jim -- You received this message because you are subscribed to the Google Grou

Re: Parenthesis Inference

2009-12-21 Thread Joost
On 21 dec, 15:38, kyle smith wrote: > Martin, you're trying to argue that some hypothetical 'unwashed > masses' of programmers won't like clojure because of parenthesis.  The > problem is you're just assuming it's the parenthesis, and there is no > way to know for sure (short of a peer-reviewed st

Re: eval performance

2009-12-21 Thread AlexK
What eval does, is wrapping (fn* [] ) around its arguments, compiling that, and calling the resulting function object (except if your list starts with a 'do or a 'def). While Clojure's compiler is pretty fast, you should try not to use eval. If you want to pass code around you should try something

Re: eval performance

2009-12-21 Thread rob
Sorry, I somehow accidentally sent it before I was done typing. The rest of my sentence was "what are you trying to do thar requires the use of evals in that way". On Dec 21, 4:22 pm, rob wrote: > It sounds like your use of evals might be something that could be done > better using a more idioma

Re: eval performance

2009-12-21 Thread rob
It sounds like your use of evals might be something that could be done better using a more idiomatic clojure approach. What are you trying to do that re On Dec 21, 2:32 pm, Gabi wrote: > Hi > I have this program that needs to do many eval's to same expression > (eval '(some-list-to-execut..)) >

Re: eval performance

2009-12-21 Thread rob
It sounds like your use of evals might be something that could be done better using a more idiomatic clojure approach. What are you trying to do that re On Dec 21, 2:32 pm, Gabi wrote: > Hi > I have this program that needs to do many eval's to same expression > (eval '(some-list-to-execut..)) >

eval performance

2009-12-21 Thread Gabi
Hi I have this program that needs to do many eval's to same expression (eval '(some-list-to-execut..)) My question is how can this be optimized ? Does eval compile the evaled expression ? Does it re-compile the evaluated expression again and again? Maybe I could compile the evaled expression once

Re: Leiningen in Python

2009-12-21 Thread John
Hi Rob, Thanks for your helpful reply. I have finally had success. On Dec 20, 7:10 pm, Rob Wolfe wrote: > Are you really sure that function `copy-to-jar` looks exactly like this: > ... > I mean `unix-path` function is called twice not only once. Evidently not. So I started from fresh again, jus

Re: text flow - a trivial generator of RFC like ASCII call flows (sequence diagrams)

2009-12-21 Thread Tzach
Thanks Newman Useful link! I'm doing a lot of SIP as well, and I even have a (not so) secret plan to extend this to create a simple SIP UA simulation. On Dec 21, 8:57 pm, Richard Newman wrote: > > I would appreciate your feedback on the code, improvement suggestions > > or any other input. > > T

Re: Second Lisp to Learn

2009-12-21 Thread Richard Newman
> newLISP I've seen enough about newLISP to not bother. http://lambda-the-ultimate.org/node/257#comment-1901 http://groups.google.com/group/comp.lang.lisp/browse_thread/thread/39a9e50aa548637f http://eli.thegreenplace.net/2006/04/20/newlisp-an-intriguing-dialect-of-lisp/ -- You received this

Re: text flow - a trivial generator of RFC like ASCII call flows (sequence diagrams)

2009-12-21 Thread Richard Newman
> I would appreciate your feedback on the code, improvement suggestions > or any other input. This is fantastic, thank you for sharing! I do SIP during the day, so this will come in handy. See also http://www.websequencediagrams.com/ which does a good job for producing images. -- You receiv

Re: Clojure meets Arduino

2009-12-21 Thread Richard Newman
> http://www.flickr.com/photos/nakkaya/4200386988/in/set-72157623036408444/ > > I would very much like to hear your feedback on the code. I watched the movie -- very cool stuff! Great way to spend a weekend :) I only skimmed your code. It looks pretty decent, though there are opportunities for

Re: Second Lisp to Learn

2009-12-21 Thread blackdog
newLISP On Sun, 2009-12-20 at 12:31 -0800, Sean Devlin wrote: > Hi everyone, > After hacking Clojure for a while, I've come to the conclusion that > studying a second Lisp would help. So, what do the people here > think? What is a good Lisp to study? Are there particular dialects & > distributi

Re: Bert Clojure Implementation

2009-12-21 Thread Daniel Simms
On Fri, Dec 18, 2009 at 5:35 PM, Vagif Verdi wrote: > There a binary protocol library http://hessian.caucho.com/ +1 (also, there's a functionally equivalent text protocol, burlap, if you need human readability in some situations, say development or debugging. A common idiom is to use Burlap in

Re: Second Lisp to Learn

2009-12-21 Thread Kevin Downey
instant second lisp: just write your own interpreter On Sun, Dec 20, 2009 at 6:39 PM, Jonathan Smith wrote: > Lisp Flavored Erlang is an extremely interesting lisp. in my opinion. > > You get Erlang, and you also get s-expressions and macros. > > Common Lisp and Scheme are the obvious choices, I

Re: Parenthesis Inference

2009-12-21 Thread kyle smith
Martin, you're trying to argue that some hypothetical 'unwashed masses' of programmers won't like clojure because of parenthesis. The problem is you're just assuming it's the parenthesis, and there is no way to know for sure (short of a peer-reviewed study). Maybe java programmers don't know abou

Re: Clojure and c++ and a bit more

2009-12-21 Thread pmf
On Dec 20, 7:22 pm, nathaniel wrote: > Does anyone know of Clojure features > which rely on Java features that would be prohibitively difficult to > implement in C++? You might run into the problem than any C++ garbage collector you find will probably not be quite as efficient as the JVM's garbag

Re: Call for masters thesis ideas (possibly related to Clojure)

2009-12-21 Thread kyle smith
I also vote for static analysis. People have combined static analysis with data mining to predict software defects. http://scholar.google.com/scholar?hl=en&q=data+mining+software+defects&btnG=Search&as_sdt=2000&as_ylo=&as_vis=0 However, it doesn't look like anyone's tried it with any functional la

text flow - a trivial generator of RFC like ASCII call flows (sequence diagrams)

2009-12-21 Thread Tzach
Hey all, During my day job, I often need to create call flows (sequence diagrams). For formal documents, I mostly used Visio or EventStudio, but when I need something quick and dirty in pure ASCII, these tools are too heavy. For a while I use my own simple CL solution, and now I ported it to Clojur