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
viaken2 is now known as viaken
clacke has joined #picolisp
pfd has quit [Quit: Client closed]
<abu[m]> Hi cpli! (list . 'a) reads as (list . (quote . a), which is (list quote . a). What kind of behavior do you mean?
<abu[m]> In this context 'quote' is just a symbol being evaluated, giving a number
<cpli> abu[m]: wouldn't i expect (list . 'a) to return 'a?
<cpli> i.e. quote returns its "argument list/&rest" unevaluated
<cpli> i would've thought of list to return its "argument list/&rest" evaluated
<cpli> for symmetry
<abu[m]> Right. But here the argument is the symbol 'quote'
<cpli> yeah.. didn't think of that when you informed me calls may have the form (f . a)
<abu[m]> The atomic 'a' is ignored, 'list' and most other functions evaluate only the pairs
<abu[m]> So (list quote . a) is like (list quote)
<cpli> does that not appear unfortunate to you?
<abu[m]> Why should it be?
<abu[m]> quote is just a symbol
<abu[m]> It is useful if called as a function
<cpli> depending on whether or not a in (f . a) is a list it substituted as the argument list to f
<abu[m]> (list (quote . a)) gives a
<abu[m]> gives (a) I mean
<cpli> that's the case in common lisp too though (+ . (1 2 3)) evaluates to 6
<abu[m]> yes. It all depends what 'f' does with its arguments
<cpli> so quote is unique
<abu[m]> (+ . (1 2 3)) is just (+ 1 2 3)
<abu[m]> No, quote is not special
<cpli> (list . 1) segmentation faults
<abu[m]> This may well be :)
<cpli> xD
<cpli> if it doesn't expect it, so be it
<abu[m]> Pil does not check all argument structures fully. For pragmati reasons.
<cpli> it wouldn't be possible to write functions that may interact with their arguments the way quote does, reliably
<abu[m]> 'list' expects a list of arguments and thus accesses the CAR of a number
<cpli> oh, oof
<abu[m]> Why? I would say 'quote' does not interact at all
<abu[m]> (de myQuote X X)
<abu[m]> It returns the whole rest unevaluated
<abu[m]> The smallest function of all
<abu[m]> Try (vi 'quote)
<cpli> o-o
<abu[m]> It does just (cdr Exe)
<cpli> vi -- Undefined
<cpli> oh
<abu[m]> $ pil +
<cpli> it primarily opens vi
<abu[m]> It is Vip, a built-in editor
<cpli> beautiful
<abu[m]> btw, is 'less' available now?
<abu[m]> (vi 'less)
<abu[m]> should be in lib.l
<cpli> it already had been last time, i'm sorry if that hadn't come across q-q
<cpli> in the repl
<abu[m]> no problem
<abu[m]> I was just wondering
<cpli> symbols return the adress of the value they're bound to?
<abu[m]> yes
<cpli> how curious
<abu[m]> i.e. the "value"
<abu[m]> everything is a pointer in Lisp
<abu[m]> except short numbers which are a kind of pseudo-pointer
<cpli> i hope my u64s aren't in my heap
<cpli> hehe
<abu[m]> all u64s :)
<cpli> cons shouldn't cons its arguments and so on
<cpli> o-o
<abu[m]> I would say the u64s are *all* in the heap (if not in the stack)
<cpli> i hope some of them can reside in my stack, it's comfy there
<abu[m]> Sure, no worries ☺
<cpli> what semantics surround "myquote"?
<cpli> (also is pil capitalization sensitive?)
<abu[m]> Nothing special, just an example for a function with the same behavior as 'quote'
<abu[m]> 'quote' is only special in that it is used by the ' read macro
<abu[m]> 'a -> (quote . a)
<cpli> how would one implement a list function where (myList . (quote . a)) yielded 'a?
<cpli> but (myList (quote a)) yielded ('a)?
<abu[m]> it is cadr
<abu[m]> myList evaluates (quote a) which gives (a)
<abu[m]> so it could do (list (lit (car ...]
<cpli> what's lit's job?
<abu[m]> of 'lit'?
<cpli> yea
<abu[m]> 'lit' quotes the argument (conses with 'quote') only if necessary
<abu[m]> (lit 'a) gives 'a
<abu[m]> but (lit 123) or (lit "abc") just return the argument
<cpli> that's kind of cool
<cpli> now give me de that would eval its argument(s) and return it/them because i still can't conceptualize it
<abu[m]> This would be (de f (X) X)
<abu[m]> for a single argument
<cpli> so i would have to check if it's a list?
<abu[m]> No
<abu[m]> It returns what it is
<abu[m]> (f '(a b c)) -> (a b c)
<cpli> but i want (f 'a 'b) -> ('a 'b) & (f . 'a) -> 'a
<abu[m]> (de f (X Y) (list (lit X) (lit Y))
<abu[m]> If the number of args is unknown, use @
<cpli> where and how o-o
<abu[m]> (de f @ (rest))
<cpli> oh
<abu[m]> (f 'a 12 'b) -> (a 12 b)
<abu[m]> (doc 'next) and (doc 'rest) etc
<cpli> i would have to check if rest is a list, no? (i feel like something is going way over my head)
<cpli> (de f @ rest) will work for single arguments
<abu[m]> (rest) is always a list (or NIL)
<cpli> (de f @ (rest)) will work for arbitrary argument count
<cpli> yeah
<cpli> so i do have to check?
<abu[m]> No, (de f @ rest) will return the value of 'rest', a pointer
<cpli> oh
<abu[m]> You can use (args) (next) (arg) (restt)
<cpli> and manually iterate?
<abu[m]> With (next)
<abu[m]> (while (args) (println (next)))
<abu[m]> or (while (next) (println @))
<cpli> so i have to "check" whether it's a list >:(
<abu[m]> but the latter stops also for a NIL arg
<abu[m]> ok, yes, check for the empty list
<cpli> D:<
<abu[m]> NIL is technically also a list
<cpli> i mean, it's the most important list
<abu[m]> the only symbol which is also a list
<abu[m]> exactly
<cpli> doc -> w3m: Can't exec D: just curl the page
<abu[m]> Yeah, 'doc' defaults to w3m. But you can set the BROWSER env
<abu[m]> 'qsym' is quite esotheric. Used in interprocess communication
<abu[m]> just a convenience function to minimize traffic
<cpli> are there other instances where functions are called in the form of dotted lists to great effect?
<cpli> quote is genuinely kind of elegant
<abu[m]> I think there are only a few ones
<abu[m]> I mean expecting atomic args
<cpli> though atomic args
<abu[m]> Functions with a 'lst' or 'prg' are common
<abu[m]> ie. FEXPRs
<abu[m]> (if 'any1 any2 . prg)
<cpli> why does local return a lambda which takes a list of symbols?
<abu[m]> (local) (privat) etc. are a bit surprising at first :)
<abu[m]> The take no args, but *read* from the input stream
<abu[m]> (local) foo
<abu[m]> So local does not return anything useful
<abu[m]> It is just for the side effect of putting those symbols into the current namespace
<cpli> (in-package #:foo) but instead it's a reader macro which reads the next symbol or list as argument to `export`?
<abu[m]> I would not call it a reader-macro. It is a normal (read), just with the current namespace isolated from the search order
<cpli> hmm
<abu[m]> It is the normal read mechanism (as in all Lisps): Search for a symbol, and if not found intern a new one
<abu[m]> So if the search order is isolated to the current namespace *only*, the symbol(s) will be interned even if existing somewhere else
<cpli> is pil's pilouge implemented via something like amb/call-cc?
<abu[m]> I forgot what AMB or call-cc are. Can you elaborate?
<cpli> scheme basically turns everything into continuation passing style and you gain this nifty function call/cc or call-with-current-continuation
<cpli> amb is this strange "ambivalence" function wherein it tries calling a function/continuation repeatedly until it either succeeds or runs out of possible arguments
<abu[m]> I don't know Scheme well, but I think Pil's coroutines are similar
<abu[m]> can be used to write a generator for example
<cpli> scheme has lazy iterators that are usually implemented using the same machinery
<cpli> i believe
<cpli> buffet?
<buffet> chi?
<cpli> (just want them to check over my random stateme-
<cpli> buffet: call/cc -> streams/lazy iterators
<cpli> ?
<buffet> yup
<buffet> for example
<cpli> also is scheme strictly cps?
<abu[m]> cpli: Your questien above, Pilog does not use it
<cpli> q-q
<abu[m]> it does it "manually" using assoc lists
<buffet> wdym by strictly?
<cpli> i.e. is everything transformed into cps
<cpli> and how does that impact performance?
<cpli> abu[m]: makes sense
<buffet> implementation detail, not even sure every scheme does that (guile?)
<cpli> how can you implement call/cc without it being a huge hack without cps?
<buffet> performance should be fine, the main difference is that you have another call rather than return
<buffet> well, guile just copies your stack, ie huge hack
<cpli> **exactly**
<abu[m]> Hi buffet btw :) Welcome here!
<buffet> hey
<cpli> buffet, be nice :>
<buffet> no >:(
<cpli> huh?! D:<
<abu[m]> hihi
<cpli> buffet, do you get the cons oughtn't cons its arg paper?
abu[7] has joined #picolisp
<cpli> and also what's your opinion on quote quoting its args properly
<cpli> instead of its first argument?
<cpli> abu[7]: what's 7?
<buffet> (succ 6)
<abu[7]> My company's name
<cpli> sieben
<abu[7]> I switched client to normal IRC
<abu[7]> yes, 7fach GmbH
<cpli> warte, also immer nur deutsche in cs online?
<buffet> cpli: i get the jist, i feel like i'd like to see an implementation (esp wrt to "just do cps lambdas" there is a bit of context missing)
<abu[7]> Too many deutsche? ...
<buffet> germans taking over this irc, auf geht's!
<abu[7]> good
<cpli> buffet: 1. do you get cons mustn't cons (check) 2. quote quotes argument list instead of its first argument
<cpli> abu[7]: do you use picolisp at work?
<abu[7]> yes
<cpli> oh damn
<abu[7]> for all projects
<buffet> 2. i still feel like it doesn't matter, but maybe one is more elegant in some cases
<abu[7]> since 1987
<cpli> oh.
<cpli> OH.
<cpli> hi pil dev
<abu[7]> 7fach.de is the same server as picolisp.co
<abu[7]> m
<cpli> schlundtech.de xD
<cpli> wait that's a domain provider
<abu[7]> T, nameserver. Provider is Domain Factory
<abu[7]> The quote issue is just pragmatism
<abu[7]> returning CDR is more efficient than CADR, and it turened out to be more convenient
<cpli> abu[7]: do functions exist? or are they of the form ((<args>) <body>)?
<abu[7]> hmm, exist in which sense?
<cpli> in a compiled sense
<abu[7]> Only the built-ins
<abu[7]> (vi 'car)
<abu[7]> so car is compiled
<cpli> '((x) x) 'a -> a
<cpli> all functions are of this form?
<abu[7]> All Lisp-level functions
<cpli> have you contemplated jit?
<cpli> (i love how simple this is, with all the translation cruft out of the way)
<abu[7]> No. It is important to understand that PicoLisp *cannot* be compiled
<abu[7]> it is a pure interpreter
<abu[7]> The language built-ins are implemented in are in a slightly different language, not really PicoLisp, only the same syntax
<cpli> i wouldn't go so far as to say it's impossible, but it lends itself to being incredibly malleable/pragmatic due to the fact its all symbolic
<abu[7]> It is indeed impossible, you get a different language
<abu[7]> different concepts
<cpli> and i'm sure building it probably doesn't take ages such as with clasp/cando
<cpli> cando takes 40min+ to build on a modern macbook
<abu[7]> Yes, pil builds within a few seconds
<abu[7]> mom, I switch clients
abu[7] has left #picolisp [#picolisp]
<abu[m]> Two clients at the same time are tedious
<cpli> i mean, they're both bridges
<abu[m]> and I don't want to log out of Matrix
<abu[m]> only this one
<cpli> irc ftw
<abu[m]> The other is an IRC client written in Pil
<cpli> wait, is the source up?
<cpli> it has modern irc extensions too no?
<cpli> oh, no you actually disconnected q-q
<abu[m]> No modern extensions I think
<abu[m]> I used that client for a decade or so, but now use the Matrix bridge
<abu[m]> on the other hand, a text-only client is easier to type in
clacke has quit [Remote host closed the connection]
<abu[m]> Perhaps you found it already, there is an article elaborating on the rationale of 'quote': https://picolisp.com/wiki?ArticleQuote
<beneroth> hi abu[m], buffet, cpli - nice discussion :)
<abu[m]> Grüezi beneroth :)
seninha has joined #picolisp
rob_w has joined #picolisp
seninha has quit [Remote host closed the connection]
seninha has joined #picolisp
seninha_ has joined #picolisp
seninha has quit [Remote host closed the connection]
seninha_ has quit [Remote host closed the connection]
seninha_ has joined #picolisp
seninha_ has quit [Quit: Leaving]
seninha has joined #picolisp
seninha has quit [Quit: Leaving]
pfd has joined #picolisp
zaWanderer has joined #picolisp
<zaWanderer> Greetings :)
<zaWanderer> I have a question regarding +Chart gui class.
<abu[m]> Hi zaWanderer!
<abu[m]> How can we help?
<zaWanderer> I see in the code that Get function is the method to actualize a 1-D list (values in the GUI now) to the 1-D list (previous values that was in the GUI)
<zaWanderer> Is that correct? (it took me a day, I hope so :D)
<zaWanderer> Is there a good trick or method to debug or trace and understand these changes?
<abu[m]> Yes, correct, though it must not be a 1-D list. Can be anything
<abu[m]> You can (trace 'get> '+Chart)
<abu[m]> or set a breakpoint
<zaWanderer> will this cause any timeout issues for the sessions?
<abu[m]> No problem
<abu[m]> Sorry, must go for 30 mins or so
<abu[m]> bbl
<zaWanderer> sure
<beneroth> hi zaWanderer :)
<zaWanderer> hi beneroth
<beneroth> zaWanderer, (trace) just prints all function calls (with arguments and return value).
<beneroth> so that should not use much more time and certainly not trigger timeouts
<beneroth> breakpoints are for interactively debug in the repl.
<zaWanderer> Thanks I am trying it now
<zaWanderer> I think it is working. I need to read on tracde and debug now
<zaWanderer> I started the app from pil command line
<zaWanderer> so I had to pack the server call in a function, so I can add the trace call in the repl
<zaWanderer> Is that how you should do it?
<zaWanderer> Also a side question, affecting my quality of life in learning web-apps with picolisp
<zaWanderer> very often the server terminal stops responding to my keystrokes, and I always have to manually break with CTRL+C if I am lucky, reset the terminal and try again
<zaWanderer> I tried on Linux VMs, WSL, all same weird behavior
<abu[m]> ret
<abu[m]> Server in a functio is good.
<abu[m]> or pass it also on the command line
<abu[m]> --server 8080 project.l
<abu[m]> the trace too
<abu[m]> pil ... -"trace 'get> '+Chart" ... --server
<abu[m]> Stopping is indeed tricky sometimes
<abu[m]> Normally, you just need ^D to exit the REPL session and then ^C to terminate the parent process
<abu[m]> But problems arise if you connect the browser twice
<zaWanderer> It's not about stopping, It's when I try to print some values like *Top, etc.. But I can't type properly, the terminal won't take all the characters, or sometimes just won't display what I type but executes correctly
<abu[m]> This gives *two* sesions on the same terminal, and you need several ^D
<abu[m]> This is also a symptom
<zaWanderer> oh, I see
<abu[m]> 2 REPLs
<abu[m]> so it is not clear which one gets which key
<zaWanderer> Is there a good practice to prevent this from happening?
<abu[m]> I think after some usage the problem disappears. Just ^D before connecting the browser again
<zaWanderer> but why the terminal stay unresponsive even after quitting pil?
<abu[m]> The terminal is reset usuall when pil exits. But sometimes the second session messes up the clean up of the first one
<abu[m]> You do "stty sane" in such cases?
<abu[m]> I have an alias:
<abu[m]> alias s='stty sane'
<abu[m]> So I can type "s" blindly (as there is no echo)
<zaWanderer> I am not that good with Linux, but I admit my Linux knowledge has improved a lot one I started learning Lisp :D
<abu[m]> Very good :)
<zaWanderer> I use just the reset command, or reset -c , then most of the times the termianl recovers
<abu[m]> Ok
<abu[m]> reset is a bit violent ;) It does more than stty it seems
<abu[m]> For the above terminal mode issues, "stty sane" is enough
<zaWanderer> I will try it moving forward.
<zaWanderer> One more question, regarding E/R representation
<abu[m]> 👍
<zaWanderer> I saw that there are some E/R text drawing in the demo app
<zaWanderer> is that done by hand, or there's a function/program for that?
<zaWanderer> Plotting the ER model I meant
<abu[m]> This was done by hand. But there is @lib/vip/draw.l which does similar things
<abu[m]> It is for creating box notations from s-expressions
<abu[m]> The E/R drawings are more difficult to automate
<abu[m]> For example: http://pb1n.de/?62f113
pfd has quit [Quit: Client closed]
<abu[m]> Put this into a file "abc", then do (vi "abc") and hit 'v'
<abu[m]> It creates an ASCII drawing in a new buffer
<zaWanderer> Nice :)
<zaWanderer> +-----+-----+ +-----+-----+ +-----+-----+
<zaWanderer> | A | ---+---->| | | ---+---->| | | / |
<zaWanderer> +-----+-----+ +--+--+-----+ +--+--+-----+
<zaWanderer> v v
<zaWanderer> | |
<zaWanderer> +-----+-----+ +-----+-----+ +-----+-----+
<zaWanderer> | B | / | | C | ---+---->| D | E |
<zaWanderer> +-----+-----+ +-----+-----+ +-----+-----+
<abu[m]> Cool, so hard to recognize in IRC
<zaWanderer> Thanks all for your help. Picolisp is very addictive :D
<abu[m]> Great :)
<zaWanderer> Have a great weekend!
<abu[m]> Thanks! You too!
seninha has joined #picolisp
abu[7] has joined #picolisp
abu[7] has quit [Read error: Connection reset by peer]
chexum has quit [Ping timeout: 240 seconds]
chexum has joined #picolisp
pfd has joined #picolisp
pfd has quit [Quit: Client closed]
rob_w has quit [Read error: Connection reset by peer]
zaWanderer has quit [Read error: Connection reset by peer]