Re: pil21 installation fail
Ok, I solved the issue by setting and exporting the environment variable TMPDIR to /tmp . For some reason clang had no place to save the temporary files generated during compilation, so I think clang just did not generate them. I think that was the "clang-16: error: unable to make temporary file: No such file or directory" error. Thanks Abu for the clue ;) On Sun, Nov 12, 2023 at 1:46 AM Alexander Burger wrote: > On Sat, Nov 11, 2023 at 04:14:02PM -0500, polifemo wrote: > > clang-16: error: unable to make temporary file: No such file or directory > > make: *** [Makefile:32: ../lib/sysdefs] Error 1 > > ``` > > > > I think it's trying to search for the sysdefs.c file in pil21/lib, but > the > > file is in pil21/src. But I can be wrong. > > It does not say that sysdefs.c is not found, but that clang cannot create a > temporary file. > > Where does clang create its temporary files? > > https://stackoverflow.com/questions/13336168 says: > >When not using the --save-temps option the temporary files are created > in a >default directory (i.e. $TMPDIR such as /tmp) > > Can you find but more? > > ☺/ A!ex > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >
pil21 installation fail
I just downloaded the latest pil21.tgz (2023-11-11) in my linux box. The installation fails immediately with: ``` clang-16: error: unable to make temporary file: No such file or directory make: *** [Makefile:32: ../lib/sysdefs] Error 1 ``` I think it's trying to search for the sysdefs.c file in pil21/lib, but the file is in pil21/src. But I can be wrong. I'm running archlinux, this is the `uname -a`: Linux pc 6.5.8-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 19 Oct 2023 22:52:14 + x86_64 GNU/Linux
Re: abort in less than a second
Thank you so much! I used poll to check for anything to read from stdin and it worked flawlessly. Here's the code. It does not have any context, but it is an example of how to use poll: '(loop (eval (loadRepeat)) (wait 100) (T (and (poll 0) (= "53" (line T))) (setq *Repite (list (loadRepeat) (loadRepeat))) ) ) Thank you all very much! On Mon, Apr 24, 2023 at 12:45 AM Alexander Burger wrote: > On Mon, Apr 24, 2023 at 06:45:06AM +0200, Danilo Kordic wrote: > > I would use Linux.epoll. pil doesn't have it... yrt. > > PicoLisp has 'poll', which uses poll(2) or ppoll(2) internally. > > ☺/ A!ex > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >
abort in less than a second
I have a loop that executes a prg and then waits for the user to input something. If the user does not input anything within the timeout, the waiting is aborted and the loop restarts. The problem is that, I want the timeout to be much faster, but 'abort only works in seconds. Is there a way to abort a program after M milliseconds?
Re: methods receive more arguments than defined?
oh, right! The first argument is the object to receive the message, and the second is the argument to the function. Thank you! On Wed, Dec 21, 2022 at 12:34 PM Alexander Burger wrote: > On Wed, Dec 21, 2022 at 05:14:15PM +0100, Frithjof Schulze wrote: > > I can’t say much about other the rest of the code, but “This” is not an > > argument, but a global variable managed by the system to have the > current object > > as a value: > > Right. > > > > > On 21. Dec 2022, at 16:51, polifemo > wrote: > > > > What does this mean? Why is This being passed as an extra argument > that is not > > > in the method definition? When can you pass extra arguments and have > it make > > > sense? > > The syntax of message passing (i.e. method calls) in PicoLisp is > >(message> object arg1 arg2) > > Read as "message is sent to object". > > The object is not really passed as an *argument*, but is the target of the > message sending, and is implicitly bound to the symbol 'This' while the > method > body runs. > > The method would be defined as > >(dm message> (Arg1 Arg2) > ... ) > > ☺/ A!ex > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >
methods receive more arguments than defined?
Still reading the vip source, and I've noticed that, often, a method call will have more arguments than defined in the method definition. Like: (dm dirty> (Win) (<> (: undo) (: dirt)) ) .. (if (dirty> (: buffer) This) " * " " ") .. (dirty> (: buffer) This) and (dm load> (Win) .. (load> (: buffer) This) The extra value seems to always be 'This ... What does this mean? Why is This being passed as an extra argument that is not in the method definition? When can you pass extra arguments and have it make sense?
the purpose of *KeyMap in vip
I'm slowly studying the @lib/vip.l source, and I've run into a global variable that appears to not be documented. What's the use of *KeyMap ? I guess it's something to do with custom keyboard remappings? Thanks for your time.
Re: penti chorded keyboard not working with termux v.117
this worked perfectly, thank you so much! On Fri, Sep 17, 2021, 13:53 Alexander Burger wrote: > Hi polifemo, > > > I followed the termux updating instructions, but after the update penti > > stopped working with termux. If I try to open penti it glitches and stops > > working, and if I force it does not accept special characters like > > backspace. > > Indeed, I had the same problem after updating to Version 0.117 from > F-Droid. > > Fortunately I found the solution after some experimentation: > >— Pull in the termux menu from the left >— Click on the settings wheel >— Select Preferences for Termux App >— then Preferences for terminal view >— Switch OFF Terminal Margin Adjustment > > No idea what "Terminal Margin Adjustment" is, but for me the spooky > behavior was > gone :) > > ☺/ A!ex > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >
Re: penti keyboard not working with termux 0.117
> termux in the app store is not being updated anymore, and the team > recommended I move to the F-droid version of the app, since they are not > gonna update to the google app store anymore. > > I followed the termux updating instructions, but after the update penti > stopped working with termux. If I try to open penti it glitches and stops > working, and if I force it does not accept special characters like > backspace. > > Is this a known problem? > I know you all are not my tech support team. I'm asking more to know my > options and if there is a ready made solution, or if I am the only one > experiencing this.issue. >
penti chorded keyboard not working with termux v.117
termux in the app store is not being updated anymore, and the team recommended I move to the F-droid version of the app, since they are not gonna update to the google app store anymore. I followed the termux updating instructions, but after the update penti stopped working with termux. If I try to open penti it glitches and stops working, and if I force it does not accept special characters like backspace. Is this a known problem? I know you all are not my tech support team. I'm asking more to know my options and if there is a ready made solution, or if I am the only one experiencing this.issue.
in the function 'later, why is the pipe run inside a 'task?
Studying the implementation of 'later, I'm curious as to why the pipe is run inside a 'task. I've tested it and it works just fine without the task. My guess is that it allows for parallel processes. Programs inside *Run are run independently of the sequence of the main program. If it was run without 'task, the child would have to return a value before the parent could continue execution. This would defeat the purpose of using 'later to spawn child processes that can run in parallel, reducing total wait time. Here's the definition of 'later, to make this post self contained: (de later ("@Var" . "@Prg") (macro (task (pipe (pr (prog . "@Prg"))) (setq "@Var" (in @ (rd))) (task (close @)) ) ) "@Var" ) thanks for your attention.
Re: why is (prog . '((+ 1 2 3) (+ 4 5 6))) not equivalent to (apply 'prog '((+ 1 2 3) (+ 4 5 6)))
I see! thanks! On Thu, May 27, 2021 at 12:39 AM Alexander Burger wrote: > On Wed, May 26, 2021 at 11:49:57PM -0500, polifemo wrote: > > (prog . '((+ 1 2 3) (+ 4 5 6))) returns the expected value, 15, while > > (apply 'prog '((+ 1 2 3) (+ 4 5 6))) fails with "Address boundary error". > > 'apply' can be used only with functions evaluating their arguments (EXPRs > or > SUBRs). It takes a list of already *evaluated* arguments, and passes these > to > the function. > > 'prog' is an FEXPR (an FSUBR to be exact). It wants to evaluate each > argument by > itself, one by one. > > ☺/ A!ex > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >
why is (prog . '((+ 1 2 3) (+ 4 5 6))) not equivalent to (apply 'prog '((+ 1 2 3) (+ 4 5 6)))
(prog . '((+ 1 2 3) (+ 4 5 6))) returns the expected value, 15, while (apply 'prog '((+ 1 2 3) (+ 4 5 6))) fails with "Address boundary error". Why is this so? I would have expected both to behave the same, and they do if I use a more benign function like '+ (+ . (1 2 3)) -> 6 (apply '+ (1 2 3)) -> 6
Re: use of (+ N) in 'task and 'timeout
thanks for the explanation! I'm glad I was able to help a little : ) On Tue, May 25, 2021, 00:35 Alexander Burger wrote: > On Mon, May 24, 2021 at 08:03:35PM -0500, polifemo wrote: > > As I refactor pil21 for my amusement, I've found the function '+ being > used > > on single numbers. What is this for? As far as I could think, it might > have > > to do something with formatting... but I really can't think of anything
use of (+ N) in 'task and 'timeout
As I refactor pil21 for my amusement, I've found the function '+ being used on single numbers. What is this for? As far as I could think, it might have to do something with formatting... but I really can't think of anything. here are two examples, in related operations: (de timeout (N) (if2 N (assoc -1 *Run) (set (cdr @) (+ N)) # here (push '*Run (list -1 (+ N) '(bye))) # here (del @ '*Run) ) ) it is also used inside 'task, in this expression: `(link (+ (eval (++ Prg) 1)))` , though the entire thing is too long for me to comfortably paste here.
Re: get the 'up value of a variable across a lambda
Ok, I see my mistake. I assumed that let and the rest could create enclosing environments, when only a function call can. Another example I made of how to use 'up: : (de f () (and 1000 (up 1 @) @)) -> f : (and 10 (f)) -> 10 Thanks for the clarification alex! On Mon, May 24, 2021 at 12:55 AM Alexander Burger wrote: > On Sun, May 23, 2021 at 08:44:32PM -0500, polifemo wrote: > > `(let @ 1 (let @ 10 (let @ 20 (up 2 @` > > This are two misunderstandings in this example: > > 1. It has not a good idea to bind '@' in a 'let' expression. '@' is set >implicitly by flow- and logic-functions, so a correct usage would be > > (and 1 (or 10 (while 20 (up 2 @ > >or - more realistically - > > (and (foo) (or (bar) (while (zup) (up 2 @ > > 2. 'up' does not care about 'let', 'use', 'for' etc. They are ignored. An > up >"enclosing environment" always means the enclosing *function* > environment. So >all the above 'let's all run in the same environment. The same rule > applies >to the environment offsets to 'eval' and 'run'. > > > > returns 1, as I expected, if I enclose the 'up expression inside a > function > > This return value of '1' just happens because the environment setup in > bindeng > '@' in 'let' is undefined. > > > Let me try to give an example. > >(when 7 # The result of 'when' is what we are interested in > (extract > '((N) # Here we are in a function > (when (num? N) # 'when' sets '@' >(+ N @) ) ) # so we add the wrong '@' > (1 a 2 b 3))) >-> (2 4 6) > >(when 7 > (extract > '((N) # in a function > (when (num? N) >(+ N (up 1 @)) ) ) # Here we get the '7' > (1 a 2 b 3))) >-> (8 9 10) > > ☺/ A!ex > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >
get the 'up value of a variable across a lambda
while `(let @ 1 (let @ 10 (let @ 20 (up 2 @` returns 1, as I expected, if I enclose the 'up expression inside a function like `(de f (N) (up N @))` then no value of N will yield the value of @ in an environment higher than the innermost let: ` : (let @ 1 (let @ 10 (let @ 20 (f 3))) -> 20 ` how can I access the (@ . 1) value in that higher environment from inside the function?
Re: tentative bug report for 'task
I see, I had misunderstood the @'s meaning there. Thanks for the clarification! On Tue, May 18, 2021 at 12:03 AM Alexander Burger wrote: > On Mon, May 17, 2021 at 04:53:50PM -0500, polifemo wrote: > > So, running: > > (task -5000 (/ @ 5) (tty (println 'a))) > > > > does not save in *Run my expected: > > (-5000 -1000 (tty (println 'a))) > > > > but instead it saves this: > > (-5000 NIL (tty (println 'a))) > > > > my guess is that `(eval (++ Prg) 1)` is not working properly, though I am > > probably just doing it wrong. > > It all depends on what is *before* the 'task' call. After all, the purpose > of > the 'eval' offset is to use the *caller*'s value of '@'. > > For example: >: (when (format (key)) > (task -5000 (msg (* @ 10)) > (tty (println 'a)) ) ) >70 # After hitting key "7" >-> (-5000 70 (tty (println 'a))) >a >a > > > ☺/ A!ex > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >
tentative bug report for 'task
I'm not sure if this is really a bug, since the behaviour I expected only runs in a version of 'task I'm refactoring right now. But I'll try anyways. So, running: (task -5000 (/ @ 5) (tty (println 'a))) does not save in *Run my expected: (-5000 -1000 (tty (println 'a))) but instead it saves this: (-5000 NIL (tty (println 'a))) my guess is that `(eval (++ Prg) 1)` is not working properly, though I am probably just doing it wrong. what do you guys think?
Re: the purpose of (eval (++ Prg) 1) in the 'task function
ok, now I see how to work it with '@. It refers to the value of the first argument: (task -5000 (/ @ 5) N 0 (tty (println (inc 'N I guess (eval (++ Prg) 1) is the idiom to let your functions use @. Though you have to be thoughtful of how you do it. This '@ comes from the 'when, which is the enclosing caller of the (eval (++ Prg) 1) expression. On Sun, May 16, 2021 at 7:19 PM polifemo wrote: > ok, I've found a way to pass an expression to eval: > (task -5000 (* 10 100) N 0 (tty (println (inc 'N > > the next step is to figure a way to use @ inside that expression > > On Sun, May 16, 2021 at 7:14 PM polifemo > wrote: > >> I'm studying 'trace in @lib.l, and I've run into a question. >> I don't understand why must 'eval be called on the second number on the >> case that the first number is negative. I'm especially confused by giving 1 >> as an argument to 'eval. That's supposed to give you the context from which >> to extract the value of @, but since its a number, it should never have an >> @ to affect the result. If it was an expression, then I could understand, >> but I've tried passing an expression as a second argument several times and >> its always failed. >> >> My question would be, why eval the second argument, and why pass a 1 to >> eval when @ does not seem to be relevant in this context? >> >> Here's the body of the 'trace function, as a refresher. >> >> (de task (Key . Prg) >>(nond >> (Prg (del (assoc Key *Run) '*Run)) >> ((num? Key) (quit "Bad Key" Key)) >> ((assoc Key *Run) >> (push '*Run >> (conc >>(make >> (when (lt0 (link Key)) >> (link (+ (eval (++ Prg) 1))) ) ) #the line that >> confuses me >>(ifn (sym? (car Prg)) >> Prg >> (cons >> (cons 'job >> (cons >>(lit >> (make >> (while (atom (car Prg)) >> (link >>(cons (++ Prg) (eval (++ Prg) 1)) >> ) ) ) ) # the same pattern in another line. >>Prg ) ) ) ) ) ) ) >> (NIL (quit "Key conflict" Key)) ) ) >> >> >>
Re: the purpose of (eval (++ Prg) 1) in the 'task function
ok, I've found a way to pass an expression to eval: (task -5000 (* 10 100) N 0 (tty (println (inc 'N the next step is to figure a way to use @ inside that expression On Sun, May 16, 2021 at 7:14 PM polifemo wrote: > I'm studying 'trace in @lib.l, and I've run into a question. > I don't understand why must 'eval be called on the second number on the > case that the first number is negative. I'm especially confused by giving 1 > as an argument to 'eval. That's supposed to give you the context from which > to extract the value of @, but since its a number, it should never have an > @ to affect the result. If it was an expression, then I could understand, > but I've tried passing an expression as a second argument several times and > its always failed. > > My question would be, why eval the second argument, and why pass a 1 to > eval when @ does not seem to be relevant in this context? > > Here's the body of the 'trace function, as a refresher. > > (de task (Key . Prg) >(nond > (Prg (del (assoc Key *Run) '*Run)) > ((num? Key) (quit "Bad Key" Key)) > ((assoc Key *Run) > (push '*Run > (conc >(make > (when (lt0 (link Key)) > (link (+ (eval (++ Prg) 1))) ) ) #the line that > confuses me >(ifn (sym? (car Prg)) > Prg > (cons > (cons 'job > (cons >(lit > (make > (while (atom (car Prg)) > (link >(cons (++ Prg) (eval (++ Prg) 1)) ) > ) ) ) # the same pattern in another line. >Prg ) ) ) ) ) ) ) > (NIL (quit "Key conflict" Key)) ) ) > > >
the purpose of (eval (++ Prg) 1) in the 'task function
I'm studying 'trace in @lib.l, and I've run into a question. I don't understand why must 'eval be called on the second number on the case that the first number is negative. I'm especially confused by giving 1 as an argument to 'eval. That's supposed to give you the context from which to extract the value of @, but since its a number, it should never have an @ to affect the result. If it was an expression, then I could understand, but I've tried passing an expression as a second argument several times and its always failed. My question would be, why eval the second argument, and why pass a 1 to eval when @ does not seem to be relevant in this context? Here's the body of the 'trace function, as a refresher. (de task (Key . Prg) (nond (Prg (del (assoc Key *Run) '*Run)) ((num? Key) (quit "Bad Key" Key)) ((assoc Key *Run) (push '*Run (conc (make (when (lt0 (link Key)) (link (+ (eval (++ Prg) 1))) ) ) #the line that confuses me (ifn (sym? (car Prg)) Prg (cons (cons 'job (cons (lit (make (while (atom (car Prg)) (link (cons (++ Prg) (eval (++ Prg) 1)) ) ) ) ) # the same pattern in another line. Prg ) ) ) ) ) ) ) (NIL (quit "Key conflict" Key)) ) )
Re: in eval, how does the 'num argument work?
Ok, I got how it works. (eval 'Exp 'Num) If 'Exp contains @, the value of @ in the 'Num higher environment will be used. For example: (setq A (2 1)) (let @ 4 (cons @ (eval '(cons 3 @) 3))) -> (4 3 2 1) if '@ is not used in the expression, it will have no effect. On Sat, May 15, 2021 at 10:19 PM polifemo wrote: > the doc of 'eval says this: > > (eval 'any ['cnt]) -> any > Evaluates any. Note that because of the standard argument evaluation, any > is actually evaluated twice. > > If an offset cnt is given, the value of @ in the > cnt'th call environment is used during the second evaluation. cnt should > be greater than zero. See also run and up. > > I'm having a hard time understanding what the 'cnt value does. I thought > it would use the value of the 'any that is 'cnt positions up, like 'up > does, but then this test code does not behave as I expect: > > (setq A (2 1)) > (let A 3 (list A (eval 'A) (eval 'A 2) (up 2 A))) > -> (3 3 3 (2 1)) > instead of (3 (2 1) (2 1)), which is what I expected. > > would someone help me understand? > > >
in eval, how does the 'num argument work?
the doc of 'eval says this: (eval 'any ['cnt]) -> any Evaluates any. Note that because of the standard argument evaluation, any is actually evaluated twice. If an offset cnt is given, the value of @ in the cnt'th call environment is used during the second evaluation. cnt should be greater than zero. See also run and up. I'm having a hard time understanding what the 'cnt value does. I thought it would use the value of the 'any that is 'cnt positions up, like 'up does, but then this test code does not behave as I expect: (setq A (2 1)) (let A 3 (list A (eval 'A) (eval 'A 2) (up 2 A))) -> (3 3 3 (2 1)) instead of (3 (2 1) (2 1)), which is what I expected. would someone help me understand?
Re: bug report for @bin/vip
oh! I get it! thanks for clearing that up. On Fri, May 14, 2021, 00:40 Alexander Burger wrote: > On Fri, May 14, 2021 at 07:16:27AM +0200, Alexander Burger wrote: > > In Vip, this is useful for example to set the correct namespace: > > > >$ vip --symbols llvm src/main.l + > > > > (note the double '-' as the function is '-symbols'), or to do other > useful > > things: > > > >$ vip -"trace 'foo" -"debug 'bar" lib/vip.l + > > Thus, as a consequence, if you want to 'load' a file: > >$ vip -'load "a.l"' file > > ☺/ A!ex > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >
Re: bug report for @bin/vip
this is the corrected function: (bye (if (vip~vi ## [+ | +[]] [+[]] .. (make (while (opt) (let S @ (cond ((pre? "+" S) (link (cons (cond ((= "+" S) T) ((format S) @) (T (cdr (chop S))) ) (opt) ) ) ) ((pre? "-" S) (load (pack (cdr (chop S) (T (link S)) ) ) ) ) ) 0 1 ) ) On Thu, May 13, 2021 at 5:39 PM polifemo wrote: > I realized the source of my previous loading problem: > > (bye >(if > (vip~vi > (make > (while (opt) >(let S @ > (cond > ((pre? "+" S) > (link >(cons > (cond > ((= "+" S) T) > ((format S) @) > (T (cdr (chop S))) ) > (opt) ) ) ) > ->>> ((pre? "-" S) (load S)) > (T (link S)) ) ) ) ) ) > 0 > 1 ) ) > `((pre? "-" S) (load S))` this is the offending line: it checks if the > argument string starts with a "-" to load it, but then it does not get rid > of it, so it looks for the file with a "-" prepended. > > In summary, if you write `vip -@file.l hello`, it will try to load a file > named "-file.l", instead of "file.l" >
bug report for @bin/vip
I realized the source of my previous loading problem: (bye (if (vip~vi (make (while (opt) (let S @ (cond ((pre? "+" S) (link (cons (cond ((= "+" S) T) ((format S) @) (T (cdr (chop S))) ) (opt) ) ) ) ->>> ((pre? "-" S) (load S)) (T (link S)) ) ) ) ) ) 0 1 ) ) `((pre? "-" S) (load S))` this is the offending line: it checks if the argument string starts with a "-" to load it, but then it does not get rid of it, so it looks for the file with a "-" prepended. In summary, if you write `vip -@file.l hello`, it will try to load a file named "-file.l", instead of "file.l"
Re: load script to vip with `vip -@ext.l hello`
I'm using picolisp version 21.4.10 On Thu, May 13, 2021 at 4:59 PM polifemo wrote: > I'm having trouble loading the library picohome/ext.l with the minus > notation of vip. > > I could not find an example in the wiki's documentation, could someone be > kind enough to explain how to use it? >
load script to vip with `vip -@ext.l hello`
I'm having trouble loading the library picohome/ext.l with the minus notation of vip. I could not find an example in the wiki's documentation, could someone be kind enough to explain how to use it?
Re: what does prepending a "+" to an argument to vip do?
whoa! that's ingenious! Thank you for the quick response On Thu, May 13, 2021 at 1:41 PM Alexander Burger wrote: > On Thu, May 13, 2021 at 01:15:54PM -0500, polifemo wrote: > > (cond > > ->> ((pre? "+" S) > > (link > >(cons > > (cond > > ((= "+" S) T) > > ((format S) @) > > (T (cdr (chop S))) ) > > (opt) ) ) ) > > ... > > I think it means "do something special when the argument starts with "+". > > Correct. > > It first checks if the argument is just a single "+". If so, Vip opens the > file > from the following argument and jumps to its end > >$ vip + file # Go to the end of "file" > > Otherwise, if it is a number (told by 'format'), it opens the file and > jumps to > that number > >$ vip +42 file # Go to line 42 > > Else, the argument is taken as a "word" pattern to search for > >$ vip +foo file # Search for "foo" > > You can hit 'n' (find next) when the file is open. > > "Word" is a word according to PicoLisp delimiter rules, the same as if you > start > a search by hitting '*' on a word. > > ☺/ A!ex > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >
what does prepending a "+" to an argument to vip do?
reading through the file @bin/vip, I found this line: ((pre? "+" S) inside this function (bye (if (vip~vi (make (while (opt) (let S @ (cond ->> ((pre? "+" S) (link (cons (cond ((= "+" S) T) ((format S) @) (T (cdr (chop S))) ) (opt) ) ) ) ((pre? "-" S) (load S)) (T (link S)) ) ) ) ) ) 0 1 ) ) I think it means "do something special when the argument starts with "+". But I don't know what that is. I've tried running `vip +hello`, and it opens a temporary file in the picolisp tmp folder (~/.pil/tmp) but if that's all it did, why bother adding the name stuff? thanks for your help.
Re: why does *Dbg appear to prevent loading of @lib/vip.l in vip?
ok! thank you! :D On Thu, May 13, 2021 at 12:05 PM Alexander Burger wrote: > On Thu, May 13, 2021 at 11:40:50AM -0500, polifemo wrote: > > reading the file that calls vip, the first line is: > > > > (unless *Dbg > >(load "@lib/vip.l") ) > > > > why does it seem that, when in debug mode, the vip library is prevented > > from loading? its especially confusing since it seems to do nothing, as > > running `vip +` runs vip normally. > > It is because in debug mode "@lib/vip.l" is already loaded in "@lib.l". > > The 'vip' script has the first line > >#!/usr/bin/picolisp /usr/lib/picolisp/lib.l > > At the end of "lib.l" we have > >### Debug ### >`*Dbg >... >(load ... "@lib/vip.l") > > Thus, loading it once more is not nevessary. > > ☺/ A!ex > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >
why does *Dbg appear to prevent loading of @lib/vip.l in vip?
reading the file that calls vip, the first line is: (unless *Dbg (load "@lib/vip.l") ) why does it seem that, when in debug mode, the vip library is prevented from loading? its especially confusing since it seems to do nothing, as running `vip +` runs vip normally.
Is there a mechanism to save the last defined function?
Inspired by the way methods are defined, by just defining them and looking which class a method belongs to by looking into the global variable *Class, I'd like to have a similar mechanism for creating docstrings. My idea is something like this: ``` (de f (A) A) (mkdocstr "A test function that returns its argument evaluated") ``` where mkdocstr is defined like this: ``` (de mkdocstr (Docstr) (put *Function 'docstr Docstr) ) ``` This, of course, requires some global variable *Function that saves the last symbol defined by 'de. Is there such a variable? Or is there a way to change 'de to write to that variable?
^X does not exit a breakpoint in pil21
it seems that ^X does not exit a breaking point to the main picolisp process anymore. When I break a process with ^C, for example `(loop (println "hello world") (wait 1000))`, I enter a breakpoint, but I can't return to toplevel with ^X as I used to. was this functionality disabled? for now, I can write `(quit)` in the breakpoint prompt to go to toplevel, though the lack of ^X caught me by surprise.
Re: What is the structure of a namespace
ok, I see how your understanding of the underlying machine informs your description of the tree structure. Being aware of lists as chains of cons cells is still not intuitive for me. But I'll practice this view, since I agree that your explanation is simpler and more deeply true. Thanks for answering my questions! Having such clear an practically immediate feedback makes it a joy to learn. I really am grateful. On Sat, Apr 17, 2021 at 1:00 AM Alexander Burger wrote: > On Fri, Apr 16, 2021 at 03:13:10PM -0500, polifemo wrote: > > OH! I think I'm getting it! > > for example, 'simul is '(\~ ("permute" ("shuffle" ("flood" ("G" NIL "gen" > > ... > > > Something that confused me was that first symbol, '\~. It is not a valid > > picolisp symbol! > > Correct. The special symbol \~ is new in pil21 and is only used as a marker > (e.g. for error checks). It is not absolutely necessary, and did not exist > in > pil64. > > > > But now that I see that a namespace is a cons of a "short > > name namespace" and a "long name namespace", no symbol from either > > namespace would be a reasonable root for the tree. So that arbitrary > symbol > > (\~) was chosen as the root. The cadr of 'simul are the short names, and > > there is no caddr because there are no long names! > > Yes, though not the caddr but the cddr. > > In summary, a namespace consists of 2 cells: > >+--+-+ +---+---+ >| \~ | ---+>| short | long | >+--+-+ +---+---+ > > ># Create empty namespace >: (symbols 'ap 'pico) >-> (pico) > >ap: ap >-> (\~ NIL) > ># Two cells > >+--+-+ +-+-+ >| \~ | ---+>| / | / | >+--+-+ +-+-+ > > >ap: (local) (abc def ghijklmo pqrstuvw) > >ap: ap >-> (\~ (abc NIL def) ghijklmo NIL pqrstuvw) > >ap: (car ap) >-> \~ > >ap: (cadr ap) >-> (abc NIL def) > >$ap: (cddr ap) >-> (ghijklmo NIL pqrstuvw) > >ap: (all 'ap) >-> (abc def ghijklmo pqrstuvw) > > > > One of the things that confused me was the way trees are represented. For > > example, given this tree: > > > > 9 > > 8 > >7 > > 6 > > 5 > > 4 > > 3 > >2 > > 1 > > > > I would have represented it as a nested list in this way: > > (5 (2 (1 NIL NIL) (3 NIL (4 NIL NIL))) (7 (6 NIL NIL) (8 NIL (9 NIL > NIL > > That is, each new branch is inside its own list. Intuitive, but quite > > wasteful, given that conses are memory in picolisp. > > > > But the picolisp way is: > > (5 (2 (1) 3 NIL 4) 7 (6) 8 NIL 9) > > this is hard for me to describe, but something like... > > Every second element is the left branch of the element before it, and > every > > third element is the right branch of the element two places back. > > If we look at it this way, it is very simple: > >1. A tree node consists of either one or two cells. Leaf nodes need > only one > cell. >2. The first cell of a node has the payload (value) in its CAR, and the > subtrees (or NIL for leaf nodes) in its CDR. >3. The second cell of a node holds the subtrees. The left one in the > CAR and > the right one in the CDR. > > As leaf nodes need only one cell, and half of the nodes in a (balanced) > tree are > leaf nodes, such a tree occupies one and a half cells per node on the > average. > > ☺/ A!ex > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >
Re: What is the structure of a namespace
OH! I think I'm getting it! for example, 'simul is '(\~ ("permute" ("shuffle" ("flood" ("G" NIL "gen" ("DX" NIL "DY" ("FX") "FY" NIL "Col") "game" ("grid" ("Grid")) "west" ("east" ("East" ("disp")) "West")) "south" ("north" NIL "South") "border")) "subsets" ("samples"))) Something that confused me was that first symbol, '\~. It is not a valid picolisp symbol! But now that I see that a namespace is a cons of a "short name namespace" and a "long name namespace", no symbol from either namespace would be a reasonable root for the tree. So that arbitrary symbol (\~) was chosen as the root. The cadr of 'simul are the short names, and there is no caddr because there are no long names! One of the things that confused me was the way trees are represented. For example, given this tree: 9 8 7 6 5 4 3 2 1 I would have represented it as a nested list in this way: (5 (2 (1 NIL NIL) (3 NIL (4 NIL NIL))) (7 (6 NIL NIL) (8 NIL (9 NIL NIL That is, each new branch is inside its own list. Intuitive, but quite wasteful, given that conses are memory in picolisp. But the picolisp way is: (5 (2 (1) 3 NIL 4) 7 (6) 8 NIL 9) this is hard for me to describe, but something like... Every second element is the left branch of the element before it, and every third element is the right branch of the element two places back. Its a wonderfully ingenious compression, and much easier to read than my naive implementation of trees. Just that, without that description I just gave, it was really hard for me to understand it. Without that description, I could not see namespaces as binary trees at all! XD I'm publishing this as a small documentation for anyone confused about this
Re: What is the structure of a namespace
ok, I kinda see. So, I have another question: Is the 'pico tree namespace built the same way as any namespace of any 'loaded file? like, (load '@lib/simul.l) populates the 'simul symbol with the names defined inside the '@lib/simul.l file. Is the process for creating the 'simul namespace the same as creating the 'pico namespace? And how is the namespace of a loaded file created? On Fri, Apr 16, 2021 at 2:01 PM Alexander Burger wrote: > Hi polifemo, > > > I've realized that the 'pico namespace is a tree, but I can't figure out > > which kind of tree. It does not seem fit with a binary tree structure. > > > > So, what's the structure of namespaces, and what's the algorithm for > > organizing the symbols inside a namespace list? > > You are very close :) > > In fact, it is a cons-pair of *two* binary trees: One for symbols with > names of > 7 or less bytes (so that the name is a short number), and one for symbols > with > longer names (name is a bignum). > > ☺/ A!ex > > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >
What is the structure of a namespace
I've realized that the 'pico namespace is a tree, but I can't figure out which kind of tree. It does not seem fit with a binary tree structure. So, what's the structure of namespaces, and what's the algorithm for organizing the symbols inside a namespace list?
Re: PilCon tomorrow (Anatomy of Vip)
was the meeting recorded? where can I watch it? Vip is something I've wanted to hack for quite some time, but got really confused each time I tried to read it XD On Fri, Apr 9, 2021, 11:14 Cesar Rabak wrote: > Good for me too. > > Thanks for all the replies so far! > > l look forward to the next meeting at 16h00 UTC! > > > On Fri, Apr 9, 2021 at 12:53 PM Alexander Burger > wrote: > >> On Fri, Apr 09, 2021 at 05:27:59PM +0200, pd wrote: >> > this time I will try to record the session if you all agree (and if I >> can >> > attend) >> >> For me it is OK >> >> ☺/ A!ex >> >> -- >> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >> >