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
aw- has joined #picolisp
razzy has quit [Ping timeout: 245 seconds]
razzy has joined #picolisp
beneroth has joined #picolisp
hunar has joined #picolisp
<hunar> Good Morning :)
<Regenaxer> Cheers hunar!
<Regenaxer> Back at work?
<hunar> Yes
<hunar> I noticed something in the canvas when using WSL.. when I view source on the webpage it contains three .js files canvas/plio/form and when I try to open them the address bar becomes about:blank#blocked while if the server was running in linux it would open the .js file
<beneroth> good morning hunar, Regenaxer :)
<beneroth> hunar, good find
<Regenaxer> This seems similar to the missing images yesterday
<Regenaxer> Hi beneroth!
<beneroth> hunar, maybe this brings more light to the WSL issue? https://abdus.dev/posts/fixing-wsl2-localhost-access-issue/
<beneroth> "Everytime a WSL instance restarts, it gets a new IP address"
<beneroth> so not a security "feature" but a routing problem, maybe?
<beneroth> or mix of both
<Regenaxer> I think here we addressed only localhost
<beneroth> yeah from the article: "Localhost redirection often fails for some reason, such as when PC sleeps and wakes up, and localhost access to Linux services does not work anymore."
<beneroth> though some requests working and some not sounds more like overblocking. or faulty caching.
<hunar> Wait, I can open the file with http://localhost:8000/@lib/canvas.js but not with the link at the webpage's source which is http://localhost:DESKTOP-UDFDT74/@lib/canvas.js
<Regenaxer> Never seen such port identifier
<hunar> The linux server keeps the port the same, but windows replaces it with the computer name or somehting
<beneroth> hahaha, sounds like MS inventing their own stupid standards once more
<hunar> Which part of the process is responsible for that DESKTOP-UDFDT74 replacement?
<beneroth> windows WSL something-special
<Regenaxer> I think the server will not see it
<beneroth> this is not normal networking, not normal HTTP proxying
<Regenaxer> Perhaps it can be disabled?
<beneroth> use the IP of the WSL instance instead of localhost, see in my link. I think you can run "ip -4 addr show eth0" from within the WSL instance (even from the server picolisp code, if you use the (in 'lst ...) mechanism)
<hunar> It didn't load the page
<hunar> I also tried 127.0.0.1 and my local ip .. both opened the page but not the canvas
<hunar> I can't reproduce the steps in the link, it shows curl: (7) Failed to connect to 169.254.52.24 port 8081: Connection refused
<hunar> Python sais Serving HTTP on 0.0.0.0 port 8081 (http://0.0.0.0:8081/) and the ip from ip -4 addr show eth0 is 169.254.52.24
<razzy> hmm, why i cannot (conc A '(b c)) if A is NIL or only one value?
<razzy> Good morning i wish to all! :]
<Regenaxer> Good morning razzy!
<Regenaxer> 'conc' *does* work with NIL
<razzy> not in my pil21 with fresh unasigned symbol.
<Regenaxer> : (conc NIL (1 2))
<Regenaxer> -> (1 2)
<Regenaxer> Voila
<Regenaxer> Please *think* about the cell structures
<Regenaxer> What do you expect?
<Regenaxer> If you pass no cell, then there *is* no cell that can be modified
<Regenaxer> What is relevant is the return value
<Regenaxer> We discussed this in PilCon, e.g. 'flip' and 'sort', right?
<razzy> Regenaxer: is my example ok? https://termbin.com/4nw2
<Regenaxer> 'A' is irrelevant
<razzy> meaning?
<Regenaxer> Arguments are evaluated, so 'conc' gets NIL
<Regenaxer> No matter where it comes from
<Regenaxer> And no matter of which Lisp version ;)
<razzy> i see, thx
<razzy> Regenaxer: the conc was my last option. I want to read file of random chars into list. (in "out" (while (char) (chop @))) I was hoping to cons all chars into fresh list.
<Regenaxer> 'conc' can be used, but (setq A (conc A (foo))). But this is inefficient, because 'conc' traverses the whole list each time to find the end.
<Regenaxer> The right way to go is 'make' and 'link'
<Regenaxer> (in "f" (make (while (char) (link @]
<Regenaxer> BTW, (while (char) (chop @)) 'chop' makes no sense on single chars.
<razzy> yep, only way i know how to encapsulate.
<Regenaxer> encapsulate?
<razzy> char into ""
<Regenaxer> 'chop' does not make a ""
<razzy> i never liked make and link
<Regenaxer> If you mean encapsulate into a list, use 'list' or 'cons'
<Regenaxer> Anyway concatenating to a list in a loop is a bad idea. if the list is 2000 items, you traverse it one million times
<Regenaxer> all of them like 'conc', 'append' or 'queue'
<Regenaxer> Why do you dislike 'make'?
<razzy> Regenaxer: i understand. but my main bottleneck is my human head. so i will not optimise until needed.
<Regenaxer> ok, good
<hunar> Would (setq A (foo A)) and (setq A (reverse A)) be more efficient in Pil? I saw this in CL before
<hunar> sorry wrong code
<hunar> (setq A (cons foo A))
<razzy> Regenaxer: make and link seem complicated.
<Regenaxer> hunar, (cons foo A) consing the value of 'foo'?
<Regenaxer> razzy I feel 'make' very easy
<Regenaxer> (make (link 1) (link 2))
<hunar> Adding the new foo to the front of the list A to prevent traversing through all the list, then reversing it at the end
<Regenaxer> ah, yes
<Regenaxer> But not 'reverse' then. 'flip' is better
<Regenaxer> (while (foo) (setq A (cons @ A))) (flip A)
<Regenaxer> Still 'make' is a *lot* more efficient, as less function calls
<Regenaxer> (make (while (foo) (link @)))
<hunar> Aha, reverse is copy :D got it
<Regenaxer> yes
<Regenaxer> 'flip' is NCONC in CL
<Regenaxer> no
<Regenaxer> NREVERSE
<Regenaxer> (I think)
<Regenaxer> Because Pil is interpreted, the plain number of function calls is the deciding factor
<Regenaxer> Function calls have overhead (more than in compiled code)
<Regenaxer> But sometimes I do indeed 'cons' a list
<Regenaxer> usually with 'push'
<Regenaxer> and then 'flip' in the end
<Regenaxer> Also with 'sort', instead of passing a sort function which gives reverse order, I just do (flip (sort ..))
<Regenaxer> : (by - sort (3 1 2 7 4))
<Regenaxer> -> (7 4 3 2 1)
<Regenaxer> : (flip (sort (3 1 2 7 4)))
<Regenaxer> -> (7 4 3 2 1)
<hunar> Cool :) thanks
<Regenaxer> Probably slowest is:
<Regenaxer> : (sort (3 1 2 7 4) >)
<Regenaxer> -> (7 4 3 2 1)
<Regenaxer> because many calls to '>'
<hunar> I think I had the same problem with python before, you always try to use the most functionality of the language instead of figuring it out with longer code that you already know
<Regenaxer> T
<hunar> Fortunately Pil is not as complicated as CL and i can (probably) memorize all the functions
<Regenaxer> true, at least the most useful ones
<hunar> In CL you always find something that you never saw before .. no matter how many months you've been programming
<Regenaxer> It is huge
<Regenaxer> CL means "Complex Lisp"
<hunar> :D
<hunar> Do you have a number of how many functions exist in Pil, approximately
<Regenaxer> I did not check recently. But easy, moment
<Regenaxer> ~/pil21 bin/picolisp
<Regenaxer> : (length (filter getd (all)))
<Regenaxer> -> 384
<Regenaxer> ~/pil21 bin/picolisp lib.l
<Regenaxer> : (length (filter getd (all)))
<Regenaxer> -> 447
<Regenaxer> $~/pil21 ./pil +
<Regenaxer> -> 651
<Regenaxer> : (length (filter getd (all)))
<Regenaxer> Ah, better is of course (cnt getd (all))
<Regenaxer> :)
<Regenaxer> My own rule, avoid buiding unnevessary lists ;)
<hunar> Thanks for the code :)
<hunar> I once found a way to get all the functions & macros in CL , i got 22 pages each containing 40 to 50 names, that is 1000+
<Regenaxer> wow
razzy has quit [Ping timeout: 252 seconds]
<Regenaxer> And I suspect the the above CL setup includes neither a Database nor Prolog ;)
<Regenaxer> And interprocess communication or native calls are available via separate libraries (?)
<hunar> Yeat no database or anything, and native calls with ffi library .. and it doesn't contain all the magic keywords inside macros like the (loop for https://www.reddit.com/r/Common_Lisp/comments/p6ookm/i_made_a_high_quality_copy_of_periodic_table_of/
<hunar> yeah*
<beneroth> :)
<beneroth> bbl
beneroth has quit [Quit: Leaving]
<hunar> Noticed another thing, my WSL bash is like this hunar@DESKTOP-UDFDT74: so that's where DESKTOP-UDFDT74 came from
razzy has joined #picolisp
razzy has quit [Ping timeout: 240 seconds]
<Regenaxer> looks like
razzy has joined #picolisp
beneroth has joined #picolisp
cyborg_ar has left #picolisp [WeeChat 2.3]
<hunar> Ok, I solved it with a cheat :D I changed the hostname of my ubuntu in WSL to 8000 by following this website https://www.srccodes.com/change-hostname-ubuntu-microsoft-windows-subsystem-for-linux-wsl-wsl2-wsl-conf-unable-resolve-hosts-name-service-not-known-list-running-shutdown-vm-srccodes/ and now the canvas is shown
<Regenaxer> haha, cool
<hunar> Regenaxer, since we can easily get the list of Pil keywords/functions, is it hard or easy to implement syntax highlighting in Vip?
<Regenaxer> I think it is not a good idea in Lisp, as there are no keywords. All depends on the dynamic meaning, but the text is static
<Regenaxer> Technically in Vip not difficult
<Regenaxer> in 'markup' perhaps
<Regenaxer> Currently only strings and comments
<Regenaxer> : (vi 'vip~markup)
<hunar> No problem :)
<razzy> ./pil + , (all) shows 960 symbols. i remember few years back 700+ symbols. I think there should be rule: only less than 100 symbols allowed in base system. (hide it in system namespaces, external function libraries.)
<hunar> I can live without syntax highlighting :) but there are two things that I don't like :/ when I press backspace on an empty line I cant delete the line, and when I press enter I have to tab myself to get the indentation
<Regenaxer> Auto-indent
<Regenaxer> Also something I do not like
<hunar> why :/
<hunar> I like to have a button that goes through all the s-expressions and replaces them with the output of pp
<hunar> Oh there is :) by pressing comma , on the first opening (
<Regenaxer> It confuses me if the editor jumps around
<Regenaxer> And I usuall input code not in order
<Regenaxer> the lines
<Regenaxer> yes, comma indents
<Regenaxer> but not like pp
<Regenaxer> would be nice, and there is pilPretty as a script, but it loses read macros and comments
<Regenaxer> so I rarely use it
<hunar> I see
<beneroth> nice solution hunar :)
<hunar> thanks :)
<beneroth> Regenaxer, I syntax highlighting conforming to the naming conventions would be good
<beneroth> *think
<hunar> Regenaxer. when in Vip If I have a text\n\ntext and my cursor is on the first letter of first text, and press cw only the text should be removed for replacement, but in vip the following newlines are also removed .. is this normal behavior?
<Regenaxer> Yes, the w combinations behave difherently from vim
<Regenaxer> in fact, it is a bit irregular in Vim, Vip follows a more constent rule
<Regenaxer> to change a word, either ce or cTAB is recommended
<hunar> I don't understand :/ In vim cw is (change word) the newline is not part of a word so its not deleted
<Regenaxer> The rules for c[hange], d[elete], y[ank] are based on the move commands
<Regenaxer> That is, they apply *including* the position where move would go
<Regenaxer> ctx is change till x, so 1 char before that
<hunar> Ah I see what you mean :)
<Regenaxer> cfx is change find, so including
<Regenaxer> yeah, Vi behaves a bit strange here
<Regenaxer> TAB here is new in Vip
<Regenaxer> it moves before the next word, like w minus 1
<Regenaxer> so I use it most
<hunar> Cool :D now it makes sence
<hunar> sense*
mario-goulart has quit [Read error: Connection reset by peer]
<Regenaxer> :)
<Regenaxer> In the beginning I needed some time to get used to it ;)
mario-goulart has joined #picolisp
hunar has quit [Ping timeout: 256 seconds]
hunar has joined #picolisp
aw- has quit [Ping timeout: 250 seconds]
<hunar> (scl 3)
<hunar> (setq i 120 j 45)
<hunar> ((- (*/ (* i 1.) 1. 60.) 60.) . (- (*/ (* j 1.) 1. 22.5) 22.5))
<hunar> Segmentation fault (core dumped) :/
<Regenaxer> ((- (*/ (* i 1.) 1. 60.) ... evaluates to a function pointer
<Regenaxer> probably not an existing function ;)
<hunar> Oh, I wanted a cons cell
<Regenaxer> : '(`(- (*/ (* i 1.) 1. 60.) 60.) . ...) ?
<hunar> I will use the cons function instead :D
<Regenaxer> ok :)
<Regenaxer> But this would work:
<Regenaxer> -> (7 . 12)
<Regenaxer> : (`(+ 3 4) . `(* 3 4))
<hunar> I know '() and '(`()) but didn't use `()
hunar has quit [Quit: Client closed]
hunar has joined #picolisp
<hunar> What does ` alone do? I understand this '(im not evaluated `(except me))
<Regenaxer> yes, it evaluates the following expression at read time
<Regenaxer> So it is always "alone"
<beneroth> read time = during parsing of source code into binary representation in memory
<beneroth> so only once during (load)
<beneroth> primarily used as syntax sugar, so you can evaluate something in source, ending up hardcoded but in more readable form than hardcoded
<Regenaxer> T
<beneroth> backtick read-macro is also usable for modifying the parsing, of course, but better be sure to what extent you want to play that metagame
<Regenaxer> So this is different from CL backquote function
<beneroth> how is backquote in CL?
<Regenaxer> Note that in CL it is a function
<Regenaxer> It is almost the same as 'fill' in Pil
<Regenaxer> semantically
<beneroth> ok
<Regenaxer> `(a b ,c d) is (fill '(a b c d) 'd)
<Regenaxer> or (fill '(a b @C d))
<hunar> From CL to Pil it is `(1 ,(+ 1 1) ,@(list 3)) => '(1 `(+ 1 1) ~3) = (1 2 3)
<hunar> From CL to Pil it is `(1 ,(+ 1 1) ,@(list 3)) => '(1 `(+ 1 1) ~(3)) = (1 2 3)
<Regenaxer> Right, but the difference is CL does it at runtime and Pil at readtimes
<Regenaxer> So `(1 ,(foo) ,@(list (bar))) is in Pil (let @X (foo (fill (1 @X ^(list (bar))))))
<Regenaxer> I mean:
<Regenaxer> (let @X (foo) (fill (1 @X ^(list (bar)))))
<Regenaxer> Does CL have read macros in that sense?
<Regenaxer> Really evaluating at *read* time?
<Regenaxer> I don't remember
<hunar> I'm not qualified to answer that question :/ but CL can do crazy stuff, like letting you time (1+3*(4-5)) i.e infix notation, i guess that's read macro
<hunar> type*
<Regenaxer> ok
<hunar> With a library of course :)
<Regenaxer> yeah
<Regenaxer> In Pil too (library)
<Regenaxer> '(infix '(1+3*(4-5)))
<Regenaxer> or 'prefix' better
<hunar> Oh :D that is cool
<hunar> Sorry but I still didn't understand your reply to my other question.. basically what is the difference between `(+ 1 2) and (+ 1 2) why the second one was treated as a function
<Regenaxer> iirc there was a rosetta task for that
<Regenaxer> The result is the same
<Regenaxer> But ` is executed at read time
<hunar> Is read time before the function creation or after
<Regenaxer> before
<Regenaxer> any data, not just functions
<Regenaxer> $: (de f () `(* 3 4))
<Regenaxer> -> f
<Regenaxer> : (pp 'f)
<Regenaxer> 12 )
<Regenaxer> (de f NIL
<Regenaxer> -> f
<hunar> I think i understand now :)
<Regenaxer> :)
<Regenaxer> The dot in 1.0 is also a kind of read macro
<Regenaxer> The reader parses 1000000
<Regenaxer> And the normal quote ' too
<Regenaxer> 'a is read as (quote . a)
<Regenaxer> so 'quote' is the internal function
<Regenaxer> Just invisible normally, because printing outputs ' when it sees (quote ...
<Regenaxer> : ''(quote . A)
<Regenaxer> -> ''A
<Regenaxer> $: (quote quote quote . A)
<Regenaxer> -> ''A
<Regenaxer> : (quote . (quote . (quote . A)))
<Regenaxer> -> ''A
<Regenaxer> ' is the only read macro which is reversed at print time I think
<hunar> Thanks :D
<Regenaxer> In CL the read time is not so clearly to see perhaps, cause the compiler runs immediately and expands macros etc.
<Regenaxer> the distinction between reading and evaluating blurs in my feeling
<Regenaxer> But in Pil it is very clear
<hunar> Yeah
<Regenaxer> Read, then eval, and perhaps print ;)
<hunar> New unrelated question :) What is the fastest WordPerMinute that people did with the penti keyboard .. I tried it afew times and got very confused, i couldn't reliably backspace, or backspace quickly so i didn
<hunar> i didn't try learning further
<Regenaxer> Hard to answer
<Regenaxer> For me too it varies a lot, depending on my position
<Regenaxer> But in any case it is slower than a touch~type keyboard
<Regenaxer> You see about what I write here
<Regenaxer> It is my normal Penti speed
<hunar> Ooo that's pretty fast :) I didn't know you were using it here..
<Regenaxer> I use it *always* :)
<Regenaxer> also for programming
<Regenaxer> and always on this Smartphone
<hunar> Did you find it usable on phones, or you're using tablet
<Regenaxer> I first used only a tablet
<Regenaxer> but then I did not find a good tablet and bought a qhone
<Regenaxer> OnePlus 6T
<Regenaxer> You notice that Vip can scroll very good horizontally
<Regenaxer> e.g "z" and "Z"
<Regenaxer> that's for the phone screen
<hunar> ~1 inch bigger than my phone's screen
<Regenaxer> oh, ok, so a bit small
<Regenaxer> Depends your hand size
<hunar> Yeah, my fingers are slim but the circles on the phone screen sometimes touch each other
<Regenaxer> They always touch
<Regenaxer> it allocates them this way
<Regenaxer> ie. max size
<Regenaxer> For me 5 inch would be the absolute minimum
<hunar> Right :/ I didn't notice
<hunar> How do you backspace repeatedly
<Regenaxer> Arpeggio middle + index
<Regenaxer> then the repeat button
<hunar> The repeat button is the 6th finger?
<Regenaxer> yes
<hunar> I'll try :D
<Regenaxer> middle finger placed down
<Regenaxer> good :)
<Regenaxer> I can exblain on PilCon perhaps
<hunar> Oooo that's much better
<Regenaxer> *ex
<Regenaxer> *explain
<hunar> It'll be cool to see :D
<hunar> Along with the youtube recording ;)
<Regenaxer> I use scrcpy to display the phone on shared screen
<Regenaxer> yeah ;)
* beneroth confirms Regenaxer typed quicker with penti than standard layout when he saw some years ago ;-)
<beneroth> Regenaxer works truly "mobile first" hehe
<Regenaxer> The advantages outweigh the disadvantages
<Regenaxer> always at hand
<Regenaxer> vs small screen
<Regenaxer> I'm hoping for the foldables becoming cheaper and more reliable
<beneroth> the samsung foldable got some pretty good reviews, seems to be durable
<Regenaxer> good
<Regenaxer> the second attempt :)
<Regenaxer> The first was a failure
<hunar> I'll start practicing on my spare times :) although I usually type in my language which has 34 letters
<beneroth> I've found penti quite good for typing on tablet, but still don't use it for programming
<Regenaxer> oh, too much for 5 fingers :(
<Regenaxer> is it cyrillic?
<Regenaxer> cool
<hunar> Oh, I have some work to do .. I'll have to go now :/ good bye everyone :D
<Regenaxer> See you!
hunar has quit [Ping timeout: 240 seconds]
peterhil has quit [Ping timeout: 252 seconds]
<beneroth> bbl
beneroth has quit [Quit: Leaving]
hunar has joined #picolisp
hunar has quit [Ping timeout: 250 seconds]
hunar has joined #picolisp
<cess11> i've used penti almost exclusively on handhelds for a few years
<cess11> it's quite nice with the tmux arpeggio, and once it's learned one just doesn't want to go back for ergonomical reasons
<cess11> took a few weeks for me to become fluent with it, now i'm much faster with it than qwerty software keyboards
hunar has quit [Quit: Leaving]
beneroth has joined #picolisp
clacke has quit [Remote host closed the connection]
wineroots has quit [Remote host closed the connection]
beneroth has quit [Quit: Leaving]
mario-go` has joined #picolisp
mario-goulart has quit [Ping timeout: 240 seconds]
aw- has joined #picolisp
cess11 has quit [Ping timeout: 240 seconds]
cess11 has joined #picolisp