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
chexum has quit [Remote host closed the connection]
chexum has joined #picolisp
geri has joined #picolisp
<geri> hey, is there a way to redirect stdout produced by (call) directly to a file without wrapping it in prinl and piping into (line T)?
<abu[7]> Hi geri, you can use just 'out'
<abu[7]> (in (list "printf" "| %02d.%02d.%d | %02d:%02d | %.1f | %.1f | %s | %s |\n" ...) (out "file" (echo]
<geri> okay great, minus lines
<geri> i have a little shell script for journaling something, it's 15 lines
<geri> tried to rewrite it in a few schemes and its 40-45 lines on average
<geri> 34 in picolisp
<abu[7]> Good :)
<geri> kind of a bummer even the best option is 2x in source code lines
<geri> at least i can now say for sure that i hate having separate boolean type in schemes, it makes code way uglier than cl an pil often
<geri> s/ an /and/
<abu[7]> Indeed
<abu[7]> The generality of NIL in pil is very convenient
<geri> cl has nil be the only false value and also an empty list, even though its not as radical as in pil, its very comfy
<geri> stuff like (let ((x (when y "whatever"))) ...) becomes a thing; in schemes when returns some undefined/void value if it doesnt match te condition
<geri> same as (let X (when Y ...) ...) in pil
<geri> (so many less parens!)
<abu[7]> I see
<geri> why does (match '(@Year @Month @Day) (date (date))) set all @ values to be lists of one element instead of just the element?
<abu[7]> T, it would need an extended pattern syntax
<geri> so basically to be simpler in some way?
<abu[7]> 'match' would be less simple
<geri> so i gotta explicitly set @ values to be their car?
<geri> (if i know its 1 element per thingie)
<abu[7]> Right
<abu[7]> How about using destructuring 'let'?
<geri> wait it could do that?
<geri> xd
<geri> i sense a deja vu
<abu[7]> It binds to single values
<geri> okay amazing
<geri> that's indeed what i need
<abu[7]> Great :)
<geri> also the fact that `case' just works without any need to specify keys or get a library to work with strings is very neta
<geri> neat*
<abu[7]> Is 'case' so restricted is Scheme?
<geri> in both scheme and cl case is only about matching symbols
<geri> in cl you usually use alexandria:switch and give it a string= as test to do a case statement with strings
<abu[7]> ok
<geri> in scheme i dont even know what you're supposed to do other than maybe pattern matching
<geri> found out something interesting - if you chop a string and then feed it to dirname, its gonna mutate the string youve passed
<geri> which is pretty bizzare ngl
<abu[7]> This is so for most funs which expect a string. Implicit pack.
<abu[7]> You can pass a symbol, a number or a list
<geri> implicit pack is fine
<geri> im saying itll mutate the variable you pass it if its chopped
<abu[7]> oh?
<abu[7]> How do you pass the var?
<geri> sec, trying to replicate
<geri> i think this
<geri> after the second one, X is "hello/"
<abu[7]> : X
<abu[7]> -> ("h" "e" "l" "l" "o" "/")
<geri> yes
<geri> i doubt its intended
<geri> i think it also worked for basename but let me check
<geri> no, only dirname it seems
<abu[7]> Strange
<abu[7]> dirname does not use X
<geri> m?
<abu[7]> I check later, I'm on a walk
<geri> enjoy the walk
<abu[7]> ☺
<geri> ive been going to walks at 5 am lately cause its too hot in the noon
<geri> its pretty peaceful
<geri> except for mosquitos >:(
<abu[7]> :)
<abu[7]> Hmm, I think I know! 'flip' is destructive!
<abu[7]> (chop F) returns F if it is already a list
<abu[7]> Then flip modifies it :(
<geri> aha
<geri> efficiency is destructive...
<abu[7]> T
<abu[7]> I never noticed
<abu[7]> Thanks!
<geri> contributing a bit!
<abu[7]> Yeah
<abu[7]> Walking home first
<geri> i think youre like the only person i know who could unironically fix code mid-walk :D
<abu[7]> Fix will be later ;)
<geri> not saying you should, saying people usually can't do that at all
<geri> how are your hands doing?
pablo_escoberg has quit [Quit: Client closed]
<abu[7]> 'flip' could be replaced by 'reverse' in 'dirname' and 'basename', but the current version is rather ugly I think.
<geri> like you want dirname and basename to be prettier overall?
<abu[7]> T
<abu[7]> I think about 'split'
<geri> ah
<abu[7]> let me try
<geri> thats how i get basename in bash - get thing after last slash
<abu[7]> Right
<geri> one problem - basename of /tmp/meme/1/ should be 1, but in my approach its null
<geri> so i just remove last slash in my thingie
<abu[7]> How about this? http://pb1n.de/?d3d744
<geri> looks neat
<abu[7]> At least a little smaller
<abu[7]> 21 vs 29 cells
<geri> and more accurate cause no destructive changes
<abu[7]> Yeah
<abu[7]> The old one is against the rules
<abu[7]> Now 'basename'
<geri> i wrote the exact same thing but in slightly more characters
<geri> :D
<geri> is there something like "butlast" from cl?
<abu[7]> 👍😎
<geri> its like last but the opposite way
<abu[7]> Yes, via 'tail'
<abu[7]> or (head -1 ...
<abu[7]> not 'tail'
<geri> oh they take negative numbers too, very cool
<abu[7]> Very good that you found this bug :)
<geri> )
<abu[7]> I hope the new versions work for all combinations of slashes again
<geri> they seem to so far
<abu[7]> But it looks like
<abu[7]> T
<abu[7]> Great, I will release it
<geri> 🎉
<abu[7]> > 11:45 <geri> how are your hands doing? -- No change, but I use my new keyboard instead of Penti, so I can write more relaxed (even while walking because I need only a single finger)
<geri> your keyboard
<abu[7]> Nice!
<abu[7]> The video is about building the hardware, but what are the principles?
<geri> i think there was something about how he encoded the firmware to interpret keys
<geri> i doubt its anything other than morse code though
<abu[7]> ok
<geri> sec, there was another vid where he had twice as many keys
<geri> (2 XD)
<geri> here
<abu[7]> Yes, morse code
<geri> 3 words per minute
<geri> that so funny
<geri> my silly little script
<abu[7]> Instead of '(= "." (car (chop ...' you might do '(pre? "." ...'
<geri> very nice
<geri> there's too many functions for me to know :D
<abu[7]> No hurry :)
<geri> are there any drawbacks to introducing variables with setq?
<abu[7]> What do you mean with "introduce"?
<geri> like instead of using let or use i just setq a non-existant variable
<abu[7]> On th top level it is fine, but in a function it should be named as a global (with "*" or lower-case)
<abu[7]> In a fun it might owerwrite a var in a caller
<geri> oh okay
<abu[7]> 'lint' or 'lintAll' would report such a case
<geri> okee
<geri> even shorter B)
alexshendi has joined #picolisp
<abu[7]> Perfect!
<geri> its surprisingly useful
<abu[7]> Yes, good idea to get files out of the way
<abu[7]> Unless in the home dir dotfiles are rarely used, so no conflicts
<geri> oh wait, i remembered
<geri> it used to be a shell script and mv used an -i switch to prevent overriding files
<abu[7]> So better test first with 'info'?
<geri> it'd be more performant than using mv for sure, sec
<geri> silent error is eh but its still neat
<abu[7]> T
<abu[7]> or 'quit' if conflict
alexshendi has quit [Read error: Connection reset by peer]
<geri> made it (bye 1) on conflicts
<abu[7]> ok
alexshendi has joined #picolisp
alexshendi has quit [Read error: Connection reset by peer]
<geri> how do i concatenate argv with spaces?
<geri> glue lol
<abu[7]> 👍
alexshendi has joined #picolisp
alexshe16 has joined #picolisp
alexshendi has quit [Ping timeout: 260 seconds]
<geri> what was the name of the function to do a thing N times?
<geri> im p sure ive seen something like this in the reference
<abu[7]> (do 7 ...
<geri> that, thanks
alexshe16 has quit [Read error: Connection reset by peer]
alexshendi has joined #picolisp
<geri> is there something like break or continue to get out of loops?
<abu[7]> Yes, a T or NIL clause
<geri> wait how does that work?
<abu[7]> It is interpreted especially
<abu[7]> so not a function
<abu[7]> The T or NIL must be on the top level
<abu[7]> Else use catch/throw
<geri> oki
<geri> thanks
<abu[7]> ☺
<geri> oh i can also de my options directly
<geri> like if my script has a "-e" switch, i can just (de "-e" ... and then directly call the symbol that was passed
<geri> ... via cli
<geri> thats cool
<abu[7]> T, but (de -e needs --e as option
<abu[7]> (de e is not so good as 'e' is already defined
<geri> if you call pil directly via cli, this is a script though and doesnt seem to touch my argv
<geri> (why is e already defined xd)
<geri> something about debugging
<abu[7]> Only in debug mode
<geri> okay
<abu[7]> e
<abu[7]> T
<geri> docs for e lack the legendary "(Debug mode only)" messsage
<abu[7]> oh
<abu[7]> Ah, it is built-in
<abu[7]> (vi 'e)
<geri> so it always works?
<abu[7]> Yes, in breakpoints
<abu[7]> via '!'
<geri> im yet to learn the debugger
<geri> im shamelessly using external commands in my scripts cause not using them makes scripts way larger than id like
<geri> B)
<abu[7]> ☺
<abu[7]> Sorry, bbl
<geri> laters
<abu[7]> ret
<geri> carriage has returned
<abu[7]> Yay
<geri> )
<abu[7]> I thought so :)
<tankf33der> hi all
<abu[7]> O/ tankf33der!
<tankf33der> abu[7]: about coroutine issue
<abu[7]> The mail?
<geri> hihi
<tankf33der> yeap
<tankf33der> what if stack size and old pil version?
<abu[7]> I thought that too. There was no stack error message in older versions
<abu[7]> But this code uses only little stack
<abu[7]> -> ((masterOut . 61)
<tankf33der> so you run it
<abu[7]> yes
<tankf33der> ok
<abu[7]> also with 000 added
<abu[7]> Coroutines were buggy in prev versions
<tankf33der> i've got no errors
<abu[7]> Good
<tankf33der> very fast, nothing special.
<tankf33der> not 000, but one zero
<tankf33der> both versions run 1sec
<abu[7]> ok
<tankf33der> ok
<tankf33der> afk.
<abu[7]> cu
<geri> gotta go too, enjoy the evening
<abu[7]> GooG night geri!
<abu[7]> * Good ;)
geri has quit [Quit: ERC 5.5.0.29.1 (IRC client for GNU Emacs 29.3)]
fuxoft has joined #picolisp
pablo_escoberg has joined #picolisp
<fuxoft> Hello, I seem to have problems with receiving picolisp mailing list emails. I've subscribed, I've sent the question, I see the reply to my question in the list webarchive, but I've received ZERO actual emails (not even the subscription confirmation). The emails are definitely not in my Spam folder and I don't even see them in incoming emails log (I
<fuxoft> am using forwardemail.net).
<fuxoft> Or are emails intentionally delayed, e.g. sent only once a day?
<abu[7]> No, should arrive after a few minutes
<abu[7]> You checked the spam folder I presume?
<fuxoft> Yeah, I even checked the SMTP logs of forwardemail.net
<abu[7]> strange
<fuxoft> The emails are being received by forwardemail.net and forwarded to my GMail inbox. They never even arrive to forwardemail. Testing email from elsewhere arrived OK.
<abu[7]> EMail is nasty :(
<abu[7]> It was yo
<abu[7]> oops
<abu[7]> It was you asking about the coroutine?
<abu[7]> BBL in one or two hours
<fuxoft> Yes
<fuxoft> It was me about the coroutine. Probably because I was using the older picolisp included in my Linux distro
<fuxoft> But the email not working is the bigger problem :/
<fuxoft> The crash happened in picolisp version (23 2 8)
<fuxoft> The crash happened in picolisp version ( 23 2 8 )
bjork1intosh has quit [Quit: "Every day, computers are making people easier to use." David Temkin]
bjorkintosh has joined #picolisp
bjorkintosh has joined #picolisp
fuxoft has quit [Quit: Client closed]
alexshe96 has joined #picolisp
alexshendi has quit [Read error: Connection reset by peer]
alexshe96 is now known as alexshendi
<abu[7]> ret
<abu[7]> As we said, coroutines improved a lot last yean (a lot due to tankf33der's testing), so it was a bug which is fixed meanwhile
<abu[7]> s/yean/year
fuxoft has joined #picolisp
fuxoft has quit [Client Quit]
alexshe36 has joined #picolisp
alexshendi has quit [Read error: Connection reset by peer]
alexshe36 has quit [Read error: Connection reset by peer]
alexshendi has joined #picolisp
alexshendi has quit [Read error: Connection reset by peer]
alexshendi has joined #picolisp