Haskell
Haskell Video Tutorials :
http://vimeo.com/album/24920
Newbie Tutorial on Haskell
http://book.realworldhaskell.org/read/getting-started.html#starting.string
Introduction on Data.Map
http://www.haskell.org/ghc/docs/latest/html/libraries/containers/Data-Map.html
.
How to load .hs files using Haskell GHCI compiler?
1. Run GHC
2. Load File Location
3. Load .hs file
4. Run your function
.
Explanation on the 4 Steps to load .hs into GHC
Below is the explanation for the four steps above to understand the steps in-depth.
_
Step 1:
Run GHC (GHC is short for Glasgow Haskell Compiler Interface)
If you do not have GHC installed, you could download it from here
For those who are interested in Window Haskell Compiler (WinHugs), download it from here
Step 2:
Locate where your .hs file is saved. For example, I created my code using notepad and saved it as ayumilove.hs (with the .hs file extension) in c:\program files\haskell. The location that I am referring to is the c:\program files\haskell. Next, you need to load that file location into GHC. To do complete step 2, you need to type in this command line (without double quotes) “:cd YourHsLocation”. In my case, I would type into GHC as “:cd c:\program files\haskell”. The reason to complete step 2 is to acknowledge GHC that ayumilove.hs file is located in that folder/place I saved.
Step 3:
Once you have pointed out to GHC on .hs file location, you need to load your .hs file into GHC too. To do this, type this command line (without double qoutes) “:load yourhsfilename”. In my case, my .hs file is called ayumilove.hs, so I will type this “:load ayumilove” without the .hs file extension!. Another example would be, if my .hs file is called calculator.hs, I would type it as “:load calculator”. If you encounter an error message here, this means the code in your .hs needs to be corrected before able reload the file perfectly in GHC.
Step 4:
Finally, you can now run your function that you have written in your .hs file. Example, if my calculator.hs has sumNumber function that takes in 2 Int parameters, I would just need to type in the function name and input 2 values like this (without double quotes) “sumNumber 3 5″. GHC would compute and sum those number (3 + 5 = 8 ) and generate the result 8 on the next new line. Most common mistake that newbie does is forget to include the function first before inputing the values.
.
.
Exercise 1
The area of a triangle with sides a, b, c is given by the formula
squareroot(s(s-a)(s-b)(s-c)) where s=(a+b+c)/2.
Design a haskell program to calculate the area of a triangle.
-
areaTriangle :: Float -> Float -> Float -> Float
areaTriangle a b c =
let s = (a+b+c)/2
in sqrt (s * ( s – a ) * ( s – b ) * ( s – c ))
l watched your videos l like them. thank you my friend
Thank you so much for your instructions, Ayu.
I am waiting for other videos regarding haskell.
Again, thank you ^_^
oh, nice to meet you. have not touched haskell for some time after creating a haskell application that does some weird stuff lol, its for school.
i love you ayumilove….
you re pretty intelligent to do all this work with haskell coding….could you out some new haskell tutorial videos… i am a student of engineering in systems…i see so much of haskell lenguaje..and its so hard for me to do it all alone…i hope you bring me out some help—i cant do it all by myself…i got a question: how do i do this?
a) Given a chain, the letters spend(pass) in position couple(par) to capital letter, and those of odd position to small letter.
i hope so much you could bring out some help….kisses, take care and your blog its wonderfull!!!!!
Carlos
cac_666@hotmail.com answer me PLEASE!!!!!
sorry for the very late reply, this message did not appear in my dashboard where i usually check for visitor messages.