Hi Meikel, hi all,
thanks for the explanation, I think I got it now. I suppose something
in the sentence I quoted led me to think that pattern matching was
less in a way than destructuring, whereas in fact it seems to be the
opposite - pattern matching seems to presuppose destructuring if I'm
There is a slight performance penalty over a normal function call. I
think the dispatching takes one function call, a hash lookup, and an
equality test.
Strictly speaking, an isa? test. That's where the ad hoc hierarchy
functionality ties in.
On Aug 22, 5:56 am, jng27 jgran...@gmail.com wrote:
Took a shot at implementing PI in Clojure using a reasonably fast
algorithm.
So why is it so slow ? Is BigDecimal just that bad ? Would fixed point
arithmetic be better using BigInteger ?
Hmm, my impression is that the java boxed numbers
Meikel Brandmeyer m...@kotka.de writes:
Hi,
On Aug 21, 12:05 pm, Jan Rychter j...@rychter.com wrote:
It isn't what I want. But that's because I misspecified what I actually
wanted. I didn't think about the problem enough. I need something more
akin to a splice function:
(splice tree1
Stefan van der Meer stefanvanderm...@gmail.com writes:
On Aug 21, 12:05 pm, Jan Rychter j...@rychter.com wrote:
think crossover in genetic programming (this is actually what I need
this for).
I've written a genetic programming framework in Clojure, it might
be of interest if you're looking
Sorry if this is a FAQ. I'm a Clojure newbie.
What is the best way to iterate through the characters of a string? Is
there some kind of EXPLODE function such that:
= (explode test)
(\t \e \s \t)
I did a Google search but the closest thing I found was SUBS:
=(subs test 1 2)
t
This version is about 2x faster :
(import 'java.lang.Math)
(import 'java.math.MathContext)
(import 'java.math.RoundingMode)
(import 'java.math.BigInteger)
(import 'java.math.BigDecimal)
(defn sb-pi [places]
Calculates PI digits using the Salamin-Brent algorithm
and Java's BigDecimal
This updated version is 2x as fast as the previous version :
(import 'java.lang.Math)
(import 'java.math.MathContext)
(import 'java.math.BigDecimal)
(defn sb-pi [places]
Calculates PI digits using the Salamin-Brent algorithm
and Java's BigDecimal class.
(let [digits (+ 10 places) ;;
On Sat, Aug 22, 2009 at 4:54 AM,
clint.laskowskiclint.laskow...@gmail.com wrote:
Sorry if this is a FAQ. I'm a Clojure newbie.
What is the best way to iterate through the characters of a string? Is
there some kind of EXPLODE function such that:
= (explode test)
(\t \e \s \t)
'seq'
On Sat, 2009-08-22 at 01:54 -0700, clint.laskowski wrote:
What is the best way to iterate through the characters of a string? Is
there some kind of EXPLODE function such that:
= (explode test)
(\t \e \s \t)
I did a Google search but the closest thing I found was SUBS:
=(subs test 1
Welcome to Clojure!
A String is a form of a Sequence, so the correct function is seq.
user=(seq test)
(\t \e \s \t)
The sequence abstraction is on of may favorite things about Clojure.
It is an interface most collections implement, and it makes it very
consistent to manipulate any
Stuart S,
I have a few ideas for enhancements in stri-utils2
Note: I am going to add a str- prefix to your method for the sake
of discussion
* str-parition
What if this could take an integer as an argument as well? The
resulting method would look like this
(defmethod str-partition :number
Okay, I'm not sure what the correct thing do for the entire library
is, but I think I've got a convincing argument for some functions.
The following functions share a name with core functions
butlast
contains?
drop
get
partition
repeat
reverse
take
These functions should follow their
Good point. Obviously java.lang.String doesn't implement any extra
interfaces.
The correct thing to say is that a String is something seq works on.
On Aug 22, 10:07 am, Rich Hickey richhic...@gmail.com wrote:
On Sat, Aug 22, 2009 at 8:20 AM, Sean Devlinfrancoisdev...@gmail.com wrote:
On Aug 22, 1:51 pm, jng27 jgran...@gmail.com wrote:
This updated version is 2x as fast as the previous version :
(import 'java.lang.Math)
(import 'java.math.MathContext)
(import 'java.math.BigDecimal)
(defn sb-pi [places]
Calculates PI digits using the Salamin-Brent algorithm
and
Hi,
Am 22.08.2009 um 16:59 schrieb Jarkko Oranen:
You *really* shouldn't do nested defns. They're misleading, as defns
*always* cause a global change.
Just use separate functions.
+1
Hm, I wonder if there's a way to avoid calling java. But if you do, I
think you should use the form
On Fri, 2009-08-21 at 22:26 -0700, James Sofra wrote:
This seems like a pretty nice pattern matching implementation for
Clojure.
http://www.brool.com/index.php/pattern-matching-in-clojure
Beautiful!
Cheers,
--
Michel
--~--~-~--~~~---~--~~
You received
I favor using a map as the state because I think the information in
your example is an integral part of most parsing goals, not meta-data
retained to serve an auxiliary purpose. An example of what I would
consider meta-data for a parser would be the number of calls to
consumption functions the
Thank you all for your replies and your help. I never expected Rich
Hickey would respond :-)
-- Clint
On Aug 22, 9:07 am, Rich Hickey richhic...@gmail.com wrote:
On Sat, Aug 22, 2009 at 8:20 AM, Sean Devlinfrancoisdev...@gmail.com wrote:
Welcome to Clojure!
A String is a form of a
I've dabbled in genetic programming as well. My approach to crossover
is simply to return a seq of indices to the node. Then you can just
use nth repeatedly, or if your trees are nested vecs, you can use
assoc-in directly. Then I just eval'd a fn and map-reduce'd it across
my test data.
You *really* shouldn't do nested defns. They're misleading, as defns
*always* cause a global change.
Just use separate functions.
Agreed, creating global functions that are meant to be local is no
good. Using letfn instead.
(. (. (* (+ a1 b1) (+ a1 b1))
divide (*
First paragraph, first TBD:
Hi. I'm here to talk about Clojure, which I've done several times,
and never ... oh, yeah, once, at the European (TBD something that
sounds like cover less) workshop, for an audience of Lispers, but
European Common Lisp Workshop
:-)
--
JFB
On Aug 13, 9:40 pm, Andy
I am planning on migrating an app from ruby to clojure (for
performance and to learn clojure) and before I proceed I wanted to
make sure a few libraries are available.
One crucial part of the app is parsing a URL to return the pages HTML
(htmlbody...etc). Then I need to grab a certain element
23 matches
Mail list logo