| |||||||
| Programming and Assembly Language Please read this Topic's rules!! |
![]() |
| | LinkBack | Thread Tools | Rate Thread |
| |||
| Haskell Just out of interest is there any one here who knows anything about the functional programming language Haskell? If so i'm in need of a little help with implementing what is essentially a for loop using recursion and where clauses. I'm pretty sure there's something very simple wrong with the code i have but i really can't see what the problem is! In essence the layout of what I have is: mainfunction :: input type -> output type mainfunction x y = secondfunction x y where secondfunction x y | something == True = this | otherwise = secondfunction (change to x) (change to y) This to me seems it should work but i keep getting unexpected keyword "where" errors when i try and run it. Any thoughts?
__________________ Last edited by Rackne; 17th February, 2002 at 08:32 PM. |
| |||
| Sorry! Haskell is a language I'm learning as part of my degree, more because of it's value in giving us more programming experience than because it's useful for "real world" applications. It's meant to help improve our problem solving skills and has the added bonus of making us appreciate Java more. ![]() It also has fun things like polymorphic types that Java doesn't currently cope well with and it's one of the areas of research that the computing laboratory at my university (University of Kent) is currently persuing. Go to http://www.haskell.org for more information if you're interested.
__________________ |
| |||
| Visual Basic was the first language I learnt and I hadn't even thought to compare them until you mentioned it. Thinking about it, on the surface at least I don't think they're any more similar than Haskell and say Java is but I may well be wrong. Haskell is in fact based on lambda calculus, ie maths that goes straight over my head! It's taught side by side with logic and set theory which gives you an idea what it's principles are like. The thing about Haskell that I don't like is that there is little or no built in syntax for things like loops, which to be honest I miss and was what caused me a major problem last night! There's also as far as I can see little scope for casting between types which I also find irritating but then again it's very easy to define your own types specific to the problem being solved. It does have the advantage of requiring far fewer lines of code to achieve the same task than other languages would and code can very easily be reused due to its polymorphic nature. ie You can write functions without ever specifying an input or output type. I'm probably missing a lot of its subtleties but what I do like about it is that it seems less fluffy than other languages and it's easy to build up complex functions from lower level functions. But when it goes wrong it can be very difficult to find out why! There, I think I've rambled on long enough
__________________ |
| ||||
| Digging in deeper this looks like a very powerful language to write in. Since it is based around Lambda Calculus I would assume that is great for computational data, such as labratory programming. I just read a very little bit but the small amout of code is awsome... and the polymorphic nature of the code that the site discusses is cool as hell. you could port entire reams of code from one program to another with monkeying with it very much... very interesting stuff. I gotta know what degree you are working on that teaches this language... |
| |||
| Yes it was simple, and i'm quite ashamed that I didn't see it sooner! I'm on the first year of a BSc in Computer Science (with a year in industry that I really need to start thinking about soon.....)
__________________ |
| ||||
| I always used to get stupid little errors in my dephi programming, and it was always something so obvious and dumb I'd look right past it looking for a major error when it was usually something as simple as a spelling mistake, or colon missing or something. A 2nd set of eyes usually helps a lot, bit like when you're playing solitaire and someone watching see's all the moves you miss |
| ||||
| Quote:
__________________ "And, most of all, remember this descendant of David who beat the hell out of death." -from the book "Six Hours One Friday" by Max Lucado "You have to go outside the sequence of engines, into the world of men, to find the real originator of the rocket. Is it not equally reasonable to look outside nature for the real Originator of the natural order? -C.S. Lewis Director of JavaScript section of the Allied Sites Support Team, web designer and programmer for DaOCPlace, and co-web designer and programmer for AOA Files Avatar by Epox Tech ![]() <>< I Believe-Do You? |
| ||||
| Quote:
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Rate This Thread | |
| |