-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Brian,
On Thu, Oct 20, 2005 at 03:22:11PM -0700, Brian Chrisman wrote:
> yes.. I agree it went well.. I learned some bits and I think so did
> everybody.. I've got more comments. but am in crunch time right now.
I just wrote my first haskell code. Only to find it was already
in the Prelude. Doh! But it was neat to work out. I was
attempting to explain to a friend on IRC how instead of (ie
Python):
def mysum(x):
sum = 0
for x in xrange(len(xs)):
sum = sum + x
return sum
You can just say like:
> mysum :: [Integer] -> Integer
> mysum [] = 0
> mysum (x:xs) = x + mysum xs
In fact once I realise the power of inferential typing I noticed
you can even eliminate the explicit type declaration:
> mysum [] = 0
> mysum (x:xs) = x + mysum xs
Here's some glorious screenshots:
Prelude> :l sum.lhs
Main> mysum([])
0
Main> mysum([1])
1
Main> mysum([1,4,8])
13
Main> mysum([6..12])
63
Main> mysum(['a',1])
ERROR - Cannot infer instance
*** Instance : Num Char
*** Expression : mysum ['a',1]
Oh well... so that's where I'm at after about a day of reading
on and off when I had the chance. Best of luck with whatever
you are crunching on. I assume scholastic things... :)
I'm not sure, for Nick etc, how it's done in Fedora but in
Debian/Ubuntu one can simply apt-get install the following
packages (well actually I installed everything that said haskell
LOL but this is just for the tutorial purposes):
hugs haskell98-report haskell98-tutorial
I've also installed:
ghc6 ghc6-doc ghc6-hopengl ghc6-libsrc ghc6-prof haskell-doc
haskell-hsql-doc haskell-utils
hmake libghc6-harp-dev libghc6-hsql-dev
libghc6-hsql-mysql-dev libghc6-src-exts-dev libghc6-wash-dev
libhugs-missingh missingh-doc
peace,
core
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
iD8DBQFDWCHvGAuLrxOyeJMRAj3LAKC/3WPyVOjwG+++Bpm+7PUrburJ6gCg9LX3
ZiLxKSgVArrLaKWQIciRE+c=
=TCOx
-----END PGP SIGNATURE-----
_______________________________________________
RLUG mailing list
[email protected]
http://lists.rlug.org/mailman/listinfo/rlug