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
rob_w has joined #picolisp
beneroth_ has joined #picolisp
beneroth has quit [Read error: Connection reset by peer]
rob_w_ has joined #picolisp
beneroth_ has quit [Quit: Leaving]
beneroth has joined #picolisp
geri has joined #picolisp
<geri> hello!
<geri> had a lot of fun in the last two days writing a lisp in python and writing combinator-based parsers
<geri> got new-found appreciation for how much stuff was done to make picolisp exist
<geri> :D
<abu[7]> Nice! :)
<geri> it seems that passing 'functions' with fill is rather weird - it tries to evaluate the list instead of having it be a function
<geri> is that expected?
<abu[7]> Can you give an example?
<geri> yeah, give me a second
<geri> crashed the interpreter on accident xd
<geri> sec
<abu[7]> ☺
<geri> if i quote @Fun it works
<geri> or if i make _test not evaluate its arguments
<abu[7]> Yeah
<abu[7]> it expan
<abu[7]> Hmm, how to explain? ☺
<abu[7]> I give an example
<abu[7]> You need ('((X Y) (* X Y)) 3 4)
<abu[7]> or ('((X) (print X) ..
<abu[7]> The CAR must evaluate to a function
<geri> so i guess its like
<abu[7]> (((X) (print X) ..) is wrong
<geri> _test already evaluates @Fun
<beneroth> hi geri, abu[7] :)
<beneroth> good you have fun geri!
<geri> so it gets eval'd twice if you do a fill
<geri> beneroth: yes!!
<beneroth> picolisp is much deeper than it looks on the surface :)
<abu[7]> @Fun is substituted with ('((X) (print X)
<geri> without quote
<abu[7]> @Fun is substituted with ((X) (print X)
<abu[7]> sorry
<abu[7]> wrong copy/paste
<geri> happens :D
<abu[7]> 'fill' does not care
<abu[7]> it just substitutes
<geri> well, it seems that both pointers and list functions work fine if you put a quote in inner function
<geri> so i guess that's very much fine
<abu[7]> Putting more quotes fon a function is fine
<abu[7]> It evaluates the CAR until it hits upon a fun
<abu[7]> ('* 3 4)
<geri> i just realized this is legal
<geri> (+ * *)
<geri> its funny
<abu[7]> (setq a '* b 'a c 'b) (c 3 4)
<abu[7]> -> 12
<geri> damn
<abu[7]> This is "It evaluates the CAR until ..."
<beneroth> that is also why/how function call works
<abu[7]> Right :)
<beneroth> because technically, the function name given with (de) is just a global variable pointing to the anonymous function
<abu[7]> T
<beneroth> therefore in picolisp, the same function can even have multiple names :)
<geri> yee, i know
<geri> de itself isnt magical either, it just sets its car to be its uneval'd cdr
<geri> + debug stuff
<abu[7]> T
<geri> it's very bad on all levels imaginable
<geri> but its mine and im proud!
<geri> also fexpressions + dynamic binding, but everything is re-looked up in a hash table cause i couldnt figure out how to do interning actually properly
<abu[7]> Cool! Important is to have fun
<beneroth> haha, nice!
<beneroth> that's why you looked into the structure of pico
<geri> i wrote it in python cause doing it in a lisp would feel like cheating
<geri> in cl you can hook into the reader and make it do your bidding, so that's free
<geri> wanted to do C but i cant figure out types
<beneroth> the older 32bit version of picolisp was done in C, maybe you want to study it?
<geri> looked at cell in picolisp repo and its just a struct of itself and my head went dizzy
<geri> :D
<geri> yeah, that'4 what im doing
<geri> im getting closer to understanding the basics, but rn C type system is being a pita
<abu[7]> on miniPicoLisp
<abu[7]> or*
<geri> that may be even better
<abu[7]> Same C types though
<abu[7]> There was also ErsatzLisp written in Java
<abu[7]> perhaps clearer
<abu[7]> also has a Symbol class iirc
<geri> sounds like cheating to me! (joke)
<abu[7]> :)
<geri> okay, so we have a cell, which has 2 pointers - both to cells
<geri> i remember you said something about tag bits so i bet that's how you differentiate between types of what's in those cells
<abu[7]> da
<geri> now just gotta find an example of dereferencing stuff
<abu[7]> In C it was all macros
<geri> isNil, isTxt, etc?
<abu[7]> Yeah
<geri> okay
<geri> i guess i see why you chose to go with only a cell struct now
<geri> i tried doing strings and numbers - it's fine; but when i tried to do a cons cell then allocating it was a total pain
<abu[7]> in Python?
<geri> in C
<geri> i got an object struct that has a short type and void* data in that case
<abu[7]> Strings are also painful then
<geri> if i wanted to initialize a number i had to first wrap it in an object
<geri> which is fine, but when you want a cons you wrap 2 objects and cons itself
<geri> xd
<geri> (also struct of 2 things, almost sounds like a cell!)
<geri> also i started writing a combinator parser in picolisp for fun too and this function makes me happy
<geri> (de _digits (S)
<geri> (case (car S) (`(chop "0123456789") S)))
<geri> its not much but good use of ` is a sweet thing
<geri> aighty im gone for a few hours most likely
<beneroth> :)
<abu[7]> o/
rob_w_ has quit [Ping timeout: 240 seconds]
rob_w has quit [Quit: Leaving]
<geri> now that i think about it, representing lambdas as lists is really neat
<geri> its user-accessible and you dont need to implement new data structures for representation
<geri> :D
<geri> weren't lambdas in some earlier lisps always just lists with first element being a symbol "lambda" or smth?
<abu[7]> Hmm, could well be
<geri> appanrently pre-standards common lisp implementations did that for interpreters
<geri> maclisp too apparently
<geri> cool to know
<geri> pil starts slowly making more and more sense
<geri> :D
<abu[7]> Glad to hear that :)
<geri> aighty, time to go offline
<geri> have fun
geri has quit [Quit: ERC 5.5.0.29.1 (IRC client for GNU Emacs 29.3)]
<beneroth> abu[7], FYI current ref for (db) has a typo, in its description (step) is falsely linked as refF.html#step instead of refS.html#step