Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."
Today's Topics:
1. Re: Project euler question (David McBride)
2. Re: Project euler question (David McBride)
3. Re: Project euler question (Daniel Fischer)
4. Re: haskell on OpenBSD 5.5 (Michael S)
5. Re: Project euler question (martin)
6. Re: Project euler question (martin)
----------------------------------------------------------------------
Message: 1
Date: Wed, 21 May 2014 17:10:41 -0400
From: David McBride <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Project euler question
Message-ID:
<CAN+Tr40Kq1ED7EfP7WiJn87RxvC5m=8t9qzv3x2yabkfwed...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
For what it is worth, I'm getting the same answer as you are.
> head $ drop (1000000-1) $ sort $ Data.List.permutations [0..9]
[2,7,8,3,9,1,5,4,6,0]
>(sort $ Data.List.permutations [0..9]) !! (1000000-1)
[2,7,8,3,9,1,5,4,6,0]
I guess either euler is wrong or we are both crazy.
On Wed, May 21, 2014 at 4:09 PM, martin <[email protected]> wrote:
> Hello all,
>
> I tried to solve Problem 24 (https://projecteuler.net/problem=24) and
> came up with the following solution:
>
> import Data.List.Ordered
> import Data.Char
>
> elems = [0,1,2,3,4,5,6,7,8,9] :: [Int]
>
> x = do
> a <- elems
> b <- elems `without` [a]
> c <- elems `without` [a,b]
> d <- elems `without` [a,b,c]
> e <- elems `without` [a,b,c,d]
> f <- elems `without` [a,b,c,d,e]
> g <- elems `without` [a,b,c,d,e,f]
> h <- elems `without` [a,b,c,d,e,f,g]
> i <- elems `without` [a,b,c,d,e,f,g,h]
> j <- elems `without` [a,b,c,d,e,f,g,h,i]
> return [a,b,c,d,e,f,g,h,i,j]
>
> without a b = minus a ( sort b)
>
> solution = filter isDigit $ show $ (x !! 1000001)
> -- "2783915640"
>
> PE tells me that this is wrong, and I peeked the correct answer, which is
> 2783915460 (the 4 and 6 are swapped). So I
> tried to find out where the correct answer is in my list x and added
>
> y = filter (\(x,y) -> x == "2783915460") $ zip (map (filter isDigit .
> show) x) [1..]
> -- [("2783915460",1000000)]
>
> How can that be? "solution" tells me that the millionth element is
> "2783915640" but "y" tells me that "2783915460" is at
> the millionth position? I just cannot see it.
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20140521/3409f02c/attachment-0001.html>
------------------------------
Message: 2
Date: Wed, 21 May 2014 17:14:14 -0400
From: David McBride <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Project euler question
Message-ID:
<CAN+Tr409rtYhGKS85VNywfv_p-r2F-jdeCSD5Tn=tbpx98c...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Err actually I guess I got the euler answer, I guess I don't understand
your solution without the "minus" function definition.
On Wed, May 21, 2014 at 5:10 PM, David McBride <[email protected]> wrote:
> For what it is worth, I'm getting the same answer as you are.
>
> > head $ drop (1000000-1) $ sort $ Data.List.permutations [0..9]
> [2,7,8,3,9,1,5,4,6,0]
>
> >(sort $ Data.List.permutations [0..9]) !! (1000000-1)
> [2,7,8,3,9,1,5,4,6,0]
>
> I guess either euler is wrong or we are both crazy.
>
>
> On Wed, May 21, 2014 at 4:09 PM, martin <[email protected]> wrote:
>
>> Hello all,
>>
>> I tried to solve Problem 24 (https://projecteuler.net/problem=24) and
>> came up with the following solution:
>>
>> import Data.List.Ordered
>> import Data.Char
>>
>> elems = [0,1,2,3,4,5,6,7,8,9] :: [Int]
>>
>> x = do
>> a <- elems
>> b <- elems `without` [a]
>> c <- elems `without` [a,b]
>> d <- elems `without` [a,b,c]
>> e <- elems `without` [a,b,c,d]
>> f <- elems `without` [a,b,c,d,e]
>> g <- elems `without` [a,b,c,d,e,f]
>> h <- elems `without` [a,b,c,d,e,f,g]
>> i <- elems `without` [a,b,c,d,e,f,g,h]
>> j <- elems `without` [a,b,c,d,e,f,g,h,i]
>> return [a,b,c,d,e,f,g,h,i,j]
>>
>> without a b = minus a ( sort b)
>>
>> solution = filter isDigit $ show $ (x !! 1000001)
>> -- "2783915640"
>>
>> PE tells me that this is wrong, and I peeked the correct answer, which is
>> 2783915460 (the 4 and 6 are swapped). So I
>> tried to find out where the correct answer is in my list x and added
>>
>> y = filter (\(x,y) -> x == "2783915460") $ zip (map (filter isDigit .
>> show) x) [1..]
>> -- [("2783915460",1000000)]
>>
>> How can that be? "solution" tells me that the millionth element is
>> "2783915640" but "y" tells me that "2783915460" is at
>> the millionth position? I just cannot see it.
>>
>> _______________________________________________
>> Beginners mailing list
>> [email protected]
>> http://www.haskell.org/mailman/listinfo/beginners
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20140521/b207633e/attachment-0001.html>
------------------------------
Message: 3
Date: Wed, 21 May 2014 23:18:15 +0200
From: Daniel Fischer <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Project euler question
Message-ID: <[email protected]>
Content-Type: text/plain; charset="us-ascii"
On Wednesday 21 May 2014, 22:09:24, martin wrote:
> Hello all,
>
> I tried to solve Problem 24 (https://projecteuler.net/problem=24) and came
> up with the following solution:
>
> solution = filter isDigit $ show $ (x !! 1000001)
> -- "2783915640"
>
> PE tells me that this is wrong,
Yes, you took the 1000002nd element. List indexing is 0-based, so the
millionth element is at index (1000000 - 1), not (1000000 + 1).
------------------------------
Message: 4
Date: Wed, 21 May 2014 17:17:13 -0700 (PDT)
From: Michael S <[email protected]>
To: MJ Williams <[email protected]>, The Haskell-Beginners
Mailing List - Discussion of primarily beginner-level topics related
to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] haskell on OpenBSD 5.5
Message-ID:
<[email protected]>
Content-Type: text/plain; charset="iso-8859-1"
I never? tried? NetBSD, however my initial thought was to install FreeBSD.
Unfortunately FreeBSD installer did not pick up the built-in SATA controller
and therefore I couldn't install it.
OpenBSD installed withouth a hitch. No need to run Linux packages, they all
have native ghc and many other related packages.
The issue I asked about is not present on OpenBSD amd64 port.
On Wednesday, May 21, 2014 2:46:35 PM, MJ Williams
<[email protected]> wrote:
Any reason for installing OpenBSD and not NetBSD or FreeBSD? I think
you can run any Linux package including ghc on both of those.
At 20:10 20/05/2014, you wrote:
>Good day all,
>
>I installed OpenBSD 5.5 in order to learn haskell.
>There are a few glitches however. I installed the haskell-platform
>meta-package and the issues I noticed are:
>- hs-vector wouldn't install
>- ghci wouldn't start, the message: unable to load package `integer-gmp'
>
>Has anyone experienced the same issue? Is this happening on OpenBSD 5.4?
>Is this OpenBSD specific?
>
>Thanks in advance.
>
>
>
>_______________________________________________
>Beginners mailing list
>[email protected]
>http://www.haskell.org/mailman/listinfo/beginners
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20140521/297bcd06/attachment-0001.html>
------------------------------
Message: 5
Date: Thu, 22 May 2014 08:36:48 +0200
From: martin <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Project euler question
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1
Am 05/21/2014 11:18 PM, schrieb Daniel Fischer:
> On Wednesday 21 May 2014, 22:09:24, martin wrote:
>> Hello all,
>>
>> I tried to solve Problem 24 (https://projecteuler.net/problem=24) and came
>> up with the following solution:
>
>>
>> solution = filter isDigit $ show $ (x !! 1000001)
>> -- "2783915640"
>>
>> PE tells me that this is wrong,
>
> Yes, you took the 1000002nd element. List indexing is 0-based, so the
> millionth element is at index (1000000 - 1), not (1000000 + 1).
Oops.
------------------------------
Message: 6
Date: Thu, 22 May 2014 08:47:12 +0200
From: martin <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Project euler question
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1
Am 05/21/2014 11:14 PM, schrieb David McBride:
> Err actually I guess I got the euler answer, I guess I don't understand your
> solution without the "minus" function
> definition.
"minus" is from Data.List.Ordered. It it like the standard set operation
"minus" when both lists are ordered.
>
>
> On Wed, May 21, 2014 at 5:10 PM, David McBride <[email protected]
> <mailto:[email protected]>> wrote:
>
> For what it is worth, I'm getting the same answer as you are.
>
> > head $ drop (1000000-1) $ sort $ Data.List.permutations [0..9]
> [2,7,8,3,9,1,5,4,6,0]
>
> >(sort $ Data.List.permutations [0..9]) !! (1000000-1)
> [2,7,8,3,9,1,5,4,6,0]
>
> I guess either euler is wrong or we are both crazy.
>
>
> On Wed, May 21, 2014 at 4:09 PM, martin <[email protected]
> <mailto:[email protected]>> wrote:
>
> Hello all,
>
> I tried to solve Problem 24 (https://projecteuler.net/problem=24) and
> came up with the following solution:
>
> import Data.List.Ordered
> import Data.Char
>
> elems = [0,1,2,3,4,5,6,7,8,9] :: [Int]
>
> x = do
> a <- elems
> b <- elems `without` [a]
> c <- elems `without` [a,b]
> d <- elems `without` [a,b,c]
> e <- elems `without` [a,b,c,d]
> f <- elems `without` [a,b,c,d,e]
> g <- elems `without` [a,b,c,d,e,f]
> h <- elems `without` [a,b,c,d,e,f,g]
> i <- elems `without` [a,b,c,d,e,f,g,h]
> j <- elems `without` [a,b,c,d,e,f,g,h,i]
> return [a,b,c,d,e,f,g,h,i,j]
>
> without a b = minus a ( sort b)
>
> solution = filter isDigit $ show $ (x !! 1000001)
> -- "2783915640"
>
> PE tells me that this is wrong, and I peeked the correct answer,
> which is 2783915460 (the 4 and 6 are swapped). So I
> tried to find out where the correct answer is in my list x and added
>
> y = filter (\(x,y) -> x == "2783915460") $ zip (map (filter isDigit .
> show) x) [1..]
> -- [("2783915460",1000000)]
>
> How can that be? "solution" tells me that the millionth element is
> "2783915640" but "y" tells me that
> "2783915460" is at
> the millionth position? I just cannot see it.
>
> _______________________________________________
> Beginners mailing list
> [email protected] <mailto:[email protected]>
> http://www.haskell.org/mailman/listinfo/beginners
>
>
>
>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 71, Issue 28
*****************************************