question

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
18 messages Options
Reply | Threaded
Open this post in threaded view
|

question

Roelof Wobben-2


hello,

 

For a exercise I need to multiply a number by itself.

So I used :

 

[x^2 | x <- [1..100]]

 

but now I get a error message on codepad that ^is unknown.

What can I use then and where do I find it on a keyboard?

 

Roelof

     

Reply | Threaded
Open this post in threaded view
|

question

Adrien Haxaire
Le 13/07/2011 21:27, Roelof Wobben a ?crit :

> For a exercise I need to multiply a number by itself.
>
> So I used :
>
>
>
> [x^2 | x<- [1..100]]
>
> but now I get a error message on codepad that ^is unknown.
> What can I use then and where do I find it on a keyboard?
>
> Roelof

Hello,

What does codepad not recognize? the caret character or the expression
you used?

ghci 7.0.3 gives me this:

Prelude> [x**2 | x <- [1..10]]
[1.0,4.0,9.0,16.0,25.0,36.0,49.0,64.0,81.0,100.0]

Prelude> [x^2 | x <- [1..10]]
[1,4,9,16,25,36,49,64,81,100]

Did you try it on ghci or in a text file?

I guess we need more details if the former. Which version of ghci do you
have? What is your OS?

Regards,
Adrien


Reply | Threaded
Open this post in threaded view
|

question

Roelof Wobben-2



----------------------------------------

> From: rwobben at hotmail.com
> To: adrien at adrienhaxaire.org
> Subject: RE: [Haskell-beginners] question
> Date: Wed, 13 Jul 2011 20:07:54 +0000
>
>
>
>
> ----------------------------------------
> > Date: Wed, 13 Jul 2011 22:00:40 +0200
> > From: adrien at adrienhaxaire.org
> > To: beginners at haskell.org
> > Subject: Re: [Haskell-beginners] question
> >
> > Le 13/07/2011 21:27, Roelof Wobben a ?crit :
> > > For a exercise I need to multiply a number by itself.
> > >
> > > So I used :
> > >
> > >
> > >
> > > [x^2 | x<- [1..100]]
> > >
> > > but now I get a error message on codepad that ^is unknown.
> > > What can I use then and where do I find it on a keyboard?
> > >
> > > Roelof
> >
> > Hello,
> >
> > What does codepad not recognize? the caret character or the expression
> > you used?
>


It don't regonize the caret character,

Like I said I use www.codepad.org and it uses Hugs.

Roelof




     

Reply | Threaded
Open this post in threaded view
|

question

Kyle Murphy-2
If you're going to continue to use www.codepad.org it might be worthwhile to
download and install Hugs so you have a better idea of what is and isn't
supported by it.

That being said, I wouldn't use codepad.org, or Hugs, as Hugs is rather out
of date and GHC is much better. In addition to being more up to date, GHC is
also used by most Haskell developers, including I'd imagine nearly everyone
on this mailing list, so you're going to get much better feedback about it
versus Hugs.

-R. Kyle Murphy
--
Curiosity was framed, Ignorance killed the cat.


On Wed, Jul 13, 2011 at 16:09, Roelof Wobben <rwobben at hotmail.com> wrote:

>
>
>
> ----------------------------------------
> > From: rwobben at hotmail.com
> > To: adrien at adrienhaxaire.org
> > Subject: RE: [Haskell-beginners] question
> > Date: Wed, 13 Jul 2011 20:07:54 +0000
> >
> >
> >
> >
> > ----------------------------------------
> > > Date: Wed, 13 Jul 2011 22:00:40 +0200
> > > From: adrien at adrienhaxaire.org
> > > To: beginners at haskell.org
> > > Subject: Re: [Haskell-beginners] question
> > >
> > > Le 13/07/2011 21:27, Roelof Wobben a ?crit :
> > > > For a exercise I need to multiply a number by itself.
> > > >
> > > > So I used :
> > > >
> > > >
> > > >
> > > > [x^2 | x<- [1..100]]
> > > >
> > > > but now I get a error message on codepad that ^is unknown.
> > > > What can I use then and where do I find it on a keyboard?
> > > >
> > > > Roelof
> > >
> > > Hello,
> > >
> > > What does codepad not recognize? the caret character or the expression
> > > you used?
> >
>
>
> It don't regonize the caret character,
>
> Like I said I use www.codepad.org and it uses Hugs.
>
> Roelof
>
>
>
>
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20110713/819bef06/attachment.htm>

Reply | Threaded
Open this post in threaded view
|

question

Andres Löh-2
I've just tried to evaluate 2 ^ 5 in codepad and it worked for me, so
(^) seems to be supported.

Cheers,
  Andres


Reply | Threaded
Open this post in threaded view
|

FW: question

Roelof Wobben-2

Oke,


I tried with Ghci 7.03 on the prompt but then I see this:


[x^2 | x <-- [1..100]


not in scope x
not in scope <--


When I put the text in a file I see these errors.


parse error : naked expression at top level.


Roelof


>
>
>
> ----------------------------------------
> > Date: Wed, 13 Jul 2011 23:04:58 +0200
> > From: andres.loeh at googlemail.com
> > To: beginners at haskell.org
> > Subject: Re: [Haskell-beginners] question
> >
> > I've just tried to evaluate 2 ^ 5 in codepad and it worked for me, so
> > (^) seems to be supported.
> >
> > Cheers,
> > Andres
> >
> > _______________________________________________
> > Beginners mailing list
> > Beginners at haskell.org
> > http://www.haskell.org/mailman/listinfo/beginners     

Reply | Threaded
Open this post in threaded view
|

FW: question

Luca Ciciriello
Hi.
On wich system are you using GHCi ? Probably I missed this information from the previous mail.

I'm using GHC 7.0.4 on MacOS X 10.6.8 (Xcode 4) and all works fine with [x^2 | x <- [1..10]].

You can try to see if you installation of ghc is ok typing "ghc-pkg list" from a console, or using the command ghc -v to see if there are some strange notification.

Luca.


On Jul 14, 2011, at 9:55 AM, Roelof Wobben wrote:

>
> Oke,
>
>
> I tried with Ghci 7.03 on the prompt but then I see this:
>
>
> [x^2 | x <-- [1..100]
>
>
> not in scope x
> not in scope <--
>
>
> When I put the text in a file I see these errors.
>
>
> parse error : naked expression at top level.
>
>
> Roelof
>
>
>>
>>
>>
>> ----------------------------------------
>>> Date: Wed, 13 Jul 2011 23:04:58 +0200
>>> From: andres.loeh at googlemail.com
>>> To: beginners at haskell.org
>>> Subject: Re: [Haskell-beginners] question
>>>
>>> I've just tried to evaluate 2 ^ 5 in codepad and it worked for me, so
>>> (^) seems to be supported.
>>>
>>> Cheers,
>>> Andres
>>>
>>> _______________________________________________
>>> Beginners mailing list
>>> Beginners at haskell.org
>>> http://www.haskell.org/mailman/listinfo/beginners     
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>



Reply | Threaded
Open this post in threaded view
|

FW: question

Benjamin Edwards
The first problem I see is that "x <--" is wrong... it should be just x <-,
a single hyphen.

On 14 Jul 2011 09:18, "Luca Ciciriello" <luca_ciciriello at hotmail.com> wrote:

Hi.
On wich system are you using GHCi ? Probably I missed this information from
the previous mail.

I'm using GHC 7.0.4 on MacOS X 10.6.8 (Xcode 4) and all works fine with [x^2
| x <- [1..10]].

You can try to see if you installation of ghc is ok typing "ghc-pkg list"
from a console, or using the command ghc -v to see if there are some strange
notification.

Luca.



On Jul 14, 2011, at 9:55 AM, Roelof Wobben wrote:

>
> Oke,
>
>
> I tried with Ghci 7.03 on the...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20110714/299727ea/attachment.htm>

Reply | Threaded
Open this post in threaded view
|

FW: question

Roelof Wobben-2


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: edwards.benj at gmail.com
> To: luca_ciciriello at hotmail.com
> CC: beginners at haskell.org; rwobben at hotmail.com
>
>
> The first problem I see is that "x <--" is wrong... it should be just x
> <-, a single hyphen.
>
> On 14 Jul 2011 09:18, "Luca Ciciriello"
> <luca_ciciriello at hotmail.com<mailto:luca_ciciriello at hotmail.com>>
> wrote:
>
> Hi.
> On wich system are you using GHCi ? Probably I missed this information
> from the previous mail.
>
> I'm using GHC 7.0.4 on MacOS X 10.6.8 (Xcode 4) and all works fine with
> [x^2 | x <- [1..10]].
>
> You can try to see if you installation of ghc is ok typing "ghc-pkg
> list" from a console, or using the command ghc -v to see if there are
> some strange notification.
>
> Luca.
>
>
> On Jul 14, 2011, at 9:55 AM, Roelof Wobben wrote:
>
> >
> > Oke,
> >
> >
> > I tried with Ghci 7.03 on the...      

Reply | Threaded
Open this post in threaded view
|

FW: question

Benjamin Edwards
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" <rwobben at hotmail.com> 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: edwards.benj at gmail.com
> To: luca_ciciriello at hotmail.com
> CC: beginners at haskell.org; rwobben at hotmail.com

>
>
> The first problem I see is that "x <--" is wrong... it should be just x
> <-, a single hyph...
> <luca_ciciriello at hotmail.com<mailto:luca_ciciriello at hotmail.com>>

> wrote:
>
> Hi.
> On wich system are you using GHCi ? Probably I missed this information
> from...

_______________________________________________
Beginners mailing list
Beginners at haskell.org
http://...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20110714/e6132496/attachment.htm>

Reply | Threaded
Open this post in threaded view
|

FW: question

Patrick LeBoutillier
On Thu, Jul 14, 2011 at 6:16 AM, Benjamin Edwards
<edwards.benj at gmail.com> 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" <rwobben at hotmail.com> 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: edwards.benj at gmail.com
>> To: luca_ciciriello at hotmail.com
>> CC: beginners at haskell.org; rwobben at hotmail.com
>
>>
>>
>> The first problem I see is that "x <--" is wrong... it should be just x
>> <-, a single hyph...
>
>> <luca_ciciriello at hotmail.com<mailto:luca_ciciriello at hotmail.com>>
>
>> wrote:
>>
>> Hi.
>> On wich system are you using GHCi ? Probably I missed this information
>> from...
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://...
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
>



--
=====================
Patrick LeBoutillier
Rosem?re, Qu?bec, Canada


Reply | Threaded
Open this post in threaded view
|

FW: question

Roelof Wobben-2



----------------------------------------

> Date: Thu, 14 Jul 2011 09:59:07 -0400
> Subject: Re: [Haskell-beginners] FW: question
> From: patrick.leboutillier at gmail.com
> To: edwards.benj at gmail.com
> CC: rwobben at hotmail.com; beginners at haskell.org
>
> On Thu, Jul 14, 2011 at 6:16 AM, Benjamin Edwards
> <edwards.benj at gmail.com> 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

     

Reply | Threaded
Open this post in threaded view
|

FW: question

David Place
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
d at vidplace.com





Reply | Threaded
Open this post in threaded view
|

FW: question

thomas-2
In reply to this post by Patrick LeBoutillier
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.
>


Reply | Threaded
Open this post in threaded view
|

FW: question

Roelof Wobben-2
In reply to this post by David Place

Oke,

 

Everyone thanks for the help.

 

Roelof



----------------------------------------

> Subject: Re: [Haskell-beginners] FW: question
> From: d at vidplace.com
> Date: Thu, 14 Jul 2011 10:40:17 -0400
> CC: beginners at haskell.org
> To: rwobben at hotmail.com
>
> 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
> d at vidplace.com
>
>
>    

Reply | Threaded
Open this post in threaded view
|

FW: question

Brent Yorgey-2
In reply to this post by David Place
On Thu, Jul 14, 2011 at 10:40:17AM -0400, David Place wrote:

> 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.  

Usually that is called "literate" programming style.  However, I like
very much the idea of a literary programming style.  Good programs
should read like gripping novels. =)

-Brent


Reply | Threaded
Open this post in threaded view
|

FW: question

Magnus Therning
On Mon, Jul 18, 2011 at 12:36:51PM -0400, Brent Yorgey wrote:

> On Thu, Jul 14, 2011 at 10:40:17AM -0400, David Place wrote:
> > 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.  
>
> Usually that is called "literate" programming style.  However, I like
> very much the idea of a literary programming style.  Good programs
> should read like gripping novels. =)

Like mystery novels, with twists and unexpected turns?

That's often what programs do read like, but I would much prefer them
to be like books for small children; concise, to the point, and
exceedingly easy to read, even when one is tired.

/M

--
Magnus Therning                      OpenPGP: 0xAB4DFBA4
email: magnus at therning.org   jabber: magnus at therning.org
twitter: magthe               http://therning.org/magnus

Most software today is very much like an Egyptian pyramid with
millions of bricks piled on top of each other, with no structural
integrity, but just done by brute force and thousands of slaves.
     -- Alan Kay
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/beginners/attachments/20110718/6ab867c5/attachment.pgp>

Reply | Threaded
Open this post in threaded view
|

FW: question

Brent Yorgey-2
On Mon, Jul 18, 2011 at 06:42:57PM +0200, Magnus Therning wrote:

> On Mon, Jul 18, 2011 at 12:36:51PM -0400, Brent Yorgey wrote:
> > On Thu, Jul 14, 2011 at 10:40:17AM -0400, David Place wrote:
> > > 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.  
> >
> > Usually that is called "literate" programming style.  However, I like
> > very much the idea of a literary programming style.  Good programs
> > should read like gripping novels. =)
>
> Like mystery novels, with twists and unexpected turns?
>
> That's often what programs do read like, but I would much prefer them
> to be like books for small children; concise, to the point, and
> exceedingly easy to read, even when one is tired.

It depends on the type of program.  If you have a complicated story to
tell, you have a complicated story to tell.  But good mystery novels
take a complicated story and tell it in a way that helps the reader
follow all the threads, appreciate the surprising twists, and come
away feeling satisfied.  Most programs do not read like that.

-Brent