On Sat, Aug 22, 2009 at 11:24 PM, Michel Salim
wrote:
>
> On Sat, 2009-08-22 at 23:00 -0700, bradford cross wrote:
>
> >
> > Destructuring is useful all over the place, not just for pattern
> > matching. For example, it is really useful in function parameter
> > vectors.
>
> I consider that to be
On Sat, 2009-08-22 at 23:00 -0700, bradford cross wrote:
>
> Destructuring is useful all over the place, not just for pattern
> matching. For example, it is really useful in function parameter
> vectors.
I consider that to be an example of pattern matching, though.
--
Michel
--~--~---
On Sat, Aug 22, 2009 at 2:08 AM, Sigrid wrote:
>
> 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
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
(...etc). Then I need to grab a certain element off the
pag
I am having trouble sending expressions to repll.
If I have (defn greet [] (println "Hello")), I position the cursor to
be inside the first cursor, then type \et, and I get the message,
"Error: Not in toplevel expression!"
What gives?
--~--~-~--~~~---~--~~
You rece
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, A
>
> 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))
> > d
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.
--~--~-
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 wrote:
> On Sat, Aug 22, 2009 at 8:20 AM, Sean Devlin wrote:
>
> > Welcome to Clojure!
>
> > A String is a form of a Sequence, so the correct function is seq.
>
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 par
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
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
(.divide
On Aug 22, 1:51 pm, jng27 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 Java's Bi
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 wrote:
> On Sat, Aug 22, 2009 at 8:20 AM, Sean Devlin wrote:
>
> > Welcome to Clojure!
>
> > A String is a form o
On Sat, Aug 22, 2009 at 8:20 AM, Sean Devlin wrote:
>
> Welcome to Clojure!
>
> A String is a form of a Sequence, so the correct function is seq.
>
I think we all need to be very careful about calling things sequences
which are not. seq can give you a sequential view of many things, but
that does
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 correspon
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
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 "collectio
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:
>
> =>(s
On Sat, Aug 22, 2009 at 4:54 AM,
clint.laskowski 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' creates a sequence ou
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) ;; a
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 class
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 seems like a pretty nice pattern matching implementation for
Clojure.
http://www.brool.com/index.php/pattern-matching-in-clojure
Cheers,
James
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To
Stefan van der Meer writes:
> On Aug 21, 12:05 pm, Jan Rychter 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 for some inspiration:
> http://bitbuc
Meikel Brandmeyer writes:
> Hi,
>
> On Aug 21, 12:05 pm, Jan Rychter 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 index tree2)
>>
>>
On Aug 22, 5:56 am, jng27 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 aren't particul
> 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.
--~--~-~--~~~--
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
c
29 matches
Mail list logo