I think it'd be a good exercise to do this all without using strings.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with
Hi,
On Mon, Feb 15, 2010 at 01:07:15PM -0800, Glen Rubin wrote:
> I tried using your alternate definition for palindromes? , but an
> exception was thrown:
>
> java.lang.NullPointerException
> [Thrown class java.lang.RuntimeException]
Works for me. However one has to wrap the first string into
I tried using your alternate definition for palindromes? , but an
exception was thrown:
java.lang.NullPointerException
[Thrown class java.lang.RuntimeException]
On Feb 15, 7:02 am, Meikel Brandmeyer wrote:
> Hi,
>
> On Feb 15, 2:50 pm, Glen Rubin wrote:
>
> > ;definition of a palindrome
>
On 15 Feb 2010, at 13:58, Steve Purcell wrote:
> On 15 Feb 2010, at 13:50, Glen Rubin wrote:
>
>> Thank you so much This is really wonderful advice...saved me
>> months of learning. I have rewritten my code as follows:
>
>
> You'll want to use "let" in place of all of those "def" declarat
Hi,
On Feb 15, 2:50 pm, Glen Rubin wrote:
> ;definition of a palindrome
> (defn palindrome? [s]
> (= s (apply str (reverse s
You might want to call vec on the string and then rseq instead of
reverse. reverse walks the string twice, while rseq just walks the
string once. The vector w
On 15 Feb 2010, at 13:50, Glen Rubin wrote:
> Thank you so much This is really wonderful advice...saved me
> months of learning. I have rewritten my code as follows:
You'll want to use "let" in place of all of those "def" declarations.
-Steve
--
You received this message because you are
Thank you so much This is really wonderful advice...saved me
months of learning. I have rewritten my code as follows:
;definition of a palindrome
(defn palindrome? [s]
(= s (apply str (reverse s
;list of palindromes for range of numbers
(defn palindromes [start end]
(def
On Feb 14, 5:49 pm, Glen Rubin wrote:
> Thank you for the advice! Just for reference I am working on project
> euler question #4 (Find the largest palindrome made from the product
> of two 3-digit numbers.)
>
> I have a solution, but am hoping somebody can clarify some things for
> me:
>
> Firs
Thank you for the advice! Just for reference I am working on project
euler question #4 (Find the largest palindrome made from the product
of two 3-digit numbers.)
I have a solution, but am hoping somebody can clarify some things for
me:
First, I define a panlindrome tester:
(defn palindrome? [s
On Feb 14, 9:57 am, Glen Rubin wrote:
> How do I take an element from one collection and test for no remainder
> (e.g. (zero? (mod x y)), when dividing by every element of the second
> collection, before processing the next item in the first
> collection?
The 'for' macro does this.
-SS
--
You
Glen Rubin writes:
> How do I take an element from one collection and test for no remainder
> (e.g. (zero? (mod x y)), when dividing by every element of the second
> collection, before processing the next item in the first collection?
This form checks if every element of the second range is a fa
Hi,
On Sun, Feb 14, 2010 at 06:57:41AM -0800, Glen Rubin wrote:
> howdy clojure folks! I am a noob and trying to do the following:
>
> Suppose I have 2 collections of numbers:
>
> (range 1000 2000) (range 100 150)
>
>
> How do I take an element from one collection and test for no remainder
>
howdy clojure folks! I am a noob and trying to do the following:
Suppose I have 2 collections of numbers:
(range 1000 2000) (range 100 150)
How do I take an element from one collection and test for no remainder
(e.g. (zero? (mod x y)), when dividing by every element of the second
collection, b
13 matches
Mail list logo