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: Need advice on R vs Haskell (Ertugrul Soeylemez)
2. Typing/N00b question/My first haskell. (bryan hunt)
3. Re: Typing/N00b question/My first haskell. (Alia)
4. Re: Typing/N00b question/My first haskell. (Henk-Jan van Tuyl)
5. Re: Typing/N00b question/My first haskell. (Magnus Therning)
----------------------------------------------------------------------
Message: 1
Date: Mon, 21 Nov 2011 10:15:39 +0100
From: Ertugrul Soeylemez <[email protected]>
Subject: Re: [Haskell-beginners] Need advice on R vs Haskell
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=US-ASCII
Hello there,
my experience is that most people who don't take Haskell seriously as a
programming language won't really learn to use it for real applications.
Even though you will learn to solve fractions of problems in more
elegant ways in other languages, you will likely miss the big picture.
In some cases your Haskell knowledge may even get in your way [1].
Now this is a generalization, which may not be true in your case. In
fact your knowledge of other languages will be more likely to get in
your way in Haskell, because it is very easy to adopt imperative
thinking, while it is more involved to adopt Haskell thinking (which is
not simply functional thinking) especially when you are an imperative
thinker.
In any case, you might be able to contribute to existing packages soon,
because usually one of the first things you learn in Haskell is to write
pure, elegant algorithms. This is certainly valuable for math packages.
Greets,
Ertugrul
[1]: <http://lukeplant.me.uk/blog/posts/
why-learning-haskell-python-makes-you-a-worse-programmer/>
haskell heath <[email protected]> wrote:
> I should also mention I've been through node.js's tutorials, and I've
> briefly dabbled in Ruby. Is it far-fetched to think I can be just as
> productive in Haskell as opposed to using stuff I already know? Just trying
> to decide if it's worth continuing my learning experience. One alternative
> I've considered is to take it slow with Haskell, and use it more for
> educational purposes for now, and use it when I feel comfortable. Read
> through one section of LYAH/week, one section of the R tutorial/day, and
> work on one project euler problem each week.
>
> Then again if it's just for educational purposes, I could even throw in the
> SICP videos when, but I'm not sure how practical that is either.
>
> On Sat, Nov 19, 2011 at 11:52 PM, haskell heath
> <[email protected]>wrote:
>
> > I'm new to Haskell and I can't really call myself a decent programmer in
> > any other language. Do you think it's wrong to think that I can contribute
> > to the statistics library? I can't decide if I'm being pragmatic for me to
> > learn Haskell and contribute to the statistics library in hopes of being as
> > productive as I would be in learning R. I'm wanting to write a scraper and
> > analyze that data, and I figure this is what the statistics module can be
> > used for. The other alternative to Haskell and R, is to use something like
> > node.js for scraping, js's regex for filtering, and analyzing the resulting
> > data with RPy.
> >
> > Here's a brief overview of my programming exp:
> > Python:
> > - How to Think Like a Computer Scientist using Python
> > - official tutorial
> > - official reference material
> > - a few project euler problems
> >
> > Javascript
> > - all of the Mozilla docs
> >
> > Haskell
> > - started with the RWH, switched to 98' Report, switched over to Yet
> > Another Haskell Tutorial, switched to Gentle Intro, and finally switched to
> > Learn You a Haskell and I'm on the seventh chapter now. I'm considering
> > switching yet again to A Gentle Intro, because it's been months now, and I
> > just want to finish one of these, and that seems to be quickest route.
> >
> > Other
> > - I have briefly learned about C and C++, I start an intro to C++
> > programming next semester.
> >
> > Thank you for your help.
> >
>
--
nightmare = unsafePerformIO (getWrongWife >>= sex)
http://ertes.de/
------------------------------
Message: 2
Date: Mon, 21 Nov 2011 10:38:03 +0000
From: bryan hunt <[email protected]>
Subject: [Haskell-beginners] Typing/N00b question/My first haskell.
To: Haskell Beginners List <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii
I'm trying to read in a value and convert it into a number for use in the
ageJudge function. I've tried a number of different approaches but keep
getting type conversion errors. This is literally my first Haskel
program - so please don't laugh...
module Main where
ageJudge :: (Integral a) => a -> String
ageJudge age
| age >= 40 = "You're too old!"
| age <= 30 = "Your too young"
| otherwise = "Not in the programming age range.."
main = do
putStrLn "What is your name?"
name <- getLine
putStrLn ("Nice to meet you, " ++ name ++ "!")
putStrLn "What is your age?"
age <- getLine
let inpIntegral = (read age)::Double
-- let decission = ageJudge (read inpIntegral)::Integral
putStrLn ("We decided!")
-- putStrLn ("We decided:\n" ++ show(1) ++ "!")
-- ageJudge inpIntegral
------------------------------
Message: 3
Date: Mon, 21 Nov 2011 02:49:47 -0800 (PST)
From: Alia <[email protected]>
Subject: Re: [Haskell-beginners] Typing/N00b question/My first
haskell.
To: "[email protected]" <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset=iso-8859-1
The key function is to_int below:
<snip>
module Main where
ageJudge :: (Integral a) => a -> String
ageJudge age
??? | age >= 40 = "You're too old!"
??? | age <= 30 = "Your too young"
??? | otherwise?? = "Not in the programming age range.."
to_int s = read s :: Int
eg = ageJudge (to_int "40")
</snip>
------------------------------
Message: 4
Date: Mon, 21 Nov 2011 11:54:32 +0100
From: "Henk-Jan van Tuyl" <[email protected]>
Subject: Re: [Haskell-beginners] Typing/N00b question/My first
haskell.
To: "Haskell Beginners List" <[email protected]>, "bryan hunt"
<[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset=iso-8859-15; format=flowed;
delsp=yes
On Mon, 21 Nov 2011 11:38:03 +0100, bryan hunt
<[email protected]> wrote:
> but keep
> getting type conversion errors.
> module Main where
>
> ageJudge :: (Integral a) => a -> String
> ageJudge age
> | age >= 40 = "You're too old!"
> | age <= 30 = "Your too young"
> | otherwise = "Not in the programming age range.."
>
> main = do
> putStrLn "What is your name?"
> name <- getLine
> putStrLn ("Nice to meet you, " ++ name ++ "!")
> putStrLn "What is your age?"
> age <- getLine
> let inpIntegral = (read age)::Double
> -- let decission = ageJudge (read inpIntegral)::Integral
> putStrLn ("We decided!")
> -- putStrLn ("We decided:\n" ++ show(1) ++ "!")
> -- ageJudge inpIntegral
You use the type class Integral, which contains Int and Integer, for
ageJudge; it is better to use Double, as you use this type for reading the
age. Another option is, to use the function "round" to round the age.
Note, that you cannot use Integral as a type.
Regards,
Henk-Jan van Tuyl
--
http://Van.Tuyl.eu/
http://members.chello.nl/hjgtuyl/tourdemonad.html
--
------------------------------
Message: 5
Date: Mon, 21 Nov 2011 11:59:00 +0100
From: Magnus Therning <[email protected]>
Subject: Re: [Haskell-beginners] Typing/N00b question/My first
haskell.
To: bryan hunt <[email protected]>
Cc: Haskell Beginners List <[email protected]>
Message-ID:
<CAAExw5suO=3fyb3grbw--sh+sylknp67fn00py7phdehmaj...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8
On Mon, Nov 21, 2011 at 11:38, bryan hunt <[email protected]> wrote:
>
>
> I'm trying to read in a value and convert it into a number for use in the
> ageJudge function. I've tried a number of different approaches but keep
> getting type conversion errors. This is literally my first Haskel
> program - so please don't laugh...
>
> module Main where
>
> ageJudge :: (Integral a) => a -> String
I'd just skip the type of 'ageJudge' and let the compiler choose
itself; it then ends up being "ageJudge :: (Ord a, Num a) => a ->
[Char]".
> ageJudge age
> ? ?| age >= 40 = "You're too old!"
> ? ?| age <= 30 = "Your too young"
> ? ?| otherwise ? = "Not in the programming age range.."
>
> main = do
> ?putStrLn "What is your name?"
> ?name <- getLine
> ?putStrLn ("Nice to meet you, " ++ name ++ "!")
> ?putStrLn "What is your age?"
> ?age <- getLine
> ?let inpIntegral = (read age)::Double
"Double" is not an "Integral", you most likely want to use "Int" or
"Integer" here. But again, you can just drop the explicit type and
let the compiler decide itself.
> -- ?let decission = ageJudge (read inpIntegral)::Integral
"read" takes a String argument, so this line makes very little sense.
> ?putStrLn ("We decided!")
> -- ?putStrLn ("We decided:\n" ++ show(1) ++ "!")
> -- ageJudge inpIntegral
/M
--
Magnus Therning ? ? ? ? ? ? ? ? ? ? ?OpenPGP: 0xAB4DFBA4
email: [email protected] ? jabber: [email protected]
twitter: magthe ? ? ? ? ? ? ? http://therning.org/magnus
------------------------------
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
End of Beginners Digest, Vol 41, Issue 27
*****************************************