Re: Examples of quote usage instead of lambda

2020-02-06 Thread Wilhelm Fitzpatrick



On 2/6/20 9:41 AM, John Duncan wrote:

The dotted pair syntax (a . b) refers to the car and cdr of a list.


I too had been scratching my head about the use of the dotted notation 
in the function documentation, but I just had a lightbulb. Since in a 
regular list, the cdr is the "tail", in an example like:


(let? sym 'any . prg)

..the dot is telling us that "prg" represents the "rest of the list" 
i.e. all the expressions that follow the (in this case) first three 
elements.


Thank you for your explanation, John.

-wilhelm


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


Constructing functions programmatically?

2020-02-01 Thread Wilhelm Fitzpatrick
Hello, I've recently stumbled across Picolisp (while playing around with 
Termux) and have been reading up and finding it very intriguing. In the 
process of learning, I experimented with making a function to generate 
incrementor functions, e.g. (make-inc 2) would return a function that 
adds two to its input. My current solution looks like this:


: (de make-inc (X) (list '(Y) (list '+ X 'Y)))
-> make-inc
: (setq inc1 (make-inc 1))
-> ((Y) (+ 1 Y))
: (setq inc2 (make-inc 2))
-> ((Y) (+ 2 Y))
: (inc1 3)
-> 4
: (inc2 3)
-> 5

..but I am wondering if there might be more idiomatic approaches that 
allow the "function under construction" to be specified in a more 
readable fashion than building it up using "list"? Is there perhaps a 
mechanism for temporarily escaping from a quoted section to evaluate a 
specific symbol? Or some other approach that is similar where the 
"templated" parts of the function being built can be written as they 
would normally appear?


Thanks in advance for any hints, and I look forward to hanging around 
and learning from this list.


-wilhelm


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


Subscribe

2020-01-31 Thread Wilhelm Fitzpatrick

Hello Wilhelm Fitzpatrick  :-)
You are now subscribed




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


Local install problem

2020-03-25 Thread Wilhelm Fitzpatrick
I tried doing a local install of picolisp in my Chromebook's Linux 
container (Debian Buster).


After downloading and building the 19.12 tarball, I find that the pil 
script in picoLisp/bin has /usr/bin/picolisp as the shbang, so it 
wouldn't actually work as a local installation.


Did I miss a step?

-wilhelm


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


Re: Digging into Symbols

2020-04-28 Thread Wilhelm Fitzpatrick

On 4/28/20 2:18 AM, Guido Stepken wrote:


E.g Python dqueue doesn't show any performance loss here


The performance of a particular python data structure has no bearing on 
the fact that your original statement:



In most Lisp languages, you only can "append" to a list, never "prepend"
..is incorrect on its face, since the cons based linked list is the 
fundamental data structure of Lisp and _prefers_ prepend over append.



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


Re: Digging into Symbols

2020-04-27 Thread Wilhelm Fitzpatrick

Thanks for the insights, Alex!

On 4/27/20 1:53 PM, Alexander Burger wrote:

This means, a pointer to a cell points direcly to its CAR, while a pointer to a
symbol points to its VAL. In both cases (car ...) or (val ...) are just a single
pointer derefernces (memory fetches).
Ah, so car and val are effectively synonyms, and it's easier to allow 
that then prevent :)



3. Again from curiosity, I'm wondering why the
bytes of the name are seemingly stored
"backwards"? I'm assuming this also provides
some performance optimization.

Correct. The first character(s) need to be accessed more prominently.

Hmm... because checking the first byte/character is just a mask, rather 
than shift & mask?


-wilhelm


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


Digging into Symbols

2020-04-27 Thread Wilhelm Fitzpatrick
I've been digging down to really understand the symbol implementation in 
Picolisp, since symbols are used for so many purposes within the language.


One surprising thing I learned last night is that (get ...) has a side 
effect! It moves the key that was accessed to the head of the symbol 
"tail". I assume this is a performance optimization to cause recently 
accessed properties to "bubble up" to the front of the list in case they 
are re-accessed soon.


A few questions:

1. I understand why (cdr) doesn't function on a symbol (semantically 
it's not a pair) but I'm curious why (car) is allowed to work (returning 
the VAL)?


2. Is there anyway within the REPL to inspect the tail structure of the 
symbol directly? This is mostly from curiosity.


3. Again from curiosity, I'm wondering why the bytes of the name are 
seemingly stored "backwards"? I'm assuming this also provides some 
performance optimization.


-wilhelm


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


Re: PilCon 2020

2020-04-22 Thread Wilhelm Fitzpatrick
I'll add my voice as being another who would be interested in an online 
convention.


-Wilhelm

On 4/21/20 11:13 PM, George-Phillip Orais wrote:
Same here, as lurker and amateur PicoLisper, I love to join and the 
attend this online PilCon 2020, thank you Alex!


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


Re: Digging into Symbols

2020-04-27 Thread Wilhelm Fitzpatrick

On 4/27/20 2:42 PM, Guido Stepken wrote:


In most Lisp languages, you only can "append" to a list, never "prepend".:


"Prepend", aka "add to the beginning" seems the natural (and 
non-destructive) operation of Lisp, e.g.


(cons 9 (1 2 3)) -> (9 1 2 3)

..perhaps that is what you meant?

-wilhelm


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


Re: Stop using US controlled software stacks!!!

2020-04-27 Thread Wilhelm Fitzpatrick



China is changing gears, decoupling from TCP/IP protocol. Means: USA 
becoming isolated. It's a 320 million people state, making just 5% of 
global population.


https://cntechpost.com/2020/03/30/huawei-aims-to-reshape-internet-with-protocol-called-new-ip/

China certainly has long wanted to isolate itself from the rest of the 
internet, given the propensity for inconvenient truths to leak in that 
way. And given that they are 1/5th of the world population, perhaps they 
can do that.


That said, not sure we in the rest of the world should be excited about 
signing up for a new basic layer with "authoritarian ready" features. As 
much as some factions in the USA would like to become "China Jr.", 
keeping the sieve leaking is our best path forward to frustrating their 
ambitions.


https://www.engadget.com/2020-03-30-china-huawei-new-ip-proposal.html

I might have to look into the actual "New IP" proposal a little further 
though. I'm curious to see if they built in any "migration path" that 
would help solve the critical mass issues that have kept IPv6 on the 
back burner for 20 years.


-wilhelm


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


Re: divmod?

2020-05-03 Thread Wilhelm Fitzpatrick




I'm not finding such a thing in the function reference, but asking on the off 
chance I'm
overlooking it. Is there a way in Picolisp to get a division result and 
remainder as a single
operation?

Sure
http://ix.io/2kBM


Thanks! But as Alex intuited, I was looking to leverage the underlying 
processor operation that returns both parts of the integer divide in a 
single operation. But if I follow his response correctly, the cost of 
building the memory representation of the answer swamps the actual cost 
of the divide, and that's going to be similar regardless of if the 
divide and remainder wind up being one machine instruction or two.


-wilhelm



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


Formatting in the REPL?

2020-05-02 Thread Wilhelm Fitzpatrick
I'm experimenting with the object system in Picolisp, and I'm wondering 
if there is a way of teaching the REPL to invoke some formatting 
function when displaying an object instance? Having to constantly invoke 
(show) to see what is going on with the instances does get a little 
tedious...


-wilhelm


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


divmod?

2020-05-02 Thread Wilhelm Fitzpatrick
I'm not finding such a thing in the function reference, but asking on 
the off chance I'm overlooking it. Is there a way in Picolisp to get a 
division result and remainder as a single operation?


-wilhelm

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


Re: Do free Open Source Foundation's Software Stacks fall under US Export Law?

2020-05-06 Thread Wilhelm Fitzpatrick

On 5/6/20 11:35 AM, Guido Stepken wrote:


If this is really the case, it promise, i say 'goodbye' from PicoLisp
mailing list!!! I promise!

Oh, Guido, please don't make promises you can't keep 藍

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


Re: Formatting in the REPL?

2020-05-03 Thread Wilhelm Fitzpatrick




Perhaps by setting '*Prompt'?

ww https://software-lab.de/doc/refP.html#*Prompt

☺/ A!ex


Thanks for the tip! I think I'm on to something...

: (de *Prompt (cond ((isa '+Fixed @) (format> @)) (T "")))
# *Prompt redefined
-> *Prompt
:
: (fixed 1234 2)
-> $171307330464572
12.34: (fixed+ @ (fixed 123 1))
-> $171307330465675
24.64:

..fun :)

-wilhelm


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


Re: Fridays for Functions (Was: PilCon 2020)

2020-06-03 Thread Wilhelm Fitzpatrick

I'd definitely try to join to listen and learn.

On 6/2/20 11:26 PM, Jean-Christophe Helary wrote:



On Jun 3, 2020, at 14:54, Alexander Burger  wrote:

I would propose informal Jitsi meetings every second Friday or so. The time
could be alternating 8:00 and 16:00 UTC, to allow attendance from most time
zones. No big planning and schedule. Let's start with questions, tutorials and
demonstrations.

Any thoughts?

Nice idea ! :)




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


Re: PilCon Friday

2020-11-06 Thread Wilhelm Fitzpatrick
Only topics whose questioners were present were discussed, so we didn't 
talk about the interpreter only approach, holding it as a topic for 
future session.


Alex addressed the "array avoidance" question, explaining the how arrays 
would complicate the core single data type implementation and approach 
of picolisp (that single data type being the cell). Further he talked 
about how most approaches that in other languages fall to arrays by 
default can be handled through picolisp lists, or creating more purpose 
built data structures rather than reaching for an array. Finally he 
showed how picolisp's native code interface can be used to malloc a 
section of heap memory and address it directly to create a direct access 
array like structure if that is absolutely required.


Then the question of how picolisp interacts with Java was discussed, and 
Alex showed examples in the Pilbox, and showed the named pipe mechanism 
used to send commands to the Java side and receive responses back to the 
picolisp world.


Olaf showed off his experimentation of using picolisp to communicate 
with JavaScript running in a browser to dynamically update SVG objects, 
creating animation. Olaf & Alex dug into some of the issues in the 
original experiment, and one source of problems was that the ServerEvent 
facility that Olaf was using only sends a single line at time to the 
other side.


Olaf's motto for the evening: "when you read the picolisp documentation, 
you have to read every word"


There may have a been a few other small topics that I am failing to 
recollect.


-wilhelm

On 11/6/20 8:03 AM, C K Kashyap wrote:
As bad an excuse that it may sound, it is the truth - I messed up my 
alarm setting (AM vs PM) :) and missed the meeting.


Could I request someone to please summarize what was discussed? 
particularly about the "interpreter only" approach. If it was not 
discussed then perhaps I can request Alex to write down his thoughts.


Regards,
Kashyap

On Thu, Nov 5, 2020 at 2:59 PM Kevin Ednalino > wrote:


Personally, I work business hours so Friday mornings I'm generally
unavailable (GMT).

I think at least one on the weekday in the afternoon/evening and
one on the weekend might be the most convenient with the latter
more convenient for non-European timezones. For example, if it's
hosted on Saturday at noon then it'd be roughly morning for the
Americas and evening for Asia.

If doing 2x meetings a month, then alternating each month with the
weekday/weekend day might maximize availability like if someone is
busy during the week and/or busy during the weekend (if busy both
times, just have to wait untill the next meeting!):

Month: Week 1 / Week 2
Nov: Wed/Sat
Dec: Fri/Sun
Jan: Wed/Sat
...

Or even alternate just weekends weekly between Saturday and Sunday.

On Thu, Nov 5, 2020 at 6:42 PM Alexander Burger
mailto:a...@software-lab.de>> wrote:

On Thu, Nov 05, 2020 at 01:23:13PM -0500, r cs wrote:
> Raw video would be welcomed.  The timing of the PilCon can
be challenging
> in some time zones.

Independent of the recording issue, the current scheduling is
not an absolute
must. I did a proposal initially, and nobody complained, so we
stayed with it.

Should we consider a change for the future? Perhaps Saturday
would be better
than Friday? And/or some other UTC time(s)? Should we try some
democratic
decision process?

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de

?subject=Unsubscribe



Re: pilbox file sharing

2021-01-18 Thread Wilhelm Fitzpatrick
Is the one having issues a newer version of Android perhaps (Android 10 
or 11?)


Android has been locking thing down to require use of the Storage Access 
Framework in the most recent version of the OS, I believe.


-wilhelm

On 1/18/21 12:47 PM, Shaughan Lavine wrote:
I have two Android devices running pilbox 20201231. On one, access to 
/storage/emulated/0 works perfectly, but on the other, any attempt to 
access /storage/emulated/0 (ls, mkdir cat, …) yields "permission 
denied." Storage permission has been granted. Any ideas?

Thanks,
Shaughan


Sent from ProtonMail mobile




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


Re: pilbox file sharing

2021-01-18 Thread Wilhelm Fitzpatrick
If you are building your own pilboxes, it seems like the easiest way for 
now would be to add the requestLegacyExternalStorage flag to the app 
manifest, or bump the target API version down to 28:


https://developer.android.com/training/data-storage/use-cases#opt-out-scoped-storage

If you are using the Play Store version, that we might have to lobby 
Alex to make an update that sets this flag, which he should be able to 
do as long as he has not already set the the target API version of the 
published app to 30. If a version with target API 30 has already been 
published then we are past the point of no return.


To cooperate with the storage access framework past API 29 is very 
tricky. Termux recently abandoned their Play Store distributed version 
and is only distributing through F-Droid in the future for just this 
reason (so they can continue targeting an older API version that does 
not yet enforce these restrictions). Pilbox may need to consider such a 
course for the future, if Alex isn't already doing it.


-wilhelm

On 1/18/21 7:49 PM, Shaughan Lavine wrote:

Wilhelm–
Yes: Android 10 vs 9. So, how do I get files out of pilbox on Android 10?
Thanks!
Shaughan
Sent from ProtonMail mobile



 Original Message 
On Jan 18, 2021, 7:32 PM, Wilhelm Fitzpatrick < raf...@well.com> wrote:


Is the one having issues a newer version of Android perhaps
(Android 10
or 11?)

Android has been locking thing down to require use of the Storage
Access
Framework in the most recent version of the OS, I believe.

-wilhelm

On 1/18/21 12:47 PM, Shaughan Lavine wrote:
> I have two Android devices running pilbox 20201231. On one,
access to
> /storage/emulated/0 works perfectly, but on the other, any
attempt to
> access /storage/emulated/0 (ls, mkdir cat, …) yields "permission
> denied." Storage permission has been granted. Any ideas?
> Thanks,
> Shaughan
>
>
> Sent from ProtonMail mobile
>
>

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



Re: pilbox file sharing

2021-01-19 Thread Wilhelm Fitzpatrick

On 1/18/21 11:21 PM, Alexander Burger wrote:


I have not looked at the Scoped Storage API yet. Is it really a problem? The
PilBox core runtime does not depend on external storage, so the API should be
accessible from Lisp (with perhaps a slight modification of
AndroidManifest.xml), no?

☺/ A!ex


I confess I've not dug into it myself either, as I've not had the need 
to do external file access in any of my apps. As you say, since Pilbox 
allows calls to be made to the Android framework, it should be possible 
to cobble something together. The general approach as I understand it is 
that the app makes a request that causes a system UI to appear that 
allows the user to select a file to operate on, or (I believe) a 
directory tree. There is definitely some approach that the various file 
manager apps are using to adapt to this new world.


What I'm not clear on myself is if this is a permission grant that then 
allows normal file IO operations to be done, or if the access has to 
take place through a new API path.


-wilhelm


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



Re: Possible bug with prog1 and @

2022-02-08 Thread Wilhelm Fitzpatrick

This behavior seems like it is "as advertised"? I see in the documentation:

"Flow- and logic-functions store the result of their controlling 
expression - respectively non-NIL results of their conditional 
expression - in @."


So the case when (sym? A2) seemingly would not update the current value 
of @, and...


"@ is generally local to functions and methods, its value is 
automatically saved upon function entry and restored at exit."


No function has been entered or exited here, unless I'm misunderstanding 
what constitutes a function.


-wilhelm

On 2/8/22 9:15 AM, Kevin Ednalino wrote:

Hello,

I may have encountered a possible bug, unless my understanding of @ is 
incorrect. It appears the value of @ is not restored in a prog1 body 
when another flow/logic statement occurs as the car of an expression 
within the said prog1 body. In both cases, the correct result is 
returned from prog1.


Test Cases:

  (let (A0 (1)
        A1 (2 3)
        A2 'x)
    (prog1 (cdr A1)
      ((if (sym? A2) 'set 'con) A2 A0)
      # Prints T when sym? result is T (incorrect)
      # but prints (3) when sym? result is NIL (correct)
      # Expect (3) printed regardless of sym? result
      (println @)))

  (let (A0 (1)
        A1 (2 3)
        A2 (4))
    (prog1 (cdr A1)
      ((if (sym? A2) 'set 'con) A2 A0)
      # Prints T when sym? result is T (incorrect)
      # but prints (3) when sym? result is NIL (correct)
      # Expect (3) printed regardless of sym? result
      (println @)))

Thanks,
Kevin