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
fbytez has quit [Quit: byte byte]
fbytez has joined #picolisp
alexshendi has quit [Read error: Connection reset by peer]
alexshe50 has joined #picolisp
bjorkint0sh has joined #picolisp
bjorkintosh has quit [Ping timeout: 268 seconds]
rob_w has joined #picolisp
alexshe50 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
geri has joined #picolisp
<geri> hey, what would you recommend to do to check if an executable is installed (or is in PATH)?
<geri> i usually do `command -v thing` in bash, but calling bash for this would suck
<geri> i could install which but eh
<geri> this seems to work 🤔 (find (quote (X) (= X "bash")) (mapcan dir (split (chop (sys "PATH")) ":")))
<geri> uglier but this also works (find (quote (X) (find (quote (Y) (= Y "bash")) (dir X))) (split (chop (sys "PATH")) ":")
<geri> wonder which is more efficient
<geri> nested higher order functions are kinda hard to reason about
<abu[7]> I'll look later, in a meeting now ☺
<geri> (it also needs a (fill), guess it sucks :D)
<geri> enjoy
<abu[7]> ☺
<abu[7]> Done
<abu[7]> How about (call "test" "-x" ?
<geri> the idea is to find it in PATH
<geri> its a file opener script
<abu[7]> I see
<abu[7]> So the search is chop is perhaps the best
<abu[7]> I would nest the 'find's I think
<geri> would it save time cause dir runs only as much as needed?
<abu[7]> I thought because of less list building
<geri> okay fair
<geri> also, is there some sort of prog function that sets @ on every line?
<abu[7]> 'and' comes close
<abu[7]> but not exactly what you need
<geri> original: https://0x0.st/XqUt.sh
<abu[7]> 👍
<geri> i wanted to use @ to make it so i dont need as many let clauses
<geri> but came up with this for now
<abu[7]> Good I think
<geri> btw i had a silly idea
<geri> itd be kinda fun if list functions would have implicit chop if the eval'd result was a symbol
<geri> prolly not happening cause extra checks though
<abu[7]> Right, it is a trade-off
<geri> nothing stops me from making a "library" of functions like that though :)
<abu[7]> and not so often needed I believe
<geri> its needed constantly for my needs xd
<geri> well for string stuff anyway
<geri> the second cond clause in (deduce) for example
alexshendi has quit [Read error: Connection reset by peer]
alexshendi has joined #picolisp
<geri> or Type in the let too
<abu[7]> Yeah
<geri> (btw yeah, indentation for cond is horrifying if you separate the condition to multiple lines)
<abu[7]> I feel all right with it, indenting by 6 then
<abu[7]> As 'pretty' does it too
<geri> btw this script is only a thing because of termux
<geri> xdg-open cannot open stuff with a cli editor for some reason
<geri> so i wrote this instead
alexshe76 has joined #picolisp
alexshendi has quit [Read error: Connection reset by peer]
<abu[7]> You could use 'stem' in cases like (pre? (reverse (chop "mp3" ...
<geri> like (= "mp3" (stem (chop Name) "."))?
<geri> p.s. brb in like an hour or a bit more
<abu[7]> (= '`(chop "mp3") ... iirc
<geri> or pack the result
<geri> backquote is probably faster though
<abu[7]> How do you mean "pack" here?
<geri> pack the stem call
<abu[7]> stem operates on a list
<abu[7]> ah
<abu[7]> ok
<abu[7]> This is slower
<geri> ye
<geri> aight im gone for now
<abu[7]> The pack is needed, and list comparison is faster than symbol names
<abu[7]> Ok :)
<geri> how do symbol names compare to list comparison's?
<geri> dont you need to check every element until they differ anyway?
<abu[7]> Yes, but the characters are packed in the celle in short numbers
<geri> m?
alexshendi has joined #picolisp
alexshe76 has quit [Ping timeout: 252 seconds]
<abu[7]> *cells
<abu[7]> shifting and masking the UTF-8 bytes
<geri> shouldn't it be faster then because you don't need to follow pointers?
<abu[7]> Depends on caching, but I think the pointers are faster
<geri> there
<geri> slightly neater imo
<abu[7]> T, less 'let' :)
<geri> also slightly less processing when the type can be deduced from the name itself
<geri> )
<geri> 44 vs 66 lines too
<geri> lovely
<abu[7]> ☺
rob_w has quit [Quit: Leaving]
<geri> is there a shortcut to see if symbol is nil?
<geri> there's =T, nT, but i dont see the one for nil
<abu[7]> 'not'
<abu[7]> So usually 'ifn', 'unless', 'nond' etc.
<abu[7]> I avoid 'not' if possible
<geri> why?
<geri> i only understand avoiding it when it makes more sense to use ifn/unless...
<abu[7]> Yes, that's what I mean
<abu[7]> Some people write (if (not (foo))
<geri> sometimes it can be good
<geri> but not very often
<abu[7]> or even (if (not (= NIL (foo))) !!!
<geri> especially considering nond and ifn exist in pil
<abu[7]> (if (not (foo)) can be good?
<geri> ouch
<geri> for style
<geri> sec
<abu[7]> It is of course needed in cases like (on A (not B))
<abu[7]> *(or A (not B))
<geri> i cant find it lol
<geri> it was when my if not was very small and if true was very large
<geri> not in picolisp but still
<geri> it was more readable with inverted condition
<abu[7]> ok, yes
<geri> im dipping my toes into all lisps i can find haha
<abu[7]> Good thing
<geri> my music "script" in cl compiles to a 40+ MB binary file...
<geri> its pretty fast but that hurts
<abu[7]> uh
<geri> you dump the whole cl implementation into the binary
<geri> thats why
<geri> someone really needs to make a "only take what i need" compilation type
<geri> (which is normal in literally any language that isnt cl xd)
<geri> lisps are really fun
<abu[7]> Sure :)
alexshendi has quit [Read error: Connection reset by peer]
alexshendi has joined #picolisp
alexshendi has quit [Ping timeout: 268 seconds]
alexshe55 has joined #picolisp
alexshe55 has quit [Read error: Connection reset by peer]
alexshendi has joined #picolisp
<geri> aight gone for today, enjoy the evening
<geri> (im very active in chat!)
<abu[7]> Yes, very good!
alexshendi has quit [Read error: Connection reset by peer]
alexshendi has joined #picolisp
geri has quit [Quit: ERC 5.5.0.29.1 (IRC client for GNU Emacs 29.3)]
alexshendi has quit [Quit: -a- Connection Timed Out]
alexshendi has joined #picolisp
bjorkint0sh has quit [Quit: "Every day, computers are making people easier to use." David Temkin]
z4k4ri4 has quit [Ping timeout: 268 seconds]
bjorkintosh has joined #picolisp
bjorkintosh has joined #picolisp
z4k4ri4 has joined #picolisp
alexshendi has quit [Read error: Connection reset by peer]
pablo_escoberg has joined #picolisp
alexshendi has joined #picolisp
alexshendi has quit [Read error: Connection reset by peer]
alexshendi has joined #picolisp
pablo_escoberg has quit [Quit: Client closed]
alexshendi has quit [Ping timeout: 268 seconds]
alexshe14 has joined #picolisp
alexshe14 has quit [Read error: Connection reset by peer]
alexshendi has joined #picolisp
alexshe97 has joined #picolisp
alexshendi has quit [Read error: Connection reset by peer]
alexshe97 has quit [Read error: Connection reset by peer]
alexshendi has joined #picolisp