Re: Did you know? Webassembly Containers are (Pico-)Lisp machines!

2020-04-11 Thread Alexander Burger
Hi Rowan,

> By the way what I love most about Picolisp is that it feels like as
> good a hybrid as you can get between the "typical functional
> lisp/scheme" mental model and something that feels "forth-like" in
> terms of minimalism/precision/close-to-the-metal von-neumann
> architecture-friendliness. I describe it to friends as "as close as
> you can get a lisp to forth while still being able to call it a lisp"
> (I hope Alex doesn't hate that oversimplification too much

Not at all. It is perfectly as I see it too :)

☺/ A!ex

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


Re: Interning symbols in lib/simul.l

2020-04-11 Thread Alexander Burger
Hi Bruno,

> I'm studying lib/sumul.l, specifically the 'grid function. I understand how
> it works now, but I have two doubts:
> 
> 1) why are symbols in the grid interned?
> ...
>(if (> DX 26)
>   (box)
>   (intern (pack (char (+ X 96)) Y)) ) )  # why

It is just to conveniently access them by name (e.g. a1 - z1), in programs and
during debugging. For example in "games/chess.l":

   (bookMove 'd2 'd4)

or

   $ pil games/chess.l -main +
   ...
   : (go d2 d4)
   ...
   -> ("BlackPawn" d7 . d5)
   : (show 'd4)
   d4 ((c4 . e4) d3 . d5)
  piece "WhitePawn"
  x 4
  whAtt ("WhiteQueen")
  color
  y 4
   -> d4


> 2) what does the F in FX and FY stand for?
> ...
> (de grid (DX DY FX FY)
> ...
>   (let West (and FX (last Grid))

It stands for "Flag", as these parameters are boolean values.

☺/ A!ex

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


Re: Did you know? Webassembly Containers are (Pico-)Lisp machines!

2020-04-11 Thread Tomas Hlavaty
Rowan Thorpe  writes:
> parentheses are not used because as is stated at
> https://picolisp.com/wiki/?src64 "Assembly language is not a
> functional language, i.e. the individual instructions do not "return"
> a value. So a fully parenthesized syntax is useless and just tedious."

because picolisp doesn't have a compiler (program)

it is "compiled" to the picolisp assembly manually ahead of time by Alex
(human)

once you have a compiler (lisp program), parenthesis make sense because
they simply show lisp datastructures manipulated by the compiler

you can write lisp without parenthesis in similar spirit (see common
lisp loop for example) but that is rather "ugly"

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


Re: Lisp, a language for "Stratified Design" Podcast and paper.pdf

2020-04-11 Thread C K Kashyap
Thanks for sharing ... loved the podcast!
Regards,
Kashyap

On Fri, Apr 10, 2020 at 2:28 PM Guido Stepken  wrote:

> A highly inspiring, philosophical Podcast about Abstractions in Lisp, that
> - until today - you simply can't do in other programming languages:
>
> https://podcasts.google.com/?q=Lisp+stratified
>
>
> https://www.researchgate.net/profile/Gerald_Sussman/publication/37596906_Lisp_A_Language_for_Stratified_Design/links/53d142ce0cf220632f392c19/Lisp-A-Language-for-Stratified-Design.pdf
>
> Also see that strage discussion about PicoLisp and 'Graph Database':
>
> https://www.mail-archive.com/picolisp@software-lab.de/msg09451.html
>
> Even with a Bachelor in Computer Science, people simply don't get the
> power of Picolisp. They don't see the forest for the trees.
>
> Have fun listening!
>
> Guido Stepken
>
>
>


Interning symbols in lib/simul.l

2020-04-11 Thread Bruno Franco
I'm studying lib/sumul.l, specifically the 'grid function. I understand how
it works now, but I have two doubts:

1) why are symbols in the grid interned?
2) what does the F in FX and FY stand for?

here's the code for reference:

(de grid (DX DY FX FY)
   (let Grid
  (make
 (for X DX
(link
   (make
  (for Y DY
 (set
(link
   (if (> DX 26)
  (box)
  (intern (pack (char (+ X 96)) Y)) ) )  # why
are symbols interned here?
(cons (cons) (cons)) ) ) ) ) ) )
  (let West (and FX (last Grid))
 (for (Lst Grid  Lst)
(let
   (Col (++ Lst)
  East (or (car Lst) (and FX (car Grid)))
  South (and FY (last Col)) )
   (for (L Col  L)
  (with (++ L)
 (set (: 0 1) (++ West))  # west
 (con (: 0 1) (++ East))  # east
 (set (: 0 -1) South) # south
 (con (: 0 -1)# north
(or (car L) (and FY (car Col))) )
 (setq South This) ) )
   (setq West Col) ) ) )
  Grid ) )


Re: Did you know? Webassembly Containers are (Pico-)Lisp machines!

2020-04-11 Thread Rowan Thorpe
On Sun, 12 Apr 2020 at 01:04, Guido Stepken  wrote:
> Hello, all!
>
> It might sound a little bit weird, when i tell you, that recently 
> standardized Webassembly Containers in your browser are - Lisp machines.

Aside from the surface syntactic similarities due to the use of
s-expressions in the text format, I think the better
content-comparison of WebAssembly is to a register machine (hence
"assembly" in the name, but something closer to the LLVM IR - which
can be JITted or statically compiled - feels like a good comparison),
as opposed to lisp which is functional. I used to think of it as being
like other stack-machine languages like Forth (or even the JVM), and
the design rationale at https://webassembly.org/docs/rationale/ even
describes it as "a structured stack machine", but
http://troubles.md/posts/wasm-is-not-a-stack-machine/ explains why
this is not quite accurate. Also several Forths (like gforth) are
considered "stack-machine implementations" due to being a forth, but
they can use registers in addition to the typical 2-stack forth core,
so the stack/register boundary gets a little fuzzy there too. When I
first read about WebAssembly the thought that hit me was not that it
was like Picolisp but that it is very similar to the 64-bit assembly
written for and used at the core of the 64-bit Picolisp
implementation, except that - unlike WebAssembly's text format - there
parentheses are not used because as is stated at
https://picolisp.com/wiki/?src64 "Assembly language is not a
functional language, i.e. the individual instructions do not "return"
a value. So a fully parenthesized syntax is useless and just tedious."

By the way what I love most about Picolisp is that it feels like as
good a hybrid as you can get between the "typical functional
lisp/scheme" mental model and something that feels "forth-like" in
terms of minimalism/precision/close-to-the-metal von-neumann
architecture-friendliness. I describe it to friends as "as close as
you can get a lisp to forth while still being able to call it a lisp"
(I hope Alex doesn't hate that oversimplification too much, if he has
a better soundbite-way to capture the core of that sentiment I'd be
keen to hear it and would be happy to modify my soundbite). My two
favourite programming idioms are lisp and forth (rust comes third, and
part of its coolness is its comprehensive support for compiling to
webasm, which is why I started learning rust).

-- 
Rowan Thorpe
http://twitter.com/rowanthorpe
PGP fingerprint: 92FA 6C6F ABF2 C1B2 7E1C  7CCD 131F D7A9 542F 12F0

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


Did you know? Webassembly Containers are (Pico-)Lisp machines!

2020-04-11 Thread Guido Stepken
Hello, all!

It might sound a little bit weird, when i tell you, that recently
standardized Webassembly Containers in your browser are - Lisp machines.

Emscripten C/C++ "emcc" compiler does not translate into machine code
directly, but rather some kind of meta machine code (Intermediate
Bytecode), that the processor (Intel, ARM, ...) then can easily JIT -
transform into its final, executable machine code. That Intermediate
Bytecode, in fact, is a pure Lisp, just like PicoLisp is:

https://developer.mozilla.org/en-US/docs/WebAssembly/Understanding_the_text_format

PicoLisp and Webassembly containers have a lot in common. They even have
same capabilities, features. Nothing speaks against letting PicoLisp run
directly in a browser container or - serverside as Webassembly container.
PicoLisp thus - was far ahead of its time!

Here a famous quote by the Docker inventor on twitter:

https://twitter.com/solomonstre/status/004913222324225

Solomon Hykes
@solomonstre


If WASM+WASI existed in 2008, we wouldn't have needed to created Docker.
That's how important it is. Webassembly on the server is the future of
computing. A standardized system interface was the missing link. Let's hope
WASI is up to the task!


PicoLisp *is* a genius strike, but some get it at least a decade later ...
:-(

Even Microsoft now is on the train to port its ASP DOTNET CORE 3.0 Blazor
Library onto Webassembly Lisp:

https://dotnet.microsoft.com/apps/aspnet/web-apps/blazor
https://github.com/AdrienTorris/awesome-blazor/blob/master/README.md

It's just ridiculous!

Have fun!

Happy easter and keep away from Windows and other viruses!

Guido Stepken