Re: @lib/scrape.l questions
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
Re: @lib/scrape.l questions
2015-06-23 17:44 GMT+01:00 Alexander Burger a...@software-lab.de: Hi Luis, I want to go through every link to perform further parsing in some links, based in the first word of the tile of the link, but ran into some difficulties. Is this the right way to access each of the links? : (for L *Links (cond ((=T (pre? Quarto (car L))) (scrape this link... ... I know that scrape.l is available, but still a ton too much for me to understand it. I would think that @lib/scrape.l is not so much for parsing general websites. It is tailored for communication with - and controlling of - interactive PicoLisp GUI applications, and thus rather overkill. You can directly access the contents of a site with 'client', 'from' and 'till'. For example, this prints every link ('href' anchor): (client picolisp.com 80 wiki/?home (while (from a href=\) (msg (till T)) ) ) Instead of the final 'msg', you could to further processing of the data, and/or omit the 'T' in the 'till' call to get lists of characters instead of strings. These are beginner questions, but why doesn't this work? (in i.html (while (from a href=\) (parseLink (till T)) )) (in i.html (while (from a href=\) (setq Tt (till T)) (parseLink Tt))) It's just a substitution of `msg` by a call to `parseLink` that doesn't seem to get called. Just for curiosity, in my previous message, in (for L *Links (cond ((=T (pre? Quarto (car L))) (scrape this link... (car L) return the same as (caar L), (caaar L), etc? Luis -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
@lib/scrape.l questions
Hi list, When scraping a website: : (scrape Urlbase 80 How) I want to go through every link to perform further parsing in some links, based in the first word of the tile of the link, but ran into some difficulties. Is this the right way to access each of the links? : (for L *Links (cond ((=T (pre? Quarto (car L))) (scrape this link... After further digging, I thought that (car L) would access the description (title) of the link, and `cdr` the last part of the url. But, then I found out that (car L) returns the same than (caar L) and (caaar L). So, L returns T to `lst?`. But what is the right way to access it? I know that scrape.l is available, but still a ton too much for me to understand it. Have a nice weekend, Luis -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
pil + interactive mode access lines of previous command
Hi, Assume I issue these instructions in `pil +` interactive mode : (setq N 3) : (while (gt0 n) (dec 'n) (prinl n)) It executes. Then I want to access the second command to edit it, for example to change the second line: : (while (gt0 n) (dec 'n 2) (prinl n)) I press the up arrow key, but the only line that is editable is the first one (while (gt0 n) Is there a way to edit the second line, even though all the three lines could be accessed as one big line, such as: : (while (gt0 n)(dec 'n) (prinl n)) Luis -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: https server side
Thank you all for your contributions! Luis 2015-05-27 9:03 GMT+01:00 Henrik Sarvell hsarv...@gmail.com: I do WSS via httpGate with a CA signed certificate, see this article under the WSS section: http://picolisp.com/wiki/?Websockets On Wed, May 27, 2015 at 8:13 AM, Alexander Burger a...@software-lab.de wrote: On Wed, May 27, 2015 at 07:25:59AM +0200, Alexander Burger wrote: The file names holds a configuration for the servers to be started. This is the part which still needs to be documented. Hmm, actually this is rather simple. Create a file with one server per line. For example, here some lines from my config file for the wiki and some demo apps: app 8080 app /home/app log/app./pil app/main.l lib/app.l -main app/_patch.l -go -wait wiki5000 app /home/app log/wiki ./pil wiki/main.l lib/app.l -main wiki/_patch.l -go -wait sushi 22000 app /home/app log/sushi ./pil sushi/main.l lib/app.l -main -go -wait menu 24000 app /home/app log/menu ./pil menu/main.l lib/app.l -main -go -wait canvas 27002 app /home/app log/canvas ./pil misc/canvas.l lib/app.l -main app/_patch.l -go -wait phone 27003 app /home/app log/phone ./pil misc/phone.l lib/app.l -main app/_patch.l -go -wait osm27004 app /home/app log/osm./pil osm/main.l lib/app.l -main app/_patch.l -go -wait i.e. the arguments, separated by spaces, are: 1. The name of the application 2. The port where this server should listen at 3. The user name 4. The working directory of the server process 5. The log file where stdout and stderr should be redirected to 6. The command line to start the server process (For optimal access if you have really many servers, you should 'balance' the contents of the config file. That's left as a task to the reader) When a client requests e.g. https://7fach.de/canvas this server will be started. That is, the name 'canvas' is looked up, and 'httpGate' checks if a process is listening at 27002. If not, it starts that process. The 'go' function of the server (see the example in app/main.l) may call (retire 20) This will cause this server to stop if there are no child processes and no activities for 20 minutes. 'httpGate' sends the NAME of the application under which it was invoked, and the PORT it should listen at, in environment variables. Thus, the 'server' call is (server (or (format (sys PORT)) 8080) !work) ) It uses the PORT passed in, or defaults to 8080. In that way you may have thousands of client application running on a single machine, each one only started and stopped as necessary. ♪♫ Alex -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
https server side
Hi, I couldn't find anything about the support of https in server side in 'Picolisp by Example' and in 'Picolisp Works' books. But, there's a thread http://t8373.lisp-picolisp-general.lispforum.info/picolisp-ssl-problem-t8373-20.html that seems to imply that https/SSL has been implemented. So my question, can a https server application be build in Picolisp with a certificate signed by some CA? If so, what part of the documentation am I missing? Luis -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: A Minimal PicoLisp DB/GUI Application, Telephone field
Hi, 2015-01-14 12:09 GMT+00:00 Alexander Burger a...@software-lab.de: I see. So Norway has different systematics with telephone numbers. I don't understand them, though. In Germany we have the rule that both 0049 123 456 and +49 123 456 are the same as 0123 456. The 00 to + conversion is of no problem, but the 0 leading local or domestic numbers seems to be a feature of some countries, but not of others. Luis -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Recursive (dir) - some help needed
Hi, I'm building a script to print the contents of a directory tree recursively, but I'm facing some problems. The script can be found at http://ideone.com/BuN931 Attached, I also send the script as well as the directory tree I created to test it. The problems: 1) how to print a blank line? 2) The function GetFullPath (Parent L Full) [line 6] seems to return a list with the subdir components of some dir, but (ffiles (cdr (append Dir_list (GetFullPath Item (dir Item) ) [line 39] does not seem to get that list back. When I run it, it only seems to get a list of one file only, even if there's a a sub-directory there. 3) (lst? (GetFullPath Item (dir Item)))[line 38] is not doing what I was expecting, returning T or NIL whether GetFullPath sends a list or not. FYI, I've already seen http://rosettacode.org/wiki/Walk_Directory_Tree#PicoLisp. Luis recurdir.tar Description: Unix tar archive
Re: Cannot run script from bash
Correct would be (de ffiles (dir_list) (cond ((=T (info (car dir_list))) (print is directory)) (T (print is not directory)) ) ) Note the 'T' in the last line. Ok, I already corrected the code and capitalized the function parameter. $ pil pil_files.l -main + : (enters interactive mode) OK, nothing was printed for the above reason. Now, when the code is: (de ffiles (Dir_list) (cond ((=T (info (car Dir_list))) (print is directory)) (T (print is not directory)) ) ) (de main () (ffiles (dir))) and I try to run it as $ pil pil_files.l -main is not directory: there's no return to the bash shell (either using '+' or not). If I had the (bye) at the bottom of the code as suggested by Henrik: $ pil pil_files.l -main outputs nothing and return to bash (either using '+' or not). I should be missing something... Luis -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Cannot run script from bash
Hi again, sorry for these novice questions, but can't figure out why this script doesn't run. Be pil_files.l: #!/usr/bin/picolisp /usr/lib/picolisp/lib.l (de ffiles (dir_list) (cond ((=T (info (car dir_list))) (print is directory)) (print is not directory))) (de main () (ffiles (dir))) And I try to run it with: $ pil pil_files.l -main + : (enters interactive mode) $ pil pil_files.l -main : (no +, same result) $ pil -main pil_files.l + !? (main) main -- Undefined $ pil -main pil_files.l !? (main) main -- Undefined (no +, same result) $ ./pil_files.l : (as there's a shebang, but this one seems correct to me as I didn't pass an argument and there's nothing to parse it). But why does not `pil pil_files.l -main +` execute the function ffiles with the list resulting from function `dir`? Thank you in advance Alex. Luis -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
eol characters
Hi, I tried to find this, but couldn't. In http://software-lab.de/doc/refL.html#line, it is said that End of line is recognized as linefeed (hex 0A), carriage return (hex 0D), or the combination of both. But sometimes, at least in other text processing languages (eg awk), it's very convenient to have a different character as the marker for end of line. Did I miss something in the reference or is it not possible to assume a different character from those ones as eol? Luis PS. A beginner trying to read a xml text file and to do something useful with it. -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Some initial questions
2013/9/29 O.Hamann o.ham...@gmx.net: And I remember a very nice interactive tutorial (basics of Lisp in general), looked similar to this, perhaps is the same: http://art2.ph-freiburg.de/art/login-e.html It's available in english, covers the Lisp basics in few lessons and offers interactive excercises with explanations. It's fun, too! Thank you for your help Olaf! Right now I'm doing some exercises in the site: http://alarm.cti.depaul.edu/lisptutor/ but will take lessons from the site you mention as well. Luis -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Some initial questions
Hi, I'm writing for this list hoping to get some good insights on what I'm going to say. I started with BASIC for Timex 2068/ZX Spectrum, then learned Pascal. Had a lot of years when my programming was only some Access databases and Excel macros. After these 'gray' years, I became interested very much in programming again and learned Python. More recently, I began projects in C and C++. C++ is a very complex language that I really dislike, although I'm implementing my PhD research on it (about clustering), because of speed of execution. I like somehow C, because it's simpler and one can know what to expect, even though I didn't have my graduation or other studies in Computer Science or related fields. And C is fast! On the other hand, Python is slow at run time. I began to like very much, but the absence of (optional) static typing gave me some problems trying to find bugs at runtime. I also need programming for my job, although it's not exclusively a programming job, many times I program in PHP, add some SQL and Bash. I've heard of Lisp, but it always felt as not a serious thing, with slow execution and aimed at smaller scripts or compiled programs. These were my perceptions until recently. Going from Lisp to Scheme, to Rebol, to Red Lang, reading a lot, I came across PicoLisp and 'fell in love' with what is promised by the language. It's pratical... So, right now, I'm at 41 years old, striving for simpleness, and I'm looking for a programming language that I can adopt (hopefully) through the rest of my life, maybe also to a career change aiming at working at consultation in management/IT/decision-aid applications. This is my context. I'd appreciate some enlightenment on some topics. Please consider that I haven't learned Lisp yet! I keep reading that execution speed is not very important. Well, it certainly depends on the subject. Computers are quicker nowadays but the quantity of data is increasing at also an increasing rate. So, for example, when considering a time series with 100 000 elements, what is the magnitude of slowness that I can expect from PicoLisp compared to C++? 20x? And what about if the number of elements grow by a factor of ten, can I expect the time to increase less than, 10x or more than 10 times the previous? This can be the difference between getting a small break and check results after some minutes or to have to leave some computation running all night. And about memory consumption compared to the benchmark C++? I've read that PicoLisp has simplified structure representations in memory, but I'd like to know some rough number about it. Another question is about the integrated database. I use PostGresSQL and MySQL to handle my data. In MySQL, there are tables with +10 million rows, others with +10^4 only. The idea to have an integrated database is excellent, but at what speed? How much slower than those two databases? Can the fields be indexed somehow? Continuing with the integrated database, is it possible to build 'queries' of several joins and unions using Pilog? Now regarding PicoLisp and C++ integration. I'd like to build a project in some language (hope not to have to use C++) that uses a POSIX C++ API in the financial arena. I've seen several examples of PicoLisp 'talking' to C and it's said that C and C++ share the same protocol (ABI?). Is it possible to build a PicoLisp program that uses that C++ API (probably full of objects and complexities) for input and output? Can I learn from examples given in PicoLisp documentation, or is it needed some CS degree to be able to decipher the process? In C, C++, I can access data structures via pointers for great speed. I guess I can achieve the same in PicoLisp somehow, is is right so? (remember I haven't get my feet wet in Lisp yet). Now, for the two last questions: It's said that normally PicoLisp will find some type errors during run time at an early stage. But since I got burnt with Python in the past, I'd like to know if there are tests available or easily programmable to force some variables to only accept values of some type. With lint? Since PicoLisp is interpreted and since the original author Alexander Burger builds and sells himself applications for clients, isn't there an issue that the code is given as is to those clients? Or is there some JIT code that can be build that hides somehow the code from the users? If you got down here, thank you for reading my long message. Luis -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe