ChanServ changed the topic of #picolisp to: PicoLisp language | Channel Log: https://irclog.whitequark.org/picolisp/ | Picolisp latest found at http://www.software-lab.de/down.html | check also http://www.picolisp.com for more information
pierpal has quit [Ping timeout: 240 seconds]
alexshendi has joined #picolisp
pierpal has joined #picolisp
andyjpb has quit [Ping timeout: 276 seconds]
pierpal has quit [Ping timeout: 256 seconds]
pierpal has joined #picolisp
alexshendi has quit [Ping timeout: 256 seconds]
pierpal has quit [Quit: Poof]
pierpal has joined #picolisp
aw- has joined #picolisp
orivej has joined #picolisp
rob_w has joined #picolisp
anjaa has joined #picolisp
alexshendi has joined #picolisp
alexshendi has quit [Ping timeout: 245 seconds]
alexshendi has joined #picolisp
orivej has quit [Ping timeout: 240 seconds]
alexshendi has quit [Ping timeout: 276 seconds]
<aw-> Regenaxer: here?
<Regenaxer> yes
<aw-> i have a really weird issue
<aw-> (date (date T))
<aw-> -> (2018 6 22)
<aw-> (let D (date (date T)) (prinl (pack (day D '("Mon" "Tue" "Wed" "Thu" "Fri" "Sat" "Sun")) " " (car D))))
<aw-> Thu 2019
<aw-> -> "Thu 2019"
<aw-> why is the year increment by 1 ?
<Regenaxer> Wrong arg to 'day'
<Regenaxer> It takes a date, not a list
<Regenaxer> (pp 'day)
<Regenaxer> (de day (Dat Lst)
<Regenaxer> (or Lst *DayFmt)
<Regenaxer> (get
<Regenaxer> (when Dat
<Regenaxer> (inc (% (inc Dat) 7)) ) ) )
<Regenaxer> this increments the CAR of Dat
<aw-> Ohhhh!! my bad
<aw-> wrongarg
<Regenaxer> : (let D (date T) (prinl (pack (day D) " " (car (date D)))))
<Regenaxer> Friday 2018
<Regenaxer> :)
<aw-> yeah i fixed it
<aw-> ok thanks!!
<Regenaxer> np
orivej has joined #picolisp
yunfan[Cr2] has joined #picolisp
andyjpb has joined #picolisp
singa has joined #picolisp
<singa> Hi All!
<singa> Is there anyone working on asynchronous functionality in picoLisp?
<Regenaxer> Hi singa!
<singa> But there is a lot of work to port http stack with coroutines
<singa> maybe someone interested in such things
<Regenaxer> What exactly is the difference to the internal select() calls?
<singa> select doesn't have async mode
<Regenaxer> I've never looked at epoll
<singa> means we can't process remaining job untill data available in any of listening descriptors
<Regenaxer> well, we can poll with select() too
<Regenaxer> (doc 'poll)
<Regenaxer> Seems that epoll() just supports *more* file descriptors
<Regenaxer> select is limited to 1024 by default
<singa> yup, it's much like enchanced poll
<Regenaxer> yeah
<Regenaxer> So it would make sense to replace the internal select
<Regenaxer> But with more FDs we run into other problems
<Regenaxer> in a typical pil setup
<Regenaxer> as the parent process schedules the messages, so there is a performance bottleneck
<Regenaxer> Your code looks very good
<yunfan[Cr2]> i am reading the chapter about run script from any places
<singa> Tanks!
<yunfan[Cr2]> and thinking why not act like python does
<yunfan[Cr2]> you just treat every file as a module and use a powerful load instead of so many rules
<Regenaxer> yunfan[Cr2], which rules do you mean?
<yunfan[Cr2]> Regenaxer: the whole chapter talk about
<Regenaxer> are you talking about epoll, or *Run / task's ?
<yunfan[Cr2]> nope, i am talking about (load "@app/blah.l")
<yunfan[Cr2]> such things from that tutorial
<Regenaxer> Ah, ok
<yunfan[Cr2]> also , that commandline options implmentation were so cool
singa_ has joined #picolisp
singa has quit [Quit: Page closed]
singa_ has left #picolisp [#picolisp]
singa has joined #picolisp
<aw-> singa: awesome!
<aw-> singa: you can do a single (setq *Key value *Key2 value2) rather than multiple (setq)
<yunfan[Cr2]> so epoll could allow rising edge trigger?
<singa> sorry, what it means?
<beneroth> hi
<singa> You mean timer?
<Regenaxer> Hi beneroth
<yunfan[Cr2]> no, rising edge
<yunfan[Cr2]> when you have a sequences of binary number, which change from 0 to 1, its called rising edge, isnt that?
<singa> the man says: "The epoll API can be used either as an edge-triggered or a level-triggered interface.."
<Regenaxer> I think singa referred to the setq
<yunfan[Cr2]> and 0/1 could be mappting to file handle's close/open status
<beneroth> so its just a bit-table?
<beneroth> I'm interested in epoll. no experience.
<yunfan[Cr2]> i just heard of that epoll could support that
<yunfan[Cr2]> but i havent look into that
<singa> yes, in general, it's a bit table, mapped to array of epoll_event structures
<singa> it has O(1) instead of poll's O(n) complexity
mtsd has joined #picolisp
<aw-> epoll used by libev (nodejs)
<aw-> it has nice properties
yunfan[Cr2] has quit [Ping timeout: 264 seconds]
<singa> I had project in Rust using https://tokio.rs/ (it uses epoll too)
<singa> thince picoLisp has fast coroutines - thought it would be great to bring asynchronous I/O too
<beneroth> nginx uses epoll (when available)
<beneroth> I still have to find out how to hand a socket from one process to another
<beneroth> e.g. master process to select/epoll (listen) to incoming connections, and than assign it to a worker process.
<aw-> beneroth: i think i did that in my nanomsg lib.. can't remember
<beneroth> instead of the simpler (and more stable, but not as scalable) forker architecture
<singa> usually there is one process utilizes epoll and calling asynchronous handlers (coroutines)
<singa> Hovewer, such design imposes restrictions to all app architecture
<singa> since you have to write every heavy function as coroutine
<Regenaxer> I still don't see why all this can be done with existing 'task's (ie *Run)
<Regenaxer> s/can/can't
<Regenaxer> epoll()s main diff is the higher limit on FDs, right?
<Regenaxer> I'm using coroutines in tasks
<singa> and fastest polling
<Regenaxer> select() is not the bottleneck
<Regenaxer> Usually there is no polling at all
<Regenaxer> polling (busy wait) is bad, right?
<singa> definitely
<Regenaxer> So I have everything asynchronous in tasks
<Regenaxer> or separate processes of course
<singa> let me look closer on tasks
<singa> maybe it's already there - all I need
<Regenaxer> Looks like epoll() is better, would be good to replace the internal select() with epoll() in the long range
<Regenaxer> This is not trivial probably, I also looked at poll() back then but decided against it
<Regenaxer> it is internally the same system call anyway
<Regenaxer> (I think poll() is the true internal in Linux)
<singa> epoll is not the POSIX
<Regenaxer> yeah
<Regenaxer> but widely supported?
<singa> yes
<Regenaxer> Oops, must go. Back later
<Regenaxer> afp
<aw-> i looked into epoll a while back, it seems like it would be a great addition to PicoLisp, i wouldn't specifically try to "replace" what's already there
<aw-> there's always a need to select() blocking
<aw-> sometimes* a need
<beneroth> T
sriram has joined #picolisp
<Regenaxer> ret
<Regenaxer> Hi sriram!
<Regenaxer> I looked at your code this morning
<Regenaxer> There were some issues, I'm not sure what you intended in the SVG code
<Regenaxer> This works here: https://pastebin.com/23CkeGyZ
<sriram> Hi Regenaxer...many thanks for looking at it
<sriram> (trying the pastebin now)
<Regenaxer> :)
<Regenaxer> The 'allow' calls make only sense if there was an 'allow' before
<Regenaxer> otherwise *everything* is allowed, and 'allow' calls have no effect
<Regenaxer> The (csPost) is also not needed
<Regenaxer> But both allow and csPost were not the problem
<sriram> you mean if there was an "allowed" before?
<Regenaxer> Also funny was (de drawTile (Letter, X, Y, R, W, H, LP, HP)
<Regenaxer> ie C syntax ;)
<Regenaxer> I inserted an 'allowed'
<Regenaxer> (allow showTextMetric ) is also wrong, needs a quoti
<sriram> yes :) I just noticed that in the diff...funny thing is I did not get an error...I dont even know what was happening
<Regenaxer> quote
<Regenaxer> but anyway no effect
<sriram> (I was experimenting, with ', and without)
<Regenaxer> , is a read macro
<Regenaxer> interns the following symbols into *Uni
<sriram> i mean with '
<Regenaxer> also no visible effect here
<sriram> oh I see, so luckily no effect...but also may not work properly
<Regenaxer> So the problem was just the self-made SVG code perhaps?
<sriram> yes....I thought I could do prinl...since that was what svg> was outputting anyway
mtsd has quit [Quit: leaving]
<sriram> I took the output of running (svg> ....)
<Regenaxer> right
<sriram> and stuck it in prinls
<sriram> i mean in prins
<Regenaxer> yes
<Regenaxer> but (prin "<g transform=\"translate(126,72)\">") is not a full <svg> tag
<Regenaxer> so probably nothing at all is generated
<Regenaxer> I tried with
<Regenaxer> (<svg> 200 200 "px"
<Regenaxer> (rect 0 0 40 30)
<sriram> i thought the output of multiple prin sent to browser
<Regenaxer> )
<sriram> will have the same effect
<Regenaxer> and it shows a rect
<Regenaxer> yes, it has
<Regenaxer> but it is no legal SVG
<sriram> so if i combined all into one big prin that may work?
<sriram> (or better yet, I can try to understand what <svg> does :) )
<Regenaxer> no, you need the right tags
<Regenaxer> The above rect gives:
<Regenaxer> <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="200px" height="200px" viewBox="0 0 200 200" class="svg">
<Regenaxer> <rect x="0" y="0" width="40" height="30" fill="none" stroke="black" stroke-width="1"/>
<Regenaxer> </svg>
<Regenaxer> I recommend to use the library functions, they build all that
<sriram> yes...agreed
<sriram> (svg> '$177226067223240 T 0 NIL NIL) svg> +PdfWin $177226067223240 : T 0 NIL NIL <g transform="translate(126,72)"> <rect x="0" y="0" width="300" height="258" fill="none" stroke="gray" stroke-width="0.25"/> </g>
<sriram> using svg> does not give all what you have above
<Regenaxer> the svg or a +PdfWin is just a fragment
<Regenaxer> works only if *embedded* in a page
<sriram> ah..ok...in any case I know now I dont need pdfPage or PdfWin...can call <svg> directly
<Regenaxer> +PdfPage does this, yes
<Regenaxer> Look at app/lib.l for a page print
<Regenaxer> invoices in that case
<Regenaxer> demo app
<sriram> (looking)
<Regenaxer> The function 'page' is in fact calling '<svg>' here
<sriram> ahh i was wondering how the example was similar to my case :)
<Regenaxer> it is a bit hidden, yeah :)
<Regenaxer> the <svg>
<sriram> seems the ps command is also useful
<sriram> I was looking at svg.l
<Regenaxer> yes, the main text generator
<sriram> i mean the ps function..used often
<Regenaxer> T
<sriram> but this is very nice now..I have a self contained mini-app...that I can experiment with..next step mouse click, and moving the tile :)
<Regenaxer> yes, bottom-up
<sriram> (i removed showTextMetric as dont need because using svg now)
<sriram> so will proceed now...thanks!
<Regenaxer> welcome!
<sriram> one small question about <svg> :)
<sriram> it takes X Y args...but what is the need...because the rectangle also has an X Y arg for origin
<sriram> is it like canvas?
<sriram> defining an area so that rect parameters are relative to <svg> origin?
<Regenaxer> it is the size of the SVG document
<Regenaxer> (de <svg> (*DX *DY Z . "Prg")
<Regenaxer> Z is the zoom factor
<sriram> yes, was reading the source for <svg> "\" width=\"" (if (num? Z) (* @ *DX) (pack *DX Z))
<sriram> so sets up width of the <svg> area
<sriram> Z need not be a number it seems
<Regenaxer> can be a unit like "px"
<sriram> ah like in your example in draw2Rects you used "px"
<Regenaxer> or "pt" as in 'page'
<sriram> bit confused "pt" as in virtual screen units? or as in 'page'?
<Regenaxer> Typographical points
<Regenaxer> 1/72 inch
<sriram> ahh .. this is the same as the meaninng of pt in CSS.. i.e screen points
<Regenaxer> another example
<Regenaxer> I made this to build the Penti Logo
<sriram> nice!! (i uncommented "display")
<sriram> beautiful in fact
<sriram> (reading that code)
<sriram> i see..so inside <svg> it is possible to use the prin...my mistake was to use it directly
<Regenaxer> Yeah, I just found that pentiLogo here while grepping for <svg>
<sriram> Is it possible to use the align options (left, center, right) to put text in the circle (as well as rectangle)
<Regenaxer> I don't remember
<sriram> trying to add (font 24 "Courier" (ps "Hello" T)) after one of the circles to see if I can get the text inside the circle
<sriram> maybe should use <text> instead
<sriram> (font 24 "Courier" (ps T "Hello" )) works , but the align is w.r.t svg doc not the circle
<Regenaxer> yes, <text> seems more low-level and direct
<sriram> need some way to group the circle and text, reading up on svg
<Regenaxer> There is 'window' for such things
<sriram> yes..was just reading the code for it
<Regenaxer> My documents are full of 'window' and 'table' calls
<Regenaxer> Found another stupid test example:
<Regenaxer> Meaningless, just to test all kinds of compunents
<sriram> checking to see if it has text in center of a circle or polygon
<Regenaxer> 'window' makes a local coordinate system
<Regenaxer> you could place circle plus text there
<sriram> yes
<sriram> i was trying that in the example but my text comes outside the circle...i think my offsets are wrong
<sriram> the latest test you sent is fine...it relies on an img.once I deleted it, I could run and generate the pdf
<sriram> img/PilDemoQR.png to be precise
<Regenaxer> yes, or put some other image
<sriram> yes...i am finding that left middle and right only work in horizontally..if I want the text centered about the center of the circle
<sriram> must maybe do something else
<Regenaxer> T, 'ps' is line-oriented. No concept of vertical posiitioning
<Regenaxer> 'window' plus 'down'
<sriram> (checking down)
<Regenaxer> I do most vertical spacings with 'down'
<Regenaxer> see eg. app/lib.l
<sriram> yes...it takes in pixels
<Regenaxer> lines rather
<sriram> i tried down 1 to go down one line of height font size...but that didnt work
<sriram> down 60 seems to be better
<sriram> (window 90 160 120 120 (circle 60 60 60) (down 60) (font 24 "Courier" (ps 0 "Hello" )))
<sriram> down is relative to the origin of the window? or relative to the last object drawn
<sriram> must be the former
<Regenaxer> true
<Regenaxer> it is dots (1/72 inch)
<sriram> hmmm...my window args are in pixels...so not easy to find the number of dots needed to move to center of circle
<sriram> 1 point is 1.333 px it seems
<sriram> perfectly centered now :)
pierpal has joined #picolisp
<Regenaxer> No, there is no direct relation between points and pixels
<sriram> of course that conversion may not work on phone or tablets
<Regenaxer> pt (1/72 inch) is when printing
<Regenaxer> px depends on the screen
<sriram> its only for 96dpi displays it seems
<sriram> yes
<sriram> px *pixels (1px = 1/96th of 1in)
<sriram> Pixels (px) are relative to the viewing device. For low-dpi devices, 1px is one device pixel (dot) of the display. For printers and high resolution screens 1px implies multiple device pixels.
<sriram> so just lucky it worked on my screen with that default conversion (96/72)
<sriram> so i suppose my question still holds
<sriram> how can we use the down function when its units are in dots (points)
<sriram> and the svg doc is specified with "px"
<sriram> ^when^if
<Regenaxer> As you see in app/lib.l
<Regenaxer> Good for rough positioning
<Regenaxer> Printing is always in pt
<Regenaxer> I often do (down 6) for roughly half a line
<sriram> yes...i saw app/lib.l...the down calls...i assumed that the down arguments were pixels too just like the x and y positions
<sriram> ah ok ...good to know
<Regenaxer> Whatever the unit is
<Regenaxer> in 'page' for PDF printing it is always "pt"
<sriram> even in pdfPage down is used : (down (*/ *FontSize 2 3))
<Regenaxer> here *FontSize can have huge variations
<Regenaxer> so it wants to go down 2/3 of a lineheight
<sriram> so a lineheight = FontSize...and because FontSize varies it goes down 2/3 of FontSize
<sriram> not sure i understood correctly
<Regenaxer> lineheight is probably fontsize plus some spacing
<sriram> (what is a lineheight?)
<sriram> ah ok
<Regenaxer> I don't remember well. Did not look at this stuff for some years
<sriram> no problem
<sriram> i will leave it now
<Regenaxer> Simply use it for printing ERP etc. documents
<sriram> and i will go to the mouse click/move for now :)
<Regenaxer> Yeah, I also need some stuff doen
<sriram> agreed....for screen..somehow i have a feeling i would like to use % rather than
<sriram> absolute numbers
<sriram> but thats ok
<sriram> for now
<sriram> bye for now :)
<sriram> and thanks!
<Regenaxer> :)
<Regenaxer> yes, percent also work I think
<Regenaxer> not sure for SVG at the moment
<Regenaxer> on mobiles I do all in percent, but that's CSS/HTML
<sriram> yes...will try in my miniapp too
<Regenaxer> ok :)
orivej has quit [Ping timeout: 260 seconds]
<sriram> hi Regenaxer...I was looking at the generated svg..the same DX DY args to <svg> are used for the width and height of the element itself *as well as* the view box
<sriram> so cant do something like : <svg width="60%" height="60%" viewBox="0 0 1000 1000" ....>
<sriram> so that the width and height of the element in the browser window is dissociated from the actual x y coords used for drawing rectangles circles text inside (they will use the viewbox coords)
<sriram> the browser would scale the drawings inside the viewbox to to the actual element size
<sriram> (I was planning to write my own <mysvg> function (<mysvg> W H Z *DX *DY) ...but just wanted to let you know in case you had any ideas to merge with the existing function)
<sriram> illustration penyacom.org/p?q=SHZsUUw
<sriram> (its an html file)
rob_w has quit [Quit: Leaving]
<Regenaxer> I see, cool!
<sriram> by the way..can I call the console function from lisp side...to display something on the repl
<sriram> since the output port is used for sending to browser
<Regenaxer> yes, stderr, usually with (msg X " some text")
<Regenaxer> trace also goes to stderr
<sriram> ah ok good...console does not work
<sriram> it prints..but the browser does not show anything..though it responds to mouse clicks
<sriram> console works from java side
<Regenaxer> 'console' in lib/form.l should work
alexshendi has joined #picolisp
sriram has quit [Ping timeout: 260 seconds]
andyjpb has quit [Ping timeout: 264 seconds]
khk has joined #picolisp
pierpal has quit [Quit: Poof]
pierpal has joined #picolisp
pierpal has quit [Quit: Poof]
pierpal has joined #picolisp
pierpa has joined #picolisp
_whitelogger has joined #picolisp
orivej has joined #picolisp
khk has left #picolisp ["Once you know what it is you want to be true, instinct is a very useful device for enabling you to know that it is"]