Re: Presentation about Clojure

2014-08-21 Thread Bruno Kim Medeiros Cesar
I've given the following presentation in 30 minutes: https://github.com/brunokim/learning-clojure. I've used LightTable to change and evaluate code live, mutating from the code in short-preso/ to the one in notes/. It's probably not well annotated, I intended to make a video with that but didn'

Transposing a map and back again

2014-08-01 Thread Bruno Kim Medeiros Cesar
Is there a standard/library function to transpose a map from key-value to value-keys? I've met this task many times before, and I'm sure others have too. Here is the code I'm using, mildly highlighted by Google Groups. I used to copy-paste from Pygments.org

Re: Name for this pattern: side-effect from swap!

2014-04-08 Thread Bruno Kim Medeiros Cesar
Why aren't watches adequate? You could test inside them if you really wish to create the side-effect based on your context. On Tuesday, April 8, 2014 12:41:50 PM UTC-3, John Hume wrote: > > I sometimes find that after mutating an atom, I want to create some > side-effect that depends on the old

Re: Looking for advice to fine tune a simple function

2014-02-16 Thread Bruno Kim Medeiros Cesar
I can't claim to be an experienced Clojure developer, specially so regarding maintainability as I'm the only reader of what I write. Andy provided a great piece of code, although I scratched my head for a second or two unwrapping the last two lines. You'll be surprised how often (partition * 1)

Re: Confused by Clojure floating-point differences (compared to other languages)

2014-02-06 Thread Bruno Kim Medeiros Cesar
n Thursday, February 6, 2014 10:07:40 AM UTC-2, Bruno Kim Medeiros Cesar wrote: > > Just to add a bit to the thread: the Java compiler treats java.lang.Math > differently when more efficient alternatives are available. StrictMath is > used only as a fallback. > > From the ja

Re: Confused by Clojure floating-point differences (compared to other languages)

2014-02-06 Thread Bruno Kim Medeiros Cesar
Just to add a bit to the thread: the Java compiler treats java.lang.Math differently when more efficient alternatives are available. StrictMath is used only as a fallback. >From the java.lang.Math >javadoc : > By default many of the

Re: Confused by Clojure floating-point differences (compared to other languages)

2014-02-06 Thread Bruno Kim Medeiros Cesar
Just to add a bit to the thread: the Java compiler treats java.lang.Math differently when more efficient alternatives are available. StrictMath is used only as a fallback. >From the java.lang.Math >javadoc : > By default many of the

Re: Akka-like framework in Clojure ?

2013-12-27 Thread Bruno Kim Medeiros Cesar
I haven't dabbled yet on actor-based concurrency, can someone point out (a blog post about) a comparison between Akka actors, Clojure agents and other solutions? On Friday, December 27, 2013 6:54:16 AM UTC-2, Eric Le Goff wrote: > > > Hi, > > After a long background with imperative languages suc

Re: Who is "doing something worthwhile" in Clojure?

2013-12-19 Thread Bruno Kim Medeiros Cesar
Being acquired by Monsanto does not invalidate "The Climate Corporation"'s work, which I find extremely exciting and valuable. In fact, why would their work be "worthwhile" by your worthiness definition? They are just insurance sellers, after all. Clojure itself is the ultimate worthwhile proje

Re: graphs library?

2013-12-13 Thread Bruno Kim Medeiros Cesar
Maybe late to the thread, but I'm currently implementing some complex networks analysis tools in https://github.com/brunokim/loom (specifically, loom.metrics) that may be merged back to the main library. For what you described, Aysylu's Loom https://github.com/aysylu/loom fits well. Bruno Kim.

Why not automatically generate classes?

2013-10-18 Thread Bruno Kim Medeiros Cesar
I was reading on Erjang implementation, and in an article about how it handles recursion, the author says this about multi-arity functions: - Every function is comp

Re: Improving a nested if, or How to use multimethods the right way.

2013-09-05 Thread Bruno Kim Medeiros Cesar
latten a nested if. That's usually all you need, >> imo. >> >> >> On Thu, Sep 5, 2013 at 1:07 PM, Bruno Kim Medeiros Cesar < >> bruno...@gmail.com > wrote: >> >>> Thanks for your suggestion, didn't know about that! One of the things >

Re: Clojure for the Brave and True, an online book for beginners

2013-09-05 Thread Bruno Kim Medeiros Cesar
I would like to add to Roberto's request, a thorough treatment of ns would be great. It has its specific syntax that takes some time to understand, but that you don't use enough to imprint in your brain. It differs between the REPL and the file source, and is a showstopper when you want to try

Re: Improving a nested if, or How to use multimethods the right way.

2013-09-05 Thread Bruno Kim Medeiros Cesar
s] conj (if (directed? g) (vec e) (set e))) g On Wednesday, September 4, 2013 7:07:06 PM UTC-3, Leonardo Borges wrote: > > You could use pattern matching with core.match > On 05/09/2013 6:57 AM, "Bruno Kim Medeiros Cesar" > > > wrote: > >> I'm wri

Improving a nested if, or How to use multimethods the right way.

2013-09-04 Thread Bruno Kim Medeiros Cesar
s for each type are separated. Do you have any suggestions on how to improve this design? Thanks for any consideration! Bruno Kim Medeiros Cesar Engenheiro de Computação Pesquisador em Redes Complexas www.brunokim.com.br -- -- You received this message because you are subscribed to the Goog

Re: too circular?

2013-08-29 Thread Bruno Kim Medeiros Cesar
This exact use case is covered by letfn, which creates a named fn accessible to all function definitions and the body. That even allows mutual recursive definitions without declare. Your example would be (defn fib-n [n] (letfn [(fib [a b] (cons a (lazy-seq (fib b (+ b a)]

Re: Lisp newbie seeks (macro?) wisdom - instrumentation and app metadata

2013-08-11 Thread Bruno Kim Medeiros Cesar
Thanks for that link, I loved this tutorial! On Saturday, August 10, 2013 3:13:52 PM UTC-3, Jacob Goodson wrote: > > Here is where I started... > http://www.lisperati.com/clojure-spels/casting.html > > I personally disagree about being so timid with macros, however, I do not > code Clojure with

Re: Parallelizing tasks

2013-04-11 Thread Bruno Kim Medeiros Cesar
On Thursday, April 11, 2013 10:03:51 AM UTC-3, Gary Verhaegen wrote: > > The way the f function is written, there is no way to run it in > parallel, since it needs the previous answer. The best you can hope > for is to use two cores, one for a and one for b. > That was my goal at first, but you