Regards
Chris Saunders
When typing functions into GHCi, add a `let' in front:
Prelude> let myadd (x,y) = x + y
Prelude> :info myadd
myadd :: (Num t) => (t, t) -> t -- Defined at <interactive>:1:4-8
Prelude>
If you put it in a file instead and use :load to load it (or :reload to
reload it), you don't put the `let' in the definition in the file.
Mark
Regards
Chris Saunders
"Mark T. B. Carroll" <Mark.C...@Aetion.com> wrote in message
news:87aazpy...@ixod.org...
IRC might be a better place than Usenet to seek this kind of help. If
you have an IRC client, hang out on #haskell. It is a friendly place
and you'll learn a lot.
> I very much appreciate your help. I'm afraid I may be full of dumb
> questions for awhile. For a little while, I don't think I'll be trying to
> create any source files but I'll try to remember the tip.
No problem, dumb questions are at least quickly answered. (-:
So what is this Channel 9 that teaches Haskell? Sounds intriguing.
Mark
Oh, an online Microsoft community thing, thank you! And I had been
wondering if it was some local public access station. (Ours happens to
be on channel 9 on cable.)
Mark
Your original question has been answered. I just like to add something
very important.
Simply put, this is not the way you would define a 'myAdd' function in
Haskell. Your function doesn't take two arguments, but only one
argument, a tuple of two numbers, notated by (x, y). Here is how to do
it properly:
myAdd x y = x + y
What is the difference, you may ask. It's currying. If you define it
the way you did, you lose the advantages of curried style, one of which
is more concise source code, another one is partial application. You
couldn't use the following statements:
myAdd 3 5
Results in 8, you would need to write myAdd (3, 5).
myAdd 3
Results in a function, which adds 3 to its argument. This is called
partial application, one of the key features of currying.
3 `myAdd` 5
Infix notation for binary functions. Doesn't make sense for your
definition, because your variant of myAdd takes only one argument,
namely a tuple.
Functional programming tutorials on the MSDN are usually totally
brain-damaged, even for Microsoft's own language F#. Even though F#
supports currying, they don't promote its use and still use the obsolete
uncurried style. It seems like the tutorial authors don't understand
the language themselves. Interestingly even F#'s design is highly
influenced by this incompetence, which makes the language frustrating to
use, even though it would have potential.
I recommend learning from other sources.
Greets,
Ertugrul.
--
nightmare = unsafePerformIO (getWrongWife >>= sex)
http://blog.ertes.de/
Regards
Chris Saunders
"Paul Rubin" <http://phr...@NOSPAM.invalid> wrote in message
news:7xvdidi...@ruckus.brouhaha.com...
Don't be ashamed, just ask. There are no dumb questions, just dumb answers.
I'm not using Windows, but AFAIK, "mirc" is a popular client for Windows.
- Dirk
Regards
Chris Saunders
"Ertugrul S�ylemez" <e...@ertes.de> wrote in message
news:20091018070...@tritium.xx...
> Chris Saunders <ev...@mountaincable.net> wrote:
>> I rather like this suggestion. I have never used IRC. Could you suggest a
>> program to use on Windows. Right now I am having a few difficulties that
>> I'm almost ashamed to ask about.
>
> Don't be ashamed, just ask. There are no dumb questions, just dumb answers.
Quite, if you're making a good effort to try, we'll still be able to
tell even if the questions are dumb. And for what it's worth, I've asked
my fair share of dumb questions too. (-:
Mark
> dumb questions are at least quickly answered.
For instance, seeing intersectBy, etc., I was just wondering aloud where
differenceBy is, only for it to be pointed out to me that it's
deleteFirstsBy. (In my defense, Hayoo was down at the time. (-:)
Mark