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
beneroth has quit [Read error: Connection reset by peer]
beneroth has joined #picolisp
ygrek has joined #picolisp
alexshe80 has quit [Read error: Connection reset by peer]
ygrek has quit [Remote host closed the connection]
alexshendi has joined #picolisp
geri has joined #picolisp
<geri> hoii
<geri> judge me harshly (but not too harshly!)
<geri> still gotta think how do i replace $HOME with ~ prettily in subproject
<geri> i know that `(not *Dbg) is a bit faster cause it reads as an eof but its prettier like that with not that big of an impact
<abu[7]> The issue is not about being faster, but reading symbols which might otherwise pollute the namespace (e.g. if the rest of the file has (de debugFuns ...
alexshendi has quit [Ping timeout: 258 seconds]
<geri> well, that's not a problem here cause it just runs the thing and bye's
<abu[7]> Yes, just for the records
<geri> any idea how do i substitute $HOME for ~ optionaly in subproject function?
<abu[7]> You want to avoid ~ hardcoded in the pathes?
<abu[7]> How about using 'chdir'?
<geri> no, (ls) prints full paths to the files, i want to grab stdout and replace all instances of /home/geri with ~
<geri> i do want to unhardcode ~, but that's a. later and b. supposed to link to stuff like $XDG_CONFIG_HOME and the rest
<geri> and c. maybe i wont do cause its very ugly
<geri> :D
<abu[7]> ah
<abu[7]> Vip does that
<abu[7]> iirc makes relative pathes whenever possible, forgot the details
<abu[7]> vip~fName ?
<geri> hmm
<geri> (pipe
<geri> (prinl "/home/geri/hello.txt")
<geri> (out '("sed" "s#/home/geri#~#")
<geri> (echo)))
<geri> well this kinda seems to work
<abu[7]> sed is a bit overkill
<geri> i have a lot of lines to process
<geri> at least 111
<abu[7]> just chop and nth with length of HOME
<geri> wont it be slower though?
<abu[7]> A forked process is a lot slower
<geri> okay, lets see
<geri> (de subproject-pretty (Name)
<geri> (pipe
<geri> (subproject Name)
<geri> (while (line T)
<geri> (prinl "~" (nth (chop @) `(inc (length HOME)))))))
<geri> now to "benchmark"
<geri> 0.018-0.034s for sed, 0.016-0.034s for while read
<geri> fair enough
alexshendi has joined #picolisp
<abu[7]> I meant 'pipe' vs. 'nth'
<geri> ls returns stdout
<geri> thats why pipe
<geri> (except i didnt get it anyway i think)
<abu[7]> Seems I misunderstood what you want to do
<geri> grab all stdout generated by git + prinl and switch $HOME to ~
<geri> i use subproject subcommand in emacs to quickly jump to files in my configs and termux has $HOME be billion characters long
<geri> hence the ~ replacement
<abu[7]> (pack (nth (chop (path File)) (length HOME))) or similar
<abu[7]> Perhaps also 'realpath'
<abu[7]> like ie vip~fName
<geri> well, it works and is similar-ish way already, just grabbing stdout first
<geri> so i guess question resolved xd
<abu[7]> OK, if speed is not an issue
<geri> not an issue but is nice to have
<geri> basically, (subproject) returns stdout - paths to files that are related to a particular thing, like emacs or my scripts
<geri> and subproject-pretty should just substitute $HOME in stdout to be a tilde instead
<abu[7]> ok
<geri> idk if theres anything else i could optimize there
<abu[7]> (let Path (or Path HOME) could be (default Path HOME)
<abu[7]> avoiding a bind with 'let'
<geri> less indentation, nice
<geri> i even use backquote whenever calculating constants!
<geri> its such a nice feature
<abu[7]> if `*Dbg, the whole (de main ..) can be avoided
<geri> its useful for debugging if something in my case statement is broken
<abu[7]> switching on *Dbg later?
<geri> no like the (case (arg 1) ...) part
<abu[7]> Then *Dbg is off and main is there
<abu[7]> I meant `(not *Dbg) of course
<geri> for some reason i have "git" as a case option in there xd
<geri> main is always there, yeah
<geri> if im not debugging its getting called and script dies
<geri> if im debugging its there for me to debug
<abu[7]> se
<abu[7]> Good
<geri> original
<geri> very ugly!
<abu[7]> T
<geri> :D
<geri> i like the alist with subproject files that resolves properly
<geri> its neat
<abu[7]> (cdr (assoc Name Subpr... could be (get Name Subpr...
<abu[7]> is also faster
<geri> ah okay
<geri> i was confused about it at some point when writing a lisp interpreter in pil :D
<abu[7]> Works because the keys are internals
<abu[7]> ie. 'asoq'
<geri> actually it returns nothing for some reason
<geri> :(
<abu[7]> Must go ...
<geri> laters?
<abu[7]> Yes, cu :)
geri has quit [Remote host closed the connection]
alexshendi has quit [Quit: -a- Connection Timed Out]
alexshendi has joined #picolisp
alexshendi 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
rob_w has joined #picolisp
f8l has joined #picolisp
alexshe46 has joined #picolisp
alexshendi has quit [Ping timeout: 252 seconds]
ygrek has joined #picolisp
ygrek has quit [Remote host closed the connection]
ygrek has joined #picolisp
ygrek has quit [Ping timeout: 260 seconds]
taleon has quit [Ping timeout: 252 seconds]
taleon has joined #picolisp
alexshe46 has quit [Ping timeout: 260 seconds]
f8l has quit [Ping timeout: 255 seconds]
rob_w has quit [Quit: Leaving]
lagash has quit [Remote host closed the connection]
lagash has joined #picolisp