Hi Alex,

2015-06-24 12:49 GMT+01:00 Alexander Burger <a...@software-lab.de>:
> Hi Luis,
>
>> These are beginner questions, but why doesn't this work?
>>
>> (in "i.html"
>>    (while (from "<a href=\"")
>>       (parseLink (till "<" T))
>>       ))
>
> This depends on what 'parseLink' does.
>
> (till "<" T) returns a transient symbol, you can try it as
>
>    (in "i.html" (from "<a href=\"") (till "<" T))
>    -> "http://...";
>
> So perhaps 'parseLink' wants a list of characters, to be able to parse
> it? Then you might better do:
>
>    (in "i.html" (from "<a href=\"") (till "<"))
>    -> ("h" "t" "t" "p" ":" "/" ...)
>
> i.e. without the 'T' argument to 'till'.
>
>
>> It's just a substitution of `msg` by a call to `parseLink` that
>> doesn't seem to get called.
>
> 'parseLink' will get called, if at least one pattern "<a href=\"" is in
> the file.

In the above example, I used `in` and the call to `parseLink` works fine.
But
(client "picolisp.com" 80 "wiki/?home"
   (while (from "<a href=\"")
      (parseLink (till "<"))))

does not.  AFAICT, each while cycle returns a list which in my view
would be used as an argument to `parseLink`, but it doesn't work as I
expect.  `in` opens an input channel, `client` seems to me to return a
list.

I tried to save the whole html file with a `out`, before the `client`
instruction, so that I could parse the file as you've shown before,
but had no success either.  A file is created but it's empty.

(out "hh.html"
   (client "picolisp.com" 80 "wiki/?home"))

(out "hh.html"
   (client "picolisp.com" 80 "wiki/?home"
      (while (from "<a href=\"")
         (msg (till "<")))))

Also tried to append to a file with each iteration:
(client "picolisp.com" 80 "wiki/?home"
   (while (from "<a href=\"")
      (out "+hh.html"
         (msg (till "<")))))

As `client` is build as a library, I couldn't get an english
description as the core functions have, so it's more difficult for me.

Frustation is high right now... :-(
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to