Re: can Clojure 1.3 code always be made as fast as Java for numeric computations?

2012-03-26 Thread Daniel Solano Gomez
On Mon Mar 26 15:15 2012, Cedric Greevey wrote: > > What you're running into is the overhead of get the root value of vars > > like swap! and move-up!.  The only way to avoid this is use something > > like definline. > > I thought that in 1.3 those had been made much faster to access if > they did

Re: GSOC Idea: Interactive documentation with autodoc

2012-03-26 Thread Daniel Solano Gomez
On Mon Mar 26 16:11 2012, Zack Maril wrote: > Here's one way of going about getting the bare bones for examples: > > Simple examples with autodoc: > http://clojure-examples.herokuapp.com/clojure.core-api.html#clojure.core/+ > > The changes to autodoc required to make this happen: > https://github

Re: can Clojure 1.3 code always be made as fast as Java for numeric computations?

2012-03-26 Thread Daniel Solano Gomez
Hello, Having given a talk on precisely this topic at Clojure/West, I may be able to give you a couple of hints and explanations. You can find the slides at , and I am planning o

Re: Precondition asserts in macros

2012-03-20 Thread Daniel Solano Gomez
Hello, I am not sure that anything has changed between Clojure 1.2.1 and Clojure 1.3.0 with respect to pre- and post-conditions. However, I think I have any idea as to what may be going on. On Tue Mar 20 05:34 2012, Shantanu Kumar wrote: > Hi, > > The way preconditions are invoked in Clojure 1.

Re: clojure on android over CLI

2012-03-09 Thread Daniel Solano Gomez
On Fri Mar 9 02:44 2012, Rostislav Svoboda wrote: > On 8 March 2012 11:14, Jim - FooBar(); wrote: > > There is a clojure repl for android... > > Jim, my goal is to be able to write android apps in clojure. But to > develop an app in clojure on a PC is pain: The android emulator eats a > lot of m

Re: clojure on android over CLI

2012-03-08 Thread Daniel Solano Gomez
Hello, On Thu Mar 8 02:43 2012, Rostislav Svoboda wrote: > Hi. I'm trying to run: > java -cp clojure-${VERSION}.jar clojure.main > > on an Android phone from bash (using the 'terminal-ide' app) but I > can't make it past the error bellow. I did the jar-to-dex conversion > using: > dx --v

Re: Is it possible to extend a parameterized type using gen-class?

2012-03-02 Thread Daniel Solano Gomez
On Thu Mar 1 21:53 2012, sim wrote: > Hi all, > > This has me stumped and I found another message: > https://groups.google.com/forum/?fromgroups#!searchin/clojure/parameterised$20type/clojure/8YxzIYXH49c/xCxkMaGXBzUJ > > > that says it isn't possible, but that was back in 2009, is it still no

Re: Google Summer of Code 2012: We need mentors!

2012-02-28 Thread Daniel Solano Gomez
ee what I can do to coordinate at the conference. Sincerely, Daniel > David > > On Mon, Feb 27, 2012 at 1:18 PM, Daniel Solano Gomez > wrote: > > > On Mon Feb 27 12:08 2012, David Nolen wrote: > > > We need mentors as much as we need students. > > > > &g

Re: Google Summer of Code 2012: We need mentors!

2012-02-27 Thread Daniel Solano Gomez
On Mon Feb 27 12:08 2012, David Nolen wrote: > We need mentors as much as we need students. > > There are many great projects inside and outside of contrib. If you own a > project that could use documentation, new work, visual design, *anything*, > please consider taking the 5-10 minutes to write

Re: ANN: A new Clojure brush for syntax highlighter

2011-11-20 Thread Daniel Solano Gomez
On Sat Nov 19 13:46 2011, Andrew Brehaut wrote: > I have written a new brush for the javascript Syntax Highlighter to > replace sh-clojure. Rather than using the typical regex system, it has > a full parser and simple form annotator. This should result in > significantly better highlighting than ea

Re: Relationship between .clj and .class files?

2011-11-17 Thread Daniel Solano Gomez
On Thu Nov 17 09:06 2011, Terje Dahl wrote: > What is the relationship between the .clj source-file(s) and its gen- > class compiled class-files? > > The reason I ask is that my app is an applet, written in Clojure > (obviously), and compiled. > The resulting class-files are then bundled into a ja

Re: Clojure Conj extracurricular activities spreadsheet

2011-11-10 Thread Daniel Solano Gomez
The Clojure development with Android BoF session will be in the Willow Oak room from 6-7 this evening. On Fri Oct 28 12:41 2011, blcooley wrote: > > > On Oct 27, 5:41 pm, Daniel Solano Gomez wrote: > > > > I'd like to propose a new activity: Android.  It'd be mo

Re: Clojure Conj extracurricular activities spreadsheet

2011-10-27 Thread Daniel Solano Gomez
On Tue Oct 25 14:10 2011, Roger Austin wrote: > One idea would be to organize something for people wanting to set up local > clojure meetups. I don't think this needs to be a BOF, but I don't know the > best > way to promote the idea. > > Anyone coming with family and/or spouse-dates? If so, le

Re: Idiomatically returning one or two values from a function.

2011-09-28 Thread Daniel Solano Gomez
On Wed Sep 28 18:52 2011, Daniel Pittman wrote: > G'day. > > I have problem that I have been thrashing back and forth over the best > design of for a week now, and I can't work out the nicest way to > handle it. Specifically, I have a collection of functions that return > a primary result, and mi

Re: can't see the error

2011-09-25 Thread Daniel Solano Gomez
On Sun Sep 25 21:51 2011, Dennis Haupt wrote: > (let [rand (new java.util.Random) nextInt (fn [a] (.nextInt rand))] > ((map (print) (iterate ((nextInt "dummy") 0) > > > the error is: > java.lang.ClassCastException: java.lang.Integer cannot be cast to > clojure.lang.IFn (NO_SOURCE_FILE:0) > >

Re: apply func

2011-09-25 Thread Daniel Solano Gomez
On Sun Sep 25 06:38 2011, Vincent wrote: > I cannot understand why this does'nt work > (apply inc [1 2 3 4]) ; apply inc to each vector element From the documentation: clojure.core/apply ([f args* argseq]) Applies fn f to the argument list formed by prepending args to argseq. This means

Re: android / mobile help

2011-09-16 Thread Daniel Solano Gomez
On Fri Sep 16 10:24 2011, Raoul Duke wrote: > hi, > > i dream of having a remote repl onto e.g. android so that i can try to > reduce the write-push-run-test-debug-repeat cycle time. pretty please, > does anybody have insights / experience / git hub forks / ideas about > this? getting to a point w

Re: Can't "recur" from within a "catch" expression.

2011-03-18 Thread Daniel Solano Gomez
On Thu Mar 17 21:49 2011, Fiel Cabral wrote: > Hello Clojure users, > This is a dumb question but I'd like to write something equivalent to this > in Clojure: > > public String loop_with_exception(int retries) > { > for (int n = retries; n > 0; n--) { > try { > return some_io_operation

Re: almost abusing the system... defmutabletype

2011-03-18 Thread Daniel Solano Gomez
On Fri Mar 18 18:33 2011, Sunil S Nandihalli wrote: > I wanted to define a bunch of types which were mutable to be used in > defining a cyclic data structure. So, I wrote the following macro... > > … code sample … > > although not idiomatic clojure .. thought some of you may find it useful. > Sun

Re: Polymorphic functions in Clojure (or how to stop thinking in objects)...

2011-03-15 Thread Daniel Solano Gomez
On Tue Mar 15 09:21 2011, Alan wrote: > On Mar 14, 8:15 pm, Daniel Solano Gomez wrote: > > I believe there are two approaches to doing this in Clojure: > > > > 1. Multimethods:http://clojure.org/multimethods > > 2. Protocols:http://clojure.org/Protocols > >

Re: Polymorphic functions in Clojure (or how to stop thinking in objects)...

2011-03-14 Thread Daniel Solano Gomez
On Mon Mar 14 19:54 2011, stu wrote: > The problem I have is with the myshapes.picture/draw function. As a > Clojure newb I keep wanting to think of this like a polymorphic > function in the O-O world that relies on each sequence member having a > draw function. > > What's the idiomatic way of han

Re: Multiple replacements in string using a map

2011-03-14 Thread Daniel Solano Gomez
On Mon Mar 14 13:02 2011, shuaybi2 shuaybi2 wrote: > I have a string such as: > > "select * from account where acctId = _ACCT-ID_ and acctTyp = _ACCT-TYP_" > > I have a map such as: > > {:_ACCT-ID_ 9876 :_ACCT-TYP "B"} > > I want to write a clojure function that will take the string and map as

Re: Macros, macros, macros

2011-03-08 Thread Daniel Solano Gomez
On Wed Mar 9 11:16 2011, Andreas Kostler wrote: > Hi all, > > I need a macro to basically outputs this: > > (macroexpand '(chain-field-queries record "location" "name" "country")) > (. (. (. record (field "location")) (field "name")) (field "country")) > > Which chains method calls on a java ob

Re: using records in Java

2011-03-03 Thread Daniel Solano Gomez
On Thu Mar 3 13:48 2011, Aaron Cohen wrote: > On Wed, Mar 2, 2011 at 11:38 PM, Earl J. Wagner > wrote: > > > > > Then I try to compile Java code to use it: > > > > import java.lang.reflect.Method; > > import t.core; > > import t.core.TRecord; > > > > Attempting to compile this with the jar in th

Re: load-file, and new function definitions not catching at the REPL

2011-03-03 Thread Daniel Solano Gomez
On Thu Mar 3 09:39 2011, Sam Ritchie wrote: > Is there a way to call commands from a JVM process's REPL in any way other > than pasting it in to that REPL? Specifically, is there a way to tell an > active REPL to re-enter its current namespace? I'm not sure if this answers your question, but have

Re: A blocking function

2011-03-02 Thread Daniel Solano Gomez
On Wed Mar 2 15:44 2011, clj123123 wrote: > In a multi thread app, is there a way to mark a function to be > blocking so it can run not simultaneously but would be blocking for > each thread? You could try the locking macro. For this you need an object to lock on. I suppose you could lock on th

Re: Passing vars

2011-02-21 Thread Daniel Solano Gomez
> Is that considered bad practice and if so can you think of a nicer way > of doing it? It seems like a very weird API... Is there a way I can > pass in the function and determine its var internally? Is there some > alternative/better way of determining function uniqueness or will I > always be def

Re: how can I call java method that requires Foo[] as argument?

2011-02-20 Thread Daniel Solano Gomez
On Sun Feb 20 19:13 2011, B Smith-Mannschott wrote: > The class SVNCommitClient [1] defines two overloads of doMkDir. I'm > trying to call the two argument version: > > SVNCommitInfo doMkDir(SVNURL[] urls, String commitMessage) > > [1] http://svnkit.com/javadoc/org/tmatesoft/svn/core/wc/SVNCo

Re: Docstring on def

2011-02-20 Thread Daniel Solano Gomez
On Sun Feb 20 17:30 2011, Paul Richards wrote: > I've been trying to add docstrings to my constants that are defined > using 'def'. According to the webpage[1] I should be able to write: > > (def pi "hello" 3.14) > > But this fails with: > java.lang.Exception: Too many arguments to def (NO_SOURC

Re: First N unique random floats from a lazy seq

2011-02-18 Thread Daniel Solano Gomez
On Fri Feb 18 15:38 2011, Alan wrote: > user=> (take 100 (distinct (repeatedly #(rand-int 200 > (100 55 65 188 90 150 144 72 137 74 187 158 163 28 140 146 111 116 135 > 88 29 81 36 173 149 79 16 105 82 162 60 20 49 50 91 176 165 3 56 22 9 > 85 44 101 33 134 186 128 141 103 92 143 123 23 129 83

Re: Trouble with type hints

2011-02-18 Thread Daniel Solano Gomez
> Is there something besides type-hinting that I'm missing? Is there any chance that you can make a sample data set/complete script available? That would make it easier to try different things and figure out where the problem is. Sincerely, Daniel Solano Gómez pgp40moegLknA.pgp Description: P

Re: [ANN] Clojure REPL for Android

2011-02-16 Thread Daniel Solano Gomez
On Wed Feb 16 15:01 2011, Laurent PETIT wrote: > I would love to have another way to install it than from the Android market, > 'cause I currently don't own an Android, so I installed a VirtualBox Android > VM, but from there I cannot install from the market's website without giving > google accoun

Re: Annotations

2010-04-24 Thread Daniel Solano Gomez
Thank you very much for this new feature. I was able to use it successfully to create and test a simple EJB. I wrote about this on my blog and put a demo up on GitHub. Blog entry: http://www.deepbluelambda.org/programming/clojure/building-ejbs-with-clojure GitHub link: http://github.com/satt

Re: (- x 1) and (dec x) behave differently

2010-04-20 Thread Daniel Solano Gomez
On Tue, Apr 20, 2010 at 04:43:13AM -0700, jvshahid wrote: > Thanks Per, > > This definitely works > > > Try (loop [x (. 1 longValue)] (if (= 0 x) x (recur (- x (long 1). > > but from my understanding of clojure internals clojure.lang.Numbers > should take care of that. Since one of the argum

Re: primitive arrays, am I reading this right?

2010-04-19 Thread Daniel Solano Gomez
> Aside from the misuse of 'for' (which then needs to be iterated to > cause the side-effects), what am I missing here? Hints on idiomatic > Clojure as well as my primitives question are most welcome. Have you tried float-array? Examples: user=> (class (float-array 1)) [F user=> (aget (float-a