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
<aw-> pablo_escoberg: yes there is, probably with the use of (% Arg 2) modulo 2
<aw-> (% 3 2) = 1, (% 4 2) = 0, (% 5 2) = 1... etc
seninha has quit [Remote host closed the connection]
aw- has quit [Quit: Leaving.]
aw- has joined #picolisp
aw- has quit [Ping timeout: 245 seconds]
aw- has joined #picolisp
<DKordic> pablo_escoberg: What is so magical about C?! I prefer ""loop"" as a form of Tail Recursion. ""[de setq E [loop [NIL E] (set (pop 'E) (eval (pop 'E)))]]""?
<user3456> Is there a way to build picolisp with gcc instead of clang?
<user3456> passing CC=gcc to make doesn't work, seems like I also need to change LCC and some other settings but I'm not sure what to change them to
<aw-> user3456: no
<aw-> you'll need to use an older version of picolisp, such as pil32 or picolisp-20
<aw-> here's the older version: https://github.com/picolisp/picolisp latest 20.12
<pablo_escoberg> I didn't make myself clear. I realize I can emulate whatever argument signature I want using F expressions.  The question I meant to ask was: is it possible to do this directly, without just grabbing the args in an F expression and selectively evaluating its constituents?
<aw-> wat
<aw-> what are you trying to do?
<aw-> can you give an example?
<aw-> "is it possible to do this" <-- this == what?
<pablo_escoberg> `setq` is a pretty good example.  it's signature (if that's that term we use here) is `(setq var 'any ...) .  That means that alternating arguments are evaluated.  What I'm trying to do is declare a function with a similar signature (again, if that's the right term here).
<aw-> why?
<aw-> what are you trying to do?
<aw-> what is the purpose of the function you want to make?
<aw-> the end goal?
<pablo_escoberg> Well, I'm trying to create a similar function.  Instead of setting one to the other, I want to capture the arguments in a list of cons pairs.
<pablo_escoberg> (said list of cons pairs will later be translated either to JSON or HTML, depending)
<pablo_escoberg> So in fact, `setq` is the perfect example, since I want the exact same signature.
<aw-> why don't you use (de) ?
<aw-> (de MyFun @ ...)
<aw-> then you can use (rest) and (next) and (args)
<pablo_escoberg> I am using `de`
<pablo_escoberg> right, but then ALL the arguments would evaluate, which is not what I want
<pablo_escoberg> I could do `(de foo Args ...)` and then eval every other arg
<pablo_escoberg> but that's what I'm trying to avoid.  It's not the end of the world though.
<pablo_escoberg> so if there's no alternative, it's just what I'll do.
<pablo_escoberg> IOW, I'll use `%` as you originally suggested.
<abu[7]> pablo_escoberg, I see what you mean. But there is no way.
<pablo_escoberg> thanks.  that's what I thought.
<abu[7]> Picolisp functions either evaluate *all* arguments, or *none*, or a combination where the first args are evaluated and the rest not
<abu[7]> Built-ins are all of the *none* type
<pablo_escoberg> right.  I was just making sure that `setq` used some kind of C magic rather than some functionality for which I couldn't find the docs.
<abu[7]> The problem is: How sholld be specified syntactically what you intend?
<abu[7]> Yeah, no C magic
<abu[7]> (there is no C)
<abu[7]> So the "real" pil funs don't evaluate
<pablo_escoberg> right.  I had this one insight while thinking about this that `Str` probably gives you the ability to do this.
<abu[7]> Just if the parameters are a list, the interpreter is so nice to do it for us
<pablo_escoberg> you have to redefine the language at read.
<abu[7]> Not at read
<pablo_escoberg> so, for example, you could make `de` work like the docs.
<abu[7]> it is how the args are *interpreted*
<pablo_escoberg> (de 'foo bar 'baz 'bat)
<pablo_escoberg> oops
<pablo_escoberg> (de foo 'bar baz 'bat)
<pablo_escoberg> foo is the function name, bar and bat get executed; baz does not.
<pablo_escoberg> I think it's doable without C using `Str`
<pablo_escoberg> I'll probably look into it.
<abu[7]> yes, but "evaluated" instead of "executed"
<pablo_escoberg> Gah!  I keep doing that!
<pablo_escoberg> :)
<abu[7]> :)
<pablo_escoberg> ok, I was going to just work around this, but I'm going to play with `Str`.  I just realized that that one function actually gives you the same control you get in Racket but more conveniently (I think).
<abu[7]> What "Str" do you mean?
<pablo_escoberg> oops, I meant `str`
<abu[7]> This is basically just reading and printing from/to strings. Has nothing to do with argument evaluation.
<abu[7]> You can do it also with 'input' and 'output' now
<pablo_escoberg> Well, I can use it and/or `read` to evaluate a list any way I specify, so I can `Str` an unevaluated args list and interpret it as the signature listed above (again, I think and need to read and test more)
<abu[7]> Not sure what you mean
<abu[7]> You don't need string manipulations to do special forms of evaluation
<abu[7]> It all happens directly on the s-expression level
<pablo_escoberg> I guess I'm trying to capture the input before the interpreter takes over.  Maybe something like arbitrary read macros.
<abu[7]> Read macros are just syntactic sugar
<pablo_escoberg> So, essentially read -> manipulate -> evaluate.
<abu[7]> You must strictly distinguish between I/O and evaluation
<abu[7]> First design the evaluation syntax
<abu[7]> Then maybe put some syntactic sugar around it
<pablo_escoberg> Well, the syntax I'm going for is `(func foo 'a b c 'd 'e)` .  Not sure, but I think I can accomplish that.
<abu[7]> yes, no need for a read macro
<abu[7]> DKordic gave an example for setq above
<abu[7]> and remember what we did with the flow functions
<abu[7]> (de func Args ... (++ Args) (eval (++ Args)) ... (++ Args) (eval (++ Args)) ...
<abu[7]> This evaluates every second argument
<abu[7]> That's all
<pablo_escoberg> Yup, and that's almost verbatim what I was starting to do before asking the question :)
<abu[7]> I thought so
<pablo_escoberg> cool.  I'll stick with it for now.
<abu[7]> user3456: Why do you want to build Pil with gcc?
<abu[7]> The distro has only a single C file, src/lib.c
<abu[7]> This can perhaps be compiled with gcc, but it does not help much because most of Pil is not C
rob_w has joined #picolisp
msavoritias has joined #picolisp
msavoritias has quit [Ping timeout: 260 seconds]
msavoritias has joined #picolisp
msavoritias has quit [Ping timeout: 260 seconds]
pablo_escoberg has quit [Quit: Client closed]
pablo_escoberg has joined #picolisp
msavoritias has joined #picolisp
msavoritias has quit [Ping timeout: 240 seconds]
msavoritias has joined #picolisp
msavoritias has quit [Ping timeout: 246 seconds]
msavoritias has joined #picolisp
pablo_escoberg has quit [Quit: Client closed]
msavoritias has quit [Ping timeout: 252 seconds]
msavoritias has joined #picolisp
seninha has joined #picolisp
rob_w has quit [Remote host closed the connection]
seninha has quit [Ping timeout: 252 seconds]
seninha has joined #picolisp
msavoritias has quit [Ping timeout: 252 seconds]
msavoritias has joined #picolisp
<DKordic> pablo_escoberg: You might be interested in so called ""Pattern Matching"" which is defined on Algebraic Data Types. Of which so called ""str(ing)"", ASCII, Unicode or UTF-8, is the most meaningless and irrelevant. Byte String, Bit String?! You are trying to pattern match on S-Expressions.
<DKordic> That declaration in docs is not useful for _cons_truction of _cond_! IMHO they are a mistake. Would you be kind enough to tell us what do you think about it?
<abu[7]> tankf33der awake?
msavoritias has quit [Ping timeout: 252 seconds]
seninha has quit [Remote host closed the connection]
msavoritias has joined #picolisp
<tankf33der> Here
<abu[7]> Hi!
<tankf33der> Hi all
<abu[7]> I found an fixed yet another bug in coroutines
<tankf33der> Running tests
<abu[7]> If one coroutine was started from inside another coroutine, and then is 'yield'e
abu[7] has left #picolisp [#picolisp]
abu[7] has joined #picolisp
<abu[7]> oops
abu[7] has left #picolisp [#picolisp]
abu[7] has joined #picolisp
<abu[7]> grr
<abu[7]> ... and then 'yield'ed to
<abu[7]> Thanks tankf33der!
<tankf33der> All passed
<abu[7]> Cool, thanks!
<abu[7]> this crashed for example:
<abu[7]> (co 'a (catch 'ok (co 'b (loop (yield) ) ) (yield T 'b) (throw 'ok T)))
<abu[7]> Now should pass
<abu[7]> (yield T 'b) crashed
<tankf33der> I will to tests
<tankf33der> i will add to tests
<abu[7]> Good
<abu[7]> Then perhaps something like http://pb1n.de/?6969f7
<tankf33der> Yeap
<tankf33der> sure
<gahr> that gives me T here, it doesn't crash
<gahr> (version) is 23.8.8
<gahr> sorry I don't mean to hijack the flow here :)
<gahr> I just got curious
<tankf33der> crashes here before the fix
<abu[7]> gahr, crashes in general are often hard to reproduce
<abu[7]> Memory and stack layout and such things
seninha has joined #picolisp
seninha has quit [Remote host closed the connection]
seninha has joined #picolisp
<abu[7]> It took me a few hours to boil it down to the above minimal code
<abu[7]> The problem is the last 'yield', but the crash happens in the (throw 'ok T) at the end due to a messed up stack frame
<abu[7]> And finding the real cause and fixing it took me more than one day :(
msavoritias has quit [Remote host closed the connection]
theruran has quit [Quit: Connection closed for inactivity]
<user3456> abu[7]: The shared debian box I have access to only has gcc, and I am unable to install new packages
<user3456> make is present though