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. Converting wiki pages into pdf (mukesh tiwari)
2. Re: Converting wiki pages into pdf (Stephen Tetley)
3. Re: Question about lazy evaluation (Brandon Allbery)
----------------------------------------------------------------------
Message: 1
Date: Thu, 8 Sep 2011 18:03:34 +0530
From: mukesh tiwari <[email protected]>
Subject: [Haskell-beginners] Converting wiki pages into pdf
To: [email protected]
Message-ID:
<CAFHZvE9zXbtuUCRJQFVTPVtaRiGWr4_25qVA92FHy=hgTe=z...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
Hello all
I am trying to write a Haskell program which download html pages from
wikipedia including images and convert them into pdf . I wrote a small
script
import Network.HTTP
import Data.Maybe
import Data.List
main = do
x <- getLine
htmlpage <- getResponseBody =<< simpleHTTP ( getRequest x ) --open
url
--print.words $ htmlpage
let ind_1 = fromJust . ( \n -> findIndex ( n `isPrefixOf`) . tails $
htmlpage ) $ "<!-- content -->"
ind_2 = fromJust . ( \n -> findIndex ( n `isPrefixOf`) . tails $
htmlpage ) $ "<!-- /content -->"
tmphtml = drop ind_1 $ take ind_2 htmlpage
writeFile "down.html" tmphtml
and its working fine except some symbols are not rendering as it should be.
Could some one please suggest me how to accomplish this task.
Thank you
Mukesh Tiwari
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20110908/e7564179/attachment-0001.htm>
------------------------------
Message: 2
Date: Thu, 8 Sep 2011 18:43:46 +0100
From: Stephen Tetley <[email protected]>
Subject: Re: [Haskell-beginners] Converting wiki pages into pdf
Cc: [email protected]
Message-ID:
<CAB2TPRA9Q9ALGcpU1zVZ03FG=fx6na4nl5oy5x9yp+861fv...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
I don't know PDF, but PostScript (the underlying technology) doesn't
use Unicode which might be your problem.
What particular symbols are you having problems with?
------------------------------
Message: 3
Date: Thu, 8 Sep 2011 18:09:33 -0400
From: Brandon Allbery <[email protected]>
Subject: Re: [Haskell-beginners] Question about lazy evaluation
To: Zhi-Qiang Lei <[email protected]>
Cc: Haskell Beginer <[email protected]>
Message-ID:
<cakfcl4udkm+uftn5qpu-xcsqoof7b6ux1uatqsun0vhtvb9...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
On Thu, Sep 8, 2011 at 01:56, Zhi-Qiang Lei <[email protected]> wrote:
> When ('f' : "oo") ++ "bar" becomes 'f' : ("oo" ++ "bar") and then becomes
> 'f' : ('o' : ("o" ++ "bar")), we still need 'f', don't we?
Haskell lists are singly-linked lists, not arrays or double-linked lists or
etc. Once we've evaluated past a given ":", there is no way to go back to
what precedes it; it's no longer reachable (unless the caller, who has been
passed the earlier part, is holding onto it) and the garbage collector will
reclaim it.
Put slightly differently: as you've phrased it, evaluation would expand
each element but always start stepping into it from the very start. That's
not what happens; as the evaluator steps through the list, it throws away
its reference to the earlier part completely. So it never becomes 'f' :
('o' : ("o" ++ "bar"))) because when the evaluator is at the 'o' it has
completely forgotten about the 'f'. It's got 'o' : ("o" ++ "bar") and any
remaining reference (if there is one) to the 'f' is held by something else.
--
brandon s allbery [email protected]
wandering unix systems administrator (available) (412) 475-9364 vm/sms
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20110908/154bea20/attachment-0001.htm>
------------------------------
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
End of Beginners Digest, Vol 39, Issue 9
****************************************