Send Beginners mailing list submissions to beginners@haskell.org To subscribe or unsubscribe via the World Wide Web, visit http://mail.haskell.org/cgi-bin/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. Re: phantom type (PICCA Frederic-Emmanuel) 2. Re: phantom type (PICCA Frederic-Emmanuel) 3. Re: Efficient Binary Multiplication (Stephen Tetley) 4. Re: Efficient Binary Multiplication (KC) ---------------------------------------------------------------------- Message: 1 Date: Wed, 18 Apr 2018 14:39:58 +0000 From: PICCA Frederic-Emmanuel <frederic-emmanuel.pi...@synchrotron-soleil.fr> To: "The Haskell-Beginners Mailing List - Discussion of primarily beginner-level topics related to Haskell" <beginners@haskell.org> Subject: Re: [Haskell-beginners] phantom type Message-ID: <a2a20ec3b8560d408356cac2fc148e530107ded...@sun-dag4.synchrotron-soleil.fr> Content-Type: text/plain; charset="us-ascii" > Directly relevant blog: > https://www.benjamin.pizza/posts/2017-12-15-functor-functors.html thanks a lot very interesting post :) ------------------------------ Message: 2 Date: Wed, 18 Apr 2018 14:41:39 +0000 From: PICCA Frederic-Emmanuel <frederic-emmanuel.pi...@synchrotron-soleil.fr> To: "The Haskell-Beginners Mailing List - Discussion of primarily beginner-level topics related to Haskell" <beginners@haskell.org> Subject: Re: [Haskell-beginners] phantom type Message-ID: <a2a20ec3b8560d408356cac2fc148e530107ded...@sun-dag4.synchrotron-soleil.fr> Content-Type: text/plain; charset="us-ascii" Hello > I am in a rush so I cant write a minimal example, but wouldn't > a typeclass + make Collect and Cara instances of that typeclass do? Yes I can do this in my case and it is not thaht difficult :). thanks for your help. cheers Frederic ------------------------------ Message: 3 Date: Wed, 18 Apr 2018 18:33:12 +0100 From: Stephen Tetley <stephen.tet...@gmail.com> To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level topics related to Haskell <beginners@haskell.org> Subject: Re: [Haskell-beginners] Efficient Binary Multiplication Message-ID: <CAB2TPRB_VrjCThcvSyVE-toFdUhi_tspTMpzN=TB3jE=ss4...@mail.gmail.com> Content-Type: text/plain; charset="UTF-8" List fusion has existed for a long time (based on a change to the internal representation of lists to make them streams). IIRC the actual implementation was not considered a satisfactory replacement for GHCs existing list implementation as performance improvements were not uniform, the stream representation is good for some things worse for others. I don't know whether this situation has now changed. Byte String and Text exist because implementing strings or byte sequences as a cons list of Char or Byte is very inefficient both for storage / data locality and for many operations. Fusion for Byte String and Text is a bonus rather than a motivation. [*] Stream Fusion: From Lists to Streams to Nothing at All Duncan Coutts , Roman Leshchinskiy , Don Stewart http://citeseer.ist.psu.edu/viewdoc/summary?doi=10.1.1.104.7401 On 17 April 2018 at 01:48, Steven Leiva <leiva.ste...@gmail.com> wrote: > Interesting question. > > So there is a concept in computer science called fusion. > > My understanding (I don't have a CS degree) is that when data is subject to > fusion, we don't create the intermediary lists as you are talking about. > This is why, in Haskell, we have the ByteString and Text datatypes. Unlike > String, they (ByteString / Text) are subject to fusion. Text is useful when > we are dealing with unicode data, while ByteString is the correct tool when > we are dealing with binary data. > > All of this is to say that you should look at the ByteString data type. > (Take a look at this description, for example: > https://hackage.haskell.org/package/bytestring-0.10.8.2/docs/Data-ByteString.html#t:ByteString). > > The only potential problem I see is that ByteString internally uses Word8, > and since Word8 is unsigned, negatives are problematic. (Now that I think > about it, how the heck do you represent negative numbers in binary?). > > I hope this is useful. > > On Sat, Apr 14, 2018 at 4:28 PM, Quentin Liu <quentin.liu.0...@gmail.com> > wrote: >> >> Hi all, >> >> Suppose I want to multiply two binary numbers whose representation uses >> lists (e.g. 14 is represented as [1, 1, 1, 0]). Is there any efficient way >> to do binary multiplication? The way I could come up with involves a lot of >> intermediate lists that will be discarded eventually and is extremely >> inefficient. I know one fast algorithm that uses Array but would it be >> possible to do the multiplication with only lists? >> >> Regards, >> Qingbo Liu >> >> _______________________________________________ >> Beginners mailing list >> Beginners@haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners >> > > > > -- > Steven Leiva > 305.528.6038 > leiva.ste...@gmail.com > http://www.linkedin.com/in/stevenleiva > > _______________________________________________ > Beginners mailing list > Beginners@haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > ------------------------------ Message: 4 Date: Wed, 18 Apr 2018 19:07:06 +0000 From: KC <kc1...@gmail.com> To: Haskell Beginners <beginners@haskell.org> Subject: Re: [Haskell-beginners] Efficient Binary Multiplication Message-ID: <CAMLKXy=a-4longfoyfroggszyhk2m5rpoibweyuqlawfbuc...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" Hi Must you use only lists? Must each node only contain one digit? -- Sent from an expensive device which will be obsolete in a few months Casey On Sat, Apr 14, 2018, 1:30 PM Quentin Liu, <quentin.liu.0...@gmail.com> wrote: > Hi all, > > Suppose I want to multiply two binary numbers whose representation uses > lists (e.g. 14 is represented as [1, 1, 1, 0]). Is there any efficient way > to do binary multiplication? The way I could come up with involves a lot of > intermediate lists that will be discarded eventually and is extremely > inefficient. I know one fast algorithm that uses Array but would it be > possible to do the multiplication with only lists? > > Regards, > Qingbo Liu > _______________________________________________ > Beginners mailing list > Beginners@haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.haskell.org/pipermail/beginners/attachments/20180418/a05313fd/attachment-0001.html> ------------------------------ Subject: Digest Footer _______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners ------------------------------ End of Beginners Digest, Vol 118, Issue 12 ******************************************