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
mario-go` has joined #picolisp
aw-1 has joined #picolisp
aw- has quit [Ping timeout: 252 seconds]
mario-goulart has quit [Read error: Connection reset by peer]
aw-1 has quit [Quit: Leaving.]
aw- has joined #picolisp
ellis has joined #picolisp
<ellis> sup yall
<ellis> coming from the CL world, taking a first look at picolisp is striking fear into my heart
<ellis> can someone help me understand a practical use-case for transient symbols for example?
pablo_escoberg has joined #picolisp
<pablo_escoberg> You can safely think of transient symbols as stings in most languages.
<ellis> yes but in picolisp you can also 'unsafely' think of them as other things (the value bound to it)
<aw-> hi ellis
<ellis> hello!
<pablo_escoberg> ellis: Yeah, you can bind values to transient symbols.  It's a good idea under certain circumstances, but I personally avoid it.
<aw-> transient symbols can be seen as symbols that disappear when they're not in use anymore
<aw-> so if you have a list '(One Two "Three") then "Three" is a transient symbol
<pablo_escoberg> that might be a safer way to think of it :).
<ellis> ohh it is within the context of the special quote context? (or something of the sort)
<aw-> or something, I think my explanation isn't exactly correct
<aw-> what are you trying to do?
<pablo_escoberg> There's no quote context that I know of.
<ellis> im just trying to understand :P - maybe there's some better examples of its usage out there
<pablo_escoberg> for now, wherever you need a string literal, use a transient symbol.  As you look at some of the code in the standard distribution, you'll find cases where they're used to store values.  You'll probably never need to do this yourself, but bear in mind there are cases where it's helpful and you'll see it in code sometimes.
<abu[7]> Technically, transients are symbols currently not found in any namespace
<abu[7]> A symbol may be interned in a namespace which is not in the current search order, then it is also transient at that moment
<abu[7]> In effect, a symbol prints with double quotes if it is not found in the search order
<abu[7]> When *reading*, double quotes cause a symbol *not* to be interned in the current namespace, but only in the transient namespace which has a file-local scope
abu[7] has left #picolisp [#picolisp]
abu[7] has joined #picolisp
abu[7] has left #picolisp [#picolisp]
abu[7] has joined #picolisp
rob_w has joined #picolisp
msavoritias has joined #picolisp
msavoritias has quit [Ping timeout: 256 seconds]
mario-go` has quit [Changing host]
mario-go` has joined #picolisp
mario-go` is now known as mario-goulart
msavoritias has joined #picolisp
rob_w has quit [Remote host closed the connection]
geri has joined #picolisp
<geri> hey, is there an official way to pipe a whole file into (pp)?
<abu[7]> Something like (while (read) (pretty @) (prinl))
<geri> yeah that
<geri> thanks
<geri> oh wait, read doesnt eval anything either, it just reads until end of expression and returns as-is?
<abu[7]> It does eval read-macros
<geri> ah
<abu[7]> 'read' reads a *single* exe
<geri> (de ... ) is a single expression with a bunch nested in, no?
<abu[7]> Yes, 1 exe
<geri> why "exe"?
<abu[7]> (de sym . any)
<abu[7]> exe is a type
<abu[7]> see doc/ref.html
<abu[7]> distinguishes e.g. between exe and prg
<abu[7]> var etc
<geri> oh okay
<abu[7]> @doc/ref.html#fun
<geri> yeah found it
<geri> prg is many exes and exe is just an eval'able expression
<abu[7]> So an exe is a num, sym or cell
<abu[7]> Yes
<abu[7]> prg can be passed to 'run'
<geri> is top level implemented using run
<abu[7]> I think 'eval'
<abu[7]> read eval print
<abu[7]> (vi 'load)
<geri> isnt exe kinda just a read eval (dont print) loop
<geri> but a finite one
<abu[7]> No
<abu[7]> exe is data
<geri> okee
<abu[7]> a num, sym or cell
<abu[7]> (vi 'load) then click on 'repl'
<abu[7]> Hmm, I was wrong
<abu[7]> exe is an "executable"
<abu[7]> I mean s-expr
<abu[7]> s-expr is read
<abu[7]> And if it is code, it is an exe
<abu[7]> And a prg is a list of exe's
<geri> nice & weird :D
<abu[7]> Simple :)
<geri> can you show me an example of mapping a fexpr over a list?
<abu[7]> 'read' reads an s-expr
<geri> cause ive kinda realized most of the time i cant even imagine how id do it
<abu[7]> 'eval' evaluates it if if we are in a repl
<geri> yee
<abu[7]> To fix the mess I told:
<abu[7]> 'repl' reads an expression, evaluates it, and prints the result if the current output channel is a stdout
<geri> and loops!
<abu[7]> Yess! :)
msavoritias has quit [Ping timeout: 240 seconds]
msavoritias has joined #picolisp
abu[7] has left #picolisp [#picolisp]
abu[7] has joined #picolisp
<geri> is there any way to force a fexp to evaluate its argument?
<geri> like if we had `de' bu not `def' in pico
<geri> ...and we need to pass a value of a variable instead of a hardcoded variable
abu[7] has left #picolisp [#picolisp]
abu[7] has joined #picolisp
abu[7] has left #picolisp [#picolisp]
abu[7] has joined #picolisp
<abu[7]> Oops :)
<geri> someone's real indecisive
<abu[7]> "force" in which way?
<geri> setq in common lisp also doesnt evaluate its first argument
<abu[7]> It is
<geri> but i can "force" it to by wrapping it in another macro
<abu[7]> You can make a macro that uses 'setq', yes
<geri> (defmacro setq-other-thing (thing value) `(setq ,thing ,value))
<geri> kinda useless
<geri> useful in some cases but idr which ones
<geri> can you do something like that with fexps?
<abu[7]> Yes, but it doen not change the fexpr
<abu[7]> You build the surrounding expression
<abu[7]> : (let @S 'X (macro (setq @S 7)))
<abu[7]> Then X is 7
<geri> oh hey, what a familiar word :D
<abu[7]> I use 'macro' sometimes in GUI code
<abu[7]> Some GUI functions don't evaluate
<geri> mmm
<abu[7]> So the expression must be built
<abu[7]> But that's no magic
<geri> with hacks!
<abu[7]> Kind of, yes
<geri> is (macro) an "actual" macro
<abu[7]> Yes
<geri> exactly for building over stuff that doesnt evaluate?
<abu[7]> A macro is defined as something which evaluates twice
<geri> almost like an eval in bash
<abu[7]> It evaluates to another expression which is then evaluated
<geri> s/almost/exactly/
<abu[7]> I would not say so
<abu[7]> eval in bash is like eval in Lisp
<abu[7]> (eval (list '+ 3 4))
<abu[7]> It does not *build* an expression first
<geri> description
<abu[7]> yes
<abu[7]> it evaluates *once*
<abu[7]> not twice
<geri> well maybe like this it makes more sense > eval echo $(echo hello)
<geri> first arguments get eval'd then result gets eval'd
<geri> evaluated normally though
<abu[7]> It is building the argument
<geri> yes, just like macro while it expands patterns
<abu[7]> Bash is kind of all fexpr
<geri> XD
<abu[7]> only explicit arguments with $ are evaluated
<geri> bash was a lisp all along
<abu[7]> echo a
<abu[7]> 'a' is not evaluated
<abu[7]> No, bash is no Lisp
<abu[7]> no List processing
<geri> (its a joke)
<geri> yeah, lists in bash suck
<abu[7]> OK :)
<geri> arrays*
<abu[7]> right
<geri> did you know posix shell actually has arrays
<abu[7]> Bash is a pain to read
<abu[7]> Not sure
<geri> "$@"
<abu[7]> Did not do much in bare shell
<abu[7]> ah, yes, of course
<geri> you `set' it and use positional arguments to retrieve nth element of array
<geri> its very cursed
<geri> and very fun
<geri> bash is a pain to read if someone wrote it poorly
<geri> my bashrc, although its readability is to be questioned
<geri> :D
<geri> especially LS_COLORS
<geri> and PS1
<abu[7]> Don't you use .inputrc ?
<geri> i use both
<geri> although i wish i didnt have to
<abu[7]> OK
<geri> tab colors dont work properly unless you use inputrc
<geri> actually the idea was to have bashrc work fine in standalone mode
<geri> but i now use .profile and am pretty good with unconfigured bash too
<geri> might as well migrate it all to inputrc
<abu[7]> Pil also uses inputrc
<geri> ye, i read about paren blink somewhere
<geri> honestly its slightly confusing
<abu[7]> This was one of the reasons why pil21 uses readline
<abu[7]> Instead of the self-rolled one in pil32 and pil64
<geri> so its configurable?
<geri> or you mean for blinking parens
<abu[7]> Just inputrc, out of the box
<geri> oh wait, completions are so much better with proper inputrc
<abu[7]> Also in PilBox
<geri> xd
<abu[7]> I copied my inputrc into PilBox
<abu[7]> With readline completions A'm not satisfied
<abu[7]> Seems we cannot configure delimites
<abu[7]> *delimiters
<geri> why do pair and atom not end with "?"
<abu[7]> They are traditional Lisp functions
<abu[7]> Most predicates in Pil don't end in ?
<geri> why do some do but some dont :D
<abu[7]> Historical
<abu[7]> In some way every function is a predicate
<abu[7]> or most
<geri> is there anything you want to change about the language but cant because backwards compat will suffer?
<abu[7]> Yes, some naming
<abu[7]> T should be *T
<abu[7]> and NIL -> *NIL
<abu[7]> But I'm too much used to the current ones
<geri> all capital were global, but if you add * to em they were like
<geri> "very global"?
<geri> xd
<abu[7]> In fact T and NIL adhere to the conventions
<geri> yeah, thats why im asking
<abu[7]> "Global constants may be written all-uppercase"
<abu[7]> T is a border line
<abu[7]> *all* means just a single char ;)
<geri> xd
<geri> its totally a local variable
<abu[7]> Yeah
<geri> first letter is capital and none of others are!
<abu[7]> T is easy to forget
<abu[7]> (de f (R S T) ...
<abu[7]> boom!
<abu[7]> 'lint' complains though
<abu[7]> T locally bound as a param or local may terribly break a program
<abu[7]> Cause T may evaluate to NIL
<abu[7]> So I always recommend to call (lintAll) before going to production
<geri> and then world goes on to take a nap
<abu[7]> I do it from time to time in my apps
<abu[7]> a nap?
<geri> do companies other than yours use pil for production?
<abu[7]> A few
<geri> "when the world is gone to hell, go take a nap"
<abu[7]> beneroth and aw- at least do
<geri> neat, neat
<geri> speaking of naps, i gotta sleep
<geri> laters
<abu[7]> Good! :)
<abu[7]> C.U.
<geri> 👋
geri has quit [Quit: ERC 5.5.0.29.1 (IRC client for GNU Emacs 29.3)]
msavoritias has quit [Ping timeout: 264 seconds]
<ellis> i am back from my eternal slumber
<ellis> re: setq in CL above, there is also set which will evaluate first arg, part of the spec i think
<ellis> re transient-symbols: sounds like file-local scope may be an important consideration for em. if anyone stumbles on a real-world demo for it I would be interested in taking a look. I'm just looking for what type of design patterns it would be useful to apply to in situations where the security considerations aren't concerning, like the internals of the compiler
<abu[7]> Yes, 'set' should be the same in CL & Pil
<abu[7]> Pil accepts multiple sym/val pairs