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
seninha has quit [Ping timeout: 255 seconds]
_whitelogger has joined #picolisp
rob_w has joined #picolisp
msavoritias_ has joined #picolisp
cpli has joined #picolisp
seninha has joined #picolisp
<cpli> i brought this up in both #commonlisp and #scheme
<cpli> but pico is so cool i'm sure there's interest here
<cpli> is there an effort to represent recursive forms as circular lists?
<cpli> i.e. for factorial: #0=(lambda (n k) (if (= 0 n)) k (#0# (- n 1) (* n k)))
<abu[m]> I never did, but technically it is a loop
<cpli> abu[m]: yeah! but with this all you'd be encoding is binding the lambda and implicitly capturing it in itself
<abu[m]> Let me try
<abu[m]> works
<abu[m]> PicoLisp has direct syntax only for top-level circular lists, but you can modify the structure
<abu[m]> Prints 720
<abu[m]> If you try to print 'f' you get an infinite loop of course
<abu[m]> (if (=0 N) K ('((N K) (if (=0 N) K ('((N K) (if (=0 N) K ('((N K) (if (=0 N) K ('((N K) (if (=0 N) K ('((N K) (if (=0 N) K ('((N K) (if ( =0 NIL !
<abu[m]> But you can inspect it with 'less':
<abu[m]> : (less f 7)
<abu[m]> -> ((N K) (if (=0 N) K ('((N K) (if ..)) (dec N) (* ..))))
buffet has joined #picolisp
aw- has quit [Quit: Leaving.]
rob_w has quit [Remote host closed the connection]
<cpli> abu[m]: (set (; f 2 4) (lit f))
<cpli> causes me to stack overflow in my repl
<abu[m]> As I said, don't print it ;) REPL means read - eval - *print*
<cpli> oh
<abu[m]> You can put a T on the same line
<cpli> makes sense
<abu[m]> Or put it in a file
<cpli> abu[m]: what does (set (; f 2 4) (lit f)) even do?
<cpli> are 2 & 4 arbitrary?
<cpli> what is the `;` accessor?
<abu[m]> It is a short form of (caddr (cadr f))
<abu[m]> i.e. take the second and then the 4th element
<cpli> **oh, interesting**
<abu[m]> I meand cadddr
<cpli> semicolon really isn't meshing well with my paredit either
<abu[m]> Oh, I see. Thinks it is a comment perhaps
<cpli> definitely.
<abu[m]> (set (cadddr (cadr f)) (lit f)) works fine too
<cpli> less is supposedly undefined q-q
<abu[m]> 'lit' is a cons with quote
<abu[m]> I think you did not start in debug mode.
<abu[m]> $ pil +
<cpli> abu[m]: i will not change my code to fit my editor, i will use a different editor before it starts influencing the characters i'm allowed to type :(
<abu[m]> :)
<cpli> abu[m]: starting pl in debug mode doesn't make less available in my file
<abu[m]> Hmm
<abu[m]> I think you have an older pil. 'less' used to be only in debug mode
<abu[m]> Current pil has less even in non-debug
<cpli> also, just so that were all clear, this is my first engagement with picolisp and it's surprising me with everything i read of it, and write of it
aw- has joined #picolisp
<abu[m]> : (version)
<cpli> abu[m]: pil -version yields: 23.3.30
<abu[m]> ok :)
<abu[m]> oh, very new
<abu[m]> strange
<cpli> built it just now o-o, would hope the git package on the AUR wasn't outdated
<cpli> abu[m]: i ran (LOAD "<file>")
<cpli> running the file directly yields the expected print
<abu[m]> Yes, fine
<abu[m]> or : pil <file> +
<abu[m]> : (pp 'less) should give (de less (X N) ...
<cpli> abu[m]: would you know if pil has readtables?
<cpli> i.e. can i implement the funny #n=( #n# as a reader macro?
<abu[m]> No, because pil supports (reading and printing etc.) only top level circularity
<abu[m]> (a b c .) or (a b . (c d .))
<abu[m]> You coul use 'fill' or 'patch'
<abu[m]> (patch f 'F (lit f))
<abu[m]> more readable than the 'set'
<abu[m]> if you want to get rid of the 'lit': (patch f 'F (cons 'quote f))
<cpli> is there some cheat sheet for common lispers to migrate to pil?
<cpli> i.e. where's my progn o-o
<abu[m]> I don't know of any doc about the differences to CL
<abu[m]> 'progn' is just 'prog' in Pil
<abu[m]> prog1 and prog2 are the same
<cpli> is there gensym?
<abu[m]> (new) or (box)
<abu[m]> Just (box) will do
<cpli> abu[m]: lambda?
<abu[m]> It is 'quote'
<abu[m]> (def 'lambda quote) if you like
<abu[m]> (code *is* data) ;)
<abu[m]> (mapcar '((N) (* NN )) Lst) is (mapcar (quote (N) (* N N)) Lst)
<cpli> lord, that's elegant
msavoritias_ has quit [Remote host closed the connection]
msavoritias_ has joined #picolisp
msavoritias_ has quit [Read error: Connection reset by peer]
msavoritias_ has joined #picolisp
chexum has joined #picolisp
seninha has quit [Remote host closed the connection]
seninha has joined #picolisp
seninha has quit [Remote host closed the connection]
seninha has joined #picolisp
msavoritias_ has quit [Remote host closed the connection]
seninha has quit [Quit: Leaving]
seninha has joined #picolisp
f8l has quit [Ping timeout: 276 seconds]
<beneroth> :)
seninha has quit [Quit: Leaving]
seninha has joined #picolisp