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: minimal Haskell concepts subset (KC)
2. Re: a problem with maps (David Place)
3. Re: minimal Haskell concepts subset (Davi Santos)
4. Re: minimal Haskell concepts subset (Davi Santos)
5. code critique (Bryce Verdier)
6. Re: code critique (Arlen Cuss)
7. Re: code critique (KC)
8. Re: code critique (aditya siram)
----------------------------------------------------------------------
Message: 1
Date: Mon, 25 Jul 2011 15:39:52 -0700
From: KC <[email protected]>
Subject: Re: [Haskell-beginners] minimal Haskell concepts subset
To: Davi Santos <[email protected]>, [email protected]
Message-ID:
<CAMLKXymMMJXLZr85-gyYpF1BhajtUdxwgcHbG3dR=zy_V=t...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
Take a look at Min by Stephen Tse.
http://min-lang.blogspot.com/
On Mon, Jul 25, 2011 at 1:05 PM, Davi Santos <[email protected]> wrote:
> Hello,
> which would be the?minimal Haskell concepts subset
> equivalent to a Turing-complete high level language?
> I bet there would be no monads and type classes in the subset.
> Please, see that I am not an idealist nor want to use the acclaimed very
> powerful abstraction capabilities of Haskell.
> I just need to know how much is strictly needed, even if a real Haskeller or
> other person couldn't understand my code.
> Davi
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
>
--
--
Regards,
KC
------------------------------
Message: 2
Date: Mon, 25 Jul 2011 19:18:37 -0400
From: David Place <[email protected]>
Subject: Re: [Haskell-beginners] a problem with maps
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii
On Jul 25, 2011, at 6:38 PM, [email protected] wrote:
> It is at this point that the special
> connection between politics and the debasement of language becomes
> clear.
Ouch! All because I used "perspicuously?" In the future, I'll keep my
responses monosyllabic. Ugh! I can't even say "monosyllabic"
monosyllabically! :-)
------------------------------
Message: 3
Date: Mon, 25 Jul 2011 20:20:05 -0300
From: Davi Santos <[email protected]>
Subject: Re: [Haskell-beginners] minimal Haskell concepts subset
To: KC <[email protected]>
Cc: [email protected]
Message-ID:
<canwsst951m-9paat7k57nz9ee+r4hgm6j4-kmamgkqtoxse...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
Julian,
my major critique to some OO programs is exactly the object
over-orientation.
It is something like: "divide in objects until it becomes impossible to
continue dividing".
I agree with you when comparing to FP.
Beyond that, now I realize my object over-orientation feeling can be
analogous to my over-abstraction in FP feeling.
I am not sure if it is a problem with my early imperative experience or if
it is a real problem of taking things to their extremes.
Thomas, Stephen and KC,
I will check out the mini Haskells. May be they were made specially to me,
:) .
If I stay still unsatisfied, "Programming in Haskell" is an option to
restart learning.
It has been a productive discussion,
thank you all for the open-minded attitude.
Davi
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20110725/75180771/attachment-0001.htm>
------------------------------
Message: 4
Date: Mon, 25 Jul 2011 21:23:20 -0300
From: Davi Santos <[email protected]>
Subject: Re: [Haskell-beginners] minimal Haskell concepts subset
To: [email protected]
Message-ID:
<CANWsST-Oo37_DDtTBkGCKz9eU3K5tsbAMGw9=0q7qwnbo41...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
The only other Haskell I found was Disciple
http://disciple.ouroborus.net/
Couldnt find anything in :
http://min-lang.blogspot.com/
If somebody knows another minihaskell, please let me know.
Davi
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20110725/41329558/attachment-0001.htm>
------------------------------
Message: 5
Date: Mon, 25 Jul 2011 20:52:01 -0700
From: Bryce Verdier <[email protected]>
Subject: [Haskell-beginners] code critique
To: [email protected]
Message-ID:
<CANeGHvVzGbabyWWsKoWqXdvC2i7TQw11qt3upYbx89rmv=8...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
Hi all,
I'm new to haskell, and I'm trying to get better with it. Recently I
completed one of the challenges from Programming Praxis and I was wondering
if people would be willing to spend some time and tell me how I could
improve my code.
Thanks in advance,
Bryce
Here is a link to the programming praxis:
http://programmingpraxis.com/2011/07/19/sum-of-two-integers/
And here is my code:
import Data.List
import Data.Maybe
sumCheck :: Int -> [Int] -> [Int] -> Maybe (Int, Int)
sumCheck _ [] _ = Nothing
sumCheck total (x:xs) ys = if total' == Nothing
then sumCheck total xs ys
else return (x, (ys !! ( fromJust total')))
where total' = (total - x) `elemIndex` ys
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20110725/a34927ff/attachment-0001.htm>
------------------------------
Message: 6
Date: Tue, 26 Jul 2011 15:25:24 +1000
From: Arlen Cuss <[email protected]>
Subject: Re: [Haskell-beginners] code critique
To: Bryce Verdier <[email protected]>
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1
I have one suggestion:
> sumCheck total (x:xs) ys = if total' == Nothing
> then sumCheck total xs ys
> else return (x, (ys !! ( fromJust total')))
> where total' = (total - x) `elemIndex` ys
I might write this:
> sumCheck total (x:xs) ys =
> let diff = total - x
> in if diff `elem` ys
> then Just (x, diff)
> else sumCheck total xs ys
Cheers,
A
------------------------------
Message: 7
Date: Mon, 25 Jul 2011 22:36:27 -0700
From: KC <[email protected]>
Subject: Re: [Haskell-beginners] code critique
To: Bryce Verdier <[email protected]>, [email protected]
Message-ID:
<CAMLKXynf0nqPfk7PerHPDC5c7Rt66x3UnTguGtFwyUro=cv...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
Hi:
I think you may want to use a hash table.
Are you looking for algorithm improvement
and/or
coding improvement?
On Mon, Jul 25, 2011 at 8:52 PM, Bryce Verdier <[email protected]> wrote:
> Hi all,
> I'm new to haskell, and I'm trying to get better with it. Recently I
> completed one of the challenges from Programming Praxis and I was wondering
> if people would be willing to spend some time and tell me how I could
> improve my code.
> Thanks in advance,
> Bryce
> Here is a link to the programming praxis:
> http://programmingpraxis.com/2011/07/19/sum-of-two-integers/
> And here is my code:
> import Data.List
> import Data.Maybe
> sumCheck :: Int -> [Int] -> [Int] -> Maybe (Int, Int)
> sumCheck _ [] _ = Nothing
> sumCheck total (x:xs) ys = if total' == Nothing
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? then sumCheck total xs ys
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? else return (x, (ys !! ( fromJust total')))
> ? ? ? ? ? ? ? ? ? ? ? ? ? ?where total' = (total - x) `elemIndex` ys
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
>
--
--
Regards,
KC
------------------------------
Message: 8
Date: Tue, 26 Jul 2011 01:31:52 -0500
From: aditya siram <[email protected]>
Subject: Re: [Haskell-beginners] code critique
To: Bryce Verdier <[email protected]>
Cc: [email protected]
Message-ID:
<CAJrReyg+zEyVOgyeJVKfefgSzowiRB=h+erdsqzkfqvimdm...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
List comprehension seems like the easiest way to do it.
First here's how to get the cross product of two lists, I'll be using
this below:
cp as bs = [(x,y) | x <- as, y <- bs ]
-- cp [1,2,3] [4,5,6] = [(1,4),(1,5),(1,6),(2,4),(2,5),(2,6),(3,4),(3,5),(3,6)]
Then constrain the cross product to tuples where the sum is the given number:
sums i as bs = [(x,y) | x <- as, y <- bs, x + y == i]
-- sums 4 [1,2,3] [1,2,3] == [(1,3),(2,2),(3,1)]
Then check that the list of constrained sums is not empty:
sumCheck i as bs = not (null (sums i as bs))
-deech
On Mon, Jul 25, 2011 at 10:52 PM, Bryce Verdier <[email protected]> wrote:
> Hi all,
> I'm new to haskell, and I'm trying to get better with it. Recently I
> completed one of the challenges from Programming Praxis and I was wondering
> if people would be willing to spend some time and tell me how I could
> improve my code.
> Thanks in advance,
> Bryce
> Here is a link to the programming praxis:
> http://programmingpraxis.com/2011/07/19/sum-of-two-integers/
> And here is my code:
> import Data.List
> import Data.Maybe
> sumCheck :: Int -> [Int] -> [Int] -> Maybe (Int, Int)
> sumCheck _ [] _ = Nothing
> sumCheck total (x:xs) ys = if total' == Nothing
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? then sumCheck total xs ys
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? else return (x, (ys !! ( fromJust total')))
> ? ? ? ? ? ? ? ? ? ? ? ? ? ?where total' = (total - x) `elemIndex` ys
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
>
------------------------------
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
End of Beginners Digest, Vol 37, Issue 59
*****************************************