Re: Printed representation of (char 0) ?
Hi Alex and beneroth, there are system interfaces that don't handle binary data and send them as hex strings to middleware for conversion ... All I wanted was a quick way to cross check that conversion with PicoLisp, and that was really easy, except that NUL problem, solved now. But very interesting discussion, I'm playing around with rd and pr right now. Thanks for the input Cheers Thorsten Am Mi., 14. Feb. 2024 um 08:04 Uhr schrieb Alexander Burger < picolisp@software-lab.de>: > Hi Thorsten, > > > I wonder if there actually is a way to directly print ^@ in PicoLisp for > a > > "non-printable" hex "00", instead of NIL? > > As we see from the previous discussion, this is not an issue of > printability. > Other control characters may also be non-printable. It is an issue of > binary data vs. symbol names. > > But you can of course print a caret and an at-mark instead of NIL > >(prin (or (something) "\^@")) > > > > Wrt the application, I just have to deal with fixed length hex strings > (!) > > where the values at certain offsets carry semantics, conversions are > done, > > and it's crucial that values stay in that position, the NUL values > matter. > > Yes, but why do you need to convert it to a string? I would process these > data > all exclusively as a list of numbers, and do the final printing explicitly > (if > needed at all). This printing may print '0' as "\^@", and also take care of > other control characters and non-printable stuff. > > ☺/ A!ex > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >
Re: Printed representation of (char 0) ?
Hi Alex, Thomas, thanks for your input, this is actually what I was looking for : [image: image.png] or even better: [image: image.png] I wonder if there actually is a way to directly print ^@ in PicoLisp for a "non-printable" hex "00", instead of NIL? Wrt the application, I just have to deal with fixed length hex strings (!) where the values at certain offsets carry semantics, conversions are done, and it's crucial that values stay in that position, the NUL values matter. And I don't want to write a PicoLisp application for this, I just wanted an easy way to produce the expected conversion result in PicoLisp as a reference for comparison, and the above solution is fine for that. Am Di., 13. Feb. 2024 um 09:09 Uhr schrieb Alexander Burger < picolisp@software-lab.de>: > Hi Thorsten, > > > But shouldn't hex 23232424 print to something like ##^N^N$$ instead > of > > ##$$ ? > > The problem is that you try to handle binary data as symbols. This is not > a good > idea. Binary data are numbers. > > First of all, do you really have a hex message? Where does > it come from? Normally I would expect a list of numbers > as obtained with e.g. > >(make (do 96 (link (rd 1 > > If it is really a hexadecimal string, you can obtain the list > of numbers with > >: (make (for (L (chop "23232424") (cut 2 'L)) (link (hex @ >-> (35 35 0 0 36 36) > > ☺/ A!ex > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >
Re: Printed representation of (char 0) ?
Hi Alex, But shouldn't hex 23232424 print to something like ##^N^N$$ instead of ##$$ ? So the printed ASCII string (as char) carries all the information from the hex string, and can be converted back to the exact same hex string? At least in some special cases when it's needed? Alexander Burger schrieb am Di., 13. Feb. 2024, 07:56: > Hi Thorsten, > > > it's been some time .. ;-) > > Welcome back! :) > > > > I'm playing around a bit with hex<->ascii conversion in PicoLisp, and I > > have the problem that (char 0) = NIL > > > > (hex "00") > > -> 0 > > : (char (hex "00")) > > -> NIL > > This is correct. > > 'char' converts a number to a (transient) symbol here. > > A symbol's name is a string, a null-terminated sequence of UTF-8 > characters. In > case of 'char', this string has a single character and a terminating null > byte. > This is the same as in other languages like C. > > So the number 65 gives a symbol "A": > >: (char 65) >-> "A" > > But what happens with 0? > > It gives an empty string, i.e. a null-byte > >: (char 0) >-> NIL > > and an empty string in PicoLisp is NIL. > >: "" >-> NIL > > ☺/ A!ex > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >
Re: Printed representation of (char 0) ?
Ok I understand that. But when I have a hexadecimal message string with fixed length, and the positions inside the string carry semantics? A certain value in a certain position has a meaning? Say fixed length is 96 like in the example above, and 2323 ist two start chars, and then 01 or 02 is a handshake. And this message has to be translated to ASCII to be understood by a third party, that sends ASCII answers back, that has to be translated to hex. This does not work when a round-trip conversion of 232301 results in 23231. Tomas Hlavaty schrieb am Di., 13. Feb. 2024, 07:49: > On Tue 13 Feb 2024 at 00:25, Thorsten Jolitz > wrote: > > I would like to achieve a roundtrip like this: > > why? > > NUL is often a string sentinel value > so trying to use it as a character value > will lead to issues > do not do that > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >
Re: Printed representation of (char 0) ?
I would like to achieve a roundtrip like this: : (hex (char (char (hex "23"] -> "23" but not like this: : (hex (char (char (hex "01"] -> "1" : (hex (char (char (hex "00"] -> "0" It should be possible to do this, so that W = X in the end: : (setq X "23230200010001000F00323032342D30322D303931302D35342D303520202424") : (length X) -> 96 : (setq Y (chop X)) : (length Y) -> 96 : (setq W (pack (mapcar '((A) (hex (char A))) (make (while Y (link (char (hex (pack (cut 2 'Y)] -> "232320001010F000323032342D30322D303931302D35342D303520202424" : (length W) -> 72 Am Mo., 12. Feb. 2024 um 23:56 Uhr schrieb Tomas Hlavaty < picolisp@software-lab.de>: > On Mon 12 Feb 2024 at 23:25, Thorsten Jolitz > wrote: > > Shouldn't the (char 0) representation print to something > > like ^N or so too, like (char 1), (char 2) etc? > > ^@ > > what are you trying to achieve? > > why not use base64, for example? > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >
Re: Printed representation of (char 0) ?
Ah sorry, the moment I sent the question, I figured out the answer : this is just a side effect of the final (pack ..). When using (str ...) I get what I want: : (str (make (while Y (link (char (hex (pack (cut 2 'Y)] -> "\"#\" \"#\" \"\^B\" NIL NIL NIL \"\^A\" NIL \"\^A\" NIL \"\^O\" NIL NIL NIL NIL NIL NIL NIL \"2\" \"0\" \"2\" \"4\" \"-\" \"0\" \"2\" \"-\" \"0\" \"9\" \"1\" \"0\" \"-\" \"5\" \"4\" \"-\" \"0\" \"5\" \" \" \" \" NIL NIL NIL NIL NIL NIL NIL NIL \"$\" \"$\"" although somehow I still think it would be fine to have 'pack that prints the NIL too, in this special case: : (pack (make (while Y (link (char (hex (pack (cut 2 'Y)] -> "##^B^A^A^O2024-02-0910-54-05 $$" Am Mo., 12. Feb. 2024 um 23:25 Uhr schrieb Thorsten Jolitz < tjol...@gmail.com>: > Hello List, > it's been some time .. ;-) > > I'm playing around a bit with hex<->ascii conversion in PicoLisp, and I > have the problem that (char 0) = NIL > > (hex "00") > -> 0 > : (char (hex "00")) > -> NIL > > and disappears from the resulting ascii string. > > : (setq X > "23230200010001000F00323032342D30322D303931302D35342D303520202424") > : (setq Y (chop X)) > : (pack (make (while Y (link (char (hex (pack (cut 2 'Y)] > -> "##^B^A^A^O2024-02-0910-54-05 $$" > > So how would it be possible to convert the ascii string back to the > original hex string, when all the "00" are gone in the ascii > representation? Shouldn't the (char 0) representation print to something > like ^N or so too, like (char 1), (char 2) etc? > > When I try this online converter, the "00" are maintained as blanks: > Hex to ASCII Text String Converter (rapidtables.com) > <https://www.rapidtables.com/convert/number/hex-to-ascii.html> > [image: image.png] > > and here is another representation that seems to enable the hex -> ascii > -> hex conversion, getting exactly the same hex string in the end as in the > beginning (not exactly the same conversion as above! just an example how it > might look) : > [image: image.png] > Cheers > Thorsten >
Printed representation of (char 0) ?
Hello List, it's been some time .. ;-) I'm playing around a bit with hex<->ascii conversion in PicoLisp, and I have the problem that (char 0) = NIL (hex "00") -> 0 : (char (hex "00")) -> NIL and disappears from the resulting ascii string. : (setq X "23230200010001000F00323032342D30322D303931302D35342D303520202424") : (setq Y (chop X)) : (pack (make (while Y (link (char (hex (pack (cut 2 'Y)] -> "##^B^A^A^O2024-02-0910-54-05 $$" So how would it be possible to convert the ascii string back to the original hex string, when all the "00" are gone in the ascii representation? Shouldn't the (char 0) representation print to something like ^N or so too, like (char 1), (char 2) etc? When I try this online converter, the "00" are maintained as blanks: Hex to ASCII Text String Converter (rapidtables.com) <https://www.rapidtables.com/convert/number/hex-to-ascii.html> [image: image.png] and here is another representation that seems to enable the hex -> ascii -> hex conversion, getting exactly the same hex string in the end as in the beginning (not exactly the same conversion as above! just an example how it might look) : [image: image.png] Cheers Thorsten
Re: org-mode with picolisp
Hi List, I did some tests now with PIL21 in Org-mode on Emacs doom. I did not touch picolisp-mode.el or inferior-picolisp.el from my repo yet tj64/picolisp-mode: GNU Emacs mode for PicoLisp programming (github.com) <https://github.com/tj64/picolisp-mode> However, and to my surprise, I had to do some changes to the ob-picolisp.el from my repo, they are committed to the repo file: tj64/ob-picolisp: Adding PicoLisp to Org Babel, the multi-language programming environment included in Emacs Org Mode. (github.com) <https://github.com/tj64/ob-picolisp> My version of ob-picolisp.el had some additional functionality, while the version I found in the former org-contrib repo had some cleanup in the comments and some improvements in the code: emacsPackages/ob-picolisp.el at master · NotBrianZach/emacsPackages (github.com) <https://github.com/NotBrianZach/emacsPackages/blob/master/org-plus-contrib-20181210/ob-picolisp.el> I kept the additional functionality in my version, but copied all the changes from the other version. Then I tested in Emacs Doom with PIL21 installed, and it worked (in general), did not test the whole functionality, see PS. Cheers Thorsten PS #+title: Ob Picolisp Test1 #+begin_src emacs-lisp (+ 3 4) #+end_src #+RESULTS: : 7 #+begin_src picolisp :results value (+ 2 5) #+end_src #+RESULTS: : 7 #+begin_src picolisp :results value :session test1 (setq A 12) (setq B 24) #+end_src #+RESULTS: : No #+begin_src picolisp :results output :session test1 (if (> A B) (print A) (print B) ) #+end_src #+RESULTS: : 24 Am Mi., 30. Nov. 2022 um 23:14 Uhr schrieb Thorsten Jolitz < tjol...@gmail.com>: > Ah no, there was another file with 2 versions, led.l and eled.l for line > editing vim or emacs style. > Like Alex said, edit.l and eedit.l were used for symbol editing > > Am Mi., 30. Nov. 2022 um 23:06 Uhr schrieb Thorsten Jolitz < > tjol...@gmail.com>: > >> Yes, and I added eedit.l to picolisp iirc, so one could chose between vim >> and emacs keybindings in the repl line editor. >> Inferior-picolisp.el is responsable for the picolisp repl in Emacs, so >> when starting it the user could choose between the 2 editing styles. >> You don't necessary see that repl in your org-mode file with a picolisp >> src-block, but it's there in the background, therefore the error. >> >> I think they are not needed anymore. I cannot test it right now, but when >> those lines are outcommented in the .el files, it might work (then using >> readline library for line editing in the repl in emacs, just like in >> standalone picolisp). >> >> Am Mi., 30. Nov. 2022 um 22:48 Uhr schrieb Alexander Burger < >> a...@software-lab.de>: >> >>> On Wed, Nov 30, 2022 at 03:25:31PM -0600, Galaxy Being wrote: >>> > The old picolisp file structure had ~/.../lib/edit.l and .../lib/el >>> which >>> > is no longer the case. That functionality went somewhere else? And yet >>> both >>> >>> lib/edit.l was an in-memory editor for symbols in pil64, which called Vim >>> internally. It is now obsolete, as this functionality is handled by Vip >>> (the >>> built-in Vi-style editor) in pil21. >>> >>> It is strange that lib/edit.l is loaded at all. Org-Mode should not care >>> about >>> it, and lib/edit.l is loaded at start-up by pil64, but never by pil21. >>> >>> lib/el/ is no longer part of the distro in pil21 to keep things small. >>> It should >>> probably better be made a separate tarball or repo. >>> >>> ☺/ A!ex >>> >>> -- >>> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >>> >>
Re: org-mode with picolisp
Yes, and I added eedit.l to picolisp iirc, so one could chose between vim and emacs keybindings in the repl line editor. Inferior-picolisp.el is responsable for the picolisp repl in Emacs, so when starting it the user could choose between the 2 editing styles. You don't necessary see that repl in your org-mode file with a picolisp src-block, but it's there in the background, therefore the error. I think they are not needed anymore. I cannot test it right now, but when those lines are outcommented in the .el files, it might work (then using readline library for line editing in the repl in emacs, just like in standalone picolisp). Am Mi., 30. Nov. 2022 um 22:48 Uhr schrieb Alexander Burger < a...@software-lab.de>: > On Wed, Nov 30, 2022 at 03:25:31PM -0600, Galaxy Being wrote: > > The old picolisp file structure had ~/.../lib/edit.l and .../lib/el which > > is no longer the case. That functionality went somewhere else? And yet > both > > lib/edit.l was an in-memory editor for symbols in pil64, which called Vim > internally. It is now obsolete, as this functionality is handled by Vip > (the > built-in Vi-style editor) in pil21. > > It is strange that lib/edit.l is loaded at all. Org-Mode should not care > about > it, and lib/edit.l is loaded at start-up by pil64, but never by pil21. > > lib/el/ is no longer part of the distro in pil21 to keep things small. It > should > probably better be made a separate tarball or repo. > > ☺/ A!ex > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >
Re: org-mode with picolisp
Hi, I'm more or less responsable for PicoLisp in org-mode. Before diving any deeper, note the readme of GitHub - flexibeast/plisp-mode: PicoLisp support for Emacs <https://github.com/flexibeast/plisp-mode> : "The plisp-mode in this package has been built from scratch, and is not based on, nor connected with, the PicoLisp support for Emacs provided in the PicoLisp distribution <http://software-lab.de/down.html>, or the more recently updated version of that support <https://github.com/tj64/picolisp-mode>. At this stage, the main advantages provided by this package are [...]" So you are actually in unsupported territory there, the original picolisp-mode which was used for ob-picolisp is this: GitHub - tj64/picolisp-mode: GNU Emacs mode for PicoLisp programming <https://github.com/tj64/picolisp-mode> I don't think that ob-picolisp cares about pil64 or pil21, most likely the problems you see are related to plisp-mode itself. Maybe try the original mode standalone, and if that works, try it with org-mode. plisp-mode was developed by someone else, and I don't know if it was ever used "in production". Cheers Thorsten Am Mi., 30. Nov. 2022 um 16:47 Uhr schrieb Galaxy Being : > The problem might be with plisp-mode. It gives the same error (on "send > definition and go" i.e., start REPL and hand code off to it), and I think > ob-picolisp.el relies on plisp. In any case, you've changed your files > around and there is no edit.l anymore. Here's my .emacs section for > picolisp. ;; is commented out > > ;; (add-to-list 'load-path "~/opt/picoLisp/lib/el") > ;;(load "/home/galaxybeing/.emacs.d/modes/tsm.el") ;; Picolisp > TransientSymbolsMarkup (*Tsm) > (autoload 'run-picolisp "inferior-picolisp") > (autoload 'plisp-mode "picolisp" "Major mode for editing Picolisp." t) > > (require 'plisp-mode) > > (setq picolisp-program-name "/home/galaxybeing/opt/pil21/pil") > (add-to-list 'auto-mode-alist '("\\.l$" . picolisp-mode)) > > ;; (add-hook 'picolisp-mode-hook > ;;(lambda () > ;; (paredit-mode +1) ;; Loads paredit mode automatically > ;; (tsm-mode) ;; Enables TSM > ;; (define-key picolisp-mode-map (kbd "RET") 'newline-and-indent) > ;; (define-key picolisp-mode-map (kbd "C-h") > 'paredit-backward-delete) ) ) > > On Wed, Nov 30, 2022 at 1:09 AM Alexander Burger > wrote: > >> Hi Lawrence, >> >> > Having trouble with getting picolisp to work with org-mode Babel code >> > blocks. I'm guessing it's because I have an out of date ob-picolisp.el >> > which I had to scrounge on the Internet. (Got one latest 2021.) >> >> Sorry, yes. Org-Mode is not ported to Pil21 (yet). >> >> Let us investigate a little :) >> >> ☺/ A!ex >> >> -- >> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >> > > > -- > ⨽ > Lawrence Bottorff > Grand Marais, MN, USA > borg...@gmail.com >
Re: PicoLisp Wiki: Embed Content?
Hi Alex, thanks! And in case it's a personal private wiki one could even outcomment the new syntax element and eliminate the check for an schrieb am Do., 13. Okt. 2022, 08:24: > Hi Thorsten, > > > I thought about security too. I even would like to have 2 embed options, > > one only for iframes, the other for any html (produced by an external > tool) > > This is indeed a potential security risk. A public Wiki can be edited by > everyone and malicious HTML code might sneak in. > > As discussed yesterday, I commented the change in the release and on the > public > site. It is useful in environments where edit access is controlled, so it > can be > un-commented in such cases. > > Released. > > ☺/ A!ex > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >
Re: PicoLisp Wiki: Embed Content?
Hi Alex, simplification looks good, will test later. I thought about security too. I even would like to have 2 embed options, one only for iframes, the other for any html (produced by an external tool)
Re: PicoLisp Wiki: Embed Content?
PS or better a check like this, then if the §{content} does not start with : > Hi Alex, > it's actually extremely easy to embed content in a picolisp wiki file, > when adding the syntax element from the PS 1 to wiki/lib.l : > §{ } > I added a little check for syntax user cannot insert any kind of code. > > With this element its easy to embed youtube videos in wiki pages, they all > have an embed link (see PS 2) > > Would you consider to add something like this in wiki/lib.l ? > Cheers > Thorsten > > > > PS 1 > > > 1 file changed, 5 insertions(+), 1 deletion(-) > > > lib.l | 6 > > +- > > > modified lib.l > > > @@ -54,7 +54,7 @@ > > > (recur (Nest) > > > (use C > > > (loop > > >- (ht:Prin (till "^J123456&/!_*+-%~|<@>=\^:$\\#}" T)) > > > + (ht:Prin (till "^J123456&/!_*+-%~|<@>=\^:$\\#§}" T)) > > > (NIL (setq C (char))) > > > (T (and Nest (= C "}"))) > > > (unless (= C "\\") > > > @@ -159,6 +159,10 @@ > > > (renderBlock ht:Prin)) ) > > > ("\\" (prin "{")) # Escaped brace > > > ("#" (renderBlock prog)) # Comment > > > + ("§" # iframe > > > + (let Lnk (till "}" T) > > > + (when (= " (chop Lnk) " ") > > + (prin Lnk) ) ) > > > (T (prin C "{")) ) ) > > > (T (ht:Prin C)) ) ) ) ) ) ) ) > > > PS 2 > https://www.youtube.com/embed/k7CHDscLREk; title="YouTube video player" > frameborder="0" allow="accelerometer; autoplay; clipboard-write; > encrypted-media; gyroscope; picture-in-picture" allowfullscreen> > > > Am So., 17. Juli 2022 um 15:46 Uhr schrieb Alexander Burger < > a...@software-lab.de>: > >> Hi Thorsten, >> >> > is there a way to embed content in a PicoLisp Wiki file? >> > ... >> > But when sharing e.g. a youtube video, there is the "embed" option, that >> > gives this iframe: >> > https://www.youtube.com/embed/xEKHU4zCRpY; title="YouTube video player" >> > ... >> > I could not figure out how to include this in a page with the PicoLisp >> Wiki >> > Syntax - probably it's not possible? >> >> I'm afraid so. I think there is no syntax for that in the markup >> language. Maybe >> Erik has an idea? >> >> ☺/ A!ex >> >> -- >> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >> >
Re: PicoLisp Wiki: Embed Content?
Hi Alex, it's actually extremely easy to embed content in a picolisp wiki file, when adding the syntax element from the PS 1 to wiki/lib.l : §{ } I added a little check for =\^:$\\#}" T)) + (ht:Prin (till "^J123456&/!_*+-%~|<@>=\^:$\\#§}" T)) (NIL (setq C (char))) (T (and Nest (= C "}"))) (unless (= C "\\") @@ -159,6 +159,10 @@ (renderBlock ht:Prin)) ) ("\\" (prin "{")) # Escaped brace ("#" (renderBlock prog)) # Comment + ("§" # iframe + (let Lnk (till "}" T) + (when (= "https://www.youtube.com/embed/k7CHDscLREk; title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen> Am So., 17. Juli 2022 um 15:46 Uhr schrieb Alexander Burger < a...@software-lab.de>: > Hi Thorsten, > > > is there a way to embed content in a PicoLisp Wiki file? > > ... > > But when sharing e.g. a youtube video, there is the "embed" option, that > > gives this iframe: > > https://www.youtube.com/embed/xEKHU4zCRpY; title="YouTube video player" > > ... > > I could not figure out how to include this in a page with the PicoLisp > Wiki > > Syntax - probably it's not possible? > > I'm afraid so. I think there is no syntax for that in the markup language
PicoLisp Wiki: Embed Content?
Hi List, is there a way to embed content in a PicoLisp Wiki file? I can download the video, add it to the page, and then reference it by name @{}. But when sharing e.g. a youtube video, there is the "embed" option, that gives this iframe: https://www.youtube.com/embed/xEKHU4zCRpY; title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen> I could not figure out how to include this in a page with the PicoLisp Wiki Syntax - probably it's not possible? Cheers Thorsten
Small error in httpGate doc
Hi Alex, just tried to build httpGate on WSL2 and got an error: $ make gate make: *** No rule to make target 'gate'. Stop. First I thought it's some WSL2 peculiarity as usual, but I think it's just outdated documentation: The 'httpGate' Proxy Server (software-lab.de) <https://software-lab.de/doc/httpGate.html>: "Building httpGate Next, go to the 'src' directory in the distribution and run make gate. When this is done, there should be an httpGate executable in the 'bin' directory." Looking into the makefile, it seems now there is a single "all" target, and httpGate is built together with pil21? Just to let you know Cheers Thorsten
Re: Internal WIKI Links do not work on WSL2 Debian
Hi Olaf, *"Did you try 127.0.0.1:5000 <http://127.0.0.1:5000/> instead of localhost:5000 ?"* just as a documentation, my experience is that: 1) WSL2 / w3m : all of these work http://localhost:5000 http://127.0.0.1:5000 http://0.0.0.0:5000 2) WIN10 / edge : only this works http://localhost:5000 Cheers Thorsten Am Mi., 19. Jan. 2022 um 14:43 Uhr schrieb O.Hamann : > Hi Thorsten, thanks for your solution! > > Just to be curious: > Did you try 127.0.0.1:5000 instead of localhost:5000 ? > Same pn-replacing effect? > > Regards, Olaf > > > On 19.01.22 00:20, Thorsten Jolitz wrote: > > Hi List, > > today I figured out what seems to be the problem here: > > Somehow the URLs are built with the computername instead of the port: > > http://0.0.0.0:asuspn/?home > > > > Replacing asuspn with 5000 all of these work, even from (say) Edge in > > Win10, when pil wiki server was started on WSL2: > > > > http://localhost:5000/?home > > http://localhost:5000/?help > > http://localhost:5000/?*Menu=+0&*Tab=+1&*ID=&*ID=$login > > > > with the last one, I can actually login, get a session id, and can > > navigate in the wiki and in my account. > > Strange, the port looks ok in the server call, and on Archlinux the URLs > > are ok too, but on WSL2 the servername instead of port is used to build > > the URL. > > > > $ pil wiki/main.l -main -go + > > (server (or (format (sys "PORT")) *WikiPort) "!wiki") > > ! *WikiPort > > -> 5000 > > > > Cheers > > Thorsten > > > > PS > > I start the wiki the normal way > > $ pil wiki/main.l -main -go + > > *Socket > > 1877 = 40895 20654634285828729~ > > : *Socket > > -> NIL > > : 1877 * 2022-01-19 00:00:37 admin > > 1883 = 57451 41629218673747370~ > > : > > > > > > > > Am Di., 28. Dez. 2021 um 23:42 Uhr schrieb Thorsten Jolitz > > mailto:tjol...@gmail.com>>: > > > > Hi Alex, > > yes, *ID is NIL when I debug it (see PS1). > > I'm not sure how to debug (app), but all global vars except *PID > > seem to be NIL ... > > > > I think it's a WSL2 localhost problem, not a bug in PicoLisp. > > Not too long ago I tried accessing the pil wiki server running on > > WSL2 from the Win10 Browser (say Edge), and that did not work at all > > Now it seems they have fixed that ,what is very nice, but still not > > the same like pure Linux apparently. > > > > Checking localhost everything seems normal (see PS 2) , but e.g this > > article describes a lot of problems: > > Fixing WSL2 localhost access issue - abdus.dev > > <https://abdus.dev/posts/fixing-wsl2-localhost-access-issue/> > > > > Cheers > > Thorsten > > > > PS 1 > > $ pil wiki/main.l -main -go + > > (and (== 'login *ID) (app)) > > ! *ID > > -> NIL > > ! (setq *ID 123456789) # naive try > > -> 123456789 > > > > # naiv try did not work > > Can't load -2.html?*Menu=+0&*Tab=+1&*ID=+123456789&*ID=$login > > > > PS 2 > > $ ping -a localhost > > PING localhost (127.0.0.1) 56(84) bytes of data. > > > > # type c (peek current url) in W3M : wiki start page > > http://localhost:8080/ > > > > # $ sudo cat /etc/hosts > > 127.0.0.1 localhost > > 127.0.1.1 xyz.localdomain xyz > > > > Am Di., 28. Dez 2021 um 20:44 Uhr schrieb Alexander Burger > > mailto:a...@software-lab.de>>: > > > > Hi Thorsten, Olaf, > > > > > it's a session problem. > > > Port 8080 does not help, but I cross checked on Archlinux, > > when I first > > > click on the Login link, a session prefix is added to the > > internal links, > > > and after login, that session prefix is everywhere in the html > > source. > > > But on WSL2 that does not work somehow > > > > This is indeed strange. This logic should not depend on the > system. > > > > I think the session is started after clicking on "Log in" in > > > >(dm (html> . +Doc) () > > (and (== 'login *ID) (app)) > > > > So somehow this check fails? The *ID value is passed on the URL, > > perhaps it is > > destroyed somehow? The browser? > > > > ☺/ A!ex > > > > -- > > UNSUBSCRIBE: mailto:picolisp@software-lab.de > > <mailto:picolisp@software-lab.de>?subject=Unsubscribe > > > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subjectUnsubscribe >
Re: Internal WIKI Links do not work on WSL2 Debian
Hi Alex, yes, $NAME was the computername ("asuspn"), and by setting name to $ echo $NAME 5000 everything works, I even get the wiki page with CSS then like in the real wiki. So, problem identified and solved, thanks! Cheers Thorsten Am Mi., 19. Jan. 2022 um 17:56 Uhr schrieb Alexander Burger < a...@software-lab.de>: > Hi Thorsten, > > > I looks actually as designed: > > in function baseHRef in http.l is this line > > > > (or Port (if *SesId *Port *Port1)) > > > > and *Port1 is the Computername. > > Correct, though not the Computername. > > IFF the PicoLisp server is started behind a httqGate, the "port" is the > application name. For example, on picolisp.com, the httpGate config file > has a > line > >wiki 5000 app /home/app log/wiki pil21/pil wiki/main.l @lib/app.l -main > patch.l -go -wait + > > so that httpGate translates "wiki" in requests to 5000. > > The question is how this happens in your setup: > > *Port1 is assigned in the 'server' function from the "NAME" environment > variable. So I suspect $NAME is set in your env to the machine's name, and > not > overridden by httpGate. That would explain it! > > You could unset NAME in your shell before starting PicoLisp, or (even > better) > use httpGate. > > ☺/ A!ex > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >
Re: Internal WIKI Links do not work on WSL2 Debian
Hi Alex, Hi Olaf, I would not say I found a "solution", just trying to figure out the cause. I looks actually as designed: in function baseHRef in http.l is this line (or Port (if *SesId *Port *Port1)) and *Port1 is the Computername. So apparently the landing page is build with these URLs with name instead of port, and only once a session id is acquired, a numeric port is used. These links are dead on the landing page, but when I enter the URLs in the browser, they work, e.g. http://localhost:5000/?help. Once I enter this in the browser: http://localhost:5000/?*Menu=+0&*Tab=+1&*ID=&*ID=$login , and login, all the links work again on the page, since a *'SesId exists and they are build with the port number (e.g. http://localhost:49651/62212780669042004~?Help) I wonder how these links http://localhost:asuspn/?help <http://localhost:5000/?help> http://localhost:asuspn/?h <http://localhost:5000/?help>ome are supposed to work before a session id is acquired, but somehow they do work on normal Linux. Since (session P H) is called with the Port P (5000), why not use it for URL construction (instead of *Port1)? Cheers Thorsten PS (out 2 (prinl *Pid " = " *Port " " *SesId)) 1549 = 49651 62212780669042004~ (or "Port" (if *SesId *Port *Port1)) (or "Port" (if *SesId *Port *Port1)) (or "Port" (if *SesId *Port *Port1)) (or "Port" (if *SesId *Port *Port1)) (or *SesId (bye)) : 1549 * 2022-01-19 17:07:16 admin Am Mi., 19. Jan. 2022 um 14:43 Uhr schrieb O.Hamann : > Hi Thorsten, thanks for your solution! > > Just to be curious: > Did you try 127.0.0.1:5000 instead of localhost:5000 ? > Same pn-replacing effect? > > Regards, Olaf > > > On 19.01.22 00:20, Thorsten Jolitz wrote: > > Hi List, > > today I figured out what seems to be the problem here: > > Somehow the URLs are built with the computername instead of the port: > > http://0.0.0.0:asuspn/?home > > > > Replacing asuspn with 5000 all of these work, even from (say) Edge in > > Win10, when pil wiki server was started on WSL2: > > > > http://localhost:5000/?home > > http://localhost:5000/?help > > http://localhost:5000/?*Menu=+0&*Tab=+1&*ID=&*ID=$login > > > > with the last one, I can actually login, get a session id, and can > > navigate in the wiki and in my account. > > Strange, the port looks ok in the server call, and on Archlinux the URLs > > are ok too, but on WSL2 the servername instead of port is used to build > > the URL. > > > > $ pil wiki/main.l -main -go + > > (server (or (format (sys "PORT")) *WikiPort) "!wiki") > > ! *WikiPort > > -> 5000 > > > > Cheers > > Thorsten > > > > PS > > I start the wiki the normal way > > $ pil wiki/main.l -main -go + > > *Socket > > 1877 = 40895 20654634285828729~ > > : *Socket > > -> NIL > > : 1877 * 2022-01-19 00:00:37 admin > > 1883 = 57451 41629218673747370~ > > : > > > > > > > > Am Di., 28. Dez. 2021 um 23:42 Uhr schrieb Thorsten Jolitz > > mailto:tjol...@gmail.com>>: > > > > Hi Alex, > > yes, *ID is NIL when I debug it (see PS1). > > I'm not sure how to debug (app), but all global vars except *PID > > seem to be NIL ... > > > > I think it's a WSL2 localhost problem, not a bug in PicoLisp. > > Not too long ago I tried accessing the pil wiki server running on > > WSL2 from the Win10 Browser (say Edge), and that did not work at all > > Now it seems they have fixed that ,what is very nice, but still not > > the same like pure Linux apparently. > > > > Checking localhost everything seems normal (see PS 2) , but e.g this > > article describes a lot of problems: > > Fixing WSL2 localhost access issue - abdus.dev > > <https://abdus.dev/posts/fixing-wsl2-localhost-access-issue/> > > > > Cheers > > Thorsten > > > > PS 1 > > $ pil wiki/main.l -main -go + > > (and (== 'login *ID) (app)) > > ! *ID > > -> NIL > > ! (setq *ID 123456789) # naive try > > -> 123456789 > > > > # naiv try did not work > > Can't load -2.html?*Menu=+0&*Tab=+1&*ID=+123456789&*ID=$login > > > > PS 2 > > $ ping -a localhost > > PING localhost (127.0.0.1) 56(84) bytes of data. > > > > # type c (peek current url) in W3M : wiki start page > > http://localhost:8080/ > > > > # $ sudo cat /etc/hosts > > 127.0.0.1 localhost > > 1
Re: Internal WIKI Links do not work on WSL2 Debian
Hi List, today I figured out what seems to be the problem here: Somehow the URLs are built with the computername instead of the port: http://0.0.0.0:asuspn/?home Replacing asuspn with 5000 all of these work, even from (say) Edge in Win10, when pil wiki server was started on WSL2: http://localhost:5000/?home http://localhost:5000/?help http://localhost:5000/?*Menu=+0&*Tab=+1&*ID=&*ID=$login with the last one, I can actually login, get a session id, and can navigate in the wiki and in my account. Strange, the port looks ok in the server call, and on Archlinux the URLs are ok too, but on WSL2 the servername instead of port is used to build the URL. $ pil wiki/main.l -main -go + (server (or (format (sys "PORT")) *WikiPort) "!wiki") ! *WikiPort -> 5000 Cheers Thorsten PS I start the wiki the normal way $ pil wiki/main.l -main -go + *Socket 1877 = 40895 20654634285828729~ : *Socket -> NIL : 1877 * 2022-01-19 00:00:37 admin 1883 = 57451 41629218673747370~ : Am Di., 28. Dez. 2021 um 23:42 Uhr schrieb Thorsten Jolitz < tjol...@gmail.com>: > Hi Alex, > yes, *ID is NIL when I debug it (see PS1). > I'm not sure how to debug (app), but all global vars except *PID seem to > be NIL ... > > I think it's a WSL2 localhost problem, not a bug in PicoLisp. > Not too long ago I tried accessing the pil wiki server running on WSL2 > from the Win10 Browser (say Edge), and that did not work at all. > Now it seems they have fixed that ,what is very nice, but still not the > same like pure Linux apparently. > > Checking localhost everything seems normal (see PS 2) , but e.g this > article describes a lot of problems: > Fixing WSL2 localhost access issue - abdus.dev > <https://abdus.dev/posts/fixing-wsl2-localhost-access-issue/> > > Cheers > Thorsten > > PS 1 > $ pil wiki/main.l -main -go + > (and (== 'login *ID) (app)) > ! *ID > -> NIL > ! (setq *ID 123456789) # naive try > -> 123456789 > > # naiv try did not work > Can't load -2.html?*Menu=+0&*Tab=+1&*ID=+123456789&*ID=$login > > PS 2 > $ ping -a localhost > PING localhost (127.0.0.1) 56(84) bytes of data. > > # type c (peek current url) in W3M : wiki start page > http://localhost:8080/ > > # $ sudo cat /etc/hosts > 127.0.0.1 localhost > 127.0.1.1 xyz.localdomain xyz > > Am Di., 28. Dez. 2021 um 20:44 Uhr schrieb Alexander Burger < > a...@software-lab.de>: > >> Hi Thorsten, Olaf, >> >> > it's a session problem. >> > Port 8080 does not help, but I cross checked on Archlinux, when I first >> > click on the Login link, a session prefix is added to the internal >> links, >> > and after login, that session prefix is everywhere in the html source. >> > But on WSL2 that does not work somehow >> >> This is indeed strange. This logic should not depend on the system. >> >> I think the session is started after clicking on "Log in" in >> >>(dm (html> . +Doc) () >> (and (== 'login *ID) (app)) >> >> So somehow this check fails? The *ID value is passed on the URL, perhaps >> it is >> destroyed somehow? The browser? >> >> ☺/ A!ex >> >> -- >> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >> >
Re: Internal WIKI Links do not work on WSL2 Debian
Hi Alex, yes, *ID is NIL when I debug it (see PS1). I'm not sure how to debug (app), but all global vars except *PID seem to be NIL ... I think it's a WSL2 localhost problem, not a bug in PicoLisp. Not too long ago I tried accessing the pil wiki server running on WSL2 from the Win10 Browser (say Edge), and that did not work at all. Now it seems they have fixed that ,what is very nice, but still not the same like pure Linux apparently. Checking localhost everything seems normal (see PS 2) , but e.g this article describes a lot of problems: Fixing WSL2 localhost access issue - abdus.dev <https://abdus.dev/posts/fixing-wsl2-localhost-access-issue/> Cheers Thorsten PS 1 $ pil wiki/main.l -main -go + (and (== 'login *ID) (app)) ! *ID -> NIL ! (setq *ID 123456789) # naive try -> 123456789 # naiv try did not work Can't load -2.html?*Menu=+0&*Tab=+1&*ID=+123456789&*ID=$login PS 2 $ ping -a localhost PING localhost (127.0.0.1) 56(84) bytes of data. # type c (peek current url) in W3M : wiki start page http://localhost:8080/ # $ sudo cat /etc/hosts 127.0.0.1 localhost 127.0.1.1 xyz.localdomain xyz Am Di., 28. Dez. 2021 um 20:44 Uhr schrieb Alexander Burger < a...@software-lab.de>: > Hi Thorsten, Olaf, > > > it's a session problem. > > Port 8080 does not help, but I cross checked on Archlinux, when I first > > click on the Login link, a session prefix is added to the internal links, > > and after login, that session prefix is everywhere in the html source. > > But on WSL2 that does not work somehow > > This is indeed strange. This logic should not depend on the system. > > I think the session is started after clicking on "Log in" in > >(dm (html> . +Doc) () > (and (== 'login *ID) (app)) > > So somehow this check fails? The *ID value is passed on the URL, perhaps > it is > destroyed somehow? The browser? > > ☺/ A!ex > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >
Re: Internal WIKI Links do not work on WSL2 Debian
Hallo Olaf, it's a session problem. Port 8080 does not help, but I cross checked on Archlinux, when I first click on the Login link, a session prefix is added to the internal links, and after login, that session prefix is everywhere in the html source. But on WSL2 that does not work somehow, I cleaned up the Wiki DB and started again, but same problem Regards, Thorsten PS Before that, the links look the same: WSL2/Debian Log in Archlinux: Log in => click on login Log in Am Di., 28. Dez. 2021 um 16:27 Uhr schrieb O.Hamann : > And another idea: > > Did you try other more common ports, sth. like 8080 or so? > (in case there is some firewall mechanism blocking, or so?) > > Regards, Olaf > > > On 24.12.21 14:06, Thorsten Jolitz wrote: > > Hi List, > > I have the newest pil21 and the current picolisp wiki running on > > - Win10 / WSL2 (Debian unstable) > > - Archlinux > > and while in both cases I do see the start page of the wiki on > > http://localhost:5000, only the external Menu links work on WSL2, not > > the wiki internal links (nor the login). > > > > What is quite nice now, on Win10 I can access the running wiki server on > > localhost from WSL2/Debian (via W3M) and from the Windows browser > > (chrome or edge), I think that didn't work before. > > > > But these kind of links do not work in either case, > > > href="-2.html?*Menu=+0&*Tab=+1&*ID=&*ID=$login">Log in > > > > W3M says: "Can't load -2.html?*Menu=+0&*Tab=+1&*ID=&*ID=$login", while > > Edge shows "about:blank#blocked". I started the server in debug mode > > (pil wiki/main.l -main -go +), but no messages show up in the server > > window. > > > > Did anyone experience the same issue? > > Cheers > > Thorsten > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subjectUnsubscribe >
Internal WIKI Links do not work on WSL2 Debian
Hi List, I have the newest pil21 and the current picolisp wiki running on - Win10 / WSL2 (Debian unstable) - Archlinux and while in both cases I do see the start page of the wiki on http://localhost:5000, only the external Menu links work on WSL2, not the wiki internal links (nor the login). What is quite nice now, on Win10 I can access the running wiki server on localhost from WSL2/Debian (via W3M) and from the Windows browser (chrome or edge), I think that didn't work before. But these kind of links do not work in either case, Log in W3M says: "Can't load -2.html?*Menu=+0&*Tab=+1&*ID=&*ID=$login", while Edge shows "about:blank#blocked". I started the server in debug mode (pil wiki/main.l -main -go +), but no messages show up in the server window. Did anyone experience the same issue? Cheers Thorsten
Re: Manually install (newest) PIL21 on Debian/WSL2
Hi Mike, Hi Karl, yes shame on me, I somehow forgot temporarily that it's PIL21 now, ;-( Cheers Thorsten PS with this line from INSTALL: $ sudo apt install make clang llvm libreadline-dev libffi-dev libssl-dev pkg-config nbv3@nbox:~/bin/pil21$ (cd src/; make) nbv3@nbox:~/bin/pil21$ ./pil + : (version) 21.8.20 -> (21 8 20) Am So., 22. Aug. 2021 um 23:18 Uhr schrieb Karl-Heinz Kreis < karl-heinz.kr...@gmx.de>: > > Hi, > > opt is part of llvm assembler, version 11 . > The Toolchain needs other fairly actual versions, perl3 ... > > Greetings Karl >
Manually install (newest) PIL21 on Debian/WSL2
Hi List, on Win10 with WSL2 and Debian unstable, I can install Pil21 by "sudo apt-get picolisp", and I get : nbv3@nbox:~$ pil + : (version ) 21.6.30 When I download the "rolling release" version, and try to install it locally, I'm asked to first install MAKE and CLANG. Then I get the error in PS. (There is an /OPT directory in this debian install, if that's what the error refers to) Did anyone try (and maybe solve) this too? Cheers Thorsten PS *Error* nbv3@nbox:~/bin/pil21$ (cd src/; make) make: opt: No such file or directory make: *** [Makefile:40: base.bc] Error 127 *src/Makefile: * # 19aug21 Software Lab. Alexander Burger SILENT: CC = clang PIL = ../pil # pil * ASM = opt -O3 # llvm-as * [...] base.bc: base.ll * $(ASM) -o base.bc base.ll*
Re: Jitsi screen sharing issues
Hi Alex, since I cannot attend every PilCon, I would not want to provoke a change that maybe causes problems for others that attend more frecuently. Otherwise it would of course be ok to try SSH again. For me, the jitsi problem was just that the shared screen comes and goes, and was mostly gone
Re: Jitsi screen sharing issues
Hi Mansur, I had exactly the same issue the last 2 PilCons I attended, on Win10, with both Edge and Chrome. It almost makes no sense for me to attend that way, because I do not see what Alex presents. I read somewhere if someone with Android connects, the others get problems, but it seems everybody else was just fine except you and me. Cheers Thorsten Mansur Mamkin schrieb am Mi., 21. Juli 2021, 17:19: > Hi all, > > During last PilCon I repeatedly lost shared screen after several seconds > of connection (or little more). Helped reconnection only. The same > behavior on Linux+Chrome and MacOS+(Chrome or Safari). Maybe anyone > knows how to solve such issue or some workaround? > > Best regards, > > Mansur Mamkin > > > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >
Re: PilCon tomorrow
Hi Alex, I won't be able to participate during the whole meeting, maybe just half an hour, and I already was in the first meeting about the topic. But I have questions about distributed databases. Would it be possible to use Picolisp as "super fat client" by installing the server app on the client side too and just let the databases synchronize? So you can actually allow the user to insert and execute code , because it's done on his client, and not on the server, but the client & server databases synchronize and the generated html is available on the server? I think about a Notebook type application. This is not possible with e.g. Emacs Org-Mode, for obvious security reasons. Any Org-Mode server that does website generation by exporting Org-Mode files to html has to deactivate the execution of code blocks in that file. Now imagine we want to add the syntax "code block" to the Picolisp wiki syntax, so that the user can create dynamic documents, e.g. with a code block that updates weather info every 30min. Obviously, Alex wouldn't want to blindly execute user code on his server. But what if the user could clone the whole server app on his client computer, as a "super fat client", does the code execution on his client, the DB synchronizes, and the server shows an updated html page every half hour, without any code execution on the server? A static site generator, but with dynamic sources, created by and executed at the risk of the user? Not sure if that is a valid idea ;-) Would probably only possible with Picolisp, due to the small size and easy installation. Cheers Thorsten Alexander Burger schrieb am Mo., 19. Juli 2021, 10:47: > Hi all, > > next PilCon will be tomorrow, July 20th, at 16:00 UTC on > >https://meeting.itship.ch/PilCon > > The plan was to recapitulate the three database layers in PicoLisp, > starting > from the basics. Any questions or other input welcome! > > ☺/ A!ex > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >
Re: PilCon tomorrow (Anatomy of Vip)
Hi Alex, thanks for your effort here, I can follow your reasoning, emulating Emacs produces a lot of commands , which is not exactly in the spirit of simplicity, and one can just adapt it's workflow instead of adding more commands. But maybe I can reuse your code anyway! Cheers Thorsten Alexander Burger schrieb am Mo., 19. Apr. 2021, 07:14: > On Sun, Apr 18, 2021 at 07:13:50PM +0200, Alexander Burger wrote: > > OK, thinking about it, I simplified it a little and will indeed use it > > occasionally perhaps :) > > > >(de *F9 # Eval lines till mark "e" > > (evCmd > > (run (str (getText (jmpMark "e" ) ) > > ... > > So now I do "me" somewhere to set ark "e" and then "F9" from somewhere > before > > that position to execute the code. > > No, thinking about it again, I will remove it frmm my ~/.pil/viprc :) > > It is useless, because > > 1. using the existing Ctrl-E on a few expressions, one after the other, is > more >interactive and intuitive than pressing many keys to select a region > and then >evaluate it with other keys. > > 2. it is easier to type ":l" to reload the whole file. In general I > write >sources to be 'load'able as a whole any time. > > 3. it wastes a precious function key. > > 4. it requires more rules to remember. Keep it simple! > > ☺/ A!ex > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >
Re: PilCon tomorrow (Anatomy of Vip)
Hi Alex, that is cool, a bit like in Emacs, where you work in a major mode buffer and eval expressions there, maybe sending the results to a repl buffer. What do you think about some more enhancements in that spirit: [X] eval atom [X] eval expression [ ] eval definition/form (?) [ ] eval region [ ] eval buffer/window (In Emacs all these commands often have "eval-x-and-go" siblings, that eval the expression and then jump to the repl) In Emacs one uses markers for regions, in VIP I'm not sure ... The difference between expression and definition is, that in Emacs the cursor might be inside the expression/definition, and first jumps to the opening paren, then evaluates. (de foo (X) (+ X| 2)) With the cursor behind X would then either return X+2 or foo. Saves some cursor movements before evaluation, but needs different keybindings, not only one. Cheers Thorsten Alexander Burger schrieb am So., 18. Apr. 2021, 16:39: > Hi all, > > when a question or request came up at PilCon about evaluating expressions > in > Vip's edit buffer, I explained how this works in a line-oriented way in the > bottom command window. > > Now (version 21.4.18) I added a similiar feature to normal edit buffers: > Hitting > Ctrl-E (edit) on either an open parenthesis or an atom causes the > evaluation of > that expression, with output directed to the command window. > > ☺/ A!ex > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >
Re: Native Calls with SEXP (a variant type, with subtypes for all R’s data structures).
Picolisp has "native" calls as an FFI to call C shared libraries from Picolisp, and build Picolisp wrapper functions on top of C functions defined in header files. A lot of programming languages allow that, there are e.g. many Python wrappers for all kinds of data science libraries. But with Picolisp you need only very little code to do it. It's still not easy when the C functions are non-trivial (and you have only limited C knowledge). There are quite a few Picolisp wrapper libs from AW on GitHub with good explanations Cesar Rabak schrieb am Do., 8. Apr. 2021, 21:54: > So, if I understand correctly we could use the introspective power of > picolisp and write a {meta?}program to produce the "library" for Pil, and > then use this to call R from picolisp? > > -- > Cesar Rabak > > On Thu, Apr 8, 2021 at 4:14 PM Thorsten Jolitz wrote: > >> Hi Alex, >> after digging deeper in R Internals I found out that there are actually C >> access functions for the various subtypes of SEXP that can be wrapped with >> native too: >> >> rinc: (setupRinC) >> -> NIL >> rinc: (evalQuietlyInR "V <- c(1.5, 3.4, 4.2)") >> -> NIL >> rinc: (evalInR "V") >> -> 65007640 >> rinc: (REAL (evalInR "V")) >> -> (2 3 4) >> rinc: (teardownRinC) >> -> NIL >> >> I think this is already quite nice. >> Setup an R session, do quiet evaluations in R, do evaluations with return >> value, convert that return value (SEXP subtype) to its appropriate Pil data >> type, tear down R session. >> >> So there are only a few challenges left: >> 1. write wrappers for all type conversion functions (for all SEXP >> subtypes) >> 2. figure out the SEXP subtype from the pointer returned >> 3. dynamically get the length for all SEXP subtypes with a length, to be >> able to dynamically define return types like '(1.0 . 3) in native or struct >> (I think there are C functions for this in R internals too) >> >> Question on topic 2: >> given the C data type described below for an R "node", would it be >> somehow possible to extract just the SEXPTYPE from a SEXP return value, i.e. >> the first field of the sexpinfo_struct, that is the first struct in the >> SEXPREC_HEADER, that is the first field in the SEXPREC struct to which the >> SEXP return value points? >> Without specifying that complicated C structure in native or struct, >> because we have the C access functions for that. Ignoring all the rest of >> the pointer content, just extract that one field SEXPTYPE? >> >> Knowing which SEXPTYPE the return value represents, one could then read >> the returned pointer with the appropriate data type into Pil (like REAL in >> the example above). >> if the return value is atomic, one is done. If its a vector, list, or so >> one would need the length of it too, not only the type (or is it a valid >> strategy to just use some very big value for the specification like '(1.0 . >> ) or so)? >> >> Cheers >> Thorsten >> >> >> *Composition of an R node: * >> the SEXP subtypes are defined like this: >> typedef unsigned int SEXPTYPE; >> 52 #define NILSXP›0› /* nil = NULL */ >> 53 #define SYMSXP›1› /* symbols */ >> 54 #define LISTSXP› 2› /* lists of dotted pairs */ >> 55 #define CLOSXP›3› /* closures */ >> 56 #define ENVSXP›4› /* environments */ >> 57 #define PROMSXP› 5› /* promises: [un]evaluated closure >> arguments */ >> 58 #define LANGSXP› 6› /* language constructs (special lists) >> */ >> 59 #define SPECIALSXP 7› /* special forms */ >> 60 #define BUILTINSXP 8› /* builtin non-special forms */ >> 61 #define CHARSXP› 9› /* "scalar" string type (internal >> only)*/ >> 64 #define INTSXP› 13› /* integer vectors */ >> 65 #define REALSXP› 14› /* real variables */ >> 66 #define CPLXSXP› 15› /* complex variables */ >> 67 #define STRSXP› 16› /* string vectors */ >> 68 #define DOTSXP› 17› /* dot-dot-dot object */ >> 69 #define ANYSXP› 18› /* make "any" args work. >> 72 #define VECSXP› 19› /* generic vectors */ >> 73 #define EXPRSXP› 20› /* expressions vectors */ >> 74 #define BCODESXP21/* byte code */ >> 62 etc >> >> this type is part of the sxpinfo structure: >> struct sxpinfo_struct { >> 142 SEXPTYPE type : TYPE_BITS; >&g
Re: Native Calls with SEXP (a variant type, with subtypes for all R’s data structures).
Hi Alex, after digging deeper in R Internals I found out that there are actually C access functions for the various subtypes of SEXP that can be wrapped with native too: rinc: (setupRinC) -> NIL rinc: (evalQuietlyInR "V <- c(1.5, 3.4, 4.2)") -> NIL rinc: (evalInR "V") -> 65007640 rinc: (REAL (evalInR "V")) -> (2 3 4) rinc: (teardownRinC) -> NIL I think this is already quite nice. Setup an R session, do quiet evaluations in R, do evaluations with return value, convert that return value (SEXP subtype) to its appropriate Pil data type, tear down R session. So there are only a few challenges left: 1. write wrappers for all type conversion functions (for all SEXP subtypes) 2. figure out the SEXP subtype from the pointer returned 3. dynamically get the length for all SEXP subtypes with a length, to be able to dynamically define return types like '(1.0 . 3) in native or struct (I think there are C functions for this in R internals too) Question on topic 2: given the C data type described below for an R "node", would it be somehow possible to extract just the SEXPTYPE from a SEXP return value, i.e. the first field of the sexpinfo_struct, that is the first struct in the SEXPREC_HEADER, that is the first field in the SEXPREC struct to which the SEXP return value points? Without specifying that complicated C structure in native or struct, because we have the C access functions for that. Ignoring all the rest of the pointer content, just extract that one field SEXPTYPE? Knowing which SEXPTYPE the return value represents, one could then read the returned pointer with the appropriate data type into Pil (like REAL in the example above). if the return value is atomic, one is done. If its a vector, list, or so one would need the length of it too, not only the type (or is it a valid strategy to just use some very big value for the specification like '(1.0 . ) or so)? Cheers Thorsten *Composition of an R node: * the SEXP subtypes are defined like this: typedef unsigned int SEXPTYPE; 52 #define NILSXP›0› /* nil = NULL */ 53 #define SYMSXP›1› /* symbols */ 54 #define LISTSXP› 2› /* lists of dotted pairs */ 55 #define CLOSXP›3› /* closures */ 56 #define ENVSXP›4› /* environments */ 57 #define PROMSXP› 5› /* promises: [un]evaluated closure arguments */ 58 #define LANGSXP› 6› /* language constructs (special lists) */ 59 #define SPECIALSXP 7› /* special forms */ 60 #define BUILTINSXP 8› /* builtin non-special forms */ 61 #define CHARSXP› 9› /* "scalar" string type (internal only)*/ 64 #define INTSXP› 13› /* integer vectors */ 65 #define REALSXP› 14› /* real variables */ 66 #define CPLXSXP› 15› /* complex variables */ 67 #define STRSXP› 16› /* string vectors */ 68 #define DOTSXP› 17› /* dot-dot-dot object */ 69 #define ANYSXP› 18› /* make "any" args work. 72 #define VECSXP› 19› /* generic vectors */ 73 #define EXPRSXP› 20› /* expressions vectors */ 74 #define BCODESXP21/* byte code */ 62 etc this type is part of the sxpinfo structure: struct sxpinfo_struct { 142 SEXPTYPE type : TYPE_BITS; 143 /* ==> (FUNSXP == 99) %% 2^5 == 3 == CLOSXP 144 › › ›,* -> warning: `type' is narrower than values 145 › › ›,* of its type 146 › › ›,* when SEXPTYPE was an enum */ 147 unsigned int scalar: 1; 148 unsigned int obj : 1; 149etc which then becomes part of an header: #define SEXPREC_HEADER \ 209 struct sxpinfo_struct sxpinfo; \ 210 struct SEXPREC *attrib; \ 211 struct SEXPREC *gengc_next_node, *gengc_prev_node 212 which finally becomes part of the SEXPREC structure. A SEXP is a pointer to a SEXPREC structure. 213 /* The standard node structure consists of a header followed by the 214 node data. */ 215 typedef struct SEXPREC { 216 SEXPREC_HEADER; 217 union { 218 › struct primsxp_struct primsxp; 219 › struct symsxp_struct symsxp; 220 › etc Am Mi., 7. Apr. 2021 um 15:55 Uhr schrieb Alexander Burger < a...@software-lab.de>: > On Wed, Apr 07, 2021 at 07:46:20AM +0200, Alexander Burger wrote: > > OK, so now we have a pointer to a structure filled by evalInR(). > > ... > >(struct (evalInR "6*4") ...) > > In fact this depends on what exactly evalInR() returns. > > If it returns a pointer to a dynamically allocated structure, and the > caller is > responsible to de-allocate it, you would do > >(let P (evalInR "6*4") > (prog1 > (struct P ...) > (free P) ) ) > > If, however, the structure is statically allocated, you can also
Re: Native Calls with SEXP (a variant type, with subtypes for all R’s data structures).
Hi Cesar, it works both ways, and there is an old R C API and more modern C++ implementations (with C headers too) for the use case here: - call R from C(++). or better: - call R from PicoLisp via (native) C (calls) See my last answer to Alex to see that the call to R actually works. Cheers Thorsten. Am Di., 6. Apr. 2021 um 22:20 Uhr schrieb Cesar Rabak : > Hi Thorsten, > > The quote you copied here (coming from the ref. of yours R's C Interface), > describes IIUC a structure, more accurately the model of, for calling > "foreing" C functions in R and not the converse. > > The way to call R functions in picolisp would be to call the functions > made available through the API, in case of R a process similar to FFI using > as reference the include files, wouldn't? > > HTH > -- > Cesar Rabak > > > On Mon, Apr 5, 2021 at 4:30 PM Thorsten Jolitz wrote: > >> Hello List, >> I wonder how to deal with the R SEXP Data structure in native calls. >> >> *"Technically, [a SEXP] is a pointer to a structure with typedef SEXPREC
Re: Native Calls with SEXP (a variant type, with subtypes for all R’s data structures).
Hi Alex, thanks for the hints, I tried both, T and 'P as result values , the first gives a segment fault, but the second actually works: (de evalInR ("Cmd") (native `*RinC "evalInR" 'P "Cmd")) ## SEXP evalInR(char * cmd); rinc: (evalInR "print(6*4)") [1] 24 -> 65814160 If I use "print" in the R command, I actually see the R output. And with the 'P, I actually get a return value. But what can I do in PicoLisp with that pointer? If I skip the "print" and just call R for the return value: rinc: (evalInR "6*4") -> 65814160 how can I extract the result from that Pointer in PicoLisp (lack of C skills ... ;-)? Cheers Thorsten Am Di., 6. Apr. 2021 um 10:23 Uhr schrieb Alexander Burger < a...@software-lab.de>: > Hi Thorsten, > > > I wonder how to deal with the R SEXP Data structure in native calls. > > > > *"Technically, [a SEXP] is a pointer to a structure with typedef SEXPREC. > > A SEXP is a variant type, with subtypes for all R’s data structures"* > > > > E.g. > > > >- INTSXP: integer vector > >- LGLSXP: logical vector > >- STRSXP: character vector > >- ... (and a dozen more) > > I do not really understand the implications in the context of R, but Pil21 > has a > new 'T' result specification for raw Lisp data. > > It allows to pass a pointer to any Lisp data item to a native function, > and/or > to return such data. > > > > When I have an imaginary generic C function like this: > > > > SEXP fun(SEXP x, char * cmd) > > As an example, we might call the standard 'prog1' function in the Pil21 > executable (which has the internal label "_prog1", try (vi 'prog1)). It > takes a > list for the body, and returns the resulting value: > >: (%@ "_prog1" T '(T prog1 7 (println 1 2 3))) >1 2 3 >-> 7 > > This is equivalent to > >: (prog1 7 (println 1 2 3)) >1 2 3 >-> 7 > > > > how can I specify Return Value/Arguments in a 'native' call, if I cannot > > know in advance to which R subtype the SEXP Points? > > If the above is not what you intended, the 'P' result specification can be > used > as an unspecific pointer (void*, an unsigned 64 bit number). > > ☺/ A!ex > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >
Native Calls with SEXP (a variant type, with subtypes for all R’s data structures).
Hello List, I wonder how to deal with the R SEXP Data structure in native calls. *"Technically, [a SEXP] is a pointer to a structure with typedef SEXPREC. A SEXP is a variant type, with subtypes for all R’s data structures"* E.g. - INTSXP: integer vector - LGLSXP: logical vector - STRSXP: character vector - ... (and a dozen more) When I have an imaginary generic C function like this: SEXP fun(SEXP x, char * cmd) how can I specify Return Value/Arguments in a 'native' call, if I cannot know in advance to which R subtype the SEXP Points? On the one hand, a SEXP is like a C Datatype for a Lisp list, so one could think that's ideal for calling C from Pil with list args and list return values. On the other hand, how can one give the primitive specifications in the specification lists for 'native' args/return vals, without knowing the concrete subtype (R data structure), i.e. when CMD can be any R command that may take/return any of the subtypes (char, logical, int, vector, list )? Is there maybe a generic solution on the 'native' side too, without the primitive specifications? Thanks in advance and Cheers Thorsten PS For those interested here two links: Rinternals.h source code: r-source/Rinternals.h at a1425adea54bcc98eef86081522b5dbb3e149cdc · wch/r-source (github.com) <https://github.com/wch/r-source/blob/a1425adea54bcc98eef86081522b5dbb3e149cdc/src/include/Rinternals.h> R's C Interface (blog post explaining the code/data structures) R's C interface · Advanced R. (had.co.nz) <http://adv-r.had.co.nz/C-interface.html>.
Re: Picolisp Outlook
I'm just saying that it would be nice to have a Picolisp app that has a real demand and a little ecosystem around it ... Like e.g. Moodle or some CMS system, that probably have an ecosystem of PHP programmers around them, and many organisations using them (with need for some support). For them it's irrelevant if it's PHP or anything else. C K Kashyap schrieb am Di., 23. Feb. 2021, 15:56: > I also believe that the simplicity of PicoLisp by itself is a "killer > app". I've explored several languages in the past but PicoLisp is the only > one that allowed me to understand the implementation of the language all > the way (I still have to work on the external symbol bit :) . I was so used > to seeing documents of concepts of other languages that don't directly map > to the source code that it took me a while to realize the accuracy of > PicoLisp documentation. > > Regards, > Kashyap > > On Tue, Feb 23, 2021 at 2:26 AM Manuel Cano wrote: > >> Hi, >> >> That's surely because it isn't made in Picolisp! :D >> >> Kind regards, >> Manu >> >> >> El mar, 23 feb 2021 a las 10:32, Alexander Burger () >> escribió: >> >>> Hi all, >>> >>> sorry for the multiple mails! Seems I have a DNS problem on >>> the server ... >>> >>> On Tue, Feb 23, 2021 at 09:18:57AM +0100, Alexander Burger wrote: >>> > Hi Thorsten, >>> > ... >>> >>> -- >>> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >>> >>>
Re: Picolisp Outlook
Hi Alex, Alexander Burger schrieb am Di., 23. Feb. 2021, 09:33: > Hi Thorsten, > > > Maybe we should sponsor Alex (3 month work?) to build that "killer app" > > with the clear goals > > Hmm, no need to specially sponsor me, but thanks for the proposal! > > The problem is that such an app would probably not be accepted by those > millions > of (data) scientists. As always, Lisp looks too suspicious to them ;) > That's too bad, but probably the harsh truth. Then there is only one option left ;-) Build a low-code/no-code system where Picolisp simplicity shines under the hood, but no average user sees any lisp. These are getting quite popular nowadays in the enterprise world, but then again, which enterprise doesn't go with the market leader for almost any application? Cheers Thorsten > ☺/ A!ex > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >
Re: Picolisp Outlook
I thought interfacing with important data science libraries would be a pro, but of course it has to be done first, it's quite a lot of work and not always that easy, even if it's C, not to mention C++. I guess you are right about the popularity of Lisp ... pd schrieb am Di., 23. Feb. 2021, 08:57: > In my opinion picolisp has two disadvantages to be a scientific > programming language: > > 1 lack of flota support > 2 lack of libraries > > Both together make far easier to develop a science app in Python rather > than picolisp > > For sure It has got adventages too like db and pil but disadvantages are a > heavy stone > > Also lisp is not a fancy language, at least most people thinks it's weird > compared to Python and similars and this sure doesn't helps. This is the > reason for "science languages" are so similar in syntax (python,R...) > > Greets > > > El lun., 22 feb. 2021 22:40, Thorsten Jolitz escribió: > >> Maybe we should sponsor Alex (3 month work?) to build that "killer app" >> with the clear goals >> >> - for all those millions of (data) scientists that work with R etc, it >> should be the easiest (because fully integrated) way to build applications >> on top of their data >> - for those who like Picolisp it should be the Pil App to potentially >> make money with (without being superstar programmers). >> >> If Alex charges moderate rates (and doesn't think the idea is a waste ;-) >> I would be willing to take over one month of development ... ;-) >> >> >> >> >> schrieb am Mo., 22. Feb. 2021, 21:51: >> >>> Yeah I had kinda similiar ideas, Thorsten. >>> >>> PicolispDB is certainly a killer feature - multi-paradigm database >>> (Key-Value, Object, Document, Graph, Relational.. really everything >>> covered), ACID (transactions), many indexing capabilities (including >>> text and spatial indexing), performant, extremely flexible and nicely >>> well maintainable. >>> >>> In the past, a lack of (digitalized) data was often an obstacle to get >>> useful (business) insights with software. >>> This changed, we are drowning in data. >>> >>> Now, and for the foreseeable future, the problem is to make sense of the >>> data, to be able to filter, map and connect various formats and data >>> sources together - while requirements change all the time. >>> >>> I believe Picolisp Database is a tool outstandingly suited for this. >>> >>> On 22.02.21 17:04, Thorsten Jolitz wrote: >>> > hallo list, >>> > I always thought a "killer app" would be nice, to make those "killer >>> > features" popular, and I always thought that could be a "data science >>> > application builder" with 3 features: >>> > >>> > - easy data import into a Picolisp DB >>> > - ffi/java wrappers for many data science libs (Rmath, Weka, ...) >>> > - easy web app development >>> > >>> > because for data scientists it seems often quite difficult to build >>> > applications on top of their data, and with Picolisp it would be all >>> > integrated into one single tool. >>> > >>> > But then I should be the one who implements that, and I made some >>> > attempts, but never had the time/energy/stamina/skills to bring it on
Re: Picolisp Outlook
Maybe we should sponsor Alex (3 month work?) to build that "killer app" with the clear goals - for all those millions of (data) scientists that work with R etc, it should be the easiest (because fully integrated) way to build applications on top of their data - for those who like Picolisp it should be the Pil App to potentially make money with (without being superstar programmers). If Alex charges moderate rates (and doesn't think the idea is a waste ;-) I would be willing to take over one month of development ... ;-) schrieb am Mo., 22. Feb. 2021, 21:51: > Yeah I had kinda similiar ideas, Thorsten. > > PicolispDB is certainly a killer feature - multi-paradigm database > (Key-Value, Object, Document, Graph, Relational.. really everything > covered), ACID (transactions), many indexing capabilities (including > text and spatial indexing), performant, extremely flexible and nicely > well maintainable. > > In the past, a lack of (digitalized) data was often an obstacle to get > useful (business) insights with software. > This changed, we are drowning in data. > > Now, and for the foreseeable future, the problem is to make sense of the > data, to be able to filter, map and connect various formats and data > sources together - while requirements change all the time. > > I believe Picolisp Database is a tool outstandingly suited for this. > > On 22.02.21 17:04, Thorsten Jolitz wrote: > > hallo list, > > I always thought a "killer app" would be nice, to make those "killer > > features" popular, and I always thought that could be a "data science > > application builder" with 3 features: > > > > - easy data import into a Picolisp DB > > - ffi/java wrappers for many data science libs (Rmath, Weka, ...) > > - easy web app development > > > > because for data scientists it seems often quite difficult to build > > applications on top of their data, and with Picolisp it would be all > > integrated into one single tool. > > > > But then I should be the one who implements that, and I made some > > attempts, but never had the time/energy/stamina/skills to bring it on. > > So this is just an idea I had for quite some time ... > > > > Cheers > > Thorsten > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe > >
Re: Picolisp Outlook
hallo list, I always thought a "killer app" would be nice, to make those "killer features" popular, and I always thought that could be a "data science application builder" with 3 features: - easy data import into a Picolisp DB - ffi/java wrappers for many data science libs (Rmath, Weka, ...) - easy web app development because for data scientists it seems often quite difficult to build applications on top of their data, and with Picolisp it would be all integrated into one single tool. But then I should be the one who implements that, and I made some attempts, but never had the time/energy/stamina/skills to bring it on. So this is just an idea I had for quite some time ... Cheers Thorsten pd schrieb am Mo., 22. Feb. 2021, 12:26: > > > El lun., 22 feb. 2021 9:31, Alexander Burger > escribió: > >> ... and immune to temporary hypes >> > > What a nice desire being rejected by history of humankind again and again > ;) > > Specially in computer science > >>
Re: Call native wrapper function with double argument
Hi Alex, thanks for your tips ... and patience! My lack of experience with C, Pointers and low level programming clearly shows in my questions, and most real world libraries of 'native' wrappers I find don't really implement complex C signatures, so I have to experiment myself. I'll try to digest your hints and do some more experimentation over the weekend. Luckily, If I manage to wrap one such C function, I can reuse that understanding for many others Cheers Thorsten Am Di., 24. Nov. 2020 um 07:50 Uhr schrieb Alexander Burger < a...@software-lab.de>: > On Mon, Nov 23, 2020 at 06:17:46PM +0100, Alexander Burger wrote: > > Something like '("Dx" (24 . 1.0) '(1.0 1.0 2.0 3.0)) could make sense, > if the C > > argument is "double dx[3];". > > oops > > (24 . 1.0) is of course not returning "double dx[3];", but a single double. > > Try (24 1.0 1.0 1.0) or better (24 (1.0 . 3)). > > ☺/ A!ex > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >
Re: Call native wrapper function with double argument
Hi Alex, one more 'native' question, this time a bit more complicated: libblas.so is on my machine, the C function "idamax_" is found,which is actually a C wrapper for Fortran Code. In the Fortran docs, the parameters are described exactly, see below. Since the Parameters of the C function are input/output Parameters, I try to define the input values in the CDDR, but obviously not correctly. How do I define an input array correctly (especially DX and INCX)? If I have in/out Parameters, how do I get the int return value too when the pil functions returns? hope these questions are not too messy ... cheers Thorsten PS when I understand how this works, I will use the input values for native as parameters for the pil wrapper, but for now I just write them inside of 'native'. *> \param[in] N 33 *> \verbatim 34 *> N is INTEGER 35 *> number of elements in input vector(s) 36 *> \endverbatim 37 *> 38 *> \param[in] DX 39 *> \verbatim 40 *> DX is DOUBLE PRECISION array, dimension ( 1 + ( N - 1 )*abs( INCX ) ) 41 *> \endverbatim 42 *> 43 *> \param[in] INCX 44 *> \verbatim 45 *> INCX is INTEGER 46 *> storage spacing between elements of DX 47 *> \endverbatim 48 * (symbols 'blas 'pico) (default *LibBlas "libblas.so") (de idamax () (use "N" "Dx" "Incx" (native `*LibBlas "idamax_" 'I '("N" (4 . 'I) 3) '("Dx" (8 . 1.0) '(1.0 1 2 3)) '("Incx" (4 . 'I) 0))(list "N" "Dx" "Incx") ) ) ## BLAS_extern int/* IDAMAX - return the index of the element with max abs value */ ## F77_NAME(idamax)(const int *n, const double *dx, const int *incx) # when INCX = 0 : (blas~idamax) -> ('NIL 0 'NIL) # when INCX = 1 segfault Am Di., 17. Nov. 2020 um 23:45 Uhr schrieb Thorsten Jolitz < tjol...@gmail.com>: > Hi Alex, > the wrappers with primitive arguments do work now when defined like this > with transient symbols: > > (de pgamma ("X" "Y" "Z" "I" "J") >(native `*LibRmath "pgamma" 1.0 (cons "X" 1.0) (cons "Y" 1.0) (cons > "Z" 1.0) "I" "J" ) ) >## double› pgamma(double, double, double, int, int); > > With your tips I could define wrappers for functions with pointer args too > > (de pnorm_both ("X" "I" "J") > (use "Y" "Z" > (native `*LibRmath "pnorm_both" NIL (cons "X" 1.0) '("Y" (8 . > 1.0)) '("Z" (8 . 1.0)) "I" "J" ) > (list "Y" "Z") ) ) >## void›pnorm_both(double, double *, double *, int, int);/* both > tails */ > > does work (scl 3): > : (rmath~pnorm_both 1.2 2 3) > -> (-122 -2162) > > now I only have to understand the meaning of some of these functions. > What I find irritating is that the pointer args are not used for input but > only as a kind of return values. > > Thanks for your help! > Cheers > Thorsten > > Am So., 15. Nov. 2020 um 22:55 Uhr schrieb Alexander Burger < > a...@software-lab.de>: > >> Hi Thorsten, >> >> hmm, this is not correct: >> >> > (de pnorm_both ("X" "Y" "Z" "I" "J") >> > (! native `*LibRmath "pnorm_both" 1.0 (cons "X" 1.0) '("Y" (1.0 . >> 4)) >> > '("Z" (1.0 . 4)) "I" "J" ) ) >> >> "Z" is an argument to the function, so it is bound to some evaluated >> value. >> >> But this value is ignored, because in >> >>'("Z" (1.0 . 4)) >> >> "Z" is a *return* value. Also, (1.0 . 4) makes no sense here. A structure >> argument is >> >>'(Var ( . > >> but 1.0 is no size (it is too big, something like 100) and 4 is no >> return >> spec. >> >> >> If you want to pass a buffer to receivea double (the double* in the C >> signature), you would do: >> >>(use MyDouble >> (native `*LibRmath "pnorm_both" 1.0 ... >> '(MyDouble (8 . 1.0)) ... ) >> ... do something with MyDouble ...) >> >> (8 . 1.0) allocates 8 bytes on the stack, passes the pointer to the C >> function, >> receives a double in this place, and stores it in the symbol MyDouble. >> >> ☺/ A!ex >> >> -- >> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >> >
Re: Call native wrapper function with double argument
Hi Alex, the wrappers with primitive arguments do work now when defined like this with transient symbols: (de pgamma ("X" "Y" "Z" "I" "J") (native `*LibRmath "pgamma" 1.0 (cons "X" 1.0) (cons "Y" 1.0) (cons "Z" 1.0) "I" "J" ) ) ## double› pgamma(double, double, double, int, int); With your tips I could define wrappers for functions with pointer args too (de pnorm_both ("X" "I" "J") (use "Y" "Z" (native `*LibRmath "pnorm_both" NIL (cons "X" 1.0) '("Y" (8 . 1.0)) '("Z" (8 . 1.0)) "I" "J" ) (list "Y" "Z") ) ) ## void›pnorm_both(double, double *, double *, int, int);/* both tails */ does work (scl 3): : (rmath~pnorm_both 1.2 2 3) -> (-122 -2162) now I only have to understand the meaning of some of these functions. What I find irritating is that the pointer args are not used for input but only as a kind of return values. Thanks for your help! Cheers Thorsten Am So., 15. Nov. 2020 um 22:55 Uhr schrieb Alexander Burger < a...@software-lab.de>: > Hi Thorsten, > > hmm, this is not correct: > > > (de pnorm_both ("X" "Y" "Z" "I" "J") > > (! native `*LibRmath "pnorm_both" 1.0 (cons "X" 1.0) '("Y" (1.0 . 4)) > > '("Z" (1.0 . 4)) "I" "J" ) ) > > "Z" is an argument to the function, so it is bound to some evaluated value. > > But this value is ignored, because in > >'("Z" (1.0 . 4)) > > "Z" is a *return* value. Also, (1.0 . 4) makes no sense here. A structure > argument is > >'(Var ( . > but 1.0 is no size (it is too big, something like 100) and 4 is no > return > spec. > > > If you want to pass a buffer to receivea double (the double* in the C > signature), you would do: > >(use MyDouble > (native `*LibRmath "pnorm_both" 1.0 ... > '(MyDouble (8 . 1.0)) ... ) > ... do something with MyDouble ...) > > (8 . 1.0) allocates 8 bytes on the stack, passes the pointer to the C > function, > receives a double in this place, and stores it in the symbol MyDouble. > > ☺/ A!ex > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >
Re: Call native wrapper function with double argument
Hi Alex, I actually do use a namespace, and there is not much going on wrt to assignments: >From line 8 on there are only some 100+ mostly trivial wrapper functions, see PS. I first thought it might have something to do with Picolisp Linebreaks "delta J", but I have seen the same issue now with an Y parameter name, not just J. With a definition like in PS 1, I would be on the safe side? When I use (bt) on the original signature specification, it looks like this: (native NIL "pwilcox" 1000 (cons X 1000) (cons Y 1000) (cons Z 1000) I "J") ! (bt) ("pwilcox" 2700 6200 2100 3 ..) X 2700 Y 6200 Z 2100 I 3 "J" 2 Cheers Thorsten PS 1 (de pnorm_both ("X" "Y" "Z" "I" "J") (! native `*LibRmath "pnorm_both" 1.0 (cons "X" 1.0) '("Y" (1.0 . 4)) '("Z" (1.0 . 4)) "I" "J" ) ) ## void›pnorm_both(double, double *, double *, int, int);/* both tails */ : (rmath~pnorm_both 2.1 3.2 4.1 3 2) (native "libRmath.so" "pnorm_both" NIL (cons "X" 1000) '("Y" (1000 . 4)) '("Z" (1000 . 4)) "I" "J") ! (bt) ("pnorm_both" 2100 3200 4100 3 ..) "X" 2100 "Y" 3200 "Z" 4100 "I" 3 "J" 2 PS 2 1 # libRmath.l - (native) PicoLisp bindings for Rmath 2 # copyright (C) 2020 Thorsten Jolitz 3 4 (symbols 'rmath 'pico) 5 6 (default *LibRmath "libRmath.so") 7 8 (de Rlog1p (X) 9 (native `*LibRmath "Rlog1p" 1.0 (cons X 1.0) ) ) 10 ## double Rlog1p(double); Am So., 15. Nov. 2020 um 18:50 Uhr schrieb Alexander Burger < a...@software-lab.de>: > Hi Thorsten, > > > But with my real wrapper functions, where ever I use J, as first or > second > > arg, its interpreted as a transient symbol > > So somewhere 'J' is bound to "J". > > > > But when I rename J to H in my real wrapper function, the problem is > gone: > > Right, so it is a binding issue. Think hard what values are exactly bound > to > which variables at runtime. Such things happen usually only in FEXPRs or > when > evaluable expressions are passed around through binding environments. > > > > So I think I know whats the problem here: its reading the function > > definitions from a library file vs defining the definition directly in > the > > repl. > > (load "libRmath.l") seems to have a problem with the char J used for a > > Is "libRmath.l" written by you? > > > > The easy solution is therefore to avoid J as parameter name ;-) > > But maybe I found a bug? > > I don't think it is a bug. But you must take care of the implications of > dynamic > binding, exwlained e.g. in: > >https://software-lab.de/doc/faq.html#problems > > Such things are best fixed with transient or private symbols, or even a > separate > namespace. > > ☺/ A!ex > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe > >
Re: Call native wrapper function with double argument
Hi Alex, this is strange indeed. I checked on Bash/Archlinux as well, same problem as Win Term / WSL2, so this is not about WSL or so. I can like you define a dummy wrapper, and debug it, and it looks fine: : (de foo (I J) (! native NIL NIL 1.0 I J)) -> foo : (foo 2 3) (native NIL NIL 1 I J) ! J -> 3 So here I can use J as argument name, and it works. But with my real wrapper functions, where ever I use J, as first or second arg, its interpreted as a transient symbol and is NIL, even if I create a fake wrapper without any real lib reference: : (rmath~exp_rand_fake2 3 2) (native NIL NIL 1 "J" B) ! J -> NIL But when I rename J to H in my real wrapper function, the problem is gone: : (rmath~pwilcox 1.2 2.1 3.2 3 2) (native "libRmath.so" "pwilcox" 1 (cons X 1) (cons Y 1) (cons Z 1) I H) ! H -> 2 So I think I know whats the problem here: its reading the function definitions from a library file vs defining the definition directly in the repl. (load "libRmath.l") seems to have a problem with the char J used for a paramter, and somehow converts it into a transient symbol. The easy solution is therefore to avoid J as parameter name ;-) But maybe I found a bug? Cheers Thorsten Am So., 15. Nov. 2020 um 09:01 Uhr schrieb Alexander Burger < a...@software-lab.de>: > Hi Thorsten, > > > (de pwilcox (X Y Z I J) > > ... > > : (rmath~pwilcox 2.7 6.20 5.4 1 3) > > (native "libRmath.so" "pwilcox" 1 (cons X 1) (cons Y 1) (cons Z 1) I "J") > > ... > > ! J > > -> NIL > > Why is that second Integer argument interpreted as transient symbol, and > > then NIL although the actual arg = 3? > > This is strange. I tried the same here, and get > >(native NIL "pwilcox" 100 (cons X 100) (cons Y 100) (cons Z > 100) I J) > > And I get 3 as expected for 'J'. > > Note the scaled integers! It seems your *Scl is zero. But this does not > explain > what you see. Are you sure you pasted exactly what you tested? > > > > In the docs I only find: > > "The number of fixpoint arguments is limited to six." > > but that looks irrelevant here. > > Yes, for pil64. For pil21 this no longer holds. There is no more limit on > the > number of float or double arguments. > > ☺/ A!ex > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >
Re: Call native wrapper function with double argument
Hi Alex, one more question: (de pwilcox (X Y Z I J) (! native `*LibRmath "pwilcox" 1.0 (cons X 1.0) (cons Y 1.0) (cons Z 1.0) I J ) ) ## double pwilcox(double, double, double, int, int); : (rmath~pwilcox 2.7 6.20 5.4 1 3) (native "libRmath.so" "pwilcox" 1 (cons X 1) (cons Y 1) (cons Z 1) I "J") ! J -> NIL ! I -> 1 ! -> -4 Why is that second Integer argument interpreted as transient symbol, and then NIL although the actual arg = 3? In the docs I only find: "The number of fixpoint arguments is limited to six." but that looks irrelevant here. So how do I specify a ## double pwilcox(double, double, double, int, int); signature correctly? Cheers Thorsten Am Fr., 13. Nov. 2020 um 17:15 Uhr schrieb Thorsten Jolitz < tjol...@gmail.com>: > Hi Alex, > yes that works with (cons X 1.0), I knew it was a trivial problem. > Thanks! > Cheers > Thorsten > > Am Fr., 13. Nov. 2020 um 08:00 Uhr schrieb Alexander Burger < > a...@software-lab.de>: > >> Hi Thorsten, >> >> welcome back! :) >> >> > I'm playing around with the native function again (after a long long >> time >> > ;-) and somehow I don't manage to call a native wrapper with double arg. >> >> > >> > Using rmath from R, random value from poisson distribution:^ >> > ## double› rpois(double); >> > ... >> > This works >> > : (native "libRmath.so" "rpois" 1.0 (2.567 . 1.0)) >> > ... >> > but this dumps >> > : (de rpois (X) (native "libRmath.so" "rpois" 1.0 (X . 1.0) ) ) >> > ... >> > When I debug it, X=3 when the function is called. >> >> The problem is (X . 1.0), it calls 'X' as a function. >> >> So this would work: >> >>: (de rpois (X) >> (native "libRmath.so" "rpois" 1.0 (cons X 1.0) ) ) >> >> ☺/ A!ex >> >> -- >> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >> >>
Re: Call native wrapper function with double argument
Hi Alex, yes that works with (cons X 1.0), I knew it was a trivial problem. Thanks! Cheers Thorsten Am Fr., 13. Nov. 2020 um 08:00 Uhr schrieb Alexander Burger < a...@software-lab.de>: > Hi Thorsten, > > welcome back! :) > > > I'm playing around with the native function again (after a long long time > > ;-) and somehow I don't manage to call a native wrapper with double arg
Call native wrapper function with double argument
Hello List, Hi Alex, I'm playing around with the native function again (after a long long time ;-) and somehow I don't manage to call a native wrapper with double arg. Using rmath from R, random value from poisson distribution:^ ## double› rpois(double); This works : (native "libRmath.so" "rpois" 1.0 (2.567 . 1.0)) -> 5 : (native "libRmath.so" "rpois" 1.0 (2.567 . 1.0)) -> 2 This works too: ## int› imax2(int, int); : (de imax2 (X) (native "libRmath.so" "imax2" 'I 3 6)) -> imax2 : (imax2 3 6) -> 6 but this dumps : (de rpois (X) (native "libRmath.so" "rpois" 1.0 (X . 1.0) ) ) -> rpois : (rpois 2.567) Segmentation fault When I debug it, X=3 when the function is called. So probably my function call is wrong? Cheers Thorsten
subscribe
Re: Vip without [N]curses
Alexander Burger writes: Hi Alex, >> (for termux I always have to adapt the first line in /bin/vip, >> i.e. replace /usr with termux $PREFIX, /data/data/com.termux/files/usr) > > This is no longer necessary if you install in Termux > >$ apt install termux-exec > > With that, hashbangs like #!/usr/bin/pil automagically work! :) > Most scripts now work on Linux and Termux without change. I do have that installed, but the for the library on that first line it does not work, I can leave the first (/usr/bin ...) as is, but have to change the second entry (/usr/lib ...), otherwise I get a library-not-found error. #!/usr/bin/picolisp /usr/lib/picolisp/lib.l >> I looked into vip.l and some vt100 docs, but I find it really hard to >> understand how e.g. "split window (qs)" is implemented with the vt100 >> escape sequences? >> Could you elaborate on this a bit? > > The windows are maintained by Vip directly and explicitly. Simply positioning > the cursor and writing stuff. Windows are just areas on the screen like > everything else. > > As you see in @lib/vip.l, it uses only one single escape sequence for all such > positionings: > >(de cup (Y X) > (prin "^[[" Y ";" X "H") ) > > The other escapes, like character attributes, line clearing, show/hide cursor > and switching between first and second screen are more or less just cosmetics. Ok, thanks, maybe I understand that somehow now. If you do a (horizontal) split, then 2 +Window objects refer to the same +Buffer object, so changes are synchronized. The split is realized by dividing the current window hight by 2, adjust the existing +Window object, and create a new one. Vip itself than draws the separating status line for each window (except the "mini buffer", in Emacs terminology). So its really just PicoLisp drawing on one terminal screen, not much vt100 "intelligence" involved. Thats cool ;-) -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Vip without [N]curses
Alexander Burger writes: Hi Alex, > It should be a problem only on the first bootstrap. After you > downloaded the *.s > files once and got a running system, it will self-build from that time on. I could fix this now, maybe a rather Archlinux specific problem. Fist I figured out, that java verson shows 7, but in the ArchLinux repos there are Open JDK/JRE 12 already. When I installed the newest version, the verbose output gave the decisive hint, problem was the default Java ENV. This works now, did not have to download anything. Thanks Thorsten PS (3/4) Installiere jre-openjdk (12) Default Java environment is already set to 'java-7-openjdk' See 'archlinux-java help' to change it => [tj@arch ~]$ archlinux-java help archlinux-java COMMAND: status List installed Java environments and enabled one get Return the short name of the Java environment set as default set Force as default unset Unset current default Java environment fix Fix an invalid/broken default Java environment configuration [tj@arch ~]$ sudo archlinux-java get java-7-openjdk [tj@arch ~]$ sudo archlinux-java set java-12-openjdk => [tj@arch picoLisp]$ (cd src64;make) [...] [tj@arch picoLisp]$ pil + : (version) 19.8.9 -> (19 8 9) : -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Vip without [N]curses
George Orais writes: Hi Geo, > I'm not sure but looking at those errors are coming from Java, so maybe > you can try the other two ways to build the 64bit: > > * Download one of the pre-generated "*.s" file packages > * Build a 32-bit version first, and use the resulting bin/picolisp to > generate the "*.s" files: I tried the same thing with the current stable version (19 6), same error, so it's not really a problem with the dev version. But I never ever had a problem with installing a new pil on this machine. If nobody else has this problem, seems to be a local (java) thing. Since new PicoLisp versions a coming quite frequently, I would prefer not to fall back to alternative build methods but rather fix my system so that the normal build works again. But thanks for your hints anyway. I googled this now, this seems to be a well known Java problem with versions of JRE and JDK which do not work together (the java class file was compiled with a newer Java version than the installed runtime Java). So not really a PicoLisp problem, sorry for the noise ... Cheers Thorsten PS [tj@arch bin]$ ls lisp picoLisp picoLisp-19.6.tgz PilBox pil-dev pil-old tmp waffles [tj@arch bin]$ cd picoLisp [tj@arch picoLisp]$ (cd src64/;make) /mkAsm x86-64 ".linux" .s Linux base "" ../lib/map version.l glob.l main.l gc.l apply.l flow.l sym.l subr.l big.l io.l db.l net.l err.l sys/x86-64.linux.code.l Exception in thread "main" java.lang.UnsupportedClassVersionError: PicoLisp : Unsupported major.minor version 52.0 at java.lang.ClassLoader.defineClass1(Native Method) [...] make: *** [Makefile:179: x86-64.linux.base.s] Fehler 1 [tj@arch picoLisp]$ java -version java version "1.7.0_171" OpenJDK Runtime Environment (IcedTea 2.6.13) (Arch Linux build 7.u171_2.6.13-1-x86_64) OpenJDK 64-Bit Server VM (build 24.171-b02, mixed mode) > > > BR, > Geo > On Sunday, 11 August 2019, 09:54:04 pm GMT+9, Thorsten Jolitz > wrote: > > Alexander Burger writes: > > Hi Alex, > >> more and more I got frustrated with all the quirks of Ncurses (as >> discussed here >> and in IRC), so I decided to abandon them, and implement Vip directly >> with ANSI >> escape sequences (VT-100). >> >> To my surprise this turned out quite easy, and the result is both >> smaller and >> simpler! >> >> I tested on Termux, Tmux, XTerm and Linux Console. If anybody is >> interested, it >> is in the rolling picoLisp.tgz release :) > > thats very interesting, ncurses seemed to be a real curse so to say ... > I have > - version (19 7 31) on Android/termux > - version (19 8 9) on Win10/wsl > now, both seem to have that change, and both could be installed and > work (for termux I always have to adapt the first line in /bin/vip, > i.e. replace /usr with termux $PREFIX, /data/data/com.termux/files/usr) > > But on my desktop ArchLinux machine with the newest PicoLisp dev > download I get a make error, see PS1. > > Cheers > Thorsten > > PS 0 > I looked into vip.l and some vt100 docs, but I find it really hard to > understand how e.g. "split window (qs)" is implemented with the vt100 > escape sequences? > Could you elaborate on this a bit? > > PS 1 > On an up-to-date ArchLinux today, with the freshly downloaded dev > version of PicoLisp: > > [tj@arch picoLisp]$ (cd src64/;make) > /mkAsm x86-64 ".linux" .s Linux base "" ../lib/map version.l glob.l > main.l gc.l apply.l flow.l sym.l subr.l big.l io.l db.l net.l err.l > sys/x86-64.linux.code.l > Exception in thread "main" java.lang.UnsupportedClassVersionError: > PicoLisp : Unsupported major.minor version 52.0 > at java.lang.ClassLoader.defineClass1(Native Method) > at java.lang.ClassLoader.defineClass(ClassLoader.java:803) > at > java.security.SecureClassLoader.defineClass > (SecureClassLoader.java:142) > at java.net.URLClassLoader.defineClass(URLClassLoader.java:442) > at java.net.URLClassLoader.access$100(URLClassLoader.java:64) > at java.net.URLClassLoader$1.run(URLClassLoader.java:354) > at java.net.URLClassLoader$1.run(URLClassLoader.java:348) > at java.security.AccessController.doPrivileged(Native Method) > at java.net.URLClassLoader.findClass(URLClassLoader.java:347) > at java.lang.ClassLoader.loadClass(ClassLoader.java:425) > at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:312) > at java.lang.ClassLoader.loadClass(ClassLoader.java:358) > at > sun.launcher.LauncherHelper.checkAndLoadMain > (LauncherHelper.java:482) > make: *** [Makefile:179: x86-64.linux.base.s] Fehler 1 > > PS 2 > [tj@arch picoLisp]$ lscpu > Architektur:x86_64 > CPU Operationsmodus:32-bit, 64-bit > > -- > cheers, > Thorsten -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Vip without [N]curses
Alexander Burger writes: Hi Alex, > more and more I got frustrated with all the quirks of Ncurses (as > discussed here > and in IRC), so I decided to abandon them, and implement Vip directly > with ANSI > escape sequences (VT-100). > > To my surprise this turned out quite easy, and the result is both > smaller and > simpler! > > I tested on Termux, Tmux, XTerm and Linux Console. If anybody is > interested, it > is in the rolling picoLisp.tgz release :) thats very interesting, ncurses seemed to be a real curse so to say ... I have - version (19 7 31) on Android/termux - version (19 8 9) on Win10/wsl now, both seem to have that change, and both could be installed and work (for termux I always have to adapt the first line in /bin/vip, i.e. replace /usr with termux $PREFIX, /data/data/com.termux/files/usr) But on my desktop ArchLinux machine with the newest PicoLisp dev download I get a make error, see PS1. Cheers Thorsten PS 0 I looked into vip.l and some vt100 docs, but I find it really hard to understand how e.g. "split window (qs)" is implemented with the vt100 escape sequences? Could you elaborate on this a bit? PS 1 On an up-to-date ArchLinux today, with the freshly downloaded dev version of PicoLisp: [tj@arch picoLisp]$ (cd src64/;make) /mkAsm x86-64 ".linux" .s Linux base "" ../lib/map version.l glob.l main.l gc.l apply.l flow.l sym.l subr.l big.l io.l db.l net.l err.l sys/x86-64.linux.code.l Exception in thread "main" java.lang.UnsupportedClassVersionError: PicoLisp : Unsupported major.minor version 52.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:803) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:442) at java.net.URLClassLoader.access$100(URLClassLoader.java:64) at java.net.URLClassLoader$1.run(URLClassLoader.java:354) at java.net.URLClassLoader$1.run(URLClassLoader.java:348) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:347) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:312) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482) make: *** [Makefile:179: x86-64.linux.base.s] Fehler 1 PS 2 [tj@arch picoLisp]$ lscpu Architektur: x86_64 CPU Operationsmodus: 32-bit, 64-bit -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Yet Another Emacs PicoLisp Mode - hybrid
Grant Shangreaux writes: Hello Grant, > I would be happy to make > a pull-request into the tj64 version if it is welcome, and Alexis I > would be interested in helping to improve your version as well > (especially since it is the one listed on MELPA). > > Would be glad to hear from Emacs users on the list, I know these threads > pop up time to time, i've been trying to catch up :) ! go ahead an send me a pull request, from what I read in the thread I conclude that its just merging tested code from another version into the one I maintain on github, and this merge is already tested by you (and others) so I can accept the PR without extra testing? BTW It would be nice to have even one more PicoLisp mode for Emacs! There is this new concept of LSP out there now (Language Server Protocol), with the basic idea that every language implements the server side once, and every editor implements the client side once (in a generic way). Then, a new editor mode for a language is just an adoption of the LSP client of that editior for that specific language. And every editor with an LSP client implementaton can easily offer a mode for a language that has its LSP server implementation. >From a PicoLisp point of view there are two pretty cool options here, I think: 1. implement a Picolisp LSP Server implementation, enabling all those editors out there to have their LSP PicoLisp modes (Emacs e.g. already has two competing LSP client implementations and several new or rewritten LSP major modes afaik) 2. implement a Vip LSP Client, thereby enabling language modes in Vip for all that (growing numbers) of languages with LSP server implemenations. This is from Microsoft, but not evil at all, rather seems like the future of editing modes. Maybe somebody finds this interesting too ... ;-) -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Setup for Emacs org-mode?
r...@tamos.net writes: Hi Rick, > Hi Lawrence, > > Welcome back to the list! > >> Anyone have the definitive setup they could share for picolisp on >> Emacs org-mode? > > AFAIK, there is no "definitive setup" in Emacs. > >> There seems to be two picolisp-modes > > Three is the count I have. > > 1. picolisp-mode bundled in the picolisp distro. >- N.B. hasn't been updated in years. > > 2. Thorsten/tj64 version >- https://github.com/tj64/picolisp-mode >- first commit dated Apr 2012 [...] Thanks for summing this up, I'm a bit rusty here and I did not change anything in the picolisp-mode repo for quite some time, but it worked when I left it, and sometime ago somebody complained loudly about ob-picolisp not working in org-mode, but I checked and answered (with a pretty extensive example) on the org-mode and picolisp mailing lists, and everything was still working fine, the problem was more a general misunderstanding about the working of org-babel. -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: PicoLisp on Windows WSL first tryout fails ...
Joe Bogner <joebog...@gmail.com> writes: Hey Joe, > > For WSL, you need to build picoLisp on a linux machine and then transfer > it down. You can follow the download/install instructions, but here is > generally what I did maybe I don't really understand what you mean by transfer down, but in my case (WSL with Suse) I just opened the Suse "App" and then installed picolisp the same way I do on a standalone Linux System, and it works just fine. BTW isn't WSL the best thing (produced by microsoft) ever since sliced bread? ;-) Now I have Linux with Tmux, Emacs and PicoLisp on my average Win10 Notebook (only Tmux needs a little hack to work) - as an official Windows App. I really like it ... > ON LINUX > 1. wget https://software-lab.de/picoLisp.tgz > 2. tar -zxvf picoLisp.tgz > 3. cd picoLisp/src > 4. make > 5 cd ../src64 > 6. make > > ON WINDOWS BASH > 1. wget https://software-lab.de/picoLisp.tgz > 2. tar -zvxf picoLisp.tgz > 3. cd picoLisp > 4. scp user@domain:/path/to/bin/picoLisp bin/picoLisp > > You should be able to then run ./pil > > The key here is to build on linux and then transfer down to your windows > bash install. I used SCP to do the transfer > > Hope this helps. If you do not have access to a linux machine, you may > want to try out vagrant on windows. I can help with that if you'd like > > Also, several of us are active on #picoLisp -- if you are unfamiliar > with irc you can try here: https://webchat.freenode.net/ > > NOTE: WSL has an issue with file locking with the picoLisp DB. I will > look into that next > > Joe > > On Tue, Apr 17, 2018 at 7:25 AM, Alexander Burger > <a...@software-lab.de> wrote: > > Hi Philipp, Arie, > > > pil is just a wrapper around picolisp, it loads a few libraries > etc as > > Yes, but > > > standard, but it relies on the intepreter being at > /usr/bin/picolisp, > > This is not completely correct. > > Note that there are two 'pil's in the distribution: One in bin/ > > #!/usr/bin/picolisp /usr/lib/picolisp/lib.l > (load "@lib/misc.l" "@lib/btree.l" "@lib/db.l" "@lib/pilog.l") > > which indeed calls #!/usr/bin/picolisp, but this is not meant to be > called here. > It is intended to be copied to - or linked from - /usr/bin. > > The other 'pil' looks different: > > exec ${0%/*}/bin/picolisp ${0%/*}/lib.l @ext.l "$@" > > and it is the main workhorse. It can be called locally > > $ ./pil + > > or with a relative or absolute path from anywhere > > $ /foo/bar/pil + > > and will always load everything from its local environment. > > ♪♫ Alex > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe > > -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Emacs mode can't run pil
Lawrence Bottorff <borg...@gmail.com> writes: Hi Lawrence, [just for the protocoll, I send you the identical answer on the org-mode mailing list already]. > I'm looking at picolisp -- and wondering how it works, or better, why it > doesn't really work work with babel. First problem, I couldn't get any > form of picolisp to work in Emacs -- until I stopped starting Emacs with > [...] > I don't mean to complain or sound negative, but picolisp as is can't > really be included as a babel language, can it? Maybe it worked once, > but doesn't now? sometimes the bug actually sits in front of the computer, as we all know ;-) Apparently you are not aware of the 'session' concept of org source blocks (please refer to the org manual). This is nothing specific to ob-picolisp, but holds for all ob languages that do allow for sessions: , | * Picolisp scr-block test | | #+BEGIN_SRC picolisp :session pil1 | (setq X1 (+ 3 4)) | #+END_SRC | | #+results: | : 7 | | | #+BEGIN_SRC picolisp :session pil1 | (setq X2 (+ X1 1)) | #+END_SRC | | #+results: | : 8 | | | #+BEGIN_SRC picolisp :session pil1 | (de foo1 (X) (+ X 2)) | #+END_SRC | | #+results: | : foo1 | | #+BEGIN_SRC picolisp :session pil1 :results raw | (setq X3 (foo1 8)) | #+END_SRC | | #+results: | 10 ` And, with a session, you do have a related interactive repl buffer in Emacs called "pil1", thats reflects all evaluations of the code blocks in the org file, and allows for user input just like the PicoLisp repl: , | (setq X1 (+ 3 4)) | 'org-babel-picolisp-eoe | : -> 7 | : -> org-babel-picolisp-eoe | : (setq X2 (+ X1 1)) | 'org-babel-picolisp-eoe | -> 8 | : -> org-babel-picolisp-eoe | : (de foo1 (X) (+ X 2)) | 'org-babel-picolisp-eoe | -> foo1 | : -> org-babel-picolisp-eoe | : (setq X3 (foo1 8)) | 'org-babel-picolisp-eoe | -> 10 | : -> org-babel-picolisp-eoe | : ` Hope that helps -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Chinese input causes mess in the REPL
Danilo Kordic <danilo.kor...@gmail.com> writes: > GNU Emacs can be used as a line editor. Execute elisp expression > ``(term "/absolute/path/to/pil")'' then activate `term-line-mode' with > ``C-C C-j''. > > Is this of any help? How much does it count :) ? Cool! I did not know this ... -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Which emacs mode to use?
Tim Johnson <t...@akwebsoft.com> writes: Hi Tim, > I note that my emacs (25.1.1 on ubuntu) will install and provide > 'picolisp-mode as an elpa package. I'm not the author of this mode, but I somehow took over maintainership (more or less) and did some contributions to the mode (in my github repo tj64: https://github.com/tj64/picolisp-mode). But I have no idea who added this as an elpa package (elpa or melpa?) > In addition, my installation of picolisp has at : > /usr/share/emacs/site-lisp/picolisp > tsm.el, inferior-picolisp.el, and picolisp.el (providing mode > 'picolisp) > > I'd welcome opinions as to which I should use. I think only diffing the various versions can help to find out, which one is the newest. IIRC Alex simply added new versions of the mode to the picolisp distribution, when I sent them to him once in a while. But for a long time, I did not touch these libraries anymore. -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Method undefined - why?
Thorsten Jolitz <tjol...@gmail.com> writes: > so somehow my understanding of read macros is false here: > > (class ~(any (pack '+ ClsNm))) Grrr ... of course when reading (de foo (ClsNm) ...) ClsNm is still NIL, so the outcome of the above is (class +) which can't work. Sorry for the noise. -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Method undefined - why?
Thorsten Jolitz <tjol...@gmail.com> writes: > Alexander Burger <a...@software-lab.de> writes: Ok, this works ;-) : (de foo2 (ClsNm MethNm) (class +Bar) (dm plus> (X) (+ 1 X))) -> foo2 : (foo2) -> plus> : (setq B (new '(+Bar))) -> $177641167640474 : (plus> B 3) -> 4 ')) so somehow my understanding of read macros is false here: (class ~(any (pack '+ ClsNm))) > Hi Alex, > >>> : (de +Test >>>(T (Hi) (=: hi Hi)) >>>(hi> (Nm) (or (text (: hi) Nm) "Dear Sir or Madam,")) ) >>> -> +Test >> >> .. while this is half of the lunch ... >> >>> : (hi> Foo "Alex") >>> !? (hi> Foo "Alex") >>> hi> -- Undefined # => WHY? >> >> .. it is better (as Joe Bogner suggested) to use 'dm'. >> >> The reason is that 'dm' does a little more: It also defines the symbol >> 'hi>' to >> behave as a sender of messages to objects, equivalent to >> >>: (setq hi> meth) >>-> 22951574276 >> >> With that, the following works >> >>: (hi> Foo "Thorsten") > > Ok, I see. > > But, in a source file it's obvious how to use (class) and (dm) > > (class 1 ...) > (dm ...) > (dm ...) > > (class 2 ...) > (dm ...) > (dm ...) > > The reader seems to remember which class was defined last, and > associates the following methods to that class. > > How to use (class) and (dm) in a program is not that obvious for me: > > :(de foo (ClsNm MethNm) (class ~(any (pack '+ ClsNm))) (dm ~(any (pack > MethNm ">") (X) (+ 1 X > -> foo > : (foo "Bar" "plus") > !? (val (setq *Class (car Lst))) > 270136 -- Variable expected > ' > > Would you rather write the classical definitions to a file and then load > that? -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Method undefined - why?
Alexander Burger <a...@software-lab.de> writes: Hi Alex, >> : (de +Test >>(T (Hi) (=: hi Hi)) >>(hi> (Nm) (or (text (: hi) Nm) "Dear Sir or Madam,")) ) >> -> +Test > > .. while this is half of the lunch ... > >> : (hi> Foo "Alex") >> !? (hi> Foo "Alex") >> hi> -- Undefined # => WHY? > > .. it is better (as Joe Bogner suggested) to use 'dm'. > > The reason is that 'dm' does a little more: It also defines the symbol > 'hi>' to > behave as a sender of messages to objects, equivalent to > >: (setq hi> meth) >-> 22951574276 > > With that, the following works > >: (hi> Foo "Thorsten") Ok, I see. But, in a source file it's obvious how to use (class) and (dm) (class 1 ...) (dm ...) (dm ...) (class 2 ...) (dm ...) (dm ...) The reader seems to remember which class was defined last, and associates the following methods to that class. How to use (class) and (dm) in a program is not that obvious for me: :(de foo (ClsNm MethNm) (class ~(any (pack '+ ClsNm))) (dm ~(any (pack MethNm ">") (X) (+ 1 X -> foo : (foo "Bar" "plus") !? (val (setq *Class (car Lst))) 270136 -- Variable expected ' Would you rather write the classical definitions to a file and then load that? -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Method undefined - why?
Joe Bogner <joebog...@gmail.com> writes: HiJoe, > Hi Thorsen, what about using (class) and (dm) instead? > > joebo@joebo:~/dev/picoLisp$ pil + > : (class +Test) > -> +Test > : (dm T (Hi) (=: hi Hi)) > -> T > : (dm hi> (Nm) (or (text (: hi) Nm) "Dear Sir or Madam,")) > -> hi> > : (setq Foo (new '(+Test) "Hi @1")) > -> $177463554467256 > : (hi> Foo "Alex") > -> "Hi Alex" yes, thats the more classical way, but I want to dynamically build the class definition, so using (de) seems easier. And I find it a bit strange that everything else works and looks good, but not the method call in the code below. This works > : (methods Foo) > -> ((T . +Test) (hi> . +Test)) but this not > : (hi> Foo "Alex") > !? (hi> Foo "Alex") > hi> -- Undefined ? Should it work? Does it work for others, but not for me? This would be my questions ... ;-) > On Thu, Mar 23, 2017 at 3:17 PM, Thorsten Jolitz > <tjol...@gmail.com> wrote: > > Hi List, > > playing around a bit wih Pil classes/object, here is something I > don't > understand: > > #+BEGIN_SRC picolisp > > : (de +Test > (T (Hi) (=: hi Hi)) > (hi> (Nm) (or (text (: hi) Nm) "Dear Sir or Madam,")) ) > -> +Test > > : (setq Foo (new '(+Test) "Hi @1")) > -> $176777024346263 > > : (hi> Foo "Alex") > !? (hi> Foo "Alex") > hi> -- Undefined # => WHY? > ? > > : (getl Foo) > -> (("Hi @1" . hi)) > > : (can 'hi>) > -> ((hi> . +Test)) > > : (type Foo) > -> (+Test) > > : (show Foo) > $176777024346263 (+Test) > hi "Hi @1" > -> $176777024346263 > > : (methods Foo) > -> ((T . +Test) (hi> . +Test)) > > #+END_SRC > > Is that strange, or is the problem sitting in front of the computer? > > -- > cheers, > Thorsten > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe > > -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Method undefined - why?
Hi List, playing around a bit wih Pil classes/object, here is something I don't understand: #+BEGIN_SRC picolisp : (de +Test (T (Hi) (=: hi Hi)) (hi> (Nm) (or (text (: hi) Nm) "Dear Sir or Madam,")) ) -> +Test : (setq Foo (new '(+Test) "Hi @1")) -> $176777024346263 : (hi> Foo "Alex") !? (hi> Foo "Alex") hi> -- Undefined # => WHY? ? : (getl Foo) -> (("Hi @1" . hi)) : (can 'hi>) -> ((hi> . +Test)) : (type Foo) -> (+Test) : (show Foo) $176777024346263 (+Test) hi "Hi @1" -> $176777024346263 : (methods Foo) -> ((T . +Test) (hi> . +Test)) #+END_SRC Is that strange, or is the problem sitting in front of the computer? -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: JavaCode with static class methods
Alexander Burger <a...@software-lab.de> writes: Hi Joe, Hi Alex, >> I'm experimenting a bit with the 'java' function, and the StringBuilder >> ... >> (java "java.lang.Math" 'sqrt 4) > > It needs a different call: >: (java "java.lang.Math" 'sqrt (-6 . 64.0)) thanks for the hints, so actually I was pretty close, just ignorant about the peculiarities of those numeric arguments. -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
JavaCode with static class methods
Hi List, I'm experimenting a bit with the 'java' function, and the StringBuilder and GregorianCalendar example from the JavaCode Wiki entry work fine, but I wonder how to use a constructorless class like e.g. java.lang.Math with its static class methods? #+NAME: JavaCode - none of these work #+BEGIN_SRC picolisp (java "java.lang.Math" 'sqrt 4) (java java.lang.Math 'sqrt 4) (java 'java.lang.Math 'sqrt 4) (setq M (java "java.lang.Math" T)) // returns null, no constructor #+END_SRC Thanks for any hints. -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: PicoLisp as Femto extension language
Thorsten Jolitz <tjol...@gmail.com> writes: Hi List, [funny enough, in GNUS Ricks posts to this thread don't show up for me, while I can see them in the www.mail-archive.com, so I follow up to my own post instead of his.] My original idea was to compile Femto as shared library, create FFI wrapper libraries for PicoLisp, and have buffers instead of only a single line to edit and evaluate PicoLisp code. A bit naive probably. Replacing Femto-lisp with PicoLisp as extension language seems to be the way to go, but is over my head I'm afraid. I thought, with the core editor functions already defined in C (using the gap buffer concept), it would be just about wrapping these basic functions (and data structures) in PicoLisp and one could start to write cool interactive editor features based on this Core libraries, just like in Emacs (Lisp). But solving the fundamental communication problem between the two systems is something else ... Thanks for the anwsers, Rick. > Hi List, > recently I found out about Femto, a minimal Emacs implementation in less > than 2k lines of C (including ncurses, though): > > , > | git clone https://github.com/hughbarney/femto.git > ` > > , > | Femto is an extended version of Atto Emacs. > | > | In Defining Atto as the lowest functional Emacs I have had to > | consider the essential feature set that makes Emacs, 'Emacs'. [...] > ` > > , > | Goals of Femto Emacs > | > | * To extend Atto Emacs with filename completion, dired, buffer > | menu and the ability to run a shell command. > | * Provide a rich level of functionality in the smallest amount of > | code > | * Femto Emacs will eventually have it own lisp extension > | languauge. > | * Be easy to understand without extensive study (to encourage > | further experimentation). > ` > > There is already a project underway using FemTo-Lisp as extension > language > > , > | git clone https://github.com/FemtoEmacs/Femto-Emacs.git > ` > > but I thought this would be a perfect use case for an 'AW-style' FFI > library making use of 'native'. Then, PicoLisp could have its own > (Window/Buffer)-Editor, not just the LineEditor, with all the core > Editor-Functions just wrappers around Femto's C-functions. > > But lacking C skills have me stuck in the very beginning: how to turn > this C application into a shared library for 'native', does it even > make sense? > > I guess I should: > > 1. create a shared library for all .c files in the repo except main.c > 2. create the application (main.o) linking the shared library? > > But then, the shared library by itself does not make much sense, it > would need the running C Application to do some useful work (?) > > So the queston seems rather how to embed PicoLisp in this C Application, > and make Femto extensible in PicoLisp (like Emacs is extensible in Emacs > Lisp) by having FFI wrappers for all core editor functions? > > The > > , > | /home/tj/gitclone/Femto-Emacs/femtolisp > ` > > subdirectory makes the general "Lisp integration task" look rather > complicated, but maybe there is (like so often) a really simple solution > with PicoLisp? -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
PicoLisp as Femto extension language
Hi List, recently I found out about Femto, a minimal Emacs implementation in less than 2k lines of C (including ncurses, though): , | git clone https://github.com/hughbarney/femto.git ` , | Femto is an extended version of Atto Emacs. | | In Defining Atto as the lowest functional Emacs I have had to | consider the essential feature set that makes Emacs, 'Emacs'. [...] ` , | Goals of Femto Emacs | | * To extend Atto Emacs with filename completion, dired, buffer | menu and the ability to run a shell command. | * Provide a rich level of functionality in the smallest amount of | code | * Femto Emacs will eventually have it own lisp extension | languauge. | * Be easy to understand without extensive study (to encourage | further experimentation). ` There is already a project underway using FemTo-Lisp as extension language , | git clone https://github.com/FemtoEmacs/Femto-Emacs.git ` but I thought this would be a perfect use case for an 'AW-style' FFI library making use of 'native'. Then, PicoLisp could have its own (Window/Buffer)-Editor, not just the LineEditor, with all the core Editor-Functions just wrappers around Femto's C-functions. But lacking C skills have me stuck in the very beginning: how to turn this C application into a shared library for 'native', does it even make sense? I guess I should: 1. create a shared library for all .c files in the repo except main.c 2. create the application (main.o) linking the shared library? But then, the shared library by itself does not make much sense, it would need the running C Application to do some useful work (?) So the queston seems rather how to embed PicoLisp in this C Application, and make Femto extensible in PicoLisp (like Emacs is extensible in Emacs Lisp) by having FFI wrappers for all core editor functions? The , | /home/tj/gitclone/Femto-Emacs/femtolisp ` subdirectory makes the general "Lisp integration task" look rather complicated, but maybe there is (like so often) a really simple solution with PicoLisp? -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
flinuxpicolisp
Hi List, I just discovered a nice article by Joe Bogner about FLINUX as an alternative was to run PicoLisp under Windows (http://picolisp.com/wiki/? flinuxpicolisp). I tried it out, and succeded to a certain point but not further. When installing necessary tools like wget, make etc. I often hit the "could not change the root directory (No such file or directory)" error, but it appeared after the last installation step, and after an C-c installation appeared successful. But when trying to compile the 64bit version, Java is missing, and when I try to install it, I get the above error in the middle of the installation process that thus cannot finish. There is some info about this (https://github.com/wishstudio/flinux/issues/63), but I could not really find a solution. Did somebody on the list succeed with the Flinux install of the 64bit version on Windows? Any hints would be welcome. Cheers Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Extending the wiki markup syntax
Alexander Burger <a...@software-lab.de> writes: Hi Alex, Hi List, thanks for the cool tractatus and the as always very interesting views about wiki markup. I don't know if I should mention it, because it's in a raw state and I don't have much time to polish it now, but as you know there does exist already an alternative wiki syntax: (Emacs) Org-mode. Note that Org-mode is not just dumb wiki syntax like Markdown or so, under the syntax surface is another very powerful and featurerich Lisp application that can do amazing things, see , | orgmode.org ` The gitrepo of my iOrg project can be found here: , | https://github.com/tj64/iorg ` Its the PicoLisp Wiki, but calls the Org-mode exporter to render the (Org-mode) markup, instead of using the PicoLisp render function from Alex. This works! There is even support for emacs-w3m mode for editing the wiki pages, i.e. instead of opening a small text buffer for editing an textarea (the usual behaviour), emacs-w3m opens an Org-mode buffer for editing iOrg wiki pages. The changes from the Org-mode buffer are then committed to the web application (the wiki) just like any other html form that is edited with emacs-w3m. I haven't touched it for a long time, but this part of the project worked very well IIRC. Thank to Alex for all his help back then! The project was more ambitious, there is a pretty far developed web interface for org-mode trees/nodes, that almost worked, but then I had to move to other shores and could not finish it. But I'm still interested in this project, because Emacs Org-mode is the most powerful static website/document generator anyone can think of, and using Emacs Org-mode as syntax for the PicoLisp wiki would combine my two favorite pieces of software. Under the hood, an Org-mode document is a nested (Emacs Lisp) list, which is of course very convenient from a PicoLisp point of view. Unfortunately, the Org-mode parser (org-element.el) makes use of some unique Emacs Lisp features (circular lists, text properties ...) that complicated my life tremendously when trying to make the two apps talk to each other. So if extending the PicoLisp markup is on the agenda right now - why not try a revival of the iOrg project? I would be happy about feedback and contributions. > True, but again it holds what I said about too much abstraction. I've > shot myself into the food this way many times. That made me really curios - was it vegetables, meat, or rather seafood? ;-) -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Emacs REPL not "full-featured"?
Lawrence Bottorff <borg...@gmail.com> writes: > I've got a REPL started in Emacs (called from ELPA version of picolisp > major mode with run-picolisp), but I'm noticing it doesn't have such > features as more, edit, what, etc. Starting picolisp from the command > line with pil is however "full-featured". What am I missing here? IIRC even when all libraries are loaded, there remain a few things that don't work (correctly), e.g. (doc 'pp) 1. Emacs REPL (prints unreadable results): , | : (doc 'pp) | (doc 'pp) | 1,03kbloadedinstead,itshouldbearangeofnumberswhicharetriedinturn.Whenvarisgiven,itisboundtotheportnumber.:(port0'A)#Allocatefreeport->4:A->1034#Got1034:(port(4000.4008)'A)#Tryoneoftheseports->5:A->4002(pp | 'sym) -> sym (pp 'sym 'cls) -> sym (pp '(sym . cls)) -> | symPretty-printsthefunctionormethoddefinitionofsym.Theoutputformatwouldregeneratethatsamedefinitionwhenreadandexecuted.Seealsopretty,debugandvi.:(pp'tab)(detab(Lst.@)(forNLst(letV(next)≪ | ↑ ↓ Viewing libgpm: zero screen dimension, assuming 80x25. ` 2. pil REPL (opens W3M on the console): , | (pp 'sym) -> sym | (pp 'sym 'cls) -> sym | (pp '(sym . cls)) -> sym | Pretty-prints the function or method definition of sym. The | output format would regenerate that same definition when read | and executed. See also pretty, debug and vi. | | : (pp 'tab) | (de tab (Lst . @) |(for N Lst | (let V (next) | (and (gt0 N) (space (- N (length V | (prin V) | (and | (lt0 N) | (space (- 0 N (length V))) ) ) ) |(prinl) ) | -> tab ` But I guess one could configure Emacs to show the 'doc' results in emacs-w3m or eww instead of the *picolisp* buffer itself. -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: org mode picolisp?
"O.Hamann" <o.ham...@gmx.net> writes: Hi All, as the author of of ob-picolisp I should make some smart comment now, but I'm afraid I cannot add much to the discussion, the former answers explained it all very well. As the answers show, the library still seems to work fine, so the original problem looks not really ob-picolisp specific but rather like a problem with using Org code blocks correctly. Here is a link to the relevant manual section: , | http://orgmode.org/manual/Working-With-Source-Code.html ` and here one to the ob-picolisp doc: , | http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-picolisp.html ` > I'm not really sure about namespaces, so I can't compare. > Manual explains :session this way: > == > The :session header argument starts a (possibly named) session for an > interpreted language where the interpreter’s state is preserved. All > code blocks sharing the same name are exectuted by the same > interpreter process. By default, a session is not started. > == > (fetched from: http://orgmode.org/manual/session.html) This is not related to PicoLisp namespaces but rather to the communication between Emacs and PicoLisp. - without session, Emacs/Org-mode starts a new PicoLisp instance for every query, so e.g. setting X to 3 in one code block and then adding 2 to X in the next code block won't work, since the newly started instance for the second call knows nothing about X. - with session, Emacs starts one PicoLisp instance and keeps it alive, so that state is preserved. The call from the second code block goes to the same PicoLisp instance where symbol X was set to 3 before, so the state of X is preserved and can be used for (+ X 2) e.g. -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Single File Function Reference
<andr...@itship.ch> writes: Hi List, > There are two books about picolisp available, one containing also the > reference [...] Thought I'm not absolutely sure that the reference in > there is on the newest current state, maybe someone else can > confirm/deny this. The function reference reflects the current state at the time of publishing of the books. I guess that whats in there is still 99% valid, and only a few tiny changes and corrections have be done. But some new functions may be missing in the ref. One day there should be a 2nd edition of these books, since so many exciting things have been and are happening in the PicoLisp universe that should and could be added to the book. E.g.: - PicoLisp on Hardware - PicoLisp and Java - Emacs and PicoLisp - PicoLisp Ports - etc, etc ... Don't have the time for it though. Maybe in the future ... or somebody else takes over the task? -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Let and Glue
Rick Hanson cryptor...@gmail.com writes: Hi Rick, Here is a problem (again!) with using a pil backquote expression, where the user, like you or me, is stuck on CL-unquote thinking. Let's call g again, but now we switch the places of the dates and times. In this case, we might expect the answer now to be No; however, the answer will remain Yes. : (g Is $S1$ before $S2$? The answer is `(if (and (= $D2$ $D1$) (= $T2$ $T1$) ) Yes No ) ) - Is \1999-09-09 20:12:05\ before \2000-03-04 18:03:03\? The answer is \Yes\ Why? Because when the backquote expression gets resolved by the reader, the symbols $D1$, $D2$, $T1$, and $T2$ are not bound to any values (i.e. will evaluate to NIL). And since (= NIL NIL) evals to T, g will always see Yes as its last argument. Sorry. That means you have to come up with another way to eval code in your DSL (i.e the stuff under g). I hope this make sense. This is what Alex has been trying to tell us all along. (I only now just realized this; so you can see how far I've come along: not much.) thanks for your improvements of my rather crude function and for the final hint that using (date) in the examples was a rather bad idea since (date) works with NIL args too, it just gives different results. This backquote/comma mechanism in Emacs Lisp seemed so natural to me I never really thought about the way it works. So I should rather think about function calls then read syntax. But maybe not in public, I don't want to drive more people off the mailing list ;-) However, I will use your factorized code as starting point for new investigations, thanks again! -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Let and Glue
Alexander Burger a...@software-lab.de writes: Hi Alex, sorry for being thick as a brick ... Well, 'bind' is the evaluating version of 'let'. It could be used to implement the outher functions. I'll check that out. What you probably mean is something different. It is a different way of interpreting the arguments to a function. It has nothing to do with how the symbols are bound, and nothing with the reader: (de g Args (glue (mapcar '((X) (if (pair X) (val (car X)) X) ) Args ) ) ) (setq Temp 33) (g Current \temperature\ in Berlin is (Temp) °Celsius \(its really hot!\) ) - Current \temperature\ in Berlin is 33 °Celsius (its really hot!) This comes pretty close to what I was looking for, thanks. The only drawback is that normal parens (and double quotes) are very common in text so a lot of escaping would be necessary. Something like this: (g Current temperature in Berlin is {Temp} \{°Celsius\} (its really hot!) ) resulting in: - Current \temperature\ in Berlin is 33 {°Celsius} (its really hot!) would be much more comfortable as syntax, but harder to implement. -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Let and Glue
Thorsten Jolitz tjol...@gmail.com writes: Hi Alex, When I quote the reference: , | A single backquote character ` will cause the reader to evaluate | the following expression, and return the result. | | : '(a `(+ 1 2 3) z) | - (a 6 z) ` it looks to me as if the difference between PicoLisp and others (like Emacs Lisp) must be rather in the 'let than in the read macros, since the combination quote/backquote in PicoLisp is equivalent to the combination backquote/comma in other Lisps, and works the same, except inside let bindings: PicoLisp: , | $ pil + | : (let X (+ 2 3) '(3 4 `X)) | - (3 4 NIL) | : '(3 4 `(+ 2 3)) | - (3 4 5) ` vs Emacs Lisp: , | (let ((X (+ 2 3))) `(3 4 ,X)) | - (3 4 5) | | `(3 4 ,(+ 2 3)) | - (3 4 5) ` How would the above behavior inside let bindings be achieved in PicoLisp? Thinking about it it seems that Read Macros are equivalent, but the readers work differently: - PicoLisp :: read without eval, except when encountering a read macro - Emacs Lisp :: read without eval, except in special situations (local assignments, read macros, ???) So assignments inside 'let are treated special too, like implicit read macros, and evaluated during reading. Not only that I have a concrete use case for that behavior right now (wrt to let and job), I find that very useful in general. The only advantage of the current PicoLisp behavior I can see is speed of reading (because of less assignments in the process), but there might be others of course. Would it be conveivable to have 'evaluating versions' of some of the binding environments in PicoLisp too? , | let, let?, bind, recur, with, for, job, use ... ` Here a possible use case: Imagine these two functions are given: , | (de g Txt |(glue Txt) ) | | (de getCurrTemp (Url) # should retrieve temperature from url | 33 ) ` than even a non-programmer could specify a dynamic report in PicoLisp by writing: , | (job | CurrTemp (getCurrTemp /path/to/current/temp/in/berlin) | | (g Current temperature in Berlin is `CurrTemp °Celsius) ) ` i.e. by using PicoLisp as a kind of smart/dynamic markup language instead of defining and calling functions like a programmer. Of course this could easily be done by 'normal' programming, but I'm looking for something like the above ... -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Let and Glue
Alexander Burger a...@software-lab.de writes: Hi Alex, uhh ... bad timing from my side, writing more confused question while you are actually answering them at the same time... Either : (let X (+ 2 3) (list 3 4 X)) # I would prefer a simple 'list' - (3 4 5) or : (let X (+ 2 3) (fill (3 4 X) 'X)) # Rick tried 'fill' too - (3 4 5) or : (let @X (+ 2 3) (fill (3 4 @X))) - (3 4 5) or whatever function you like to build the list. Note that also in CL and Emacs the backquote function builds a list at *runtime*, just like 'list' or 'fill' do. I have to try fill, and think more about the whole issue, but the last version with @X looks pretty close to what I'm looking for. Again, thanks for the explanations (and patience)! -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Let and Glue
Thorsten Jolitz tjol...@gmail.com writes: Hi List, This comes pretty close to what I was looking for, thanks. The only drawback is that normal parens (and double quotes) are very common in text so a lot of escaping would be necessary. Something like this: (g Current temperature in Berlin is {Temp} \{°Celsius\} (its really hot!) ) resulting in: - Current \temperature\ in Berlin is 33 {°Celsius} (its really hot!) would be much more comfortable as syntax, but harder to implement. I implemented something close to my goal, with $xyz$ syntax for arguments to be evaluated: , | (de f Args | (mapcar | '((Arg) |(if (atom Arg) | (let (ChopArgs (chop Arg) | ArgsTail (tail 2 ChopArgs) | PunctChars (chop .,;:?!\'_-{[]} ) | ArgLst NIL | Punct NIL ) | (ifn (and | (= (car ChopArgs) $) | (or |(= (last ChopArgs) $) |(and | (= (car ArgsTail) $) | (member (last ArgsTail) PunctChars) | (setq Punct (last ArgsTail)) | (setq ChopArgs (head -1 ChopArgs) | ) ) ) ) | Arg | (pack |(val | (intern | (pack | (tail -1 (head -1 ChopArgs)) ) ) ) |Punct ) ) ) | (f Arg) ) ) # use recur/recurse instead? | Args ) ) ` using it returns an almost perfect list result: , | (setq |D1 (date 1999 09 09) |D2 (date 2000 03 04) |T1 (time 20 12 05) |T2 (time 18 03 03) |S1 (stamp D1 T1) |S2 (stamp D2 T2) ) | | (f Is $S1$ before $S2$? |The answer is |`(if (and |(= $D1$ $D2$) |(= $T1$ $T2$) ) |Yes |No ) ) | | | - (Is 1999-09-09 20:12:05 before 2000-03-04 18:03:03? The answer is Yes) ` only that 2000-03-04 18:03:03? should rather be 2000-03-04 18:03:03? I did not yet make it to write a function g in the spirit of: , | (de g Args | (glue (f Args)) ) # does not work ` that then returns a single string: , | Is \1999-09-09 20:12:05\ before \2000-03-04 18:03:03\? The answer is \Yes\ ` -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Let and Glue
Alexander Burger a...@software-lab.de writes: Hi Alex, I wonder how I can use local variable X inside of the 'glue' argument list: , | : (let X (+ 3 4) X) | - 7 | | : (let X (+ 3 4) (glue '(Number X `(- 4 9 | - Number X -5 | | : (let X (+ 3 4) (glue '(Number `X `(- 4 9 | - Number -5 ` X does not seem defined in the last expression although its surrounded by (let X (+ 3 4) ...). Hmm, read-macros seem indeed a lot misunderstood. NEVER use a read-macro to insert values which are defined at *run*time! As the name says, they are evaulated at *read* time! You could do this: : (let X (+ 3 4) (glue (list Number X `(- 4 9 (the second read-macro is OK, as the (- 4 9) may be evaluated at read-time) Ah, I see, thanks. I think the (working) second read-macro fooled me a bit, and I did not have separation of read- and runtime very clear. Well, nice that, as always with PicoLisp, there is an easy way to make it work ;-) -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Let and Glue
Rick Hanson cryptor...@gmail.com writes: Yeah, sorry. I had this on the mind -- a different animal altogether. $ sbcl * (let ((X (+ 3 4))) `(hello ,X ,(- X 9))) (HELLO 7 -2) Maybe I was confused by Emacs Lisp a bit too: , | (let ((x (+ 3 4)) | (y (+ 5 6))) | `(+ 5 x ,y)) | | - (+ 5 x 11) ` Thanks, Alex, for taking the time and writing a very nice explanation. I believe I understand it, but I will re-read and ponder it more. 1+ Many thanks for that in detail explanation, its actually a bit confusing especially when one is used to other Lisps too. When I quote the reference: , | A single backquote character ` will cause the reader to evaluate | the following expression, and return the result. | | : '(a `(+ 1 2 3) z) | - (a 6 z) | | A tilde character ~ inside a list will cause the reader to evaluate | the following expression, and (destructively) splice the result into | the list. | | : '(a b c ~(list 'd 'e 'f) g h i) | - (a b c d e f g h i) ` it looks to me as if the difference between PicoLisp and others (like Emacs Lisp) must be rather in the 'let than in the read macros, since the combination quote/backquote in PicoLisp is equivalent to the combination backquote/comma in other Lisps, and works the same, except inside let bindings: PicoLisp: , | $ pil + | : (let X (+ 2 3) '(3 4 `X)) | - (3 4 NIL) | : '(3 4 `(+ 2 3)) | - (3 4 5) ` vs Emacs Lisp: , | (let ((X (+ 2 3))) `(3 4 ,X)) | - (3 4 5) | | `(3 4 ,(+ 2 3)) | - (3 4 5) ` How would the above behavior inside let bindings be achieved in PicoLisp? -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Let and Glue
Rick Hanson cryptor...@gmail.com writes: Hi Rick, Reading your other post I was wondering how it worked for you and thought it must be because of debug mode, and well ... correctly guessed ;-) Hi Thorsten! Yes. :) And btw thanks for picolisp-mode. Please count me as a happy user. Oh, you have to thanks Guillermo R. Palavecino in the first place, since he wrote it: , | ;; picolisp-mode: Major mode to edit picoLisp. | ;; Version: 1.3 | | ;;; Copyright (c) 2009, Guillermo R. Palavecino | ;;; Copyright (c) 2011, 2012 Thorsten Jolitz ` I just became the (rather inactive) maintainer a few years ago and did some enhancements later on, expecially to inferior-picolisp.el. -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Open Sound Control
Robert Herman rpjher...@gmail.com writes: Hi Rob, I have come the long way round to PicoLisp, and I have been tinkering with livecoding (audio/video, not just programming) for fun. I started with fluxus: www.pawfal.org/fluxus/ It is a great environment where you code and 3D objects show behind your code, and you can drive their parameters from an audio feed or file. It was written in a scheme which is now Racket. I am not a fan of clojure, so I only tried overtone, which is a Clojure wrapper for the Supercollider sound server. They also copied Shadertoy with their 'Shadertone' which allows for the graphics part of the livecoding of music and graphics. What I see in the livecoding scene is the combination of rather complex programming with rather simplistic music - relentless techno beats ;-) I would like it the other way around. I personally like Extempore, but I couldn't get it built on my Windows machine, the OS X install had some issues with Jack and timing, and my Linux distro had a few issues too. All in all, it is very complete and complex, but too much fuss for my skills. http://extempore.moso.com.au/ If it takes days to make it run it looses attraction ... I have been sticking with learning PicoLisp, and I would like to somehow get it to work with Grace (a single cross-platform executable, that you program music pieces in a Scheme or simplified Scheme called Sal). http://commonmusic.sourceforge.net/ Grace or CM lacks a video creation component or library. I was hoping to hook into the CM libraries with PicoLisp, and then use Alex's z3d.l library to do graphics in PicoLisp. I am not near enough of a programmer to do so, only aware that it can be done (I think?). Livecoding video and audio in a Lisp! Pure heaven...maybe CEPL in PicoLisp??? https://www.youtube.com/watch?v=I0kWZP9L9Kc What would be the minimalistic setup? A midi cmdline tool or a C shared library that can be called from PicoLisp? Or would Supercollider be the easiest thing to work with, now that the OSC Protocol is implemented in PicoLIsp? Have fun! Rob On Thu, Jul 30, 2015 at 1:26 PM, Thorsten Jolitz tjol...@gmail.com wrote: Erik Gustafson erik.d.gustaf...@gmail.com writes: Hi Erik, https://github.com/erdg/picolisp-osc If interested, more info about OSC can be found here: opensoundcontrol.org/introduction-osc opensoundcontrol.org/spec-1_0 I find the combination of sound picolisp very interesting, are you aware of SoundCollider and the Clojure Libraries Overtone and Leipzig (both on Github)? There are interesting videos on Youtube about making music with emacs/vim and clojure: , | 1. | Functional Composition - Chris Ford - YouTube | | www.youtube.com/watch?v=Mfsnlbd-4xQ8. Jan. 2013 - 39 Min. | ► - Hochgeladen von ClojureTV Music theory is one of the | 39:21 most naturally elegant and functional domains. It's a | perfect fit for ... | | 2. | Creating music with Clojure and Overtone - YouTube | | www.youtube.com/watch?v=RYZeQ6t_5SA23. Juli 2014 - 71 Min. | ► - Hochgeladen von Manchester Geek Nights Chris Ford shows | 70:50 how to make music with Clojure, starting with the basic | building block of ... ` And I noticed that you have another music related picolisp lib on github: , | 1. erdg/picolisp-aubio · GitHub | | https://github.com/erdg/picolisp-aubio ` I'm not so much interested in the technical (syntheziser) stuff but rather in the musical side of it, and I have a few questions: 1. How much would it take not to rewrite Overtone in PicoLisp but rather to define a handfull of musical instruments that can easily be used in a music creating PicoLisp program? I'm thinking of a basic rhythm section with a few rhythm instruments (maybe just a snare drum for creating swing and a Cajon and maybe Handclaps for creating Flamenco/World Music beats) and, most important, a (acoustic contra) bass. With some musical instruments available, one could take some inspiration from Overtone and Leipzig and maybe a python program like , | 1. MMA Home Page - Mellowood | | www.mellowood.ca/mma/ | | + Im Cache | + Ä hnliche Seiten | 13 Jun 2015 ... MMA-Musical MIDI Accompaniment is an | accompaniment generator. ... MMA's templating track system | puts you in control of your music. ` and create background tracks for practising in PicoLisp. I think that would be fun ;-) 2. How to use (picolisp-)aubio to get a score of what I play? Reading about Aubio, it seems that I could plugin my guitar into my computer, record some stuff
Re: Open Sound Control
detection algorithm |-u --pitch-unit select pitch output unit |-l --pitch-tolerance select pitch tolerance |-s --silence select silence threshold |-j --jack use Jack |-v --verbose be verbose |-h --help display this message ` but using e.g. aubiotrack , | $ aubiotrack -vf -i /home/docs/music/sound/jimmy\ raney\ | duets\ mp3/converted/mp3/Track01.ogg -o junk/track01 | = | -rw-r--r-- 1 tj tj 1675308 30. Jul 07:15 track01 ` I get a binary file with some rhythmical clicks in it, and using aubionotes I get something that doesn't look like a complete midi score of a tune: , | $ aubionotes -vf -i /home/docs/music/sound/jimmy\ raney\ | duets\ mp3/converted/mp3/Track01.ogg | using source: /home/docs/music/sound/jimmy raney duets | mp3/converted/mp3/Track01.ogg at 22050Hz | onset method: default, buffer_size: 512, hop_size: 256, threshold: | 0.00 | pitch method: default, buffer_size: 2048, hop_size: 256, tolerance: | 0.00 | 0.429569 | 54.00 0.4295690.603719 | 47.00 0.6037190.777869 | 44.00 0.7778691.102948 | 107.00 1.1029481.172608 | 106.00 1.1726081.462857 | 81.00 1.4628571.741497 | 108.00 1.7414974.260862 | 64.00 4.2608626.919547 | 64.00 6.91954710.019410 | 64.00 10.019410 12.875464 | 64.00 12.875464 15.406440 | 64.00 15.406440 18.111565 | 64.00 18.111565 20.816689 | 64.00 20.816689 23.498594 | 64.00 23.498594 37.558277 | read 37.97s (837248 samples in 3271 blocks of 256) from | /home/docs/music/sound/jimmy raney duets mp3/converted/mp3/Track01.ogg | at 22050Hz | 37.976234 ` So I'm kind of stuck here, a few hints would be very welcome. TIA PS Very exciting things going on in the PicoLisp universe right now! -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Property lists and keywords in PicoLisp
Alexander Burger a...@software-lab.de writes: Hi Alex, In PicoLisp, a property list cannot be seen separated from a symbol. After all, these are properties OF a symbol. It is just an implementation detail that they are a list internally. not in PicoLisp, but e.g. in Emacs Lisp there are standalone plists like the above, and functions like plist-{get|put|member} to work with them OK, but then I feel that they use the wrong term in Emacs Lisp. A property is something an item *has*, i.e. a symbol in Lisp. A stand-alone list of key-value pairs is traditionally called an association list. yes, the naming is confusing Yes, named parameters is my use-case, e.g. wrapping an R function like plot() with *many* named parameters, most of them with decent default values and thus omitted in function calls, in PicoLisp glue code. What exactly would be your goal? there are actually two goals: 1. create functions with named parameters Yes. So the approaches shown in the rosetta code tasks help? they did, after some experimenting 2. use flat lists like (:a b :c d) like alists ((:a . b) (:b . c)) You can use a flat list with 'memq' (instead of 'assoc' or 'asoq'): : (cdr (asoq 'b '((a . 1) (b . 2) (c . 3 - 2 : (cadr (memq 'b '(a 1 b 2 c 3))) - 2 ok, I see, so no need for more syntax. Thanks! -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Property lists and keywords in PicoLisp
Alexander Burger a...@software-lab.de writes: Hi Alex, using flat property lists with keywords like , | (:a b :c d) ` as data (not as a symbol's property list) is pretty common in e.g. Emacs Lisp and elsewhere. In Clojure the keywords even work like functions AFAIK I feel that I don't completely understand the question. In PicoLisp, a property list cannot be seen separated from a symbol. After all, these are properties OF a symbol. It is just an implementation detail that they are a list internally. not in PicoLisp, but e.g. in Emacs Lisp there are standalone plists like the above, and functions like plist-{get|put|member} to work with them (additional to 'get' and 'put' for symbol's plists). A stand-alone list of key-value pairs is an association list, as used with 'assoc' or 'asoq'. These 'stand-alone' property lists are pretty useful for function keyword arguments too, e.g. , | (defun foo (keys a b c (d . 5) e (f . g)) ...) ` There were some rosetta tasks in that like. I don't remember exactly if they address the same problem, but you may look at the Named parameters and Optional parameters tasks. Is this similar? Yes, named parameters is my use-case, e.g. wrapping an R function like plot() with *many* named parameters, most of them with decent default values and thus omitted in function calls, in PicoLisp glue code. What exactly would be your goal? there are actually two goals: 1. create functions with named parameters 2. use flat lists like (:a b :c d) like alists ((:a . b) (:b . c)) Both could be solved when (let L ...) in the following code would work: #+BEGIN_SRC picolisp : (let (:a 'b :c 'd :e 'f) :c) - d : (de foo L (let L :c)) - foo : (foo :a 'b :c 'd :e 'f) - NIL #+END_SRC I tried (let `L ...), (let (L) ...) and quite a lot of other combinations, but always get NIL or an error. -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Property lists and keywords in PicoLisp
Hi List, using flat property lists with keywords like , | (:a b :c d) ` as data (not as a symbol's property list) is pretty common in e.g. Emacs Lisp and elsewhere. In Clojure the keywords even work like functions AFAIK , | (:a Lst) - b ` These 'stand-alone' property lists are pretty useful for function keyword arguments too, e.g. , | (defun foo (keys a b c (d . 5) e (f . g)) ...) ` called like , | (foo :a 3 :d 4) ` I wonder if this would make sense in PicoLisp? Or is it easily emulated with existing functionality? Selecting values by key works of cause for nested symbol property-lists, but requires some manual list processing for flat lists with key/val pairs - or am I missing something? -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Strange PicoLisp site
Hi List, have you seen this website: , | http://www.picolisp.org/ ` Its a nice looking website, but I cannot see no connection to PicoLisp whatsover. Or does 'picolisp' have other no technical meanings to native English speakers? Even the camel case they use is the same as in PicoLisp, maybe Alex should sue them for copyrights violations ... ;-) -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Strange PicoLisp site
Jakob Eriksson ja...@aurorasystems.eu writes: someone registered that domain for PicoLisp, then did not renew the fee. When it was expired, the domain was snatched (like most expired domains are) by one of these companies which do nothing else but buy expired domains and resell them. The boilerplate text is just random junk to keep the page in google's index, to keep the value of the domain up a tiny little bit. I see ... but I must say that the 'random junk' looks pretty good, with a different title like 'PoetsClub' or so it would make a nice webpage. On October 27, 2014 at 9:49 AM Thorsten Jolitz tjol...@gmail.com wrote: Hi List, have you seen this website: , | http://www.picolisp.org/ ` Its a nice looking website, but I cannot see no connection to PicoLisp whatsover. Or does 'picolisp' have other no technical meanings to native English speakers? Even the camel case they use is the same as in PicoLisp, maybe Alex should sue them for copyrights violations ... ;-) -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Strange PicoLisp site
Alexander Burger a...@software-lab.de writes: Hi Alex, I think the above site is evil. so the message to take home is that evilness might come along with a pretty attractive appearance ... -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: The many uses of PilMCU
Christophe Gragnic christophegrag...@gmail.com writes: Hi Christophe, This thread is meant to collect ideas about PilMCU. At least mine (because I need to clean them up a bit) and ideas of other PicoLispers (out of curiosity). Maybe some items will look more like questions like «is it even possible?»! that last sentence describes the situation very well for people who have not been in the 'embedded world' so far (like me) - they can let their imagination (about PilMCU) flow, but most likely some seasoned embedded programmer will bring them back-to-earth soon. For me the fascination about the PilMCU chip lies in the fact that, even if it might be slower or more expensive than available mass products, I can program it in PicoLisp. For others this might be a huge advantage over doing embedded programming in other environments (which they already know), for me it would allow me to try out embedded programming without having to learn all the usual related stuff, I would simply skip the painfull part and directly go to the fun part, so to say. The problem is that I don't know exactly how that fun part would look like in the end? Whats the state-of-the-art in robotics e.g.? How difficult would it be to use the PilMCU chip as the brain of an otherwise fully functional roboter(-tool-kit) - if at all possible? What about (connecting) smart home devices etc? All my ideas are application oriented, i.e. I imagine an interesting use of a chip that is programmed in PicoLisp, but these ideas can be turned down easily by saying this would be cheaper faster when simply running 64bit PicoLisp on a regular mass-product chip. So I think this thread is a good idea, and hope it helps me to make up my mind about realistic possibilities of PilMUC. -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Programming environment for PilMCU
George Orais gpor...@yahoo.com writes: Hi George, The pilMCU is the PicoLisp interpreter itself :) To interact with it, as of the moment we will use UART and use a PC as terminal. But later we plan to add PS/2 and VGA as the means to inter act with the hardware interpreter, i hope this answer your inquiry? Thanks! Yes, thank you! This stuff is exciting, but a bit new for me too ... On Monday, September 22, 2014 5:29 PM, Thorsten Jolitz tjol...@gmail.com wrote: Alexander Burger a...@software-lab.de writes: Hi Alex, Assuming PilMCU hardware exists and someone wants to use or program it, how would that look like? Where would one type the commands to manage the file system (whats the PilCMU terminal/console?), how would one interact with the PicoLisp REPL? You saw the copy/pasted session in my first post? That's exactly how you interact with it. yes, but I wondered what would be the device the PicoLisp REPL runs on in this case. We have two I/O ports defined as TTY in- and output. On the real hardware you connect a terminal(program). ok The SSD images contain a database, with a simple file system implemented in external symbols. These images are generated with a normal PicoLisp running on a standard PC, and then transferred t o the SSDs. ok I made the images so far by copying normal *.l files from standard PicoLisp to an init/ directory, and edited the files so that they were the way we need them for PilMCU. thanks for the info! -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: PicoLisp roots
jerome moliere jer...@javaxpert.com writes: Thanks for your quick reply... Is there a guide explaining major differences between Common Lisp PicoLisp ? I guess, reading your answer , that there 's no just a few syntactic differences between the 2 dialects ... I can read between the lines some philosophical major differences , right? What are the most difficult tasks , hot topics to be aware of when porting a software from CL to PicoLisp ? You might want to have a look at rosettacode.org, there are hundreds of tasks with solutions for both, PicoLisp and CL, so you have a perfect comparison. OTOH, although people told me that they have only the parenthesis in common, I always felt that writing Emacs Lisp and writing PicoLisp has the same enjoyable (dynamic) feeling, and I think Emacs Lisp was mostly influenced by MacLisp too, not by CL. -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Announce: PicoLisp in Hardware (PilMCU)
Alexander Burger a...@software-lab.de writes: Hi Alex (and George), we are proud to announce PilMCU, the Lisp Machine on a Chip! :) though not really a hardware/low-level guy, I think this sounds pretty exiting! How shall we proceed? We need investors (or crowdfunding) to polish, manufacture and distribute the real thing. I suggest to proceed in 2 steps: 1. make me a team member 2. repeat the {Microsoft|Apple}-Story ;-) We imagine something in the line of an Embedded Lisp Machine or a Lisp Machine Kit. Perhaps for home brewing, educational institutions and/or robotics research? Is anybody interested -- or knows people who are? I think I have VC-Companies and Robotics-Research-Faculties in my neighborhood, so once you have a business-idea based on PilMCU's USPs, I could try to make first contacts if that helps. Not sure what would be a realistic business idea, but maybe start by figuring out where the real money is nowadays (energy sector, automotive sector, mobile-phones etc) and then think about a possible niche to fill. Makes things much easier when potential clients drown in profits ;) If you find out e.g. how an Embedded Lisp Machine can be really useful for the car industry, we will all have PicoLisp jobs pretty soon! -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Announce: PicoLisp in Hardware (PilMCU)
Loyall, David david.loy...@nebraska.gov writes: The Internet would like to run this locally. Would you post the verilog source and build files? Or a link to a repository? I think this has the potential to make a very nice and successfull kickstarter project, so why not try to build a business idea around it instead of just giving away the verilog source and build files? -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Announce: PicoLisp in Hardware (PilMCU)
Loyall, David david.loy...@nebraska.gov writes: From: Thorsten Jolitz Loyall, David writes: The Internet would like to run this locally. Would you post the verilog source and build files? Or a link to a repository? I think this has the potential to make a very nice and successfull kickstarter project, so why not try to build a business idea around it instead of just giving away the verilog source and build files? It's a Lisp machine. It probably shouldn't be born crippled (with closed design). :) I'm sure its technical design is not crippled at all. It still needs additional development, right Geo and Alex? Many hands make light work. With 'many hands' involved we would not have most amazing PicoLisp but rather a kind of 'small common lisp', thats for sure ... Have you seen https://news.ycombinator.com/item?id=8340283 ? Folks are looking for the source already. Of course they are, but what will folks give in return? You can still make money on open source hardware. In fact, that's a new trend. https://www.google.com/search?q=open+hardware Open-source software has been pretty much a one-way business for Alex so far - he creates the software and gives a lot of assistence to (new) users, but how many of them go on and press the 'donate' button on the website? It would be only fair (and very beneficial for the PicoLisp project) if there would be donations in both directions, and PilMCU looks pretty interesting wrt this goal. -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Announce: PicoLisp in Hardware (PilMCU)
Christophe Gragnic christophegrag...@gmail.com writes: On Fri, Sep 19, 2014 at 10:53 PM, Loyall, David david.loy...@nebraska.gov wrote: If you sell a FPGA configured to be an open source Lisp CPU, I'll buy a few Someone on Hacker News: «where's the kickstarter page? I want a few of those.» I'd buy a few too. Thats the idea, I would say: buy the chips and support the project. Give them time to prepare a nice kickstarter project. Enjoy the opportunity to support a wonderful free software project to become not only a technical but an economic success too. You ask them to give away their most important 'capital' to the public before even starting the business. Not a good advice, really ... -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: (index 'any 'lst) implementation
Alexander Burger a...@software-lab.de writes: Hi Alex, I see that the index function evaluates the entire lst before searching for a match. Wouldn’t it be more efficient to evaluate the elements of lst one by one, testing the result for a match, and only proceed with evaluation of the next element if a match was not found? Is there a specific reason why you didn’t implement it that way? What you describe here is call lazy evaluation. While some languages support this, PicoLisp (like most other Lisps) doesn't. Think about what this would mean: The function 'list' must know somehow that it should stop, because some function up in the call history doesn't need the whole list. And even if it knew that, can it know that some side effects (like your 'prinl' above) may be omitted? The fundamental rule of Lisp function calls (a function recursively evaluates its arguments before it starts to run) is broken here. Funny how views differ - in the Clojure world lazy evaluation seems to be a big feature ... OTOH, Paul Graham writes 150pages about the beauty and power of macros in 'On Lisp', what made me think that macros are the ultimate thing in programming, only to read later that 'macros are cludge' in the PicoLisp docs ;) -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: try picolisp
Christophe Gragnic christophegrag...@gmail.com writes: On Mon, Sep 1, 2014 at 10:02 PM, Thorsten Jolitz tjol...@gmail.com wrote: could you elaborate on this a bit? Sorry, I cannot give you better info that what is in the ref: http://www.tcl.tk/man/tcl8.6/TclCmd/interp.htm#M4 thx for the link! -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: try picolisp
Christophe Gragnic christophegrag...@gmail.com writes: Hi Christophe, On Mon, Sep 1, 2014 at 5:52 AM, Tomas Hlavaty Or simply call something that crashes PicoLisp, e.g. […] Here comes the power of embedded interpreters, which PicoLisp does not have. could you elaborate on this a bit? -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: try picolisp
Alexander Burger a...@software-lab.de writes: Hi Alex, Is it hard to implement minimalist version of minipicolisp in browser ? Like http://tryclj.com/ ? In addition to the proposed solutions involving JavaScript versions of PicoLisp: Perhaps not many people are aware that standard PicoLisp comes with a REPL in the browser GUI since many years. [...] just tried it out, its neat! Imagine the interactive PicoLisp web tutorials that could be written if there would actually be a safe PicoLisp interpreter as proposed - thats a nice idea. Or would it suffice to define the tutorial functions and start a server that only allows these functions and nothing else? -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe