Hi Tassilo
2011/2/16 Tassilo Horn
> Laurent PETIT writes:
>
> Hi Laurent,
>
> > Was playing with levenshtein (argh, where do I place the h -sorry
> > mister levenshtein-), and thougth it could be interesting to share my
> > current result here, to get some feedback.
>
> Looks really concise. N
Thanks for everyone who commented on my solution for Euler 28 yesterday.
Euler 40 is a bit easier, even more so I'm disappointed with the performance of
my solution:(defn euler-40 [n-max]
(reduce #(* (Integer/valueOf (str %1)) (Integer/valueOf (str %2)))
(let [r (range (inc n-max))]
Thank you all,
It has to be the same object otherwise it makes no sense. Anyways that
is good news since this means that Clojure has a little support built
in so you don't create unneccessary objects.
/Can Arel
On 16 Feb, 00:27, Stuart Sierra wrote:
> Since about 1.1, I think, the Clojure compil
> HOFs and
> lazy seqs add a bit more expense. Try deliberately throwing an
> exception in lazy-seq and then (first (map this (map that ...
> (my-exception-throwing-lazy-seq and see how deep the stack trace
> nests; the method call overheads do add up when there's many of them!
Tell me about i
Andreas, Base, sure, I'll try (I wrote it yesterday by night, let's see if I
can remember what I wrote :-) ):
So I've studied the algorithm presented here in wikipedia:
http://en.wikipedia.org/wiki/Levenshtein_distance
I've also taken note of the suggested possible improvement on space :
"We can
Hi Brenton!
2011/2/16 Brenton
> Laurent,
>
> I have been doing some work on a diff library for Clojure sequences (I
> need to get back to it and finish it up).
>
> http://github.com/brentonashworth/clj-diff
>
> The main goal of this library is to compute sequential diffs quickly.
>
While mine g
Thanks Michael.
yea true .. but I don't think I will miss them much .. :)
Sunil.
On Wed, Feb 16, 2011 at 12:32 PM, Michael Ossareh wrote:
> Am I missing something?
>>
>
> types.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to thi
2011/2/16 Sunil S Nandihalli
> Just thinking out loud...
> After listening to "classes are a premature optimization" lecture on infoQ
> .. I was just wondering if the only purpose of defrecord is space&speed
> efficiency ... and could just use maps .. ofcourse .. I won't be able to use
> the prot
Awesome! I've been looking for something like this for a long time!
I would have loved to have this while I was reading Stuart Holloway's
book on my Vibrant on the subway.
Nice job!
Adam
On Feb 15, 8:57 pm, Daniel Solano Gómez wrote:
> Hello, all,
>
> Over the past week and a half or so, I have
2011/2/16 Daniel Solano Gómez
> Hello, all,
>
> Over the past week and a half or so, I have been working on getting
> Clojure working fully on Android. At last, I have released a Clojure
> REPL that is now available on the Android Market.
>
> For now it is primarily a proof-of-concept, so it doe
No one has planned anything yet, but my sense is that anyone who wants to
take initiative to host or help plan a second meeting should get in touch
with Eric (who created the meetup.com page and organized the first meeting),
so as to coordinate with him and post the details on meetup. Also, there
On Wed, Feb 16, 2011 at 9:15 AM, Andreas Kostler
wrote:
> Thanks for everyone who commented on my solution for Euler 28 yesterday.
> Euler 40 is a bit easier, even more so I'm disappointed with the performance
> of my solution:(defn euler-40 [n-max]
>
> (reduce #(* (Integer/valueOf (str %1)) (Int
Hi folks, new to Clojure...
Question:
How do I rid the following functions of all the '(def STATE num)'
calls? I can not seem to work out a way to use either 'binding', or
'let/atom' that wraps the loop & works as well... Any other comments
are always welcomed. Here's my code:
(defn load-block (
mss wrote:
> Hi folks, new to Clojure...
>
> Question:
>
> How do I rid the following functions of all the '(def STATE num)'
> calls? I can not seem to work out a way to use either 'binding', or
> 'let/atom' that wraps the loop & works as well... Any other comments
> are always welcomed. Here's my
By the way, as those who attend the first meeting know, it was actually
quite huge in terms of the number of people who attended. There are less
than 40 people who list themselves on the meetup page as members, but closer
to 50 people actually attended if I estimate correctly, in part due to a
lar
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
On Wed, Feb 16, 2011 at 3:36 AM, Marko Topolnik
wrote:
>> HOFs and
>> lazy seqs add a bit more expense. Try deliberately throwing an
>> exception in lazy-seq and then (first (map this (map that ...
>> (my-exception-throwing-lazy-seq and see how deep the stack trace
>> nests; the method call ov
Looks like you could make the (println) depend directly on (re-find):
(when (re-find rx line)
(println line))
The check for empty line and tab might be taken care of by (re-find)
to further reduce the code to something like:
(when (and line (re-find rx line)
(println line)
(recur (read-line)
2011/2/15 Thorsten Wilms :
> Hi!
>
> I managed to get to a "Hello world" level using appengine-magic, plus an
> Emacs Swank/Slime setup.
I haven't used appengine-magic myself, but I do interactive web
programming from Emacs (mainly using Ring + Moustache + Enlive), so I
thought I'd share how my ty
P.S.
I forgot to mention that a lot of really useful slime commands are
documented at the swank-clojure project site:
https://github.com/technomancy/swank-clojure
// raek
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send em
On 16 February 2011 10:01, Michael Sanders wrote:
> I think I've worked out a better solution (hope this post renders properly):
>
> (ns topic (require [clojure.string :as s]))
>
> (defn load-block
>
> "TOPIC database: prints associated blocks to stdout"
>
> ([tag]
> (let [STATE (atom
2011/2/16 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 mar
Laurent,
When I have some time, I will take another look at my code to see if I
can get an accurate levenshtein distance without adding significant
complexity. I am optimistic.
I'll let you know what I find.
Thanks again for sharing your code.
Brenton
On Feb 16, 2:12 am, Laurent PETIT wrote:
>
On 16 February 2011 16:10, Rasmus Svensson wrote:
> (defn -main []
> (run-jetty #'my-app {:port 8080, :join? false}))
Have you tried using ring-serve
(https://github.com/weavejester/ring-serve)? It has a few advantages
over running the run-jetty adapter directly. In particular:
* It ensures `sw
One place it has mattered is in using compojure with ring. I'm building a
few middlewares that permit my applications to have a good sense of
structure (somewhat MVC ish) in that process I discovered that to be
compojure compatible you must return a supported type or extend the
Renderable protocol.
On Wed, Feb 16, 2011 at 1:23 AM, Sunil S Nandihalli <
sunil.nandiha...@gmail.com> wrote:
> Just thinking out loud...
> After listening to "classes are a premature optimization" lecture on infoQ
> .. I was just wondering if the only purpose of defrecord is space&speed
> efficiency ... and could jus
On Feb 16, 6:07 pm, Michael Ossareh wrote:
> One place it has mattered is in using compojure with ring. I'm building a
> few middlewares that permit my applications to have a good sense of
> structure (somewhat MVC ish) in that process I discovered that to be
> compojure compatible you must return
On Jan 22, 1:19 am, Mark Triggs wrote:
> Daniel Werner writes:
> > After a few tries I've come up with the following algorithm to
> > transform :keys syntax into normal destructuring syntax, but am still
> > appalled by its complexity:
>
> > (let [vmap {'y :y, 'z :z :keys ['a 'b]}]
> > (->> vma
On Feb 16, 2:01 am, Michael Sanders wrote:
> I think I've worked out a better solution (hope this post renders properly):
>
> (ns topic (require [clojure.string :as s]))
>
> (defn load-block
>
> "TOPIC database: prints associated blocks to stdout"
>
> ([tag]
> (let [STATE (atom 0)
>
> That's not even an API change -- it's a compiler change. An improved
> API behavior would be making nth work on sorted-sets and sorted-maps.
> ;)
True, I guess -- even though, with a LISP it's not obvious where API
ends and language starts -- (let) is, after all, a clojure.core
macro :)
--
You
>
> Do you have more details of this - it sounds interesting...
>
A very rough answer: https://github.com/ossareh/clj-boilerplate
I've some local changes that will go up in a few days that make this
"better" - they're based off me actually using the framework where as what
is there right now is m
Hi Marek,
I think the (inc) in (decimal-fraction-digits) and the (dec) in
(solution) cancel each other out, so the two functions can be
simplified a bit to:
(defn decimal-fraction-digits []
"Returns the lazy sequence of digits in irrational fraction created
by concatenating the positive inte
Hi Andreas,
I recently discovered a wiki of Clojure Euler solutions, thought you
might be interested:
http://clojure-euler.wikispaces.com/
On Feb 16, 1:15 am, Andreas Kostler
wrote:
> Thanks for everyone who commented on my solution for Euler 28 yesterday.
> Euler 40 is a bit easier, even more
On 02/16/2011 05:10 PM, Rasmus Svensson wrote:
With the web server up an running, I open up http://localhost:8080/ in
my browser. Now, lets assume that I want to change the "Hello, world!"
text to "Hello, Clojure-land!". I open the controller.clj file, edit
the corresponding line and press C-M-x
Hi,
user=> (let [vmap '{y :y z :z :keys [a b] :syms [e f] :strs [g h]}]
(-> (dissoc vmap :keys :strs :syms)
(into (map #(vector % (keyword %)) (:keys vmap)))
(into (map #(vector % (name %))(:strs vmap)))
(into (map #(vector % %) (:syms vmap)
{y :y, z :z, a :a, b :b,
Hi,
I'm trying to write a function that determines if a number is a prime
or not.
I Java I have no problem:
private boolean isPrime(int n) {
for(int j=2; (j*j <= n); j++) if( n % j == 0)
return false; return true;
}
Here is my first shot:
(defn prime? [num]
(loop [i 2]
(if (<= (* i i)
On Thu, Feb 17, 2011 at 12:34 AM, HB wrote:
> I'm trying to write a function that determines if a number is a prime
> or not.
> Here is my first shot:
>
> (defn prime? [num]
> (loop [i 2]
> (if (<= (* i i) num)
> false)
> (recur (inc i)))
> true)
>
> It is not working to be sure :)
>
This is just my copy of something I pulled together from other sources
while working of Project Euler problems and perhaps refined a little:
(defn prime?
[n]
(cond
(or (= n 2) (= n 3)) true
(even? n) false
:else (let [sqrt-n (Math/sqrt n)]
(loop [i 3]
(cond
(d
2011/2/16 Marek Stępniowski :
> On Thu, Feb 17, 2011 at 12:34 AM, HB wrote:
>> I'm trying to write a function that determines if a number is a prime
>> or not.
>> Here is my first shot:
>>
>> (defn prime? [num]
>> (loop [i 2]
>> (if (<= (* i i) num)
>> false)
>> (recur (inc i)))
>> tr
Some clarifications.
On Wed, Feb 16, 2011 at 8:50 PM, Ken Wesson wrote:
> Perfect squares are also worst-case (other than actual primes)
To be exact, perfect squares /of primes/. Squares of composite
integers halted on a smaller prime factor even in the original
version.
> could be a bit more e
This is how I define my app:
(defroutes index
(GET "/" [] (main-page))
(GET "/form" [] (render-page "Vote" (render-form)))
(POST "/vote" {params :params} (post-vote params))
(route/not-found "Page not found"))
(def app (site index))
(defservice app)
The site here is used to capture
Is there an easy and idiomatic way of getting the digits of a number in clojure?
(defn explode-to-digits [number]
(map #(- (int %) (int \0)) (str number)))
(explode-to-digits 123456)
=> (1 2 3 4 5 6)
Seems a bit clunky...
Andreas
--
You received this message because you are subscribed
Hi,
I've been surveying some agent based modeling systems for use in a
project I am doing in clojure. I've narrowed down the list to those
below. I am wondering if anybody here has experience with these or has
any thoughts about choosing one over the other for use with clojure. I
will probably wr
On Feb 17, 6:29 am, Andreas Kostler
wrote:
> Is there an easy and idiomatic way of getting the digits of a number in
> clojure?
>
> (defn explode-to-digits [number]
> (map #(- (int %) (int \0)) (str number)))
> (explode-to-digits 123456)
> => (1 2 3 4 5 6)
I'd do it this way:
(defn expl
Hi Saul,
> (defn explode-to-digits [number]
>(seq (str number)))
This gives you a sequence of character representations for the digits e.g:
(explode-to-digits 1234)
=> (\1 \2 \3 \4)
On 17/02/2011, at 4:01 PM, Saul Hazledine wrote:
> On Feb 17, 6:29 am, Andreas Kostler
> wrote:
>> Is there
On Feb 17, 6:29 am, Andreas Kostler
wrote:
> Is there an easy and idiomatic way of getting the digits of a number in
> clojure?
>
> (defn explode-to-digits [number]
> (map #(- (int %) (int \0)) (str number)))
> (explode-to-digits 123456)
> => (1 2 3 4 5 6)
Sorry, my first answer was care
On Feb 17, 11:09 am, Ken Wesson wrote:
> On Thu, Feb 17, 2011 at 12:29 AM, Andreas Kostler
>
> wrote:
> > Is there an easy and idiomatic way of getting the digits of a number in
> > clojure?
>
> > (defn explode-to-digits [number]
> > (map #(- (int %) (int \0)) (str number)))
> > (explod
On Feb 17, 11:39 am, Shantanu Kumar wrote:
> On Feb 17, 11:09 am, Ken Wesson wrote:
>
>
>
>
>
>
>
>
>
> > On Thu, Feb 17, 2011 at 12:29 AM, Andreas Kostler
>
> > wrote:
> > > Is there an easy and idiomatic way of getting the digits of a number in
> > > clojure?
>
> > > (defn explode-to-digits
On Thu, Feb 17, 2011 at 12:29 AM, Andreas Kostler
wrote:
> Is there an easy and idiomatic way of getting the digits of a number in
> clojure?
>
> (defn explode-to-digits [number]
> (map #(- (int %) (int \0)) (str number)))
> (explode-to-digits 123456)
> => (1 2 3 4 5 6)
>
> Seems a bit clu
49 matches
Mail list logo