Send Beginners mailing list submissions to
        beginners@haskell.org

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
        beginners-requ...@haskell.org

You can reach the person managing the list at
        beginners-ow...@haskell.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1.  question (Roelof Wobben)
   2. Re:  question (Adrien Haxaire)
   3.   question (Roelof Wobben)
   4. Re:  question (Kyle Murphy)
   5. Re:  question (Andres Loeh)
   6. Re:  Monads in javascript (Martin Drautzburg)
   7.  FW:  question (Roelof Wobben)
   8. Re:  Monads in javascript (Mats Rauhala)
   9. Re:  Monads in javascript (Thomas Davie)
  10. Re:  FW:  question (Luca Ciciriello)


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

Message: 1
Date: Wed, 13 Jul 2011 19:27:41 +0000
From: Roelof Wobben <rwob...@hotmail.com>
Subject: [Haskell-beginners] question
To: <beginners@haskell.org>
Message-ID: <snt118-w15151ddd66694f8bb57c2cae...@phx.gbl>
Content-Type: text/plain; charset="iso-8859-1"



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

                                          


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

Message: 2
Date: Wed, 13 Jul 2011 22:00:40 +0200
From: Adrien Haxaire <adr...@adrienhaxaire.org>
Subject: Re: [Haskell-beginners] question
To: Haskell Beginners <beginners@haskell.org>
Message-ID: <4e1df968.4090...@adrienhaxaire.org>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

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



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

Message: 3
Date: Wed, 13 Jul 2011 20:09:00 +0000
From: Roelof Wobben <rwob...@hotmail.com>
Subject: [Haskell-beginners]  question
To: <beginners@haskell.org>
Message-ID: <snt118-w2308ccb9c6909a4f7e0a45ae...@phx.gbl>
Content-Type: text/plain; charset="iso-8859-1"




----------------------------------------
> From: rwob...@hotmail.com
> To: adr...@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: adr...@adrienhaxaire.org
> > To: beginners@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




                                          


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

Message: 4
Date: Wed, 13 Jul 2011 16:32:38 -0400
From: Kyle Murphy <orc...@gmail.com>
Subject: Re: [Haskell-beginners] question
To: Roelof Wobben <rwob...@hotmail.com>
Cc: beginners@haskell.org
Message-ID:
        <CA+y6Jcy93iTo8Aezn-Rt=ub_k9nhgk8b9modmvjeeyofffs...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

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 <rwob...@hotmail.com> wrote:

>
>
>
> ----------------------------------------
> > From: rwob...@hotmail.com
> > To: adr...@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: adr...@adrienhaxaire.org
> > > To: beginners@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@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-0001.htm>

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

Message: 5
Date: Wed, 13 Jul 2011 23:04:58 +0200
From: Andres Loeh <andres.l...@googlemail.com>
Subject: Re: [Haskell-beginners] question
To: beginners@haskell.org
Message-ID:
        <CALjd_v5gcySr=wnf5drl+3uq9_r4pagannxfmhgjn12tc-w...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

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

Cheers,
  Andres



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

Message: 6
Date: Wed, 13 Jul 2011 23:18:04 +0200
From: Martin Drautzburg <martin.drautzb...@web.de>
Subject: Re: [Haskell-beginners] Monads in javascript
To: beginners@haskell.org
Message-ID: <201107132318.04255.martin.drautzb...@web.de>
Content-Type: Text/Plain;  charset="iso-8859-1"

On Wednesday, 13. July 2011 00:03:44 Ertugrul Soeylemez wrote:

> > I had some hopes that chaining functions monad-style would ease my
> > pain. I might be on the wrong track though, feel free to tell me so.
> 
> You probably are, because the usefulness of monads depends a good deal
> on syntax.  ECMA-based languages like JavaScript, ActionScript, Haxe,
> etc. have a terrible syntax for anonymous functions.
> 
> To give you an alternative, this really sounds like you're looking for a
> continuation-based solution.  Continuation passing style could really
> solve your problem elegantly even in JavaScript.

Right. It did. 

It sometimes doens't work to define the callback *after* the function which 
needs the callback. It is not always easy to find out *when* things need to be 
defined in javascript. Luckily in Haskell there is no "when".

Still in most cases it works and the code looks like regular procedural code, 
where control flows from top to bottom. And I could nicely write code where 
the callback makes another callback etc.

Thanks.

-- 
Martin



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

Message: 7
Date: Thu, 14 Jul 2011 07:55:30 +0000
From: Roelof Wobben <rwob...@hotmail.com>
Subject: [Haskell-beginners] FW:  question
To: <beginners@haskell.org>
Message-ID: <snt118-w25aca8f008c3d1fa3e34b7ae...@phx.gbl>
Content-Type: text/plain; charset="iso-8859-1"


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.l...@googlemail.com
> > To: beginners@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@haskell.org
> > http://www.haskell.org/mailman/listinfo/beginners                           
> >           


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

Message: 8
Date: Thu, 14 Jul 2011 11:03:23 +0300
From: Mats Rauhala <mats.rauh...@gmail.com>
Subject: Re: [Haskell-beginners] Monads in javascript
To: beginners@haskell.org
Message-ID: <20110714080323.GA4959@libre.local>
Content-Type: text/plain; charset="us-ascii"

On 23:18 Wed 13 Jul     , Martin Drautzburg wrote:
> Right. It did. 
> 
> It sometimes doens't work to define the callback *after* the function which 
> needs the callback. It is not always easy to find out *when* things need to 
> be 
> defined in javascript. Luckily in Haskell there is no "when".
> 
> Still in most cases it works and the code looks like regular procedural code, 
> where control flows from top to bottom. And I could nicely write code where 
> the callback makes another callback etc.
> 
> Thanks.

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)

-- 
Mats Rauhala
MasseR
-------------- 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/20110714/957b771c/attachment-0001.pgp>

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

Message: 9
Date: Thu, 14 Jul 2011 09:13:10 +0100
From: Thomas Davie <tom.da...@gmail.com>
Subject: Re: [Haskell-beginners] Monads in javascript
To: Mats Rauhala <mats.rauh...@gmail.com>
Cc: beginners@haskell.org
Message-ID: <deb0924c-96d6-481c-a15f-d26038b7e...@gmail.com>
Content-Type: text/plain; charset=windows-1252


On 14 Jul 2011, at 09:03, 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)

This obviously isn't Martin's example, but hopefully this should help.

In a 3D game engine, the norm (in procedural land at least) is to have calls 
like someInWorldObject.animate(someAnimation).  If you want to run that 
animation, and then another, the norm is to set a timer to fire when the 
animation is complete and to call another call like that.  My engine by 
comparison uses CPS ? whenever you ask the engine to run an animation of some 
kind you must specify either a) that it repeats indefinitely, or b) has a 
continuation to deal with what happens after that animation is complete.  The 
result is that calling code doesn't have random timers floating around, and can 
define what happens at the completion of an animation in a closure, inline with 
creating that animation.

Apple's CoreAnimation also uses continuation passing style for a similar 
purpose.

Both of these examples use CPS because it allows things to happen 
asynchronously ? an animation can disappear off and run, and then something 
come back to you once it's finished.  I have also found CPS can clean up 
synchronous code too.  Take a look at CPBrainfuck on hackage ? I personally 
think it's one of the cleaner implementations of BF out there, though I will 
freely admit it's not the fastest.

Thanks

Tom Davie


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

Message: 10
Date: Thu, 14 Jul 2011 10:16:33 +0200
From: Luca Ciciriello <luca_cicirie...@hotmail.com>
Subject: Re: [Haskell-beginners] FW:  question
To: Roelof Wobben <rwob...@hotmail.com>
Cc: beginners@haskell.org
Message-ID: <blu0-smtp6793e369a5fad556c102c69a...@phx.gbl>
Content-Type: text/plain; charset="us-ascii"

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.l...@googlemail.com
>>> To: beginners@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@haskell.org
>>> http://www.haskell.org/mailman/listinfo/beginners                           
>>>           
> _______________________________________________
> Beginners mailing list
> Beginners@haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
> 




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

_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners


End of Beginners Digest, Vol 37, Issue 26
*****************************************

Reply via email to