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:  Running a list of functions (Ertugrul Soeylemez)
   2. Re:  Running a list of functions (Ozgur Akgun)
   3.  How to convert a Data.Set to a Descending List?
      (Sunil S Nandihalli)
   4. Re:  How to convert a Data.Set to a Descending List?
      (Alexander Batischev)
   5. Re:  How to convert a Data.Set to a Descending    List?
      (Sunil S Nandihalli)


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

Message: 1
Date: Sat, 20 Aug 2011 21:35:02 +0200
From: Ertugrul Soeylemez <[email protected]>
Subject: Re: [Haskell-beginners] Running a list of functions
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=US-ASCII

Ozgur Akgun <[email protected]> wrote:

> Actually in this case sequence and sequence_ are identical. You have
> IO for m, and () for a, so:
>
> sequence  :: [IO ()] -> IO ()
> sequence_ :: [IO ()] -> IO ()

No, compare the type signatures:

    sequence  :: [IO ()] -> IO [()]
    sequence_ :: [IO ()] -> IO ()

In the former case you will receive a list of as many values of type ()
as there are actions.


Greets,
Ertugrul


-- 
nightmare = unsafePerformIO (getWrongWife >>= sex)
http://ertes.de/





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

Message: 2
Date: Sat, 20 Aug 2011 20:50:26 +0100
From: Ozgur Akgun <[email protected]>
Subject: Re: [Haskell-beginners] Running a list of functions
To: Brandon Allbery <[email protected]>
Cc: [email protected], Manfred Lotz <[email protected]>
Message-ID:
        <calzazpatfq0l7npxvdwfg-2tc0v+ttvojbdu1dlga0kdpnv...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

I stand corrected. Sorry for the additional confusion.

On 20 August 2011 20:31, Brandon Allbery <[email protected]> wrote:

> On Sat, Aug 20, 2011 at 15:21, Ozgur Akgun <[email protected]> wrote:
>
>> sequence  :: [IO ()] -> IO ()
>> sequence_ :: [IO ()] -> IO ()
>>
>
> sequence isn't ([IO ()] -> IO [()])?
>
>
-- 
Ozgur Akgun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20110820/7c8189cf/attachment-0001.htm>

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

Message: 3
Date: Sun, 21 Aug 2011 13:48:05 +0530
From: Sunil S Nandihalli <[email protected]>
Subject: [Haskell-beginners] How to convert a Data.Set to a Descending
        List?
To: [email protected]
Message-ID:
        <cap0fd727ukgqsyhgq8x_vnsx7wsaqqb6nohfupe8ngagccx...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

Hello everybody,
 Is there a more efficient way to convert a Set to a descending list?
I was looking for a function similar to Set.toAscList something like
Set.toDecList . I feel first converting to a ascending list and then
reversing may be in-efficient given that I actually don't need all the
elements only a last couple of elements..

Thanks,
Sunil.



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

Message: 4
Date: Sun, 21 Aug 2011 11:53:57 +0300
From: Alexander Batischev <[email protected]>
Subject: Re: [Haskell-beginners] How to convert a Data.Set to a
        Descending List?
To: [email protected]
Message-ID: <20110821085357.GA11415@speedy>
Content-Type: text/plain; charset="us-ascii"

Hi!

On Sun, Aug 21, 2011 at 01:48:05PM +0530, Sunil S Nandihalli wrote:
>  Is there a more efficient way to convert a Set to a descending list?
> I was looking for a function similar to Set.toAscList something like
> Set.toDecList . I feel first converting to a ascending list and then
> reversing may be in-efficient given that I actually don't need all the
> elements only a last couple of elements..

Why don't you use something like

  take N $ Set.toAscList s

then? "A last couple of elements" in descending list would be "a first
couple of elements" in ascending list. That approach may even be
*faster* than building descending list, because to get your elements
you'll build only beginning of the list, while with descending list,
you'll need to build whole list in order to get last elements.

-- 
Regards,
Alexander Batischev

1024D/69093C81
F870 A381 B5F5 D2A1 1B35  4D63 A1A7 1C77 6909 3C81
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20110821/2b3b44af/attachment-0001.pgp>

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

Message: 5
Date: Sun, 21 Aug 2011 14:34:15 +0530
From: Sunil S Nandihalli <[email protected]>
Subject: Re: [Haskell-beginners] How to convert a Data.Set to a
        Descending      List?
To: Alexander Batischev <[email protected]>
Cc: [email protected]
Message-ID:
        <CAP0FD73n68=G4XdnTZ=keUu0x=a2or6hqvcrfaxnxq2ens0...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

Hi Alex,
 Sorry for the miswording of my question. The think I am interested in
the first couple in the descending list (which would be last few in
the ascending list)

Thanks
Sunil.

On Sun, Aug 21, 2011 at 2:23 PM, Alexander Batischev <[email protected]> wrote:
> Hi!
>
> On Sun, Aug 21, 2011 at 01:48:05PM +0530, Sunil S Nandihalli wrote:
>> ?Is there a more efficient way to convert a Set to a descending list?
>> I was looking for a function similar to Set.toAscList something like
>> Set.toDecList . I feel first converting to a ascending list and then
>> reversing may be in-efficient given that I actually don't need all the
>> elements only a last couple of elements..
>
> Why don't you use something like
>
> ?take N $ Set.toAscList s
>
> then? "A last couple of elements" in descending list would be "a first
> couple of elements" in ascending list. That approach may even be
> *faster* than building descending list, because to get your elements
> you'll build only beginning of the list, while with descending list,
> you'll need to build whole list in order to get last elements.
>
> --
> Regards,
> Alexander Batischev
>
> 1024D/69093C81
> F870 A381 B5F5 D2A1 1B35 ?4D63 A1A7 1C77 6909 3C81
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (GNU/Linux)
>
> iEYEARECAAYFAk5Qx6UACgkQoaccd2kJPIHfpwCfVhaOZJnfxA3wJVW6EImZX5EE
> 7Q4AnAu8oUiFTnek0lkBdq7HJLHREZsg
> =LXPG
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
>



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

_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners


End of Beginners Digest, Vol 38, Issue 38
*****************************************

Reply via email to