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
alexshendi has quit [Ping timeout: 268 seconds]
alexshendi has joined #picolisp
alexshendi has quit [Ping timeout: 265 seconds]
alexshendi has joined #picolisp
razzy has joined #picolisp
aw- has quit [Quit: Leaving.]
razzy has quit [Ping timeout: 268 seconds]
aw- has joined #picolisp
razzy has joined #picolisp
<Regenaxer> Good morning beneroth :)
<Regenaxer> Pilog 'or' unifies variables like everywhere else
razzy has quit [Ping timeout: 265 seconds]
<beneroth> Good morning Regenaxer :)
<beneroth> I did something like (pilog @Param Param @List List (select (@Goal) ((index Entity @Param)) (member @A @List) (or ((same @A @Goal a)) ((not (bool T @Goal a))) Prg)
<beneroth> in the Prg, I didn't had @A present
<Regenaxer> Yes, this is the Prolog way
<Regenaxer> @A gets unified
<Regenaxer> by member
<Regenaxer> oh, you are still 'bool'ing ;)
<Regenaxer> I feel uneasy with that
<beneroth> hehe yeah
<Regenaxer> as there is no false proving
<beneroth> well I wanted "property a must be member of List or NIL"
<Regenaxer> I would resort to Lisp in such cases
<beneroth> ok
<Regenaxer> but if it works, all right! :)
alexshendi has quit [Quit: -a- Connection Timed Out]
alexshendi has joined #picolisp
hunar has joined #picolisp
razzy has joined #picolisp
<hunar> Hi everyone :D Is there an easier way than this (maxi max (mapcar fitness A)) or (fitness (maxi fitness A)) to get the maximum returned value when applying the function fitness to the elements of A
<Regenaxer> Hi hunar!
<Regenaxer> It should be in the secondary return value '@@'
<Regenaxer> (doc 'maxi)
<hunar> Ooooo, I read the doc multiple times but didn't read the last part
<Regenaxer> :)
<hunar> Cool :) another simple question, you don't like the CL naming syntax that uses - like get-circle-area
<hunar> ?
<Regenaxer> It is not a problem for me
<Regenaxer> Just useless in case of pil
<Regenaxer> It is in CL because it is all uppercase
<Regenaxer> so you can't use camelCase
<hunar> c++ has cases but uses this_syntax .. I don't have problem with any of them though
<Regenaxer> C (and C++) traditionally avoid upper case
<Regenaxer> I think this is also due to its ancient origins
<hunar> I personally read the-separated-words a little faster thanThis
<Regenaxer> At the time C was developed camelcase was not yet invented
<Regenaxer> ok
<hunar> Aha that's the reason then
<Regenaxer> I believe so
<Regenaxer> So get-circle-area is fine
<hunar> :D
<hunar> Last question :) Is it (easily) possible to use javascript libraries? there is an excellent library called p5.js which I can't complement enough, It makes canvas drawing very easy and powerful
<Regenaxer> I think so, but have not tried
<Regenaxer> How to call it?
<hunar> Wait, I'll check it out, i forgot
<hunar> A live editor is here https://editor.p5js.org/ you load the p5.js library either locally or remotely <script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.4.0/p5.js"></script> then create two functions setup() and draw()
<hunar> here is the code for a red ball moving
<hunar> x=0;
<hunar> y=0;
<hunar> function setup() {
<hunar> createCanvas(400, 400);
<hunar> }
<hunar> function draw() {
<hunar> background(220);
<hunar> fill(255,0,0);
<hunar> circle(x,y,10);
<hunar> x++; y++;
<hunar> }
alexshe96 has joined #picolisp
alexshendi has quit [Read error: Connection reset by peer]
<Regenaxer> Sorry, telephone
hunar has quit [Quit: Ping timeout (120 seconds)]
hunar has joined #picolisp
<beneroth> hunar, I also found separated words easier to read. I usually go with foo-bar for functions and FooBar/+FooBar for variables and classes
<hunar> :D
cranium has joined #picolisp
<beneroth> just stick with the picolisp naming convention, they make live easier and errors less likely.
<hunar> Right, since all everyone uses it, I can't really do anything about it
<beneroth> you can certainly, just not so wise maybe :)
<beneroth> see also (lint) and (lintAll), I use them to rarely, but they can spot some mistakes easily, primarily by checking naming conventions
<hunar> How can I use (lint)
<hunar> I just ran lintAll on a file and it returned a function call
<hunar> -> (("test.l" (def gen pow fitness function) (bnd mutation recombination termination mutate combine F fitness Population Y X))) It refers to function gen from lib/simul.l
<beneroth> so your test.l has no (load "@lib/simul.") in it
<hunar> It has
<Regenaxer> I use lintAll usuall just on all loaded stuff
<Regenaxer> : (lintAll)
<Regenaxer> (lintAll "file.l") is intended for files like in the gui
<Regenaxer> loaded on the fly
hunar has quit [Ping timeout: 256 seconds]
hunar has joined #picolisp
<hunar> I think now I understand how lint is used :)
<hunar> I was trying to learn the genetic algorithm within simul.l I wrote it for my future self that forgets the usage https://pastebin.com/Mck2zD5Z hence it's very sparse
<hunar> The link above has an error at line 20, just ignore F @@
<Regenaxer> Cool hunar! You are a very fluent Pil programmer already
hunar has quit [Ping timeout: 256 seconds]
hunar has joined #picolisp
<hunar> Thanks Regenaxer :) But I cheated a little bit, Copied the code/idea from https://rosettacode.org/wiki/Evolutionary_algorithm#Racket
<Regenaxer> Ah, haha, ok :)
<hunar> Did you look at the p5.js that I mentioned? what would be the procedure to load a .js library and call the functions within it
<Regenaxer> Ah, sorry, not jet
<hunar> No problem :D
<Regenaxer> uh, more than 1e5 lines
<Regenaxer> Gets heavy in Vip
<Regenaxer> How is it supposed to be used? In nodeJS?
<Regenaxer> I used JS only in browsers so far
<hunar> No, just a normal html file without any servers
<Regenaxer> Ah, so in browser?
<hunar> Yes
<Regenaxer> Pil uses JS in various places
<Regenaxer> form.l and canvas.l
<Regenaxer> also in gis.l
<Regenaxer> all in browser of course
<hunar> Yeah :) It only affects a canvas item
<Regenaxer> There is also a canvas demo
<Regenaxer> also in Wiki
<Regenaxer> or in PilBox "demo" app
<Regenaxer> Sorry, interrupt
hunar29 has joined #picolisp
hunar has quit [Ping timeout: 256 seconds]
<beneroth> Regenaxer, hunar29 so I guess the question is "how to deliver a static file (the js file) using form.l webframework" :)
<beneroth> hunar29, look at how css/js/images are served :)
<hunar29> Electricity is not very reliable in my country, I get disconnected a lot
<beneroth> oh wow. no problem :)
<beneroth> hunar29, you know about the irc log? you could use to get missed responses/discussions afterwards
<beneroth> see channel title.. https://libera.irclog.whitequark.org/picolisp
<hunar29> Yes :) I use it alot, I cant live without it :/
hunar29 is now known as Hunar
alexshe96 has quit [Quit: -a- Connection Timed Out]
<Hunar> I haven't experimented too much with gui in Pil yet so I'm hoping someone tries it for me :) I constructed the simplest example download this file https://github.com/processing/p5.js/releases/download/v1.4.0/p5.js and put it somewhere, at the same location make an html file with these contents, then open the html file and a red canvas
<Hunar> should be visible
<Hunar> <!DOCTYPE html>
<Hunar> <html lang="en">
<Hunar> <head>
<Hunar> <script src="p5.js"></script>
<Hunar> <meta charset="utf-8" />
<Hunar> </head>
<Hunar> <body>
<Hunar> <script>
<Hunar> function setup() {
<Hunar> createCanvas(400, 400);
<Hunar> }
<Hunar> function draw() {
<Hunar> background(225,0,0);
<Hunar> }
<Hunar> </script>
<Hunar> </body>
<Hunar> How can I translate this to Pil, putting p5.js in the same folder as the picolisp file, then ....
<beneroth> sorry, I've gotta go. see @lib/xhtml.l for the html dsl, e.g. (<html> '(lang . en) (<head> (<script> ....)]
<beneroth> bbl
alexshendi has joined #picolisp
<Regenaxer> Yes, @lib/xhtml.l and @lib/canvas.l
<Regenaxer> I look up an example a little later
<Hunar> Great :D It'll be cool to do something like (for A 10 (js "circle" A A 10)) to make 10 circles
<Regenaxer> You could first check here: https://picolisp.com/wiki/?canvasdrawing
<Regenaxer> oops
<Regenaxer> Paste error
<Regenaxer> I mean: https://picolisp.com/canvas
razzy has quit [Ping timeout: 260 seconds]
<Regenaxer> There is also a canvas in https://picolisp.com/wiki/?phonegui
beneroth has quit [Quit: Leaving]
razzy has joined #picolisp
razzy has quit [Ping timeout: 268 seconds]
razzy has joined #picolisp
Hunar has quit [Quit: Client closed]
Hunar has joined #picolisp
Hunar has quit [Ping timeout: 256 seconds]
razzy has quit [Ping timeout: 260 seconds]
razzy has joined #picolisp
Hunar has joined #picolisp
<Hunar> I might work on the in the future because I currently don't know how to start :/ .. one small question, p5js creates its own canvas, so doesn't use @lib/canvas.l is that a problem?
<Hunar> work on this*
<Regenaxer> What is its "own" canvas?
<Regenaxer> Not a browser <canvas> element?
<Regenaxer> @lib/canvas.l only defines some glue functions
<Regenaxer> sends commands to JS in the browser
<Hunar> I don't know too much about web, I mean in those examples the pil code creates the canvas while in p5js the function createCanvas(); is creating it, can they talk to each other?
razzy has quit [Ping timeout: 265 seconds]
razzy has joined #picolisp
<Hunar> I'll dig into it until Saturday to see what I can achieve :)
<alexshendi> Is there a (virtual) picolisp meetup in the nwar future?
<alexshendi> s/nwar/near/
<Hunar> Yes there is pilcon :) quoting Regenaxer https://libera.irclog.whitequark.org/picolisp/2021-08-24 17:30 <Regenaxer> It is on the 10th and 20th each month
razzy has quit [Ping timeout: 265 seconds]
razzy has joined #picolisp
alexshendi has quit [Read error: Connection reset by peer]
alexshendi has joined #picolisp
alexshe32 has joined #picolisp
alexshendi has quit [Remote host closed the connection]
<alexshe32> So the next one is on the 20th, 1600UTC
<alexshe32> ?
alexshe32 is now known as alexshendi
<Regenaxer> Yes alexshendi, exactly ,)
<Regenaxer> so 18:00 central european time
<alexshendi> That's a Monday? Wasn't it supposed to be on a Saturday?
<Regenaxer> yes, Monday
<Regenaxer> this was the purpose of the 10/20 rule
<Regenaxer> to have different weekday
<alexshendi> OK, I'll probably show up .
<Regenaxer> cause there was always somebody who could not attend on certain days
<Regenaxer> That would be cool! :)
alexshe55 has joined #picolisp
alexshendi has quit [Read error: Connection reset by peer]
alexshendi has joined #picolisp
<Regenaxer> hunar, I think you don't need to call the <canvas> function in @lib/canvas.l
<Regenaxer> But it expects that the application code defines 'drawCanvas'. It is a callback.
<Regenaxer> You remember the chess program in PilBox and as a stand-alone version? It is all based on @lib/canvas.l and thus @lib/canvas.js
alexshe55 has quit [Ping timeout: 268 seconds]
razzy has quit [Ping timeout: 268 seconds]
<Hunar> I don't know what to say :/ I have to check a lot of code to understand and use your helps.. I need to learn three things: 1. load a .js file using Pil 2. create a function that p5js can call (it calls setup once and draw every frame) 3. call javascript functions
<Regenaxer> 1. is in @lib/canvas.js
<Regenaxer> (push1 '*JS (allow "@lib/plio.js") (allow "@lib/canvas.js"))
<Regenaxer> or @lib/gis.l
<Regenaxer> (push1 '*JS (allow "@lib/gis.js"))
Hunar has quit [Quit: Client closed]
alexshendi has quit [Quit: -a- Connection Timed Out]
alexshendi has joined #picolisp
aw- has quit [Ping timeout: 260 seconds]
razzy has joined #picolisp
razzy has quit [Ping timeout: 252 seconds]
alexshendi has quit [Read error: Connection reset by peer]
alexshe91 has joined #picolisp
alexshe91 has quit [Quit: -a- Connection Timed Out]
alexshendi has joined #picolisp
alexshendi has quit [Read error: Connection reset by peer]
alexshendi has joined #picolisp
alexshendi has quit [Read error: Connection reset by peer]
alexshe79 has joined #picolisp
alexshe79 is now known as alexshendi
beneroth has joined #picolisp
razzy has joined #picolisp
cranium has quit [Quit: Leaving]
razzy has quit [Ping timeout: 252 seconds]
alexshendi has quit [Quit: -a- Connection Timed Out]
alexshendi has joined #picolisp
alexshendi has quit [Quit: -a- Connection Timed Out]
alexshendi has joined #picolisp
razzy has joined #picolisp
alexshendi has quit [Read error: Connection reset by peer]
alexshendi has joined #picolisp
razzy has quit [Ping timeout: 265 seconds]
razzy has joined #picolisp
alexshendi has quit [Quit: -a- IRC for Android 2.1.59]
razzy has quit [Ping timeout: 268 seconds]
razzy has joined #picolisp
razzy has quit [Ping timeout: 252 seconds]