Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."
Today's Topics:
1. Re: FW: question (Benjamin Edwards)
2. Re: FW: question (Patrick LeBoutillier)
3. Re: FW: question (Roelof Wobben)
4. Re: FW: question (David Place)
5. Re: FW: question (Thomas)
6. Re: Monads in javascript (Martin Drautzburg)
7. Looking for a datastructure (Kees Bleijenberg)
----------------------------------------------------------------------
Message: 1
Date: Thu, 14 Jul 2011 11:16:42 +0100
From: Benjamin Edwards <[email protected]>
Subject: Re: [Haskell-beginners] FW: question
To: Roelof Wobben <[email protected]>
Cc: [email protected]
Message-ID:
<can6k4njea6bnrgr_wpc8thavepeju5wfus0exf4sr0r0x+0...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
Hi Roelof,
I don't want to come across as rude here, and I am sure the rest of the list
will shoot me down if I do, but you had a number of people trying to
diagnose a problem caused mostly by a failure on your part to type out
correctly what you have read. You are going to find it very hard to make
meaningful progress in your quest to learn Haskell if you don't take the
time to at least learn the basic syntax of the language before coming to the
mailing lists for help.
Best,
Ben
On 14 Jul 2011 10:48, "Roelof Wobben" <[email protected]> wrote:
Hello
That was the problem.
When I do <- instead of <-- I see outcome.
So this problem is also solved.
Everyone thanks for the help and patience.
Roelof
________________________________
> Date: Thu, 14 Jul 2011 09:25:33 +0100
> Subject: Re: [Haskell-beginners] FW: question
> From: [email protected]
> To: [email protected]
> CC: [email protected]; [email protected]
>
>
> The first problem I see is that "x <--" is wrong... it should be just x
> <-, a single hyph...
> <[email protected]<mailto:[email protected]>>
> wrote:
>
> Hi.
> On wich system are you using GHCi ? Probably I missed this information
> from...
_______________________________________________
Beginners mailing list
[email protected]
http://...
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20110714/e6132496/attachment-0001.htm>
------------------------------
Message: 2
Date: Thu, 14 Jul 2011 09:59:07 -0400
From: Patrick LeBoutillier <[email protected]>
Subject: Re: [Haskell-beginners] FW: question
To: Benjamin Edwards <[email protected]>
Cc: [email protected]
Message-ID:
<CAJcQsbgVSrys6V_SEzSmV3ngyDNDQ0xWQc0NC8iC=y66ygc...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
On Thu, Jul 14, 2011 at 6:16 AM, Benjamin Edwards
<[email protected]> wrote:
> Hi Roelof,
>
> I don't want to come across as rude here, and I am sure the rest of the list
> will shoot me down if I do, but you had a number of people trying to
> diagnose a problem caused mostly by a failure on your part to type out
> correctly what you have read. You are going to find it very hard to make
> meaningful progress in your quest to learn Haskell if you don't take the
> time to at least learn the basic syntax of the language before coming to the
> mailing lists for help.
I agree, but here's something I'd like to point out:
IIRC, Roelof uses "Programming in Haskell" as his learning material.
One thing that I found confusing in that book (and in other books as
well), is that the authors insist on using LaTeX mathematical symbols
in Haskell code instead of "valid Haskell syntax". For example, in the
exact example from the book that Roelof is trying to understand:
[x^2 | x <- [1..5]]
, the caret ('^') is not a caret, it's "an arrow pointing upwards",
and the ASCII arrow ("<-") is not an ASCII arrow composed of '<' and
'-', but instead "a single-character arrow". A table at the end of the
book (Appendix B) explains the correspondance, but that might not be
immediately obvious.
What are the benefits of having Haskell code samples (in a book
specifically about learning Haskell) not being valid Haskell syntax?
Why burden the beginner with the task of mentally translating these symbols?
Patrick
>
> Best,
> Ben
>
> On 14 Jul 2011 10:48, "Roelof Wobben" <[email protected]> wrote:
>
>
>
> Hello
>
>
>
> That was the problem.
>
> When I do <- instead of <-- I see outcome.
>
> So this problem is also solved.
>
>
>
> Everyone thanks for the help and patience.
>
>
>
> Roelof
>
>
> ________________________________
>> Date: Thu, 14 Jul 2011 09:25:33 +0100
>> Subject: Re: [Haskell-beginners] FW: question
>> From: [email protected]
>> To: [email protected]
>> CC: [email protected]; [email protected]
>
>>
>>
>> The first problem I see is that "x <--" is wrong... it should be just x
>> <-, a single hyph...
>
>> <[email protected]<mailto:[email protected]>>
>
>> wrote:
>>
>> Hi.
>> On wich system are you using GHCi ? Probably I missed this information
>> from...
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://...
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
>
--
=====================
Patrick LeBoutillier
Rosem?re, Qu?bec, Canada
------------------------------
Message: 3
Date: Thu, 14 Jul 2011 14:20:31 +0000
From: Roelof Wobben <[email protected]>
Subject: Re: [Haskell-beginners] FW: question
To: <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"
----------------------------------------
> Date: Thu, 14 Jul 2011 09:59:07 -0400
> Subject: Re: [Haskell-beginners] FW: question
> From: [email protected]
> To: [email protected]
> CC: [email protected]; [email protected]
>
> On Thu, Jul 14, 2011 at 6:16 AM, Benjamin Edwards
> <[email protected]> wrote:
> > Hi Roelof,
> >
> > I don't want to come across as rude here, and I am sure the rest of the list
> > will shoot me down if I do, but you had a number of people trying to
> > diagnose a problem caused mostly by a failure on your part to type out
> > correctly what you have read. You are going to find it very hard to make
> > meaningful progress in your quest to learn Haskell if you don't take the
> > time to at least learn the basic syntax of the language before coming to the
> > mailing lists for help.
>
> I agree, but here's something I'd like to point out:
>
> IIRC, Roelof uses "Programming in Haskell" as his learning material.
> One thing that I found confusing in that book (and in other books as
> well), is that the authors insist on using LaTeX mathematical symbols
> in Haskell code instead of "valid Haskell syntax". For example, in the
> exact example from the book that Roelof is trying to understand:
>
> [x^2 | x <- [1..5]]
>
> , the caret ('^') is not a caret, it's "an arrow pointing upwards",
> and the ASCII arrow ("<-") is not an ASCII arrow composed of '<' and
> '-', but instead "a single-character arrow". A table at the end of the
> book (Appendix B) explains the correspondance, but that might not be
> immediately obvious.
>
> What are the benefits of having Haskell code samples (in a book
> specifically about learning Haskell) not being valid Haskell syntax?
> Why burden the beginner with the task of mentally translating these symbols?
>
>
> Patrick
Hello Patrick,
You say it better then I could say it.
The initial question was about the difference between what you call Latex and
Haskell symbols.
I must say that this book explains things better then the other books I tried.
Roelof
------------------------------
Message: 4
Date: Thu, 14 Jul 2011 10:40:17 -0400
From: David Place <[email protected]>
Subject: Re: [Haskell-beginners] FW: question
To: Roelof Wobben <[email protected]>
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii
On Jul 14, 2011, at 10:20 AM, Roelof Wobben wrote:
> The initial question was about the difference between what you call Latex and
> Haskell symbols.
>
> I must say that this book explains things better then the other books I tried.
On the web page for that book, there are a number of code sample files to
download. Maybe you could look there for some good concrete examples of
syntax. Note that they are in Literary Programming Style.
> http://www.cs.nott.ac.uk/~gmh/book.html
____________________
David Place
Owner, Panpipes Ho! LLC
http://panpipesho.com
[email protected]
------------------------------
Message: 5
Date: Thu, 14 Jul 2011 18:42:55 +0200
From: Thomas <[email protected]>
Subject: Re: [Haskell-beginners] FW: question
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
In Appendix B (page 166) there is a "symbol table" translating the
typeset symbols into valid Haskell syntax.
HTH,
Thomas
On 14.07.2011 15:59, Patrick LeBoutillier wrote:
> IIRC, Roelof uses "Programming in Haskell" as his learning material.
> One thing that I found confusing in that book (and in other books as
> well), is that the authors insist on using LaTeX mathematical symbols
> in Haskell code instead of "valid Haskell syntax". For example, in the
> exact example from the book that Roelof is trying to understand:
>
> [x^2 | x<- [1..5]]
>
> , the caret ('^') is not a caret, it's "an arrow pointing upwards",
> and the ASCII arrow ("<-") is not an ASCII arrow composed of '<' and
> '-', but instead "a single-character arrow". A table at the end of the
> book (Appendix B) explains the correspondance, but that might not be
> immediately obvious.
>
------------------------------
Message: 6
Date: Thu, 14 Jul 2011 20:32:29 +0200
From: Martin Drautzburg <[email protected]>
Subject: Re: [Haskell-beginners] Monads in javascript
To: [email protected]
Message-ID: <[email protected]>
Content-Type: Text/Plain; charset="iso-8859-15"
On Thursday, 14. July 2011 10:03:23 Mats Rauhala wrote:
> Could you give an example how CPS helped your situation? I'm trying to
> grok continuation passing style, but for now it just seems to complicate
> and/or slow down code (stack)
Well it turned out my problem was entirely syntax. If had understood, that an
ajax call basically looks like this:
// make two successive ajax calls
callAsync (remoteFunction1, ["arguments"], function(ret,exc) {
//do something with ret and exc
var x = ret[1]
callAsync(remoteFunction2, [x], function(ret,exc) {
// do something else
}}
You make a remote call and specify what shall happen when the call returns by
providing an anonymous callback function. The callAsync itself immediately
returns.
My only problem was the ugly nesting when I want to place multiple ajax calls
which need to be executed in a precise order as in the example above. I cannot
simply make the first call and return to make the second call. I would have no
idea where exceution would commence after the return.
That chain of function calls builds its own little world and you never
"return" from this world. This reminded me of haskell Monads which can also
create their own little worlds, where e.g. state is passed around . This is
why I asked here. But it turned out it had little to do with Monads. Still it
is a functional issue.
I believe the code above is already CPS, but very ugly. For some reason I
hadn't seen, that there is no need to define the callbacks inline, but I might
as well assign them to a variables. Then the above code looks like:
callAsync (remoteFunction1, ["arguments"], callback1);
var callback1 = function(ret,exc) {
//do something with ret and exc
var x = ret[1]
callAsync(remoteFunction2, [x], callback2)
}
var callback2 = function(ret,exc) {
// do something else
}
This is more gentle to my eyes.
The only difficulty is that callback1 and callback2 need to be defined at the
time callAsync is called. Usually this is the case. I could of course reverse
the order, which would make things safer, but then control will flow bottom-
up, whereas all the regular code executes top-down.
--
Martin
------------------------------
Message: 7
Date: Fri, 15 Jul 2011 11:42:12 +0200
From: "Kees Bleijenberg" <[email protected]>
Subject: [Haskell-beginners] Looking for a datastructure
To: <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset="us-ascii"
My program uses a very long list of (index,count) items. Index and count are
Int's.
The program updates the count values a lot. Therefor it uses the index as a
key to update the belonging count value.
After updating, the program needs the (index,count) pair with the least
count value in the list.
What is an approriate (fast) datastructure? My first idea was to use a heap.
Problem with the heap is that I can't update the count value by its index
fast.
Any ideas?
Kees
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20110715/755c0228/attachment.htm>
------------------------------
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
End of Beginners Digest, Vol 37, Issue 28
*****************************************