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
razzy has quit [Quit: leaving]
razzy has joined #picolisp
schulze has quit [Ping timeout: 240 seconds]
Hunar has joined #picolisp
<Hunar> Good morning :)       In this code http://ix.io/3J40  the variables    F L U X Y  don't work if i used them in drawCanvas .. I checked out @lib/canvas.l and there is also X2 Y2 that can't be used .. but why? shouldn't the variables be named differently within the library to avoid conflicts? like a special naming sytnax for example common
<Hunar> lisp would use .X. for internal use
<Regenaxer> Good morning Hunar
<Regenaxer> As far as I see, 'Z' does not conflict anywhere
<Hunar> no, only F L U X X2 Y  Y2
<Regenaxer> But anyway you are breaking the naming conventions
<Regenaxer> ah
<Regenaxer> ok
<Regenaxer> so why use 'Z' and not '*Z' or so?
<Regenaxer> There are reasons for the naming conventions in the docs
<Regenaxer> 'Z' is a typical "locally bound" symbol
<Regenaxer> of course you could also do "(private) Z"
<Regenaxer> but it is bad style
<Hunar> :)
<Hunar> I read the naming conventions before many times but didn't use them .. this was my first encounter with the problem :)
<Hunar> I'll try to change my habits
<Regenaxer> :)
<Regenaxer> The rest of your code follows the conventions I think
<Regenaxer> For example, 'U' is locally bound in the 'http' function
<Regenaxer> So when 'drawCanvas' is called inside a http transaction, it is locally bound there at that moment
<Regenaxer> : (who 'U)
<Regenaxer> -> ("attr" "undo" ps _htHead http bench (T . +UndoButton) pico)
<Hunar> Ah, that (who 'U) would have been much easier way to debug my problem
<Regenaxer> Well, the easiest is to stick with the namings ;)
<Hunar> I will :)
<Regenaxer> :)
aw- has joined #picolisp
rob_w has joined #picolisp
schulze has joined #picolisp
<razzy> good morning everyone
<Regenaxer> Hi razzy!
<beneroth> Good morning razzy, Regenaxer :)
<Regenaxer> Hi beneroth!
aw- has quit [Ping timeout: 240 seconds]
<razzy> can i check for NIL in list?
<razzy> i am thinking (filter nil? A)
<Regenaxer> 'not'
<razzy> thx
<Regenaxer> You just want to find out *if* there is a NIL?
<Regenaxer> then 'filter' would be too expensive
<Regenaxer> better (memq NIL Lst)
Hunar has quit [Ping timeout: 256 seconds]
<Regenaxer> or (find not Lst) but this is also slower than 'memq'
<Regenaxer> (filter not Lst) sounds a bit useless, as it gives a new list of only NILs
<razzy> your better
<razzy> thx
<Regenaxer> :)
<Regenaxer> The opposite is sometimes neded
<Regenaxer> needed
<Regenaxer> i.e. get all non-NIL elements
<Regenaxer> Then I do (filter prog Lst)
<Regenaxer> or better (filter bool Lst)
Hunar has joined #picolisp
rob_w has quit [Ping timeout: 240 seconds]
rob_w has joined #picolisp
Hunar has quit [Ping timeout: 256 seconds]
rob_w has quit [Remote host closed the connection]
Hunar has joined #picolisp
<Hunar> What would be an elegant/short way to do this    I have a list    (X Y Xold Yold)   I want the old xy to become the new xy   ... and at the same time the new xy increased by the difference between new and old xy ..    so turns    (100 100 90 95)   into   (110 105 100 100) .. I currently have this which I'm not happy with, I think
<Hunar> there is a much better way
<Hunar> (rot I) (rot I)
<Hunar> (conc I (list (+ (car I) (- (car I) (caddr I)))))
<Hunar> (conc I (list (+ (cadr I) (- (cadr I) (cadddr I)))))
<Hunar> (set I (head 4 I))
<Hunar> Sorry the (rot I) was suppose to come before the last line
<Hunar> (conc I (list (+ (car I) (- (car I) (caddr I)))))
<Hunar> (conc I (list (+ (cadr I) (- (cadr I) (cadddr I)))))
<Hunar> (rot I) (rot I)
<Hunar> (set I (head 4 I))
aw- has joined #picolisp
<Regenaxer> Interesting
<Regenaxer> There must be a direct, destructive, way
<Hunar> I hope :)
<Regenaxer> hmm
<Regenaxer> Let me try
<Regenaxer> For one coordinate:
<Regenaxer> (let D (- (car L) (caddr L)) (set L (caddr L)) (inc L D))
<Regenaxer> Perhaps shorter with 'xchg'?
<Regenaxer> and above is wrong :)
<Regenaxer> this one:
<Regenaxer> (let D (- (car L) (caddr L)) (set (cddr L) (car L)) (inc L D))
<Regenaxer> so analog for Y
<Regenaxer> (let D (- (cadr L) (cadddr L)) (set (cdddr L) (cadr L)) (inc (cdr L) D))
<Regenaxer> This seems correct, but I feel it can be shorter
<Hunar> My python skills made this    L[0],L[1],L[2],L[3] = 2*L[0]-L[2], 2*L[1]-L[3], L[0],L[1]      looks weird but works
<Regenaxer> ah, ok, times 2
<Regenaxer> So we get:
<Regenaxer> (xchg L (cddr L)) (inc L (* 2 (- (caddr L) (car L))))
<Regenaxer> (xchg (cdr L) (cdddr L)) (inc L (* 2 (- (cadddr L) (cadr L))))
<Regenaxer> no, second needs (cdr L) in second expr
<Regenaxer> (inc (cdr L)
<Regenaxer> I don't like the need for 2*
<Regenaxer> Telephone
<Hunar>  (xchg L (cddr L) (cdr L) (cdddr L)) :)  one line
<Regenaxer> T
<Hunar> I'm happy with your solution:)  thanks
<Regenaxer> great :)
<Hunar> One more question .. can I access   window.innerWidth  and window.innerHeigh   from javascript to make canvas dimensions as big as the window?
<Regenaxer> Later, I'm on phone
<Hunar> Ok :)
Hunar has quit [Quit: Client closed]
<razzy> Can anyone join PilCon for 40s test?
<Regenaxer> yes
<Regenaxer> works?
<razzy> not good enough, thank you
<Regenaxer> ok
<razzy> i will try to compile my own jitsi desktop
<Regenaxer> ah, cool
Hunar has joined #picolisp
<Regenaxer> Hunar, accessing window params should be possible
<Regenaxer> e.g. with 'lisp'
<Regenaxer> But perhaps not necessarily via the server?
<Regenaxer> maybe you can pass directly, if DX and DY don't need to be known on the server
<Regenaxer> (<canvas> "id" "window.innerWidth" ...
Hunar has quit [Ping timeout: 256 seconds]
Hunar has joined #picolisp
<Hunar> Sorry electricity went off.. I only need the dimensions once, then use it when drawing shapes
<Regenaxer> great
<Hunar> (rot L) (rot L) (conc (mapcar + (mapcar - (cddr L) L) (cddr L)) (cddr L))
<Hunar> this returns what I want, but doesnt set L to the result
<Hunar> I made it more readable, not sure if it's slower or faster :)
<Regenaxer> No big difference I think
<Regenaxer> the mapcar is probably the most expensive part, builds a new list and calls + repeatedly
<Hunar> I'll be back in an hour
<Regenaxer> ok
aw- has quit [Ping timeout: 240 seconds]
razzy has quit [Ping timeout: 240 seconds]
razzy has joined #picolisp
razzy has quit [Ping timeout: 250 seconds]
razzy has joined #picolisp
razzy has quit [Ping timeout: 250 seconds]
razzy has joined #picolisp
beneroth has quit [Quit: Leaving]
razzy has quit [Ping timeout: 240 seconds]
razzy has joined #picolisp
Hunar has quit [Quit: Client closed]
razzy has quit [Ping timeout: 252 seconds]
razzy has joined #picolisp
Hunar has joined #picolisp
<Hunar> I made a tabulated summary for the 6 mapping functions in pil :)    http://ix.io/3J9Q
<Regenaxer> Perfect! :)
Hunar has quit [Ping timeout: 256 seconds]
tooDumbToFleng has joined #picolisp
aw- has joined #picolisp