beneroth changed the topic of #picolisp to: PicoLisp language | The scalpel of software development | Channel Log: https://libera.irclog.whitequark.org/picolisp | Check www.picolisp.com for more information
emacsomancer has quit [Read error: Connection reset by peer]
emacsomancer has joined #picolisp
emacsomancer has quit [Read error: Connection reset by peer]
emacsomancer has joined #picolisp
emacsomancer has quit [Read error: Connection reset by peer]
emacsomancer has joined #picolisp
hunar has joined #picolisp
<hunar> Hello Everyone :D I'm opening this at work, so one message might be a few hours after another :/ .. I have more questions :D
<Regenaxer> Hi hunar! No problem
<hunar> That day you mentioned ge0 .. why is it not called >=0 there are similar names =0, why the odd name
<Regenaxer> true :)
<Regenaxer> ah, I remember
<Regenaxer> (=0 x) is (= 0 x)
<hunar> We should also have >0 <0 >=0 <=0 :D
<Regenaxer> Forget: (=0 x) is (= 0 x)
<Regenaxer> I wanted to say (>=0 x) is *not* (>= 0 x)
<Regenaxer> that is the reason
<Regenaxer> the order of the arguments
<Regenaxer> In Forth it works, 3 0>
<Regenaxer> but in Lisp (0> 3) or (>0 3) looks wrong
<Regenaxer> for (=0 x) it is OK
<hunar> I see
<hunar> :)
<Regenaxer> (= 0 x) is (= x 0)
<Regenaxer> But I see you have the same spirit :)
<hunar> Yeah, now it makes sense :D
<Regenaxer> You are working on Saturdays too?
<hunar> In my country, only Friday is the free day :|
<Regenaxer> Ah, yes, I remember
<hunar> But in universities both friday and saturday is
<hunar> Next question I read some of https://picolisp.com/wiki/?interfacing along with other references on native calls .. at that webPage there is Java, is that java the normal picolisp or ErsatzLisp, i mean there isn't this file in the latest pil21 code (load "@java/lib.l")
<Regenaxer> The above article is perhaps a bit outdated, but I think it refers to normal pil, not ersatz
<Regenaxer> "@java/" does not exist any longer in pil21
<Regenaxer> But PilBox inherited it
<hunar> Why is the reason for removing it
<hunar> What is*
<Regenaxer> I think it is not useful in a normal (non-Android) environment
<hunar> If somebody needed it, is it easy to return it?
<Regenaxer> I think it is still in the old tarballs
<Regenaxer> But outdated. Perhaps better backport from PilBox?
<Regenaxer> Do you see a use case?
<hunar> I don't actually like java :) i was just curious
<Regenaxer> hehe, I hate it
<hunar> Its extremely verbose
<Regenaxer> But true, sometimes cannot be avoided like in Android
<hunar> yeah, Unfortunately
<hunar> Ok, what about the examples :D like this https://picolisp.com/wiki/?guiscripting i could find the app folder here https://github.com/picolisp/picolisp but not the latest update, along with lib/scrape.l
<Regenaxer> Right, lib/scrape.l ...
<Regenaxer> Is also not (yet?) ported to pil21
<Regenaxer> s/ported to/included in/
<Regenaxer> I think nobody used it
<Regenaxer> I did only in one single project
<Regenaxer> Scripting the GUI
<Regenaxer> for unit tests
<Regenaxer> But I found it too tedious to use
<hunar> Oooo so pil21 is a separate thing :/ I thought picolisp is updated gradually
<hunar> thats why there are two repos in https://github.com/picolisp/picolisp/tree/dev/lib, picolisp and pil21
<Regenaxer> The focus is now on pil21, and I don't want to support all old versions
<hunar> Understandable :D
<Regenaxer> Some things which were in the distro in pil64 are now separate
<Regenaxer> or examples like https://software-lab.de/openGl.tgz
<Regenaxer> hmm, it gets confusing
<hunar> I find it hard to find those :/ Is there a list of all of them? Usually I find a projects github and see an examples folder for code, and the releases for tarballs
<Regenaxer> No list I'm afraid
<Regenaxer> Should be worth a wiki article
<Regenaxer> The problem is that it is not clear if anybody (and if so, how many) really care about this old stuff
<Regenaxer> I did not get much feedback about such details
<hunar> But if I want to learn, I will need examples :(
<Regenaxer> true
<hunar> Next question , while loading native libraries, the documentation says that the first call loads the library and the next calls do not reload and just use the previous one. So how can I reload a library? I don't know if others had this issue, I was experimenting with native and I was constantly editing the code&compiling while pil was still open
<Regenaxer> The transient symbol in native keeps only the *handle* to the library. I think if the lib changes (is recompilled) it will use the new one
<Regenaxer> But anyway you can just reload the pil source containing the native calls
<Regenaxer> this will reset the transient
<hunar> To be honest I always re-ran pil and didn't check if it reloads or not, I trusted the instructions .. I'll try now :D
<Regenaxer> good :)
<Regenaxer> I also most often just restart the whole app from bash history. It is the easiest
<Regenaxer> and fast anyway
hunar has quit [Quit: Client closed]
hunar has joined #picolisp
<hunar> Ooo, It actually reloads , no need to restart pil REPL
<Regenaxer> Good to know
<Regenaxer> You recompiled a lib?
<hunar> Yes, just a small c program with a function saying hello
<Regenaxer> ok
<hunar> Final question :D I can use pil REPL and also use vip to edit more easily .. I can write a file and run it with pil .. BUT can I open a file in Vip and run parts of it? like Emacs's SLIME for CL
<Regenaxer> You can eval the current expression with ^E
<Regenaxer> or increase the command window and re-execute lines with <enter>
<Regenaxer> Also, you can suspend Vip with qz
<Regenaxer> and continue with : (v)
<Regenaxer> Vip command line has the rule that if there is a space after the colon, it is taken as a Lisp expression
<Regenaxer> e.g.
<Regenaxer> :w
<Regenaxer> is an editor command, "write"
<Regenaxer> but
<Regenaxer> : (symbols)
<Regenaxer> is a Lisp expression
<razzy> hunar: there are examples of picolisp on rosettacode. i had issues with last one in pil21. I consider some of them possibly outdated, still good for learning.
<beneroth> hi all
<beneroth> welcome hunar :)
<Regenaxer> Hi beneroth!
<beneroth> hi Regenaxer :)
<razzy> Good day i wish to all! :]
<Regenaxer> Hi razzy!
razzy has quit [Ping timeout: 250 seconds]
Svjatoslav has quit [Quit: ZNC - https://znc.in]
Svjatoslav has joined #picolisp
razzy has joined #picolisp
<hunar> Cool :) ^E worked, but I don't know how to [increase the command window]
<hunar> razzy it's on my todo list :D
<Regenaxer> With '-' key you decrease a window, and with '+' you increase the size
<hunar> Oooo, that worked .. the best resource on vip i found was this http://www.langreiter.com/misc/picolisp/tut.html .. but i was ctrl-f ing for window
<Regenaxer> this tutorial is also outdated ;)
<Regenaxer> The current version is in the distro
<hunar> :( Soo many outdated resources
<Regenaxer> :(
<Regenaxer> a bag if fleas
<hunar> That's where a big community is useful
<Regenaxer> indeed
<hunar> I read 'PicoLisp Works' book in about 5 hours, It is also a bit outdated, I think I have the whole picture of Pil now, and I will start the doing actual coding :D
<Regenaxer> Great!
<hunar> One more thing Regenaxer, when using PilBox the chess example always freezes at some point during my turn when I move a piece, It shows a graphical glitch (the piece icon repeaded) and nothing responds.. Is it only me?
<hunar> repeated*
<Regenaxer> Not sure, I had this some time ago too, but I did not see it a long time
<Regenaxer> I don't remember well, but thought I did some fix for that. Perhaps not (?)
<hunar> I (at most) moved 3 times in the best casae
<hunar> case*
<Regenaxer> oh
<Regenaxer> I can't reproduce it here any more, just tried
<Regenaxer> Does it also happen in Setup?
<hunar> It sometimes doesn't even load all the board at the beginning
<Regenaxer> Never seen such effect
<Regenaxer> In Setup mode I can move pieces wildly
<Regenaxer> seems to work fine
<hunar> Setup movement is fine and doesn't freeze, but I'll still have afew graphical glitches
<hunar> How to share a screenshot in IRC?
<Regenaxer> Link to some external source
<Regenaxer> You say "freezes". It is not that the programd"thinks" about the next move, right?
<Regenaxer> In level 5 it takes quite a while
<hunar> I thought about it and tried 1 but same thing happens
<Regenaxer> ok
<razzy> hunar: big community also make lots of mistakes and create lots of bloat/fog. just big community is no help in matter.
<Regenaxer> As I said, I observed sush freezing of pieces in between two fields
<Regenaxer> But the program went on fine
<Regenaxer> and I don't remember if I fixed it
<Regenaxer> It would be interesting to know if this happens in the Web GUI too, e.g. if you start it as:
<Regenaxer> $ PORT=8086 ./pil chess/main.l -'chess~main "DE" "de"' -go +
<Regenaxer> The first effect I never saw
<Regenaxer> The second and third I did
<Regenaxer> Hard to debug probably :(
<hunar> Sorry to ask, but where can I download the chess file :/ you told me that night but I web.libera.chat doesn't show the link that i used to search old chats
<Regenaxer> No problem. https://software-lab.de/chess.tgz
<hunar> Thanks :)
<Regenaxer> What if you go by browser to https://picolisp.com/chess ?
<Regenaxer> Does such freezing also happen?
razzy has quit [Ping timeout: 250 seconds]
<hunar> The localhost Web GUI is empty, only the control buttons are visible
<Regenaxer> hmm
razzy has joined #picolisp
<hunar> The website has no problems
<Regenaxer> Which control buttons do you mean in local version?
<hunar> I mean the boards and the pieces aren't there
<Regenaxer> Like all images are missing
<Regenaxer> they should be all in the above chess.tgz
<Regenaxer> and an error would occur if they were not
<hunar> Suddenly I no longer can open localhost:8086, i restarted pil multiple times
<Regenaxer> On a desktop? Or Termux?
<Regenaxer> Does it say that the port is in use?
<hunar> Desktop
<hunar> It doesn't say anything
<Regenaxer> So the browser complains?
<razzy> Regenaxer: pil21, 21.8.26, if i do (char 300) it will print. (printsp (char 300)) will print. (while ...print... char 0 - 300 ) will stop printing after (char 128)
<razzy> is it good behaviour?
<Regenaxer> Should work
<Regenaxer> I do usually: (pack (mapcar char (range 33 1023)))
<Regenaxer> Does this work?
<Regenaxer> If it hangs, then your terminal interprets some char in some way perhaps
<razzy> Regenaxer: it works until char ^? which is (char 127)
<Regenaxer> So it is your terminal I think
<Regenaxer> also, (char 0) is not defined
<Regenaxer> and 1 .. 31 are control chars
<Regenaxer> might do strange things yoo
<razzy> i think it is defined as NIL
<Regenaxer> e.g. 27 is ESC
<razzy> Regenaxer: new line char is?
<Regenaxer> 10
<Regenaxer> and 13 is CR
<razzy> CR?
<Regenaxer> Carriage Return
<Regenaxer> But ok, as you do 'char' all control chars are wrapped in strings, so should be OK
peterhil has joined #picolisp
<hunar> It worked on port 8000
aw- has quit [Quit: Leaving.]
<razzy> Regenaxer: propably my terminal. thank you.
<Regenaxer> yes, but 8086 fails?
<Regenaxer> ok razzy
<Regenaxer> and anyway, I see that the images don't show
<hunar> It was working the first time, then the browser was saying (couldn't find that website) or something like that
<Regenaxer> strange
<Regenaxer> Does another browser work?
<hunar> No, I tried pc (chrome edge) android (firefox)
<Regenaxer> If you start the server on 8086 and then do in another pil repl (connect "localhost" 8086), does it retun e.g. -> 3 ?
aw- has joined #picolisp
<hunar> Id does say 3, with and without the server running .. it also says 3 when i use port 8000
<hunar> it*
<Regenaxer> 3 is always the first F
<Regenaxer> FD
<Regenaxer> but the server must be running
<Regenaxer> *some* server
<hunar> It might be a windows issue .. what is that magical number 8086 :) I know very little about networking
<Regenaxer> I always used 8080, but on Termux there is a conflict with the "Onleihe" app, so I started to use 8086
<Regenaxer> 8080 is more standard probably
<hunar> When I saw that 8086 doesn't work, I ran (python3 -m http.server) and It used 8000 successfully, that's why I tried it
<hunar> I deleted an image from the chess folder, nothing changed, where would the error appear?
<Regenaxer> Any port above 1024 should be fine if pil does not complain
<hunar> Pil didn't complain about port 80 :|
<hunar> although it didn't work
<hunar> Oh no, my mistake
<hunar> It did
<Regenaxer> I tried, in fact it does not complain
<Regenaxer> the piece is simply missing
<Regenaxer> strange
<Regenaxer> It is the canvas drawing which accesses the image
<Regenaxer> OK, I cleared the browser cache, then did
<Regenaxer> PORT=8086 ./pil chess/main.l -'chess~main' -"trace 'httpEcho" -go +
<Regenaxer> It shows how the images are served
<hunar> one unrelated question, can I draw on that canvas and create lines&circles and maybe animate? or that' is javascript's job
<Regenaxer> yes, you can animate
<hunar> Great! :D thanks for the example
<Regenaxer> I think this was a wiki article
<hunar> with that code PORT 8086 now works for some reason
<Regenaxer> I looked at httpEcho
<Regenaxer> it returns 404 if the file does not exist
<Regenaxer> so no Pil error
razzy has quit [Ping timeout: 248 seconds]
<Regenaxer> yes, it was in the wiki: https://picolisp.com/wiki/?canvasdrawing
<Regenaxer> And the "Demo" PIL for PilBox has a "Canvas" button. It shows an animated "Forest Fire"
<Regenaxer> I think "Forest Fire" was a Rosetta task initially :)
<hunar> Thanks for the link :)
aw- has quit [Ping timeout: 240 seconds]
<hunar> I just copied over the exact same binaries I compiled in WSL and ran the chess example in virtualbox/linux .. the chess board is visible there
<Regenaxer> I see, WSL is indeed problematic
<hunar> I tried the canvas example in the link above using WSL, port 8080 didn't work, and port 8000 worked but the canvas is missing like the chess..
<Regenaxer> uh ;)
<Regenaxer> no idea
<Regenaxer> Perhaps a general JS-problem?
<Regenaxer> same origin policy blocuning or so?
<Regenaxer> *blocking
<hunar> But JS runs in the browser right? same browser on windows works if the server was in virtualbox/linux instead of WSL
<Regenaxer> Yes, but JS communicates back
<Regenaxer> XMLHttpRequest()
<Regenaxer> Perhaps look at browser's debug messages?
<hunar> Good point
<hunar> I also get this
<hunar> A page or script is accessing at least one of navigator.userAgent, navigator.appVersion, and navigator.platform. In a future version of Chrome, the amount of information available in the User Agent string will be reduced.
<hunar> To fix this issue, replace the usage of navigator.userAgent, navigator.appVersion, and navigator.platform with feature detection, progressive enhancement, or migrate to navigator.userAgentData.
<hunar> Note that for performance reasons, only the first access to one of the properties is shown.
<Regenaxer> hu, no idea :)
<Regenaxer> I also cannot find canvasTest in my sources
<Regenaxer> but the wiki article seems to refer to it
<Regenaxer> in "Minimal Example", ok
<hunar> Yes :D forgot to mention that I used that example for the error
<Regenaxer> makes sense then
<Regenaxer> But I don't understand the Uncaught References
<hunar> I now tried picoLisp-21.6 (the non rolling release), didn't make a difference, so not a pil21 issue
<Regenaxer> Good to know
hunar has left #picolisp [#picolisp]
razzy has joined #picolisp
wineroots has joined #picolisp
razzy has quit [Ping timeout: 252 seconds]
razzy has joined #picolisp
beneroth has quit [Quit: Leaving]
razzy has quit [Ping timeout: 248 seconds]
razzy has joined #picolisp
razzy has quit [Ping timeout: 248 seconds]
razzy has joined #picolisp
<razzy> Regenaxer: I am trying to print string of random characters into a file. I have two problems. 1.(str) does not work with random characters from (str 10-127). 2.(str) replaces "" with () and i want to print without (). Should it happen? is there another way?
<razzy> *(char 10-127)
<razzy> ok, 2. solved with prin.
<razzy> (prin)
<razzy> hmm, i was thinking that (char) generated escaped characters, wchich seems not to be the case. working
<Regenaxer> yeah, prin is for printing, nmt str
<Regenaxer> and 'char' *returns* a string already
<razzy> prin works as i want with chopped string
<razzy> i do not know why
<Regenaxer> good
<razzy> not good
<Regenaxer> Why should it not?
<razzy> because i am confused about why it works
<Regenaxer> 'prin' works with everything
<Regenaxer> num, sym or list
<Regenaxer> Just like 'pack'
<Regenaxer> 'print' prints high-level
<Regenaxer> print, printsp, println
<Regenaxer> but prin and prinl is just text, no Lisp structures
<razzy> nice, thx.
<Regenaxer> I thought you know the differences between these functions
<razzy> used before, not engraved into soul, forgotten
<Regenaxer> :)
<razzy> sorry :]
<Regenaxer> No problem!
<razzy> I wanted sophisticated (out "out" (print (str (pack X)))) which I failed with
<Regenaxer> uh
<Regenaxer> why so very complicated?
<razzy> should work right?
<Regenaxer> If you just want to print, never build unnecessary structures first
<Regenaxer> 'pack' does the same as 'prin'
<Regenaxer> 'str' is *very* seldom needed!
<Regenaxer> Not in normal apps
<razzy> i am trying to think of example of use str and sym.
<Regenaxer> Better not too early ;)
<Regenaxer> any, sym and str are very special
<Regenaxer> perhaps code processing
<Regenaxer> Everything "normal" you can do directly
<razzy> like building interpretter?
<Regenaxer> right
<Regenaxer> eg in Vip executing text as code or so
hunar has joined #picolisp
<Regenaxer> 'str' wants to process Lisp text
<Regenaxer> not normal strings
<Regenaxer> These functions emulate Lisp level 'read' and 'print'
<Regenaxer> NOT for normal characters
<razzy> i want random characters which include parenthesis and lots of "lisp characters"
<Regenaxer> yes, so rand, char and prin[l]
<Regenaxer> no need for 'str' or such
<Regenaxer> Instead of 'prin' you can 'pack'
<Regenaxer> same algorithm
<Regenaxer> one goes to output and one builds a symbol
<razzy> I am good for now. thank you.
<Regenaxer> :)
prestidigitator is now known as f8l
<Regenaxer> (out "a" (do 99999 (prin (char (rand 33 9999)))))
<Regenaxer> not tested ...
<razzy> yep prin just works.
<Regenaxer> perfect :)
beneroth has joined #picolisp
hunar has quit [Ping timeout: 250 seconds]
<razzy> hmmm, weird. can i have only one (alarm)? if I want after one alarm setup another alarm and create "realtime" watchdog, how to do it?
<razzy> why i cannot print from (alarm?)
<beneroth> not sure about the (alarm) bit, but I would do a watchdog as a separate process (sibling forked from same parent keeping connected via picolisp IPC, or completely separate process)
<beneroth> to be able to detect if the main process hangs..
<razzy> beneroth: true, i want to watch other processes, so it is fine.
<beneroth> razzy, print form (alarm) should be possible according to the example given in the reference
<Regenaxer> alarm() is a Unix syscall,
<Regenaxer> $ man 2 alarm
<Regenaxer> The standard way in pil to do timers is 'task'
<beneroth> Regenaxer, (alarm) is calling unix alarm() which then sends an interrupt? which SIG ?
<beneroth> T
<beneroth> task is better.
<Regenaxer> right beneroth
<Regenaxer> and a new alarm() cancels the previous one
<razzy> (alarm 2 (prin "A")) does not print A
<razzy> after 2s
<Regenaxer> Needs a (flush) probably
<beneroth> razzy, try prinl
<Regenaxer> or (println )
<beneroth> Regenaxer, I see
<Regenaxer> or (msg )
<beneroth> razzy, or (prin ...) (flush)
<Regenaxer> man 2 alarm says: In any event any previously set alarm() is canceled.
<beneroth> T
<beneroth> so only one single alarm can be scheduled
<beneroth> what is a typical use case for (alarm) for you, Regenaxer ?
<beneroth> I never used it
<razzy> i do not know how to use (flush) does not work. is this possible? (de alfa () (alarm 2 (print "A")(alfa)))
<beneroth> maybe I used it once as a timeout
<Regenaxer> I think I also never used it in applications
<Regenaxer> it conflicts also with sleep() IIRC
<Regenaxer> cause the same OS timer is used
<beneroth> razzy, rather sounds like something that should be put into (job)/Task mechanism
<beneroth> Regenaxer, oh
<Regenaxer> But I used (abort ) sometimes
<razzy> I was soo proud of my alarm construct.
<Regenaxer> and abort uses alarm (?)
<beneroth> right, I only ever used (abort), never alarm
<Regenaxer> (de abort ("N" . "Prg")
<Regenaxer> : (pp 'abort)
<Regenaxer> (catch 'abort
<Regenaxer> (alarm "N" (throw 'abort))
<Regenaxer> (finally (alarm 0)
<Regenaxer> (run "Prg") ) ) )
<Regenaxer> abort is nice sometimes
<beneroth> razzy, sorry, happens :)
<Regenaxer> yeah razzy, good exercise
<beneroth> to all of us..designing sometimes something nice but stupid
<Regenaxer> But it works:
<Regenaxer> : (alarm 2 (msg 'OK))
<Regenaxer> : OK
<Regenaxer> -> 0
<Regenaxer> after 2 sec
<Regenaxer> razzy, prin does not flush
<Regenaxer> (out NIL (prin ...)) flushes
<Regenaxer> or (prinl ) or (prin ) (flush)
<Regenaxer> Best is (msg )
<Regenaxer> it is (out 2 (print ... or so
<Regenaxer> 2 is stderr
<Regenaxer> so it does not mix with stdout
<Regenaxer> In general async output is better sent to stderr
<Regenaxer> cause stdout migh go to user data at that moment
<razzy> Regenaxer: msg works. my construct works too.
<razzy> I want to check files in 2s period.
<razzy> Today was good learning, thank you Regenaxer beneroth :]
<razzy> i will need to think about (in) (out) and how it works with asynchronous alarm schedule.
<Regenaxer> To do something every 2 sec, check out 'task'
<Regenaxer> (task -2000 0 (when (info "file") ...))
<razzy> uh, alarm was so neat
<razzy> recursive and all
<Regenaxer> recursive?
<Regenaxer> calling it iside the alarm handler? ok
<razzy> it called itself. technically just cycle
<razzy> Sigh, i will look at task. i might need ms precision. thank you :]
<Regenaxer> 'task' is even easier to use than 'alarm'
<Regenaxer> And you can make many tasks
<razzy> I feel like picolisp has too many functions that has same purpose. It dillutes my learning attention. I am also very gratefull for your help.
<Regenaxer> Glad to help! :)
<Regenaxer> But I'm sure all functions do have a different purpose
<beneroth> the similar functions often differ in small but significant ways, differences coming not from the functions per se but underlying concepts/functionalities. maybe a bit confusing at first, but grokking those differences gives often deep insights which are also useful outside of picolisp for understanding software in general
<Regenaxer> Exactly
<Regenaxer> Perhaps it needs to be better documented
<Regenaxer> Anyway, good night!
<razzy> Good night! :]
beneroth has quit [Quit: Leaving]
aw- has joined #picolisp
aw- has quit [Quit: Leaving.]