Functional analysis and design

Hello all, often, when I read tutorials or lectures about haskell, I am absolutely intrigued by the solutions presented there. It often creates this "aha" effect and I think "yes, this perfectly describes the problem to solve, this is what the problem IS". But alas, I have difficulties to come up with equally brilliant solutions for my own problems. As for learning haskell, I am now pretty comfortable with it, but I fail to apply it to real world problems. I am pretty good at semantic data modelling, but this technique gives me nothing but trouble, when I try to apply it in the functional world (while it works well in the OO world). What I am trying now it asking "what do I want the system to compute in the first place" and then think about how to implement these top-level functions. Do you think that this is a good way to start? Other than that I was trying to find some information about haskell as a specification language, but could not find anything. Is this a sensible idea at all? If not, how would you write a specification if not in haskell itself? So if you have any pointers on how to address a non-trivial problem in haskell, this would by much appreciated. -- Martin

You will seldom find the 'best' solution immediately - remember that
lectures are prepared
and so is most of the things you see.
Write something that works, then make it pretty,
if you can prove by numbers (measurements) that it needs/can be
optimized, do it.
For this reason, I do TDD - building a set of regression
tests which I can lean on for refactoring.
G
On Sat, Jan 5, 2013 at 12:10 PM, Martin Drautzburg wrote: Hello all, often, when I read tutorials or lectures about haskell, I am absolutely
intrigued by the solutions presented there. It often creates this "aha"
effect
and I think "yes, this perfectly describes the problem to solve, this is
what
the problem IS". But alas, I have difficulties to come up with equally brilliant solutions
for
my own problems. As for learning haskell, I am now pretty comfortable with
it,
but I fail to apply it to real world problems. I am pretty good at semantic data modelling, but this technique gives me
nothing but trouble, when I try to apply it in the functional world (while
it
works well in the OO world). What I am trying now it asking "what do I want the system to compute in the
first place" and then think about how to implement these top-level
functions.
Do you think that this is a good way to start? Other than that I was trying to find some information about haskell as a
specification language, but could not find anything. Is this a sensible
idea
at all? If not, how would you write a specification if not in haskell
itself? So if you have any pointers on how to address a non-trivial problem in
haskell, this would by much appreciated. --
Martin _______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners

On Sat, Jan 5, 2013 at 4:40 PM, Martin Drautzburg
Hello all,
often, when I read tutorials or lectures about haskell, I am absolutely intrigued by the solutions presented there. It often creates this "aha" effect and I think "yes, this perfectly describes the problem to solve, this is what the problem IS".
But alas, I have difficulties to come up with equally brilliant solutions for my own problems.
Human learning is far more mimetic than we realize. See one master and one goes: This is incredible! See 10 and one starts picking up small patterns they use See 100s (or a few over long periods) and one starts becoming like them. A favourite example of mine: Today J S Bach is regarded as the pinnacle of western classical music. When he was a young man he spent much of his time just copying out 'the masters' (in quotes because today they are not regarded today in the same category as Bach. So go ahead -- keep getting awed by masterly 'works of (functional) art'
As for learning haskell, I am now pretty comfortable with it, but I fail to apply it to real world problems.
I am pretty good at semantic data modelling, but this technique gives me nothing but trouble, when I try to apply it in the functional world (while it works well in the OO world).
What I am trying now it asking "what do I want the system to compute in the first place" and then think about how to implement these top-level functions. Do you think that this is a good way to start?
Other than that I was trying to find some information about haskell as a specification language, but could not find anything. Is this a sensible idea at all? If not, how would you write a specification if not in haskell itself?
So if you have any pointers on how to address a non-trivial problem in haskell, this would by much appreciated.
Dont underestimate the trivial. One of the difficulties with modern haskell is that advanced type hackery is taking so much center-stage that simple stuff is getting neglected. I have a page of 'basic stuff' that is good nourishment to all (not just functional) programmers: http://blog.languager.org/2012/10/functional-programming-lost-booty.html My favourite books are Bird and Wadler and Chris Reade Martin Henson (yes that gives away my age!) And of course spj's bible on implementation, not so much for the implementation as for the foundations. --
Martin
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners

On Sunday, 6. January 2013 08:13:14 Rustom Mody wrote:
A favourite example of mine: Today J S Bach is regarded as the pinnacle of western classical music. When he was a young man he spent much of his time just copying out 'the masters'
Perfect analogy! You see, with music there is a set of rules which can be learned, because they are written down. But mastering these does not make you a good composer. When given the task "write a tooth-paste jingle" you would still not know where to start. But when you talk to a jingle writer, he could probably tell you his train of thoughts and you would be able to learn from him. Incidently I am interested in writing music too and I ran into the exact same problem as with haskell. Try to find information about how to write 3-4voice vocals, so it sounds like the Beach Boys, the BGs or Abba. Even though this wisdom is known to someone, it is impossible to find something which resembles a tutorial. Either this wisdom cannot be written down at all, or the masters prefer to keep their wisdom concealed. Copying the masters will certainly help, but it is a long and time-consuming process. I was hoping for ways to shorten it. -- Martin
participants (3)
-
Gianfranco Alongi
-
Martin Drautzburg
-
Rustom Mody