Test - please ignore

2024-06-10 Thread Alexander Burger
Test ☺


-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Garbage collected coroutines?

2024-06-10 Thread Alexander Burger
Hi František,

> I've used the following method in other programming languages (Lua, Janet)
> and I'm wondering whether I can do something similar in PicoLisp:
> 
> I've got a coroutine that generates an infinite sequence of data.
> ...
> The upshot of this method is that I don't have to manually kill any of the
> coroutines, they are all automatically garbage collected when I no longer
> use them.

In PicoLisp, execution and garbage collection of coroutines are related
in this way:

While a coroutine is running - *independent* from whether it is
referenced from anywhere else - it will not be garbage collected.

Only if it finished execution (either by dropping off the end of its
code, by doing a 'throw' outside itself, or by being explicitly stopped
by another (co)routine), it will be garbage collected. Collected are
then all data which are referenced from the now freed stack segment.


> If I understand it correctly, creating a coroutine in PicoLisp creates
> a global symbol that keeps the reference to this coroutine

This not correct. The coroutine does not create a symbol. It is the Lisp
*reader* which finds or creates a symbol 'myCoroutine' when reading an
expression like

   (co 'myCoroutine (...))

But this symbol is just a tag to access the coroutine. It is not
relevant for garbage collecting the coroutine itself.

This symbol does not need to be global. You can use a transient symbol

   (co "myCoroutine" (...))

and thus have a file-local scope, or use a namespace.

The transient symbol may go out of scope, but the coroutine continues to
exist until it terminates as described above.


> explicitly remove the coroutine when I no longer need it - it can never get
> automatically garbage collected because it's linked to a global symbol.

So you indeed need to call

   (co 'myCoroutine)

if you are not sure if it did not already terminate by itself. But this
has nothing to do with the tag symbol.

Let's clear up this in IRC :)

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Garbage collected coroutines?

2024-06-10 Thread František Fuka
I've used the following method in other programming languages (Lua, Janet)
and I'm wondering whether I can do something similar in PicoLisp:

I've got a coroutine that generates an infinite sequence of data.

I've got another coroutine that takes data from the previous coroutine,
processes it and generates a sequence (also infinite) of modified data. The
original coroutine is kept in its parent coroutine's local variable.

Another coroutine takes this modified data, modifies it further and
generates another sequence.

This happens on several levels, around 5 - 10 coroutines chained like this,
each of them generating an infinite sequence of data based on its "child"
coroutine (kept in local variable) data and passing the modified sequence
to its "parent" using "yield".

Finally the top level parent does something with this generated data and,
after some time stops and forgets the reference to it direct "child"
coroutine.

At this time, the direct child coroutine is automatically garbage
collected. This releases the reference to next level "child" coroutine,
this is also garbage collected etc., etc. until the original coroutine that
was generating the first sequence.

The upshot of this method is that I don't have to manually kill any of the
coroutines, they are all automatically garbage collected when I no longer
use them.

If I understand it correctly, creating a coroutine in PicoLisp creates a
global symbol that keeps the reference to this coroutine so I have to
explicitly remove the coroutine when I no longer need it - it can never get
automatically garbage collected because it's linked to a global symbol.

Is there a similar mechanism in PicoLisp? Keeping the coroutine reference
in the local scope so that it's automatically destroyed when it goes out of
scope?

P.S: It seems that I have problem receiving any email from this mailing
list so I'll probably have to post follow ups to this topic in the IRC
channel after I read the replies in the mailing list web archive...
--
-- František Fuka


Subscribe

2024-06-10 Thread František Fuka



Re: Noobie query

2024-06-02 Thread Alexander Burger
On Sun, Jun 02, 2024 at 02:57:18PM -0400, Lloyd R. prentice wrote:
> Unless it’s inconvenient for any and all. I’ll post here.

Perfect! Please ask.

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Noobie query

2024-06-02 Thread Lloyd R. prentice
Thanks all.

I’ve never used IRC.

Unless it’s inconvenient for any and all. I’ll post here. I’m pushing hard to 
launch a book but as soon as it’s out I hope to dive into PicoLisp and will no 
doubt have many questions.

My first step will be to work through all of Mia’s wonderful web programming 
tutorials.

My thought is to attempt development of a markdown to LaTeX and eBook parser 
Think Pandoc with one reader and two writers.

Would welcome ideas and suggestions.

All the best,

LRP

Sent from my iPad

> On Jun 2, 2024, at 2:10 PM, Alexander Burger  wrote:
> 
> Hi Lloyd,
> 
>> I’ve subscribed to the mailing list. Have received posts. But I can’t find 
>> the
>> webpage to post questions. Is posting via email as I’ve done here the only 
>> way?
> 
> Posting here is fine.
> 
> But more discussions currently take place in the "#picolisp" IRC channel on
> libera.chat, or the #picolisp:7fach.de Matrix room.
> 
> ☺/ A!ex
> 
> 
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Noobie query

2024-06-02 Thread Alexander Burger
Hi Lloyd,

> I’ve subscribed to the mailing list. Have received posts. But I can’t find the
> webpage to post questions. Is posting via email as I’ve done here the only 
> way?

Posting here is fine.

But more discussions currently take place in the "#picolisp" IRC channel on
libera.chat, or the #picolisp:7fach.de Matrix room.

☺/ A!ex


-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Noobie query

2024-06-02 Thread Mike Evron
There's also IRC.  There's almost always someone there to answer questions.

On Sun, Jun 2, 2024 at 10:52 AM Lloyd R. prentice 
wrote:

> Hello,
>
> I’ve subscribed to the mailing list. Have received posts. But I can’t find
> the webpage to post questions. Is posting via email as I’ve done here the
> only way?
>
> Thank you,
>
> LRP
>
>
> Sent from my iPad
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subjectUnsubscribe
>


Noobie query

2024-06-02 Thread Lloyd R. prentice
Hello,

I’ve subscribed to the mailing list. Have received posts. But I can’t find the 
webpage to post questions. Is posting via email as I’ve done here the only way? 

Thank you,

LRP


Sent from my iPad

--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Coroutine produces segmentation fault

2024-06-02 Thread Alexander Burger
Hi František,

> I wrote a small script to generate and print the values of sine wave, as
> follows:
> ...
> (for N 44100 (printsp (co 'masterOut T)))
> ...
> 
> wave. However, when I increase the number on the next-to-last row tenfold
> (from 44100 to 441000), the script produces a segmentation fault (after
> printing lots of "(" parentheses) on line 13 (the "for" loop). What am I
> doing wrong?

It looks all good so far. Also, it runs fine here with 441000.

What version of Pil are you using?

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Coroutine produces segmentation fault

2024-06-02 Thread František Fuka
Hello, Picolisp beginner here.

I wrote a small script to generate and print the values of sine wave, as
follows:

#!/usr/bin/picolisp /usr/lib/picolisp/lib.l

(load "@lib/math.l")
(def 'pi2 (+ pi pi))

(co 'masterOut
(let (Step 0.001 Position 0)
(loop
(yield (sin (*/ pi2 Position 1.0)))
(inc 'Position Step)
(setq Position (% Position 1.0)

(for N 44100 (printsp (co 'masterOut T)))

(bye)

This script runs correctly and prints the first 44100 values of the sine
wave. However, when I increase the number on the next-to-last row tenfold
(from 44100 to 441000), the script produces a segmentation fault (after
printing lots of "(" parentheses) on line 13 (the "for" loop). What am I
doing wrong?

Thanks.

--
-- František Fuka


Subscribe

2024-06-02 Thread František Fuka
--
-- František Fuka


Subscribe

2024-06-02 Thread František Fuka
--
-- František Fuka


Subscribe

2024-05-27 Thread picolisp

Hello mgr...@cruzio.com :-)
You are now subscribed


subscribe mgr...@cruzio.com "Mark Ryan"

--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Subscribe

2024-05-27 Thread picolisp
Hello mgr...@cruzio.com :-)
You are now subscribed



-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Subscribe

2024-05-22 Thread Lloyd R. prentice
Hello "Lloyd R. prentice"  :-)
You are now subscribed



Sent from my iPad

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Unsubscribe

2024-05-13 Thread Jean-Christophe Helary
Good bye Jean-Christophe Helary  :-(
You are now unsubscribed



-- 
Jean-Christophe Helary
@jchel...@emacs.ch
https://sr.ht/~brandelune/




--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


subscribe

2024-05-13 Thread Jean-Christophe Helary
Hello Jean-Christophe Helary  :-)
You are now subscribed



-- 
Jean-Christophe Helary
@jchel...@emacs.ch
https://sr.ht/~brandelune/




--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Blog: Discrete-Event Simulation

2024-05-13 Thread Alexander Burger
Hi all,

Mia posted a new article about Discrete-Event Simulation:

   https://picolisp-explored.com/a-railroad-simulation-with-des

It is a demo for a model railroad system. Lots of fun playing with it! :)

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Subscribe

2024-04-28 Thread Ruslan Ishchuk



Re: Stream from call

2024-04-25 Thread Patrick Lebas
Thanks everyone for the speed

Envoyé à partir de Outlook pour Android

From: andr...@itship.ch  on behalf of 
picolisp@software-lab.de 
Sent: Thursday, April 25, 2024 1:34:24 PM
To: picolisp@software-lab.de 
Subject: Re: Stream from call


I obviously meant: check out (in 'lst ...)

not open, sorry!

On 25.04.24 13:33, andr...@itship.ch wrote:

Hi Patrick!

1) for only reading: check out (open 'lst ...) - when (in) gets a list instead 
of a symbol (file) or number (already opened file descriptor), the list is 
evaluated like the (call) arguments and within the (in 'lst ...)-expression the 
input channel is bound to the output channel of the called executable. Then you 
can use (from) (till) (line) (char) etc. to read from it. Same way you can use 
(out) to call another executable and write more stuff to its stdin without 
reading from it.

2) for both reading and writing with the called executable, check out (pipe), 
especially the first form (pipe exe) -> fd which returns a file descriptor. 
Bind it to a variable like (setq OtherProcess (pipe ...)) and then you can use 
it it in subsequent calls like (in OtherProcess ...) and (out OtherProcess ...).

Be aware that the PicoLisp text stream functions (from) (till) (line) (char) 
etc. always read one additional character, which is placed in a look-ahead 
buffer, which can be retrieved with (peek) - depending on how the called 
executable handles stdin/stdout it might matter and you could block reading by 
accident because of the implicit look-ahead mechanism. It's not a big issue, 
but it can matter and then you must be aware of its workings.

Happy lisping,
Andreas

On 25.04.24 13:03, Patrick Lebas wrote:
How can I get the Stream-out from
(call 'ls) and put it into a string  (setq str...) ?  THANKS.
Envoyé à partir de Outlook pour Android


Re: Stream from call

2024-04-25 Thread picolisp

I obviously meant: check out (in 'lst ...)

not open, sorry!

On 25.04.24 13:33, andr...@itship.ch wrote:


Hi Patrick!

1) for only reading: check out (open 'lst ...) - when (in) gets a list 
instead of a symbol (file) or number (already opened file descriptor), 
the list is evaluated like the (call) arguments and within the (in 
'lst ...)-expression the input channel is bound to the output channel 
of the called executable. Then you can use (from) (till) (line) (char) 
etc. to read from it. Same way you can use (out) to call another 
executable and write more stuff to its stdin without reading from it.


2) for both reading and writing with the called executable, check out 
(pipe), especially the first form (pipe exe) -> fd which returns a 
file descriptor. Bind it to a variable like (setq OtherProcess (pipe 
...)) and then you can use it it in subsequent calls like (in 
OtherProcess ...) and (out OtherProcess ...).


Be aware that the PicoLisp text stream functions (from) (till) (line) 
(char) etc. always read one additional character, which is placed in a 
look-ahead buffer, which can be retrieved with (peek) - depending on 
how the called executable handles stdin/stdout it might matter and you 
could block reading by accident because of the implicit look-ahead 
mechanism. It's not a big issue, but it can matter and then you must 
be aware of its workings.


Happy lisping,
Andreas

On 25.04.24 13:03, Patrick Lebas wrote:

How can I get the Stream-out from
(call 'ls) and put it into a string  (setq str...) ?  THANKS.
Envoyé à partir de Outlook pour Android 

Re: Stream from call

2024-04-25 Thread picolisp

Hi Patrick!

1) for only reading: check out (open 'lst ...) - when (in) gets a list 
instead of a symbol (file) or number (already opened file descriptor), 
the list is evaluated like the (call) arguments and within the (in 'lst 
..)-expression the input channel is bound to the output channel of the 
called executable. Then you can use (from) (till) (line) (char) etc. to 
read from it. Same way you can use (out) to call another executable and 
write more stuff to its stdin without reading from it.


2) for both reading and writing with the called executable, check out 
(pipe), especially the first form (pipe exe) -> fd which returns a file 
descriptor. Bind it to a variable like (setq OtherProcess (pipe ...)) 
and then you can use it it in subsequent calls like (in OtherProcess 
..) and (out OtherProcess ...).


Be aware that the PicoLisp text stream functions (from) (till) (line) 
(char) etc. always read one additional character, which is placed in a 
look-ahead buffer, which can be retrieved with (peek) - depending on how 
the called executable handles stdin/stdout it might matter and you could 
block reading by accident because of the implicit look-ahead mechanism. 
It's not a big issue, but it can matter and then you must be aware of 
its workings.


Happy lisping,
Andreas

On 25.04.24 13:03, Patrick Lebas wrote:

How can I get the Stream-out from
(call 'ls) and put it into a string  (setq str...) ?  THANKS.
Envoyé à partir de Outlook pour Android 

Re: Stream from call

2024-04-25 Thread Alex Williams

Try:

  (setq *Str (in '(/bin/ls) (till NIL T)))

Each entry will be separated by a newline "^J"

There are other ways to do this...


AW

On Thu, 25 Apr 2024, Patrick Lebas wrote:


How can I get the Stream-out from
(call 'ls) and put it into a string  (setq str...) ?  THANKS.
Envoyé à partir de Outlook pour Android


Re: Stream from call

2024-04-25 Thread Tomas Hlavaty
On Thu 25 Apr 2024 at 11:03, Patrick Lebas  wrote:
> How can I get the Stream-out from
> (call 'ls) and put it into a string  (setq str...) ?  THANKS.

(in '(ls) (read))

you might want something else than read

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Stream from call

2024-04-25 Thread Patrick Lebas
How can I get the Stream-out from
(call 'ls) and put it into a string  (setq str...) ?  THANKS.
Envoyé à partir de Outlook pour Android


Unsubscribe

2024-04-16 Thread Pieter Suurmond
Good bye Pieter Suurmond  :-(
You are now unsubscribed



-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Subscribe

2024-04-16 Thread Pieter Suurmond
Hello Pieter Suurmond  :-)
You are now subscribed



-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Android keyboad for terminal

2024-03-14 Thread Edgaras Šeputis
I think for speed learning/getting used to should be big factor. Also
working out correct sensitivity in settings. Autocomplete I was not
thinking too much about it esp llm, but could be (what I would consider
weird), option, but you'd need to setup your own llm server most likely :)
I was thinking just basic dict based completion like on regular keyboards.
Arrows are on right double tap, they are shown in intro, and if you open
intro video in youtube (play store is a bit of an ass... that it does not
provide direct link, but if you right click on video you get the link)
You'll see bunch of links to more detailed use guide and settings, as well
as summary sheet of use. (again play store is ass and does not allow
links...).

On Thu, Mar 14, 2024 at 3:40 PM  wrote:

> I like carrot. I am looking forward for more polished version. I will
> gladly pay.
> Carrot has smoother learning curve than penti.
> Carrot takes less brain space.
> I can operate carrot with one hand.
> Carrot have less throughput than penti, which can be fixed with personal
> llm auto complete.
> I miss arrows on carrot, my mistake?
>
> Razzy
>
> e-mails are unreliable comm anyway. Shall we move to matrix?
>  Original Message 
> On Mar 13, 2024, 18:30, Alexander Burger < picolisp@software-lab.de>
> wrote:
>
>
> Hi Edgaras, thanks for your work! On Wed, Mar 13, 2024 at 06:55:27PM
> +0200, Edgaras Šeputis wrote: > Who is writing here actually? Alex? No, not
> me. Strange that there is no name ... ☺/ A!ex -- UNSUBSCRIBE: mailto:
> picolisp@software-lab.de?subject=Unsubscribe
>
>


Re: Android keyboad for terminal

2024-03-14 Thread picolisp
I like carrot. I am looking forward for more polished version. I will gladly 
pay.
Carrot has smoother learning curve than penti.
Carrot takes less brain space.
I can operate carrot with one hand.
Carrot have less throughput than penti, which can be fixed with personal llm 
auto complete.
I miss arrows on carrot, my mistake?

Razzy

e-mails are unreliable comm anyway. Shall we move to matrix?
 Original Message 
On Mar 13, 2024, 18:30, Alexander Burger wrote:

> Hi Edgaras, thanks for your work! On Wed, Mar 13, 2024 at 06:55:27PM +0200, 
> Edgaras Šeputis wrote: > Who is writing here actually? Alex? No, not me. 
> Strange that there is no name ... ☺/ A!ex -- UNSUBSCRIBE: 
> mailto:picolisp@software-lab.de?subject=Unsubscribe

Re: Android keyboad for terminal

2024-03-13 Thread Alexander Burger
Hi Edgaras,

thanks for your work!

On Wed, Mar 13, 2024 at 06:55:27PM +0200, Edgaras Šeputis wrote:
> Who is writing here actually? Alex?

No, not me. Strange that there is no name ...

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Android keyboad for terminal

2024-03-13 Thread picolisp
Razzy writing here. :)

Also, can I verify it is not sending information somewhere? No offence meant. :)
 Original Message 
On Mar 13, 2024, 17:55, Edgaras Šeputis wrote:

> I have a bug, fixing it, you need to open settings of it for it work as is. 
> But I'll fix it that it should not crash without first opening preferences.
> It already works decently with one finger in vertical.
>
> Who is writing here actually? Alex?
>
> On Wed, Mar 13, 2024 at 6:43 PM  wrote:
>
>> I was unable to make carrot work. It types nothing, no circle. I have 
>> trouble with keyboards. Can someone verify it's working for him?
>>
>> Idea has potential.
>> I would focus on:
>> -One finger use. Vertical screen
>> -Deep choice-tree
>> -api to outside personal llm, to restructure choices.
>>
>> I have ideas how to make it work, if you are interested.
>>
>>  Original Message 
>> On Mar 13, 2024, 15:58, Edgaras Šeputis < picolisp@software-lab.de> wrote:
>>
>>> No, I'm thinking of premium version in future if there is any interest in 
>>> basic one. That would allow customizing mappings (that I basically have), 
>>> and potentially some features that are more useful for less techy people - 
>>> so I guess suggestions, for faster typing. So at least for now I can't 
>>> offer sources.
>>>
>>> On Wed, Mar 13, 2024 at 4:42 PM  wrote:
>>>
 Cool idea. Do you publish sources?

 Sent from Proton Mail mobile

  Original Message 
 On Mar 13, 2024, 15:02, Edgaras Šeputis < picolisp@software-lab.de> wrote:

> Some quite long time ago I showed my special on screen keyboard here, 
> there was some minor interest, but it was in testing, and not really 
> documented all that well, but now I finally managed to properly release 
> it: https://play.google.com/store/apps/details?id=morphles.CarrotKeys It 
> can be considered similar to Pente. Hope this can be of use for PicoLisp 
> use "on the go" :)

Re: Android keyboad for terminal

2024-03-13 Thread Edgaras Šeputis
I have a bug, fixing it, you need to open settings of it for it work as is.
But I'll fix it that it should not crash without first opening preferences.
It already works decently with one finger in vertical.

Who is writing here actually? Alex?

On Wed, Mar 13, 2024 at 6:43 PM  wrote:

> I was unable to make carrot work. It types nothing, no circle. I have
> trouble with keyboards. Can someone verify it's working for him?
>
> Idea has potential.
> I would focus on:
> -One finger use. Vertical screen
> -Deep choice-tree
> -api to outside personal llm, to restructure choices.
>
> I have ideas how to make it work, if you are interested.
>
>  Original Message 
> On Mar 13, 2024, 15:58, Edgaras Šeputis < picolisp@software-lab.de> wrote:
>
>
> No, I'm thinking of premium version in future if there is any interest in
> basic one. That would allow customizing mappings (that I basically have),
> and potentially some features that are more useful for less techy people -
> so I guess suggestions, for faster typing. So at least for now I can't
> offer sources.
>
> On Wed, Mar 13, 2024 at 4:42 PM  wrote:
>
>> Cool idea. Do you publish sources?
>>
>>
>> Sent from Proton Mail mobile
>>
>>
>>
>>  Original Message 
>> On Mar 13, 2024, 15:02, Edgaras Šeputis < picolisp@software-lab.de>
>> wrote:
>>
>>
>> Some quite long time ago I showed my special on screen keyboard here,
>> there was some minor interest, but it was in testing, and not really
>> documented all that well, but now I finally managed to properly release it:
>> https://play.google.com/store/apps/details?id=morphles.CarrotKeys It can
>> be considered similar to Pente. Hope this can be of use for PicoLisp use
>> "on the go" :)
>>
>>


Re: Android keyboad for terminal

2024-03-13 Thread picolisp
I was unable to make carrot work. It types nothing, no circle. I have trouble 
with keyboards. Can someone verify it's working for him?

Idea has potential.
I would focus on:
-One finger use. Vertical screen
-Deep choice-tree
-api to outside personal llm, to restructure choices.

I have ideas how to make it work, if you are interested.

 Original Message 
On Mar 13, 2024, 15:58, Edgaras Šeputis wrote:

> No, I'm thinking of premium version in future if there is any interest in 
> basic one. That would allow customizing mappings (that I basically have), and 
> potentially some features that are more useful for less techy people - so I 
> guess suggestions, for faster typing. So at least for now I can't offer 
> sources.
>
> On Wed, Mar 13, 2024 at 4:42 PM  wrote:
>
>> Cool idea. Do you publish sources?
>>
>> Sent from Proton Mail mobile
>>
>>  Original Message 
>> On Mar 13, 2024, 15:02, Edgaras Šeputis < picolisp@software-lab.de> wrote:
>>
>>> Some quite long time ago I showed my special on screen keyboard here, there 
>>> was some minor interest, but it was in testing, and not really documented 
>>> all that well, but now I finally managed to properly release it: 
>>> https://play.google.com/store/apps/details?id=morphles.CarrotKeys It can be 
>>> considered similar to Pente. Hope this can be of use for PicoLisp use "on 
>>> the go" :)

Re: Android keyboad for terminal

2024-03-13 Thread Edgaras Šeputis
No, I'm thinking of premium version in future if there is any interest in
basic one. That would allow customizing mappings (that I basically have),
and potentially some features that are more useful for less techy people -
so I guess suggestions, for faster typing. So at least for now I can't
offer sources.

On Wed, Mar 13, 2024 at 4:42 PM  wrote:

> Cool idea. Do you publish sources?
>
>
> Sent from Proton Mail mobile
>
>
>
>  Original Message 
> On Mar 13, 2024, 15:02, Edgaras Šeputis < picolisp@software-lab.de> wrote:
>
>
> Some quite long time ago I showed my special on screen keyboard here,
> there was some minor interest, but it was in testing, and not really
> documented all that well, but now I finally managed to properly release it:
> https://play.google.com/store/apps/details?id=morphles.CarrotKeys It can
> be considered similar to Pente. Hope this can be of use for PicoLisp use
> "on the go" :)
>
>


Re: Android keyboad for terminal

2024-03-13 Thread picolisp
Cool idea. Do you publish sources?

Sent from Proton Mail mobile

 Original Message 
On Mar 13, 2024, 15:02, Edgaras Šeputis wrote:

> Some quite long time ago I showed my special on screen keyboard here, there 
> was some minor interest, but it was in testing, and not really documented all 
> that well, but now I finally managed to properly release it: 
> https://play.google.com/store/apps/details?id=morphles.CarrotKeys It can be 
> considered similar to Pente. Hope this can be of use for PicoLisp use "on the 
> go" :)

Android keyboad for terminal

2024-03-13 Thread Edgaras Šeputis
Some quite long time ago I showed my special on screen keyboard here, there
was some minor interest, but it was in testing, and not really documented
all that well, but now I finally managed to properly release it:
https://play.google.com/store/apps/details?id=morphles.CarrotKeys It can be
considered similar to Pente. Hope this can be of use for PicoLisp use "on
the go" :)


Re: 1brc

2024-03-10 Thread Alexander Burger
On Sun, Mar 10, 2024 at 08:42:21AM +0100, picolisp@software-lab.de wrote:
> I would like to share picolisp single process version:
> https://git.envs.net/mpech/tankf33der/raw/branch/master/1brc/demo.l
> ...
> Parallelized version is a question of future research.

Thanks Mike!

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


1brc

2024-03-09 Thread picolisp

hi all,

https://www.morling.dev/blog/one-billion-row-challenge/

I would like to share picolisp single process version:
https://git.envs.net/mpech/tankf33der/raw/branch/master/1brc/demo.l
Speed is ok 1 million row simple file on 40k cities = 1 sec, it is easy 
to calculate how fast it would finish  1 billion rows file.


Parallelized version is a question of future research.

Happy coding,
(mike)



--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: "macros" in miniPicoLisp

2024-03-02 Thread C K Kashyap
Thanks Alex!

On Sat, Mar 2, 2024 at 1:02 PM Alexander Burger 
wrote:

> On Sat, Mar 02, 2024 at 10:05:00AM -0800, C K Kashyap wrote:
> > Another installment of the video -
> > https://www.youtube.com/watch?v=O52fRAsr7Vg
>
> Very nice indeed! This is probably the first time PiccLisp does something
> non~triwial on Windows.
>
> Tharks for sharing!
>
> ☺/ A!ex
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Re: "macros" in miniPicoLisp

2024-03-02 Thread Alexander Burger
On Sat, Mar 02, 2024 at 10:05:00AM -0800, C K Kashyap wrote:
> Another installment of the video -
> https://www.youtube.com/watch?v=O52fRAsr7Vg

Very nice indeed! This is probably the first time PiccLisp does something
non~triwial on Windows.

Tharks for sharing!

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: "macros" in miniPicoLisp

2024-03-02 Thread C K Kashyap
Another installment of the video -
https://www.youtube.com/watch?v=O52fRAsr7Vg
I think my over 15 years of pursuit of finding the perfect programming
language is complete :) - The sad thing is that I had discovered PicoLisp
long ago but had discarded it because it was "just an interpreter" :)
I am finally free to explore my actual ideas now!
Regards,
Kashyap

On Fri, Feb 9, 2024 at 2:28 PM C K Kashyap  wrote:

> Super! - thank Alex.
>
> On Fri, Feb 9, 2024 at 11:17 AM Alexander Burger 
> wrote:
>
>> Hi Kashyap,
>>
>> > Does this look like a reasonable way to create the "create-adder"
>> function?
>> >
>> > (de create-adder Args
>> >(let
>> >   (N (car Args)
>> >  Adder (intern (pack "add-" N))
>> >  P
>> >  (list
>> > 'de
>> > Adder
>> > '(X)
>> > (list '+ N 'X) ) )
>> >   (eval P) ) )
>> >
>> > : (create-adder 10)
>> > -> add-10
>> > : (add-10 20)
>> > -> 30
>>
>> Yes, but you can do it a little simpler by directly calling 'def':
>>
>>(de create-adder (N)
>>   (def (intern (pack "add-" N))
>>  (list '(X) (list '+ N 'X)) ) )
>>
>> Note also that I use (N), i.e. an evaluated argument, as this makes the
>> function
>> more general.
>>
>>
>> Even simpler if you use 'curry':
>>
>>(de create-adder (@N)
>>   (def (intern (pack "add-" @N))
>>  (curry (@N) (X)
>> (+ @N X) ) ) )
>>
>> It is especially simpler if the function body, which is here just (+ N
>> X), is
>> more complicated, because then the 'list'ing and 'cons'ing of the body
>> would
>> become very unreadable.
>>
>>
>> > If I understand correctly, the "macro" capability of miniPicoLisp is
>> not at
>> > par with PicoLisp right?
>>
>> The 'macro' function of mini and normal PicoLisp is the same I think.
>>
>> ☺/ A!ex
>>
>> --
>> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>>
>


Re: Printed representation of (char 0) ?

2024-02-15 Thread Thorsten Jolitz
Hi Alex and beneroth,
there are system interfaces that don't handle binary data and send them as
hex strings to middleware for conversion ...
All I wanted was a quick way to cross check that conversion with PicoLisp,
and that was really easy, except that NUL problem, solved now.
But very interesting discussion, I'm playing around with rd and pr right
now.
Thanks for the input
Cheers
Thorsten

Am Mi., 14. Feb. 2024 um 08:04 Uhr schrieb Alexander Burger <
picolisp@software-lab.de>:

> Hi Thorsten,
>
> > I wonder if there actually is a way to directly print ^@ in PicoLisp for
> a
> > "non-printable" hex "00", instead of NIL?
>
> As we see from the previous discussion, this is not an issue of
> printability.
> Other control characters may also be non-printable. It is an issue of
> binary data vs. symbol names.
>
> But you can of course print a caret and an at-mark instead of NIL
>
>(prin (or (something) "\^@"))
>
>
> > Wrt the application, I just have to deal with fixed length hex strings
> (!)
> > where the values at certain offsets carry semantics, conversions are
> done,
> > and it's crucial that values stay in that position, the NUL values
> matter.
>
> Yes, but why do you need to convert it to a string? I would process these
> data
> all exclusively as a list of numbers, and do the final printing explicitly
> (if
> needed at all). This printing may print '0' as "\^@", and also take care of
> other control characters and non-printable stuff.
>
> ☺/ A!ex
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Re: Printed representation of (char 0) ?

2024-02-13 Thread Alexander Burger
Hi Thorsten,

> I wonder if there actually is a way to directly print ^@ in PicoLisp for a
> "non-printable" hex "00", instead of NIL?

As we see from the previous discussion, this is not an issue of printability.
Other control characters may also be non-printable. It is an issue of
binary data vs. symbol names.

But you can of course print a caret and an at-mark instead of NIL

   (prin (or (something) "\^@"))


> Wrt the application, I just have to deal with fixed length hex strings (!)
> where the values at certain offsets carry semantics, conversions are done,
> and it's crucial that values stay in that position, the NUL values matter.

Yes, but why do you need to convert it to a string? I would process these data
all exclusively as a list of numbers, and do the final printing explicitly (if
needed at all). This printing may print '0' as "\^@", and also take care of
other control characters and non-printable stuff.

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Printed representation of (char 0) ?

2024-02-13 Thread picolisp

Hi Thorsten,

I agree with the others, that's not a string you are processing.
Strictly speaking, PicoLisp text functions and PicoLisp strings (and 
symbol names) must not contain NULL character.


How about processing this fixed-size values in binary, using (rd 'cnt) 
and (wr 'cnt) ?


Important: The alternative argument of (rd) makes it work very 
differently, the default behavior with 'sym argument is for PLIO (the 
picolisp binary format).
It's also usually a bad idea to mix binary and text processing when 
working with the same input channel, unless you really know about how 
picolisp text procressing works (the character buffering, with a 
character potentially being 1-4 bytes), so careful with that.


Greetings,
beneroth

On 13.02.24 20:30, Thorsten Jolitz wrote:

Hi Alex, Thomas,
thanks for your input, this is actually what I was looking for :
image.png
or even better:
image.png
I wonder if there actually is a way to directly print ^@ in PicoLisp 
for a "non-printable" hex "00", instead of NIL?
Wrt the application, I just have to deal with fixed length hex strings 
(!) where the values at certain offsets carry semantics, conversions 
are done, and it's crucial that values stay in that position, the NUL 
values matter. And I don't want to write a PicoLisp application for 
this, I just wanted an easy way to produce the expected conversion 
result in PicoLisp as a reference for comparison, and the above 
solution is fine for that.


Am Di., 13. Feb. 2024 um 09:09 Uhr schrieb Alexander Burger 
:


Hi Thorsten,

> But shouldn't hex 23232424 print to something like ##^N^N$$
instead of
> ##$$ ?

The problem is that you try to handle binary data as symbols. This
is not a good
idea. Binary data are numbers.

First of all, do you really have a hex message? Where does
it come from? Normally I would expect a list of numbers
as obtained with e.g.

   (make (do 96 (link (rd 1

If it is really a hexadecimal string, you can obtain the list
of numbers with

   : (make (for (L (chop "23232424") (cut 2 'L)) (link (hex @
   -> (35 35 0 0 36 36)

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Printed representation of (char 0) ?

2024-02-13 Thread Thorsten Jolitz
Hi Alex, Thomas,
thanks for your input, this is actually what I was looking for :
[image: image.png]
or even better:
[image: image.png]
I wonder if there actually is a way to directly print ^@ in PicoLisp for a
"non-printable" hex "00", instead of NIL?
Wrt the application, I just have to deal with fixed length hex strings (!)
where the values at certain offsets carry semantics, conversions are done,
and it's crucial that values stay in that position, the NUL values matter.
And I don't want to write a PicoLisp application for this, I just wanted an
easy way to produce the expected conversion result in PicoLisp as a
reference for comparison, and the above solution is fine for that.

Am Di., 13. Feb. 2024 um 09:09 Uhr schrieb Alexander Burger <
picolisp@software-lab.de>:

> Hi Thorsten,
>
> > But shouldn't hex 23232424 print to something like ##^N^N$$ instead
> of
> > ##$$ ?
>
> The problem is that you try to handle binary data as symbols. This is not
> a good
> idea. Binary data are numbers.
>
> First of all, do you really have a hex message? Where does
> it come from? Normally I would expect a list of numbers
> as obtained with e.g.
>
>(make (do 96 (link (rd 1
>
> If it is really a hexadecimal string, you can obtain the list
> of numbers with
>
>: (make (for (L (chop "23232424") (cut 2 'L)) (link (hex @
>-> (35 35 0 0 36 36)
>
> ☺/ A!ex
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Re: Printed representation of (char 0) ?

2024-02-13 Thread Alexander Burger
Hi Thorsten,

> But shouldn't hex 23232424 print to something like ##^N^N$$ instead of
> ##$$ ?

The problem is that you try to handle binary data as symbols. This is not a good
idea. Binary data are numbers.

First of all, do you really have a hex message? Where does
it come from? Normally I would expect a list of numbers
as obtained with e.g.

   (make (do 96 (link (rd 1

If it is really a hexadecimal string, you can obtain the list
of numbers with

   : (make (for (L (chop "23232424") (cut 2 'L)) (link (hex @
   -> (35 35 0 0 36 36)

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Printed representation of (char 0) ?

2024-02-13 Thread Tomas Hlavaty
On Tue 13 Feb 2024 at 08:35, Thorsten Jolitz  wrote:
> But shouldn't hex 23232424 print to something like ##^N^N$$
> instead of

no

^N could mean SO character with byte value 14
see the program ascii

a NUL character would be displayed as ^@

> So the printed ASCII string (as char) carries all the information from the
> hex string, and can be converted back to the exact same hex string?

no, you are using wrong tool for the job

as Alex said, a picolisp string cannot contain NUL byte

> At least in some special cases when it's needed?

arbitrary binary data is not a string
parse the binary data properly

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Printed representation of (char 0) ?

2024-02-12 Thread Tomas Hlavaty
On Tue 13 Feb 2024 at 08:28, Thorsten Jolitz  wrote:
> But when I have a hexadecimal message string with fixed length, and the
> positions inside the string carry semantics? A certain value in a certain
> position has a meaning?

it is not a string, at least not in picolisp/C/unix sense

you need to properly parse the binary data into your own representation
and also write your own code to translate your own representation to
that binary data

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Printed representation of (char 0) ?

2024-02-12 Thread Thorsten Jolitz
Hi Alex,
But shouldn't hex 23232424 print to something like ##^N^N$$ instead of
##$$ ?
So the printed ASCII string (as char) carries all the information from the
hex string, and can be converted back to the exact same hex string?
At least in some special cases when it's needed?

Alexander Burger  schrieb am Di., 13. Feb. 2024,
07:56:

> Hi Thorsten,
>
> > it's been some time .. ;-)
>
> Welcome back! :)
>
>
> > I'm playing around a bit with hex<->ascii conversion in PicoLisp, and I
> > have the problem that (char 0) = NIL
> >
> >  (hex "00")
> > -> 0
> > : (char (hex "00"))
> > -> NIL
>
> This is correct.
>
> 'char' converts a number to a (transient) symbol here.
>
> A symbol's name is a string, a null-terminated sequence of UTF-8
> characters. In
> case of 'char', this string has a single character and a terminating null
> byte.
> This is the same as in other languages like C.
>
> So the number 65 gives a symbol "A":
>
>: (char 65)
>-> "A"
>
> But what happens with 0?
>
> It gives an empty string, i.e. a null-byte
>
>: (char 0)
>-> NIL
>
> and an empty string in PicoLisp is NIL.
>
>: ""
>-> NIL
>
> ☺/ A!ex
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Re: Printed representation of (char 0) ?

2024-02-12 Thread Thorsten Jolitz
Ok I understand that.
But when I have a hexadecimal message string with fixed length, and the
positions inside the string carry semantics? A certain value in a certain
position has a meaning?

Say fixed length is 96 like in the example above, and 2323 ist two start
chars, and then 01 or 02 is a handshake.

And this message has to be translated to ASCII to be understood by a third
party, that sends ASCII answers back, that has to be translated to hex.

This does not work when a round-trip conversion of 232301 results in 23231.

Tomas Hlavaty  schrieb am Di., 13. Feb. 2024,
07:49:

> On Tue 13 Feb 2024 at 00:25, Thorsten Jolitz 
> wrote:
> > I would like to achieve a roundtrip like this:
>
> why?
>
> NUL is often a string sentinel value
> so trying to use it as a character value
> will lead to issues
> do not do that
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Re: Printed representation of (char 0) ?

2024-02-12 Thread Alexander Burger
Hi Thorsten,

> it's been some time .. ;-)

Welcome back! :)


> I'm playing around a bit with hex<->ascii conversion in PicoLisp, and I
> have the problem that (char 0) = NIL
> 
>  (hex "00")
> -> 0
> : (char (hex "00"))
> -> NIL

This is correct.

'char' converts a number to a (transient) symbol here.

A symbol's name is a string, a null-terminated sequence of UTF-8 characters. In
case of 'char', this string has a single character and a terminating null byte.
This is the same as in other languages like C.

So the number 65 gives a symbol "A":

   : (char 65)
   -> "A"

But what happens with 0?

It gives an empty string, i.e. a null-byte

   : (char 0)
   -> NIL

and an empty string in PicoLisp is NIL.

   : ""
   -> NIL

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Printed representation of (char 0) ?

2024-02-12 Thread Tomas Hlavaty
On Tue 13 Feb 2024 at 00:25, Thorsten Jolitz  wrote:
> I would like to achieve a roundtrip like this:

why?

NUL is often a string sentinel value
so trying to use it as a character value
will lead to issues
do not do that

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Printed representation of (char 0) ?

2024-02-12 Thread Thorsten Jolitz
I would like to achieve a roundtrip like this:
: (hex (char (char (hex "23"]
-> "23"

but not like this:
: (hex (char (char (hex "01"]
-> "1"
: (hex (char (char (hex "00"]
-> "0"

It should be possible to do this, so that W = X in the end:
: (setq X
"23230200010001000F00323032342D30322D303931302D35342D303520202424")
: (length X)
-> 96
: (setq Y (chop X))
: (length Y)
-> 96
: (setq W (pack (mapcar '((A) (hex (char A))) (make (while Y (link (char
(hex (pack (cut 2 'Y)]
->
"232320001010F000323032342D30322D303931302D35342D303520202424"
: (length W)
-> 72

Am Mo., 12. Feb. 2024 um 23:56 Uhr schrieb Tomas Hlavaty <
picolisp@software-lab.de>:

> On Mon 12 Feb 2024 at 23:25, Thorsten Jolitz 
> wrote:
> > Shouldn't the (char 0) representation print to something
> > like ^N or so too, like (char 1), (char 2) etc?
>
> ^@
>
> what are you trying to achieve?
>
> why not use base64, for example?
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Re: Printed representation of (char 0) ?

2024-02-12 Thread Tomas Hlavaty
On Mon 12 Feb 2024 at 23:25, Thorsten Jolitz  wrote:
> Shouldn't the (char 0) representation print to something
> like ^N or so too, like (char 1), (char 2) etc?

^@

what are you trying to achieve?

why not use base64, for example?

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Printed representation of (char 0) ?

2024-02-12 Thread Thorsten Jolitz
Ah sorry, the moment I sent the question, I figured out the answer :
this is just a side effect of the final (pack ..).

When using (str ...) I get what I want:
:  (str (make (while Y (link (char (hex (pack (cut 2 'Y)]
-> "\"#\" \"#\" \"\^B\" NIL NIL NIL \"\^A\" NIL \"\^A\" NIL \"\^O\" NIL NIL
NIL NIL NIL NIL NIL \"2\" \"0\" \"2\" \"4\" \"-\" \"0\" \"2\" \"-\" \"0\"
\"9\" \"1\" \"0\" \"-\" \"5\" \"4\" \"-\" \"0\" \"5\" \" \" \" \" NIL NIL
NIL NIL NIL NIL NIL NIL \"$\" \"$\""

although somehow I still think it would be fine to have 'pack that prints
the NIL too, in this special case:
: (pack (make (while Y (link (char (hex (pack (cut 2 'Y)]
-> "##^B^A^A^O2024-02-0910-54-05  $$"

Am Mo., 12. Feb. 2024 um 23:25 Uhr schrieb Thorsten Jolitz <
tjol...@gmail.com>:

> Hello List,
> it's been some time .. ;-)
>
> I'm playing around a bit with hex<->ascii conversion in PicoLisp, and I
> have the problem that (char 0) = NIL
>
>  (hex "00")
> -> 0
> : (char (hex "00"))
> -> NIL
>
>  and disappears from the resulting ascii string.
>
> : (setq X
> "23230200010001000F00323032342D30322D303931302D35342D303520202424")
> : (setq Y (chop X))
> : (pack (make (while Y (link (char (hex (pack (cut 2 'Y)]
> -> "##^B^A^A^O2024-02-0910-54-05  $$"
>
> So how would it be possible to convert the ascii string back to the
> original hex string, when all the "00" are gone in the ascii
> representation? Shouldn't the (char 0) representation print to something
> like ^N or so too, like (char 1), (char 2) etc?
>
> When I try this online converter, the "00" are maintained as blanks:
> Hex to ASCII Text String Converter (rapidtables.com)
> 
> [image: image.png]
>
> and here is another representation that seems to enable the hex -> ascii
> -> hex conversion, getting exactly the same hex string in the end as in the
> beginning (not exactly the same conversion as above! just an example how it
> might look) :
> [image: image.png]
> Cheers
> Thorsten
>


Printed representation of (char 0) ?

2024-02-12 Thread Thorsten Jolitz
Hello List,
it's been some time .. ;-)

I'm playing around a bit with hex<->ascii conversion in PicoLisp, and I
have the problem that (char 0) = NIL

 (hex "00")
-> 0
: (char (hex "00"))
-> NIL

 and disappears from the resulting ascii string.

: (setq X
"23230200010001000F00323032342D30322D303931302D35342D303520202424")
: (setq Y (chop X))
: (pack (make (while Y (link (char (hex (pack (cut 2 'Y)]
-> "##^B^A^A^O2024-02-0910-54-05  $$"

So how would it be possible to convert the ascii string back to the
original hex string, when all the "00" are gone in the ascii
representation? Shouldn't the (char 0) representation print to something
like ^N or so too, like (char 1), (char 2) etc?

When I try this online converter, the "00" are maintained as blanks:
Hex to ASCII Text String Converter (rapidtables.com)

[image: image.png]

and here is another representation that seems to enable the hex -> ascii ->
hex conversion, getting exactly the same hex string in the end as in the
beginning (not exactly the same conversion as above! just an example how it
might look) :
[image: image.png]
Cheers
Thorsten


Re: "macros" in miniPicoLisp

2024-02-09 Thread C K Kashyap
Super! - thank Alex.

On Fri, Feb 9, 2024 at 11:17 AM Alexander Burger 
wrote:

> Hi Kashyap,
>
> > Does this look like a reasonable way to create the "create-adder"
> function?
> >
> > (de create-adder Args
> >(let
> >   (N (car Args)
> >  Adder (intern (pack "add-" N))
> >  P
> >  (list
> > 'de
> > Adder
> > '(X)
> > (list '+ N 'X) ) )
> >   (eval P) ) )
> >
> > : (create-adder 10)
> > -> add-10
> > : (add-10 20)
> > -> 30
>
> Yes, but you can do it a little simpler by directly calling 'def':
>
>(de create-adder (N)
>   (def (intern (pack "add-" N))
>  (list '(X) (list '+ N 'X)) ) )
>
> Note also that I use (N), i.e. an evaluated argument, as this makes the
> function
> more general.
>
>
> Even simpler if you use 'curry':
>
>(de create-adder (@N)
>   (def (intern (pack "add-" @N))
>  (curry (@N) (X)
> (+ @N X) ) ) )
>
> It is especially simpler if the function body, which is here just (+ N X),
> is
> more complicated, because then the 'list'ing and 'cons'ing of the body
> would
> become very unreadable.
>
>
> > If I understand correctly, the "macro" capability of miniPicoLisp is not
> at
> > par with PicoLisp right?
>
> The 'macro' function of mini and normal PicoLisp is the same I think.
>
> ☺/ A!ex
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Re: "macros" in miniPicoLisp

2024-02-09 Thread Alexander Burger
Hi Kashyap,

> Does this look like a reasonable way to create the "create-adder" function?
> 
> (de create-adder Args
>(let
>   (N (car Args)
>  Adder (intern (pack "add-" N))
>  P
>  (list
> 'de
> Adder
> '(X)
> (list '+ N 'X) ) )
>   (eval P) ) )
> 
> : (create-adder 10)
> -> add-10
> : (add-10 20)
> -> 30

Yes, but you can do it a little simpler by directly calling 'def':

   (de create-adder (N)
  (def (intern (pack "add-" N))
 (list '(X) (list '+ N 'X)) ) )

Note also that I use (N), i.e. an evaluated argument, as this makes the function
more general.


Even simpler if you use 'curry':

   (de create-adder (@N)
  (def (intern (pack "add-" @N))
 (curry (@N) (X)
(+ @N X) ) ) )

It is especially simpler if the function body, which is here just (+ N X), is
more complicated, because then the 'list'ing and 'cons'ing of the body would
become very unreadable.


> If I understand correctly, the "macro" capability of miniPicoLisp is not at
> par with PicoLisp right?

The 'macro' function of mini and normal PicoLisp is the same I think.

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


"macros" in miniPicoLisp

2024-02-09 Thread C K Kashyap
Hi Alex,

Does this look like a reasonable way to create the "create-adder" function?

(de create-adder Args
   (let
  (N (car Args)
 Adder (intern (pack "add-" N))
 P
 (list
'de
Adder
'(X)
(list '+ N 'X) ) )
  (eval P) ) )

: (create-adder 10)
-> add-10
: (add-10 20)
-> 30

If I understand correctly, the "macro" capability of miniPicoLisp is not at
par with PicoLisp right?

Regards,
Kashyap


Re: miniPicoLisp + libuv +libSDL

2024-02-02 Thread C K Kashyap
Thanks Alex and RCS :)

On Thu, Feb 1, 2024 at 10:40 AM Alexander Burger 
wrote:

> On Thu, Feb 01, 2024 at 09:05:17AM -0800, C K Kashyap wrote:
> > I finally got around to recording a video (my video recording muscles
> have
> > atrophied :)  )
> >
> > https://www.youtube.com/watch?v=Uv0ZiZAfcGc
>
> Wow, that's cool! Now I see what your intentions are!
>
> Thanks!
> ☺/ A!ex
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Re: miniPicoLisp + libuv +libSDL

2024-02-01 Thread Alexander Burger
On Thu, Feb 01, 2024 at 09:05:17AM -0800, C K Kashyap wrote:
> I finally got around to recording a video (my video recording muscles have
> atrophied :)  )
> 
> https://www.youtube.com/watch?v=Uv0ZiZAfcGc

Wow, that's cool! Now I see what your intentions are!

Thanks!
☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: miniPicoLisp + libuv +libSDL

2024-02-01 Thread r cs
Thank you for sharing it!
rcs

On Thu, Feb 1, 2024 at 12:15 PM C K Kashyap 
wrote:

> I finally got around to recording a video (my video recording muscles have
> atrophied :)  )
>
> https://www.youtube.com/watch?v=Uv0ZiZAfcGc
>
> Regards,
> Kashyap
>
> On Fri, Jan 26, 2024 at 8:06 AM C K Kashyap  wrote:
>
>> Thanks Alex - I'll take the "very good" for now :)
>>
>> I think I found a better example for demo - libuv's file change callback
>> ... I'll do a demo using that -> make changes to a picolisp script and the
>> screen gets updated as I save the script :)
>>
>> Regards,
>> Kashyap
>>
>> On Fri, Jan 26, 2024 at 7:48 AM Alexander Burger <
>> picolisp@software-lab.de> wrote:
>>
>>> Hi Kashyap,
>>>
>>> > ping Alex :)
>>>
>>> Yes, very good! There is just not much I can say here :)
>>>
>>> ☺/ A!ex
>>>
>>> --
>>> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>>>
>>

-- 
*Níl aon tinteán mar do thinteán féin. *[Irish Gaelic]
(There is no fireside like your own fireside.)


Re: miniPicoLisp + libuv +libSDL

2024-02-01 Thread C K Kashyap
I finally got around to recording a video (my video recording muscles have
atrophied :)  )

https://www.youtube.com/watch?v=Uv0ZiZAfcGc

Regards,
Kashyap

On Fri, Jan 26, 2024 at 8:06 AM C K Kashyap  wrote:

> Thanks Alex - I'll take the "very good" for now :)
>
> I think I found a better example for demo - libuv's file change callback
> ... I'll do a demo using that -> make changes to a picolisp script and the
> screen gets updated as I save the script :)
>
> Regards,
> Kashyap
>
> On Fri, Jan 26, 2024 at 7:48 AM Alexander Burger 
> wrote:
>
>> Hi Kashyap,
>>
>> > ping Alex :)
>>
>> Yes, very good! There is just not much I can say here :)
>>
>> ☺/ A!ex
>>
>> --
>> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>>
>


Re: minipicolisp with big num

2024-01-26 Thread C K Kashyap
:) ... thanks Alex!

On Fri, Jan 26, 2024 at 10:37 AM Alexander Burger 
wrote:

> Hi Kashyap, Mike,
>
> > Hey Mike ... I am actually asking if there is such a port/variation of
> > miniPicoLisp that has big num support - just like the regular picoLisp.
>
> I have never heard of any such version. In fact, I believe that at the
> moment
> you are the de-facto specialist of miniPicoLisp.
>
> ☺/ A!ex
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Re: minipicolisp with big num

2024-01-26 Thread Alexander Burger
Hi Kashyap, Mike,

> Hey Mike ... I am actually asking if there is such a port/variation of
> miniPicoLisp that has big num support - just like the regular picoLisp.

I have never heard of any such version. In fact, I believe that at the moment
you are the de-facto specialist of miniPicoLisp.

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: minipicolisp with big num

2024-01-26 Thread C K Kashyap
Hey Mike ... I am actually asking if there is such a port/variation of
miniPicoLisp that has big num support - just like the regular picoLisp.

Regards,
Kashyap

On Fri, Jan 26, 2024 at 9:14 AM Mike  wrote:

>
>
> > On Jan 26, 2024, at 18:19, C K Kashyap  wrote:
> >
> > 
> > Hey all,
> > Has anyone tried a port of miniPicoLisp with the added big num support?
>
> How did you test it?
>
> (mike)
>
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subjectUnsubscribe
>


Re: minipicolisp with big num

2024-01-26 Thread Mike



> On Jan 26, 2024, at 18:19, C K Kashyap  wrote:
> 
> 
> Hey all,
> Has anyone tried a port of miniPicoLisp with the added big num support?

How did you test it?

(mike)


--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: docker for pil21

2024-01-26 Thread C K Kashyap
Nice - I did not know about the --no-cache option :)

On Fri, Jan 26, 2024 at 8:09 AM Dmitry Non  wrote:

> Heya!
> Interestingly, I wrote a dockerfile for myself too at the end of Dec.My
> versions should be lighter due to the lack of build dependencies in the
> final image:
>
> FROM alpine:3.19 AS build
>
> RUN apk add --no-cache readline-dev libffi-dev libressl-dev binutils make
> clang llvm llvm-dev pkgconf
> RUN sh -c ' \
> wget https://software-lab.de/picoLisp-23.12.tgz; \
> tar xfz picoLisp-23.12.tgz; \
> cd pil21/src; \
> make \
> '
>
> FROM alpine:3.19
> RUN apk add --no-cache readline-dev libffi-dev libressl-dev
> COPY --from=build /pil21 /usr/lib/picolisp
>
> # RUN ln -s /pil21 /usr/lib/picolisp
> RUN ln -s /usr/lib/picolisp/bin/picolisp /usr/bin
> RUN ln -s /usr/lib/picolisp/bin/pil /usr/bin
>
> ENTRYPOINT ["pil"]
>
> It's availalbe at https://hub.docker.com/r/dmitrynon/picolisp
> but I didn't intend it for public consumption so you're better off using
> your own dockerfile with some additions from mine
>
> On 24 Jan 2024, at 18:47, picolisp@software-lab.de wrote:
>
> hi all,
>
> I have created a docker file for pil21 you can play with.
> Comments are welcome.
>
> https://git.envs.net/mpech/pil21-docker
>
> (mike)
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>
>
>


minipicolisp with big num

2024-01-26 Thread C K Kashyap
Hey all,
Has anyone tried a port of miniPicoLisp with the added big num support?
Regards,
Kashyap


Re: miniPicoLisp + libuv +libSDL

2024-01-26 Thread C K Kashyap
Thanks Alex - I'll take the "very good" for now :)

I think I found a better example for demo - libuv's file change callback
.. I'll do a demo using that -> make changes to a picolisp script and the
screen gets updated as I save the script :)

Regards,
Kashyap

On Fri, Jan 26, 2024 at 7:48 AM Alexander Burger 
wrote:

> Hi Kashyap,
>
> > ping Alex :)
>
> Yes, very good! There is just not much I can say here :)
>
> ☺/ A!ex
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Re: docker for pil21

2024-01-26 Thread Dmitry Non
Heya!
Interestingly, I wrote a dockerfile for myself too at the end of Dec.My 
versions should be lighter due to the lack of build dependencies in the final 
image:

FROM alpine:3.19 AS build

RUN apk add --no-cache readline-dev libffi-dev libressl-dev binutils make clang 
llvm llvm-dev pkgconf
RUN sh -c ' \
wget https://software-lab.de/picoLisp-23.12.tgz; \
tar xfz picoLisp-23.12.tgz; \
cd pil21/src; \
make \
'

FROM alpine:3.19
RUN apk add --no-cache readline-dev libffi-dev libressl-dev
COPY --from=build /pil21 /usr/lib/picolisp

# RUN ln -s /pil21 /usr/lib/picolisp
RUN ln -s /usr/lib/picolisp/bin/picolisp /usr/bin
RUN ln -s /usr/lib/picolisp/bin/pil /usr/bin

ENTRYPOINT ["pil"]

It's availalbe at https://hub.docker.com/r/dmitrynon/picolisp
but I didn't intend it for public consumption so you're better off using your 
own dockerfile with some additions from mine

> On 24 Jan 2024, at 18:47, picolisp@software-lab.de wrote:
> 
> hi all,
> 
> I have created a docker file for pil21 you can play with.
> Comments are welcome.
> 
> https://git.envs.net/mpech/pil21-docker
> 
> (mike)
> 
> -- 
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe



Re: miniPicoLisp + libuv +libSDL

2024-01-26 Thread Alexander Burger
Hi Kashyap,

> ping Alex :)

Yes, very good! There is just not much I can say here :)

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: miniPicoLisp + libuv +libSDL

2024-01-26 Thread C K Kashyap
ping Alex :)

On Wed, Jan 24, 2024 at 7:58 AM C K Kashyap  wrote:

> Hi Alex et al,
> For quite some time now (years), I've been attempting to have a
> miniPicoLisp + libSDL + libUV working (on Windows as well) for a while and
> I have finally got it working :) ... Much of my time was wasted attempting
> "3 part cell" etc.
>
> I thought that I'd record a video of the demo before sharing but I am
> becoming impatient now :). I have the working version here -
> https://github.com/lispware/minilisp/tree/libuv2
> To see the demo, simply execute server.l (which listens on port 8080 for
> the mouse click locations and returns an RGB color). Then execute client.l
> - this opens an SDL window and sends the mouse click location to port 8080
> and draws a square on the window with the color returned from the server.
> [Please take a look at the Docker file to see the dependencies that are
> needed]
>
> I think I need to work on modelling the callbacks better. It would be
> great if I could have some pointers on how to do it better/right. For
> example, I modelled uv_tcp_listen here -
> https://github.com/lispware/minilisp/blob/2c4581d2288eafd4b5f65b88e37411e22993fc5a/src/lisp_sdl_libuv.c#L573
>  I
> execute the callback from the C callback "on_connection
> 
> "
>
> Regards,
> Kashyap
>


Re: docker for pil21

2024-01-24 Thread C K Kashyap
Nice,
Here's some additions to make the image a little lighter (not including the
*-dev packages) and also adding the appropriate soft links as indicated in
the INSTALL file

FROM alpine:latest as builder

RUN apk update && apk upgrade
RUN apk add bash git make llvm clang readline libffi openssl
RUN apk add llvm-dev readline-dev libffi-dev openssl-dev
WORKDIR /root
RUN git clone https://github.com/picolisp/pil21
WORKDIR /root/pil21/src
RUN touch *.ll
RUN make

FROM alpine:latest
RUN apk add bash git make llvm clang readline libffi openssl vim
COPY --from=builder /root/pil21 /root/pil21
RUN ln -s /root/pil21 /usr/lib/picolisp
RUN ln -s /usr/lib/picolisp/bin/picolisp /usr/bin
RUN ln -s /usr/lib/picolisp/bin/pil /usr/bin
RUN mkdir -p /usr/share/man/man1
RUN mkdir -p /usr/share/bash-completion/completions
RUN ln -s /root/pil21/man/man1/picolisp.1 /usr/share/man/man1
RUN ln -s /root/pil21/man/man1/pil.1 /usr/share/man/man1
RUN ln -s /root/pil21 /usr/share/picolisp
RUN ln -s /root/pil21/lib/bash_completion
/usr/share/bash-completion/completions/pil

On Wed, Jan 24, 2024 at 10:59 AM  wrote:

> hi all,
>
> I have created a docker file for pil21 you can play with.
> Comments are welcome.
>
> https://git.envs.net/mpech/pil21-docker
>
> (mike)
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


docker for pil21

2024-01-24 Thread picolisp

hi all,

I have created a docker file for pil21 you can play with.
Comments are welcome.

https://git.envs.net/mpech/pil21-docker

(mike)

--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


miniPicoLisp + libuv +libSDL

2024-01-24 Thread C K Kashyap
Hi Alex et al,
For quite some time now (years), I've been attempting to have a
miniPicoLisp + libSDL + libUV working (on Windows as well) for a while and
I have finally got it working :) ... Much of my time was wasted attempting
"3 part cell" etc.

I thought that I'd record a video of the demo before sharing but I am
becoming impatient now :). I have the working version here -
https://github.com/lispware/minilisp/tree/libuv2
To see the demo, simply execute server.l (which listens on port 8080 for
the mouse click locations and returns an RGB color). Then execute client.l
- this opens an SDL window and sends the mouse click location to port 8080
and draws a square on the window with the color returned from the server.
[Please take a look at the Docker file to see the dependencies that are
needed]

I think I need to work on modelling the callbacks better. It would be great
if I could have some pointers on how to do it better/right. For example, I
modelled uv_tcp_listen here -
https://github.com/lispware/minilisp/blob/2c4581d2288eafd4b5f65b88e37411e22993fc5a/src/lisp_sdl_libuv.c#L573
I
execute the callback from the C callback "on_connection

"

Regards,
Kashyap


Re: Bye from forks sends signals?

2024-01-10 Thread Terry Palfrey
Dmitry Non

Move to real time with the IRC channel:

https://picolisp-explored.com/how-to-join-the-picolisp-community

https://libera.irclog.whitequark.org/picolisp/2024-01-10

On Tue, 9 Jan 2024 at 19:14, Dmitry Non  wrote:

> Hey.
>
> That's awesome. Thank you very much, Alex!
>
> > On 6 Jan 2024, at 06:48, Alexander Burger 
> wrote:
> >
> > Hi Dmitry,
> >
> >> Is this newsletter alive?:)
> >
> > Yes, just not so noisy :)
> >
> >
> >> I'm playing around with `native` and ZeroMQ and found a curious
> behaviour.
> >>
> >>(unless (fork)
> >>  (wait 2000)
> >>  (bye))
> >>
> >>(setq Context (native "libzmq.so" "zmq_ctx_new" 'P))
> >>(setq ZMQ_REP 4)
> >>(setq Socket (native "libzmq.so" "zmq_socket" 'P Context ZMQ_REP))
> >>(native "libzmq.so" "zmq_bind" 'I Socket "tcp://*:")
> >>
> >>(buf
> >> Buffer 10
> >> (prinl "Waiting for messages")
> >> (when (= -1 (native "libzmq.so" "zmq_recv" 'I Socket Buffer 10 0))
> >>   (prinl (pack "Error: " (errno)
> >
> > This looks good.
> >
> >
> >> The `errno` is 4 (which is signal interrupt as i understand).
> >
> > Yes. EINTR is 4 on most systems. You can see it with
> >
> >   : (sysdefs "errno")
> >   -> EACCES
> >   : EINTR
> >   -> 4
> >
> > or (vi "@lib/sysdefs").
> >
> >
> >> My assumption here is that `bye` throws some signal? Why else would it
> affect
> >> zeromq in the parent process?
> >> Actually, while writing this I found out about SIGCHLD which is
> apparently
> >> sent to parent on child's exit so I guess zmq_recv gets interrupted by
> that
> >> for some reason?
> >
> > Absolutely correct. The child sends a SIGCHLD signal, which must be
> handled or
> > ignored.
> >
> > I don't have libzmq at the moment and cannot test it, but I think it
> should be
> > something like
> >
> >   (while (lt0 (native "libzmq.so" "zmq_recv" 'I Socket Buffer 10 0))
> >  (unless (== EINTR (errno))
> > (quit (errno) "Signal") ) )
> >
> >
> >> P.S. completely offtopic but since I'm here. I just noticed that
> semicolons
> >> aren't treated as comments. Why?
> >
> > Comments in PicoLisp are # or #{...}#.
> >
> >
> >> Can it be enabled? Otherwise my Emacs' lisp-mode comment/uncomment
> function is
> >> useless and no comment highlight either.
> >
> > There is no built-in way to change it. There are some Emacs libs for
> PicoLisp,
> > but I don't use Emacs and cannot be helpful here.
> >
> > ☺/ A!ex
> >
> > --
> > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subjectUnsubscribe
>


unsubscribe

2024-01-10 Thread Nikolai Schlegel



Re: Bye from forks sends signals?

2024-01-09 Thread Dmitry Non
Hey.

That's awesome. Thank you very much, Alex!

> On 6 Jan 2024, at 06:48, Alexander Burger  wrote:
> 
> Hi Dmitry,
> 
>> Is this newsletter alive?:)
> 
> Yes, just not so noisy :)
> 
> 
>> I'm playing around with `native` and ZeroMQ and found a curious behaviour.  
>> 
>>(unless (fork)
>>  (wait 2000)
>>  (bye))
>> 
>>(setq Context (native "libzmq.so" "zmq_ctx_new" 'P))
>>(setq ZMQ_REP 4)
>>(setq Socket (native "libzmq.so" "zmq_socket" 'P Context ZMQ_REP))
>>(native "libzmq.so" "zmq_bind" 'I Socket "tcp://*:")
>> 
>>(buf
>> Buffer 10
>> (prinl "Waiting for messages")
>> (when (= -1 (native "libzmq.so" "zmq_recv" 'I Socket Buffer 10 0))
>>   (prinl (pack "Error: " (errno)
> 
> This looks good.
> 
> 
>> The `errno` is 4 (which is signal interrupt as i understand).
> 
> Yes. EINTR is 4 on most systems. You can see it with
> 
>   : (sysdefs "errno")
>   -> EACCES
>   : EINTR
>   -> 4
> 
> or (vi "@lib/sysdefs").
> 
> 
>> My assumption here is that `bye` throws some signal? Why else would it affect
>> zeromq in the parent process?
>> Actually, while writing this I found out about SIGCHLD which is apparently
>> sent to parent on child's exit so I guess zmq_recv gets interrupted by that
>> for some reason?
> 
> Absolutely correct. The child sends a SIGCHLD signal, which must be handled or
> ignored.
> 
> I don't have libzmq at the moment and cannot test it, but I think it should be
> something like
> 
>   (while (lt0 (native "libzmq.so" "zmq_recv" 'I Socket Buffer 10 0))
>  (unless (== EINTR (errno))
> (quit (errno) "Signal") ) )
> 
> 
>> P.S. completely offtopic but since I'm here. I just noticed that semicolons
>> aren't treated as comments. Why?
> 
> Comments in PicoLisp are # or #{...}#.
> 
> 
>> Can it be enabled? Otherwise my Emacs' lisp-mode comment/uncomment function 
>> is
>> useless and no comment highlight either.
> 
> There is no built-in way to change it. There are some Emacs libs for PicoLisp,
> but I don't use Emacs and cannot be helpful here.
> 
> ☺/ A!ex
> 
> -- 
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Bye from forks sends signals?

2024-01-05 Thread Alexander Burger
Hi Dmitry,

> Is this newsletter alive?:)

Yes, just not so noisy :)


> I'm playing around with `native` and ZeroMQ and found a curious behaviour.  
> 
> (unless (fork)
>   (wait 2000)
>   (bye))
> 
> (setq Context (native "libzmq.so" "zmq_ctx_new" 'P))
> (setq ZMQ_REP 4)
> (setq Socket (native "libzmq.so" "zmq_socket" 'P Context ZMQ_REP))
> (native "libzmq.so" "zmq_bind" 'I Socket "tcp://*:")
> 
> (buf
>  Buffer 10
>  (prinl "Waiting for messages")
>  (when (= -1 (native "libzmq.so" "zmq_recv" 'I Socket Buffer 10 0))
>(prinl (pack "Error: " (errno)

This looks good.


> The `errno` is 4 (which is signal interrupt as i understand).

Yes. EINTR is 4 on most systems. You can see it with

   : (sysdefs "errno")
   -> EACCES
   : EINTR
   -> 4

or (vi "@lib/sysdefs").


> My assumption here is that `bye` throws some signal? Why else would it affect
> zeromq in the parent process?
> Actually, while writing this I found out about SIGCHLD which is apparently
> sent to parent on child's exit so I guess zmq_recv gets interrupted by that
> for some reason?

Absolutely correct. The child sends a SIGCHLD signal, which must be handled or
ignored.

I don't have libzmq at the moment and cannot test it, but I think it should be
something like

   (while (lt0 (native "libzmq.so" "zmq_recv" 'I Socket Buffer 10 0))
  (unless (== EINTR (errno))
 (quit (errno) "Signal") ) )


> P.S. completely offtopic but since I'm here. I just noticed that semicolons
> aren't treated as comments. Why?

Comments in PicoLisp are # or #{...}#.


> Can it be enabled? Otherwise my Emacs' lisp-mode comment/uncomment function is
> useless and no comment highlight either.

There is no built-in way to change it. There are some Emacs libs for PicoLisp,
but I don't use Emacs and cannot be helpful here.

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Bye from forks sends signals?

2024-01-05 Thread Dmitry Non
Hey!

Is this newsletter alive?:)

Disclaimer: I'm not very familiar with system programming and POSIX


I'm playing around with `native` and ZeroMQ and found a curious behaviour.  

(unless (fork)
  (wait 2000)
  (bye))

(setq Context (native "libzmq.so" "zmq_ctx_new" 'P))
(setq ZMQ_REP 4)
(setq Socket (native "libzmq.so" "zmq_socket" 'P Context ZMQ_REP))
(native "libzmq.so" "zmq_bind" 'I Socket "tcp://*:")

(buf
 Buffer 10
 (prinl "Waiting for messages")
 (when (= -1 (native "libzmq.so" "zmq_recv" 'I Socket Buffer 10 0))
   (prinl (pack "Error: " (errno)


Basically, the main process sets up a server and waiting for a message and the 
child process simply waits for a bit and exits with `bye`.

The `errno` is 4 (which is signal interrupt as i understand).
The waiting in the child process is important because if it exits before zeromq 
code, everything's fine and the server is patiently waiting.

My assumption here is that `bye` throws some signal? Why else would it affect 
zeromq in the parent process?

Just looking for some explanation. Maybe even the proper way to resolve this.


Actually, while writing this I found out about SIGCHLD which is apparently sent 
to parent on child's exit so I guess zmq_recv gets interrupted by that for some 
reason? Weird. Can anyone confirm that's what I'm seeing?

P.S. completely offtopic but since I'm here. I just noticed that semicolons 
aren't treated as comments. Why? Can it be enabled? Otherwise my Emacs' 
lisp-mode comment/uncomment function is useless and no comment highlight either.


--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Bye from forks sends signals?

2024-01-05 Thread Dmitry Non
Hey!

Is this newsletter alive?:)

Disclaimer: I'm not very familiar with system programming and POSIX


I'm playing around with `native` and ZeroMQ and found a curious behaviour.  

(unless (fork)
  (wait 2000)
  (bye))

(setq Context (native "libzmq.so" "zmq_ctx_new" 'P))
(setq ZMQ_REP 4)
(setq Socket (native "libzmq.so" "zmq_socket" 'P Context ZMQ_REP))
(native "libzmq.so" "zmq_bind" 'I Socket "tcp://*:")

(buf
 Buffer 10
 (prinl "Waiting for messages")
 (when (= -1 (native "libzmq.so" "zmq_recv" 'I Socket Buffer 10 0))
   (prinl (pack "Error: " (errno)


Basically, the main process sets up a server and waiting for a message and the 
child process simply waits for a bit and exits with `bye`.

The `errno` is 4 (which is signal interrupt as i understand).
The waiting in the child process is important because if it exits before zeromq 
code, everything's fine and the server is patiently waiting.

My assumption here is that `bye` throws some signal? Why else would it affect 
zeromq in the parent process?

Just looking for some explanation. Maybe even the proper way to resolve this.


Actually, while writing this I found out about SIGCHLD which is apparently sent 
to parent on child's exit so I guess zmq_recv gets interrupted by that for some 
reason? Weird. Can anyone confirm that's what I'm seeing?

P.S. completely offtopic but since I'm here. I just noticed that semicolons 
aren't treated as comments. Why? Can it be enabled? Otherwise my Emacs' 
lisp-mode comment/uncomment function is useless and no comment highlight either.


--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Unsubscribe

2024-01-04 Thread Stephen Medina
Good bye Stephen Medina  :-(
You are now unsubscribed


Unsubscribe



-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Subscribe

2024-01-04 Thread Dmitry Non
Hello Dmitry Non  :-)
You are now subscribed


Hello world

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Subscribe

2024-01-04 Thread Christian Ruesch
Hello Christian Ruesch  :-)
You are now subscribed



-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: External allocations using miniPicoLisp

2023-12-03 Thread Alexander Burger
Hi Kashyap,

> I think "finally" will do what I need :)

Yes, good idea!

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Unsubscribe

2023-12-03 Thread Jan-Felix Wittmann
Good bye Jan-Felix Wittmann  :-(
You are now unsubscribed


Gesendet von Outlook für Android

--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: External allocations using miniPicoLisp

2023-12-03 Thread C K Kashyap
Thanks Alex,

The penny just dropped for me as I was writing this mail - yup, I remember
now :)
I think "finally" will do what I need :)

Regards,
Kashyap


On Sat, Dec 2, 2023 at 11:35 PM Alexander Burger 
wrote:

> Hi Kashyap,
>
> > Is there a reference implementation of external allocation using
> > miniPicoLisp?
> >
> > Here's what I'd like to do - Create a new function called "alloc" that
> > allocates some memory.
> >
> > (let A (alloc 100)
> >   (poke A 0 10)) # poke simply writes a byte(10) at offset 0
>
> I do not know if anybody has done this in miniPicoLisp, but the official
> PicoLisp has functions 'buf' and 'byte' which behave that way:
>
>(buf A 100  # Allocate on the stack
>   (byte A 10)
>   (byte (+ A 7) 11)
>   ... )
>
> 'buf' allocates memory on the runtime stack, and cleans it up when done.
>
>
> You can also explicitly allocate system memory to get the same effect, but
> this
> has more overhead:
>
>(let A (%@ "malloc" 'P 100)  # Allocate memory
>   (byte A 10)
>   ...
>   (%@ "free" NIL A) )  # Clean up
>
>
> > The part I want to ensure is that the memory that's allocated by alloc
> gets
> > collected by the GC.
>
> This does not make sense. The garbage collector traverses the 'heap'
> structures,
> managing used and unused cells (as discussed in our last mail). Memory
> allocated
> by 'buf' or malloc() does not contain cells reachable from Lisp data
> structures,
> and is therfore not known by the garbage collector. And as it is not part
> of the
> linked list of 'heap's, it will not be free'd.
>
> ☺/ A!ex
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Unsubscribe

2023-12-03 Thread Олег Тельнов



Re: External allocations using miniPicoLisp

2023-12-02 Thread Alexander Burger
Hi Kashyap,

> Is there a reference implementation of external allocation using
> miniPicoLisp?
> 
> Here's what I'd like to do - Create a new function called "alloc" that
> allocates some memory.
> 
> (let A (alloc 100)
>   (poke A 0 10)) # poke simply writes a byte(10) at offset 0

I do not know if anybody has done this in miniPicoLisp, but the official
PicoLisp has functions 'buf' and 'byte' which behave that way:

   (buf A 100  # Allocate on the stack
  (byte A 10)
  (byte (+ A 7) 11)
  ... )

'buf' allocates memory on the runtime stack, and cleans it up when done.


You can also explicitly allocate system memory to get the same effect, but this
has more overhead:

   (let A (%@ "malloc" 'P 100)  # Allocate memory
  (byte A 10)
  ...
  (%@ "free" NIL A) )  # Clean up


> The part I want to ensure is that the memory that's allocated by alloc gets
> collected by the GC.

This does not make sense. The garbage collector traverses the 'heap' structures,
managing used and unused cells (as discussed in our last mail). Memory allocated
by 'buf' or malloc() does not contain cells reachable from Lisp data structures,
and is therfore not known by the garbage collector. And as it is not part of the
linked list of 'heap's, it will not be free'd.

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


External allocations using miniPicoLisp

2023-12-02 Thread C K Kashyap
Hi Alex et al,

Is there a reference implementation of external allocation using
miniPicoLisp?

Here's what I'd like to do - Create a new function called "alloc" that
allocates some memory.

(let A (alloc 100)
  (poke A 0 10)) # poke simply writes a byte(10) at offset 0

The part I want to ensure is that the memory that's allocated by alloc gets
collected by the GC.

Regards,
Kashyap


Re: possible bug in miniPicoLisp?

2023-11-30 Thread C K Kashyap
Got it.

Thanks Alex.

Regards,
Kashyap


On Wed, Nov 29, 2023 at 9:57 PM Alexander Burger 
wrote:

> On Wed, Nov 29, 2023 at 08:08:33PM -0800, C K Kashyap wrote:
> > Thanks Alex - half a dozen worked in my example :)
>
> Great :)
>
> > I completely get the idea of the inefficiency of CELLS=1 - the segfault
>
> OK
>
> > however seems like a silent bug (more likely some optimistic avoidance
> of a
> > NULL check somewhere perhaps). What do you think?
>
> Yes, it is definitely a bug if YOU set the heap to a bad size. As long as
> it is
> big enough, a runtime check is meaningless and will never fire.
>
> ☺/ A!ex
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Re: possible bug in miniPicoLisp?

2023-11-29 Thread Alexander Burger
On Wed, Nov 29, 2023 at 08:08:33PM -0800, C K Kashyap wrote:
> Thanks Alex - half a dozen worked in my example :)

Great :)

> I completely get the idea of the inefficiency of CELLS=1 - the segfault

OK

> however seems like a silent bug (more likely some optimistic avoidance of a
> NULL check somewhere perhaps). What do you think?

Yes, it is definitely a bug if YOU set the heap to a bad size. As long as it is
big enough, a runtime check is meaningless and will never fire.

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: possible bug in miniPicoLisp?

2023-11-29 Thread C K Kashyap
Thanks Alex - half a dozen worked in my example :)

I completely get the idea of the inefficiency of CELLS=1 - the segfault
however seems like a silent bug (more likely some optimistic avoidance of a
NULL check somewhere perhaps). What do you think?

I say this because, even with CELLS=1, most of the stuff just works
(meaning no segfault - granted, highly inefficient)
If sample.l is the following - no problem
(de test (Pat . Prg)
   (bind (fish pat? Pat)
  (unless (match Pat (run Prg 1))
 (msg Prg)
 (quit 'fail Pat) ) ) )

(test '(B) (find pair (1 A 2 (B) 3 CDE)))
(test 4 (find > (1 2 3 4 5 6) (6 5 4 3 2 1)))
(test 4 (find '((A B) (> A B)) (1 2 3 4 5 6) (6 5 4 3 2 1)))
(let (A -1  B 2  C 3)
   (test 'B (find '((X) (gt0 (val X))) '(A B C)))
   (test 2 @@) )
# (test "h"
#(pick '((X) (get X 'str))
#   (list (box) (prog1 (box) (put @ 'str "Hello")) (box)) ) )


Regards,
Kashyap

On Tue, Nov 28, 2023 at 10:51 PM Alexander Burger 
wrote:

> Hi Kashyap,
>
> > I attempted to use 1 as the CELLS value in pico.h and immediately ran
> into
> > segfault
>
> Yes, this is not a good idea ;)
>
> CELLS is the number of cells per heap
>
>typedef struct heap {
>   cell cells[CELLS];
>   struct heap *next;
>} heap;
>
> and PicoLisp allocates as many heaps as needed.
>
> Setting it to 1 creates a huge overhead, because then you'll have one
> 'next'
> link for every cell.
>
> The cells in the heaps are maintained to hold internal linked lists for the
> unused cells. Probably this will not work if CELLS is 1.
>
>
> > Why am I trying CELLS = 1? Just poking around - I was just trying to
> figure
> > out the min number of CELLS I needed for certain programs.
>
> You can get the number of cells in a function with 'size':
>
>: (size '(a b c))
>-> 3
>
>: (pp 'test)
>(de test ("Pat" . "Prg")
>   (bind (fish pat? "Pat")
>  (unless (match "Pat" (run "Prg"))
> (msg "Prg")
> (quit "'test' failed" "Pat") ) ) )
>-> test
>
>: (size test)
>-> 23
>
> Even a minimal system needs a few thousand cells.
>
> Setting CELLS to just a few dozens would work, but the overhead of
> maintaining
> so many heaps will become relatively large.
>
> ☺/ A!ex
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Re: possible bug in miniPicoLisp?

2023-11-28 Thread Alexander Burger
Hi Kashyap,

> I attempted to use 1 as the CELLS value in pico.h and immediately ran into
> segfault

Yes, this is not a good idea ;)

CELLS is the number of cells per heap

   typedef struct heap {
  cell cells[CELLS];
  struct heap *next;
   } heap;

and PicoLisp allocates as many heaps as needed.

Setting it to 1 creates a huge overhead, because then you'll have one 'next'
link for every cell.

The cells in the heaps are maintained to hold internal linked lists for the
unused cells. Probably this will not work if CELLS is 1.


> Why am I trying CELLS = 1? Just poking around - I was just trying to figure
> out the min number of CELLS I needed for certain programs.

You can get the number of cells in a function with 'size':

   : (size '(a b c))
   -> 3

   : (pp 'test)
   (de test ("Pat" . "Prg")
  (bind (fish pat? "Pat")
 (unless (match "Pat" (run "Prg"))
(msg "Prg")
(quit "'test' failed" "Pat") ) ) )
   -> test

   : (size test)
   -> 23

Even a minimal system needs a few thousand cells.

Setting CELLS to just a few dozens would work, but the overhead of maintaining
so many heaps will become relatively large.

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


possible bug in miniPicoLisp?

2023-11-28 Thread C K Kashyap
Hi Alex,
I attempted to use 1 as the CELLS value in pico.h and immediately ran into
segfault at mark(ApplyArgs); in gc.c. I got around the segfault by simply
doing this -

   if(ApplyArgs)mark(ApplyArgs);
   if(ApplyBody)mark(ApplyBody);

After that, most things work but I ran into another segfault while trying
to run this sample.l file

## sample.l
(de test (Pat . Prg)
   (bind (fish pat? Pat)
  (unless (match Pat (run Prg 1))
 (msg Prg)
 (quit 'fail Pat) ) ) )

(test "Hello"
   (pick '((X) (get X 'str))
  (list (box) (prog1 (box) (put @ 'str "Hello")) (box)) ) )

kashyap@DESKTOP-NICP8CC:~/s/miniPicoLisp/src$ ../bin/picolisp sample.l
Segmentation fault


I'd appreciate any pointers.

Why am I trying CELLS = 1? Just poking around - I was just trying to figure
out the min number of CELLS I needed for certain programs.

Regards,
Kashyap


Re: pil21 installation fail

2023-11-15 Thread polifemo
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
>


Re: pil21 installation fail

2023-11-11 Thread Alexander Burger
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

2023-11-11 Thread polifemo
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


  1   2   3   4   5   6   7   8   9   10   >