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
theruran has joined #picolisp
<geri> it's such a small thing, not having to write if elif elif ..., but i love lisp's cond
chexum has quit [Remote host closed the connection]
chexum has joined #picolisp
<abu[7]> Yeah, cond is simple and beautiful
rob_w has joined #picolisp
<geri> )
<geri> iirc in original lisp paper there was cond but not if
<abu[7]> Right
<abu[7]> setq and cond were "special forms" or so
<geri> actually i dont remember if there was setq at all
<abu[7]> Me neither
<geri> i thought it came to be for practical reasons - cause everyone would use (set (quote Thing))
<abu[7]> T
<geri> (set (quote x) 5), so it became (setq x 5)
<geri> taht
<geri> that*
<geri> is there a "not member" function, like nond or ifn?
<abu[7]> no
<geri> oke
<geri> ill use (not (member ...)) with no sense of shame thne
<abu[7]> all right :)
<geri> its really hard to make let and cond indentation look good for multiline variables/conditions
<geri> lonely paren looks jarring but variables look fine
<geri> cause otherwise it looks like B is a function call
<abu[7]> Better do it like 'pretty'
<geri> wellyeah
<geri> its a tad ugly though
<geri> well, so is this honestly :D
<geri> but for that ugliness, picolisp has consistent indentation rules
<abu[7]> oops, last line wrong ;)
<geri> i actually added a let for basename but never used it
<geri> having variable name be on separate line is nice honestly
<geri> then pack is has standard formatting
<abu[7]> There is no perfect style
<geri> yeah
<geri> what other lisps have sometimes just makes code indent too far
<geri> cause elisp has very long function names, i gotta have function name on new line everywhere to not go over my 80-somethingcolumns
<geri> well, i can change it slightly but still
<abu[7]> indeed
<geri> arguments aligning one under another can be painful
chexum has quit [Read error: Connection reset by peer]
chexum has joined #picolisp
pablo_escoberg has joined #picolisp
<pablo_escoberg> the above discussion reminds me how critical color is to my code reading.  It also reminded me that it's time to get more serious about `vip`.  There were a few sample viprc's on the site somewhere, including a silly one that change parenthesis colors on every key press.  I'm having a hard time finding these.  Can someone point me to them?
<abu[7]> Hmm, I don't remember where this was
<pablo_escoberg> ah, hell.  I'll figure it out another way.  thanks anyway.
<abu[7]> 👍
pablo_escoberg has quit [Ping timeout: 250 seconds]
<geri> im wondering, what's the most meta piece of code youve written as part of picolisp? :D
<geri> like metaprogramming
<geri> or ig not as a part but using picolisp
<abu[7]> Perhaps @src/lib/llvm.l ?
<geri> writing the language in itself is rpetty meta, yeah :D
<geri> in my bash file opener i have a loop that sets functions using eval
<geri> i dont need to do it at all in picolisp cause it has loops but if i do it the same way it doesnt even require any evals
<geri> its just naturally more meta if that makes sense
<geri> (not loops but lists*)
<abu[7]> Good to have such freedom
<geri> yeah
<geri> eval is so powerful, but when you dont need it to do what you need to do elegantly thats even better
<geri> how are you supposed to use @lib.l alongside your own libraries?
<geri> like you said position of @ is based on the first argument you pass to picolisp interpreter
<geri> so if i want to use picolisp libs alongside my own i cant use @ for both, right?
<abu[7]> You mean loading something else *instead* of lib.l?
<geri> alongside
<geri> i could use full paths but thats ugly
<geri> or make my own pil wrapper that defines a "load-a-module-of-mine" function
<abu[7]> You can put a symbolic link into the installation dir
<abu[7]> or that, yes
<abu[7]> I always use local pathes
<geri> like "/home/abu/path/to/libfile.l" ?
<abu[7]> (load "app/lib.l")
<geri> oh, like relative paths
<abu[7]> I avoid absolue ones
<geri> i guess i could do it if i treat picolisp scripts as a separate project
<geri> like in it ill have lib.l with all my useful funcs
<abu[7]> I want to be able to use several pil installations in parallel
<geri> cause youre developing it :D
<abu[7]> Not only
<abu[7]> For example, I needed pil32 for a while
<abu[7]> or pil64
<geri> what for?
<abu[7]> Legacy apps
<geri> there are incompatabilities between the rewrites?
<abu[7]> A lot to pil32, but a few also to pil64
<geri> any examples? im curious
<abu[7]> @doc/diff
<geri> oki
<abu[7]> Seems no longer in the relase
<abu[7]> sec
<geri> yeah, was boutta say
<abu[7]> Then I used a @lib/compat.l
<abu[7]> A kludge though
<geri> - 'pil' is not needed
<geri> that sounds so sad
<abu[7]> Haha, yes
<geri> supporting legacy is always a cludge
<abu[7]> You could ask beneroth, I think he still uses pil64 in some cases
<geri> that's from index for "common lisp the language"
<abu[7]> 1-971 ☺
<geri> yes!
<geri> the irony is very strong
<abu[7]> pragmatism
<geri> totally :D
<geri> does relative load work from the path to script or from $PWD when starting it?
<abu[7]> From PWD
<geri> hm
<geri> so if my script is in $PATH itll not work properly?
<abu[7]> PATH doen not matter, but PWD when calling it
<geri> im talking about path cause for example in bash
<abu[7]> (if you do relative loads)
<geri> if i have a script called that and call it with bash from ~ like "script -somearg"
<abu[7]> So built-in is only @
<geri> will it fail to load the lib file if it was loaded as (load "lib.l"), thinking lib.l is in the same directory as the script itself?
<abu[7]> yes
<geri> ouch
<geri> a wrapper to (load) it is then
<geri> or wrapper to pil
<abu[7]> You must roll some tactics, yes
<abu[7]> eg, symbolic link
<geri> i cant mess with the installation, its immutable :)
<geri> i could change it in package definition but i may contribute it back to nix some time so not a good idea
<abu[7]> That's why we have local installations ☺
<geri> 👽
<abu[7]> A pil irs
<geri> irs?
<abu[7]> installation is very small ;)
<abu[7]> Keyboard ;)
<geri> it is, but you need to install llvm and a compiler and some ore stuff
<abu[7]> true
<abu[7]> Is it a problem to wrap 'load'?
<abu[7]> (load (myPath ...
<abu[7]> or (chdir "/myPath" (load ...
<geri> that's a good option
<geri> i have a "make" script for some of my projects, i make sure to cd to $(dirname $0) to know im in the right dir
<abu[7]> ok
chexum has quit [Write error: Broken pipe]
<geri> how do i name a function that checks whether or not extension of a string matches whatever i passed to it?
chexum has joined #picolisp
<geri> scheme makes me think 'extension=?'
<abu[7]> 'ends?' ?
<geri> damn :D
<geri> just gotta rework the function a bit, cause its checking for the dot implicitly
<abu[7]> how?
<geri> the on ethat uses (stem (chop N) ".")
<abu[7]> ok
<geri> (de suf? (Suffix String)
<geri> (when
<geri> (pre?
<geri> (reverse (chop Suffix))
<geri> (reverse (chop String)))
<geri> String)
<geri> sorry for spam :D
<geri> this seems to work okay
<geri> except last paren is missing
<abu[7]> I think it is a bit inefficient
<geri> suf? cause opposite of pre?
<geri> any other ideas?
<abu[7]> I would use 'tail'
<abu[7]> 'pre?' packs implifitly
<abu[7]> and reverse is also a bit expensive
<geri> okay, let's see
<geri> is length cheap?
<abu[7]> at little better at least
<abu[7]> Why not just (tail Suffix String) ?
<geri> wait it could do that? XD
<abu[7]> T
<geri> amazing
<abu[7]> :)
<abu[7]> I forgot the 'chop' of course
<geri> yeah, i figured :D
<geri> (de suf? (Suffix String) (when (tail (chop Suffix) (chop String)) (pack String)))
<geri> to not get kicked by IRC
<geri> implicit pack to be more in line with pre?
<abu[7]> Here it is explicit, no?
<abu[7]> bbl ...
<geri> bubble!
<geri> i thought implicit pack means "you pass a list to a function and its going to return a symbol instead"
<geri> (suf? (chop "hello") (chop "hello, world")) will return "hello, world", not list of chars
<geri> wouldn't changing pre? to have special behaviour when argument evaluates to a symbol make programs more efficient cause less chopping?
<geri> like doing strcmp()
<geri> probably against simplicity though
<geri> or i guess i meant tail in this case
<abu[7]> ret
<geri> wb
<geri> 10)
<geri> or 13
<abu[7]> Hmm, pre? just uses the symbol unchanged
<geri> tail
<abu[7]> ah
<geri> probably dont want this behaviour to stuff like car and cdr because they're so "low level"
<abu[7]> Yeah, it gets involved and inefficient
<geri> i propose a reader macro or chop B)
<geri> (joking)
<geri> s/or/for/
<geri> that said, even though code is data in lisps, all of them implement a ' reader macro, but none of them have a reader for eval
<geri> feels assymetric
<abu[7]> The "real" thing is always list processing, so automatic conversion to symbols is just conventional
<abu[7]> How would the syntax be?
<geri> good question
<geri> just wrapping a symbol in parens similarly to picolisp honestly feels like the only logical solution
<geri> but then how do you do functions? idk :D
<abu[7]> I do not really sec what you mean with "reader for eval"
<geri> read macro
<abu[7]> *see
<geri> so @'(+ 1 2) is same as (eval '(+ 1 2))
<geri> wait
<geri> (eval (quote (+ 1 2)))
<geri> this
<abu[7]> Not (quote + 1 2) ?
<abu[7]> '(+ 1 2)
<geri> in picolisp yes, i meant in general lisps
<abu[7]> ah, ok
<geri> 'A expanding to (quote . A) still feels a little jarring
<geri> but (quote () (+ 1 2 3)) actually feels very natural to me
<abu[7]> (quote . A) is indeed a break with traditions
rob_w has quit [Remote host closed the connection]
stultulo is now known as f8l
msavoritias has joined #picolisp
<geri> are there any symbols left for read macros to occupy? :D
<abu[7]> Well, the unicode space is big :)
<geri> ahaha
<abu[7]> I'm not sure if the quote character can be called a read macro
<abu[7]> It is just a shortcut
<abu[7]> or a syntax feature like the dot in fixnums
<geri> i understand read macros as "you see this char and instead of doing normal things with it you do something else"
<geri> like ` evals stuff in-place, ~ splices the list and just wraps the next expression in (quote )
<geri> s/ / ' /g
<abu[7]> But a macro *does* something. It executes.
<geri> don't macros just translate code
<geri> there can be invalid macros
<geri> like ones that wont be able to run
<abu[7]> Perhapt in C but not in Lisp
<abu[7]> In Lisp a macro evaluatek twice
<geri> i think in lisp the macro gets evaluated once, but the resulting expression is what's evaluated afterwards
<abu[7]> In C too it may be an expression
<geri> and at that second evaluation its no longer a macro
<geri> its just a normal expression
<abu[7]> yes
bjorkintosh has joined #picolisp
<geri> i dont remember if i asked - do you know any other companies using picolisp?
<abu[7]> At the moment I remember 3, and they are here usually
<abu[7]> beneroth, aw- and rob_w
<geri> (plot twist - one you worked in 30 years ago and other two you founded)
<geri> :D
<abu[7]> Ñope
<abu[7]> unrelated
<geri> its a joke
<geri> also that soft n nope was funny
<geri> read as nyoup
<abu[7]> oops
<abu[7]> wrong input field
<abu[7]> on steno
<geri> the one finger kb is steno?
<abu[7]> T
<abu[7]> Handrasenmäher
<abu[7]> grr
<abu[7]> wrong paste ☺
<geri> is that a grass mower :D
<abu[7]> Docs not finished
<abu[7]> Yeah
<geri> forbidden...
<abu[7]> true
<geri> i had tons of progress at work today, bet everything's gonna crumble now :D
<abu[7]> Fixed permissions
<geri> can confirm
<abu[7]> OK
<abu[7]> Out now, must mow ...
<geri> enjoy the sun
<geri> 288 combinations? that's like 3 times the normal keyboard
<geri> if you round it, my keyboard doesnt use more than 128 keys
<geri> :D
<abu[7]> T ☺
msavoritias has quit [Ping timeout: 255 seconds]