Unsubscribe

2020-01-01 Thread Johan Persson
Šo'‰¢§=ê첉ãΖچxh~ǘ¢æ«zz0º{.nÇ+‰·


Re: Slides and notes from my Picolisp presentation

2018-09-25 Thread Johan Persson
On Tue, 25 Sep 2018 12:57:00 +0200
Mattias Sundblad  wrote:

> Hello everyone!
> 
> I recently held some presentations about Picolisp, minimalism and
> software development. The slides and notes are available on the wiki
> at
> https://picolisp.com/wiki/?simplicityandminimalisminsoftwaredevelopment
> 
> The presentation does not go into great technical depth about
> Picolisp, the focus is more on the benefits of working this way. I
> hope you enjoy it!
> 
> Best regards,
> 
> Mattias
> 

An excellent write-up! Thanks for sharing!

/ Johan

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


Re: Embedding and such

2018-09-13 Thread Johan Persson
On Thu, 13 Sep 2018 08:41:55 +0200
Jakob Eriksson  wrote:

> The 32 bit version was simple to link with other programs when I
> tried it several years ago.
> 

No worries there :)


> > 13 sep. 2018 kl. 06:59 skrev Alexander Burger :
> > 
> > Hi Johan,
> >   
> >> 
> >> Is there a way of embedding the 64-bit version in a C-program, or  
> > 
> > As freemint said, this is not possible, or at least not meaningful.
> > That is, of course you are free to link it to some other program,
> > but what would you want to call from it? It makes no sense to call
> > isolated functions inside the interpreter, without the whole Lisp
> > context.
> > 
> >   

My intention was to embed the interpreter into an existing C-program,
and poke at it via the (native "@" ...)-call. It's such an attractive
prospect.

> >> statically link C-libraries to the executable? I'd love to have  
> > 
> > This is possible, if you write a library in ASM (analog to @lib/ext
> > and @lib/ht) and link it not as a shared object file but statically.
> > 
> > ☺/ A!ex
> > 

Ah, finally I got a reason to get my hands dirty in assembler again :)

I guess my intention of linking stuff into the pil-binary was a matter
of packaging up stuff, but that still leaves the lisp-code out in the
cold, so it doesn't matter anyway.

/ Johan

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


Embedding and such

2018-09-12 Thread Johan Persson
Hello all,

Is there a way of embedding the 64-bit version in a C-program, or
statically link C-libraries to the executable? I'd love to have
PicoLisp as an extension language for a couple of my projects.

/ Johan

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


Re: A few questions from a confused lisper

2018-07-13 Thread Johan Persson

On 2018-07-13 05:25, Bruno Franco wrote:

actually, you could just put the function (mumble-mumble X) in the 
place

of Y:

(for X (1 2 3 4 5)
(NIL (mumble-mumble X)
(println "this does not work")) )


Sure, but this doesn't help if I wish to use Y in multiple places...



On Thu, Jul 12, 2018 at 9:27 PM Bruno Franco 
 wrote:


Well, for the conditional exit in the iterators (for, do, and loop),
I would do something like this:
(use Y
(for X (1 2 3 4 5)
(setq Y (mumble-mumble X))
(NIL Y (println "this does not work")) ) )


Good to know! In other words, conditional exits need to be a part of the 
for-do-loop-bodies, and not nested.




Though I'm not sure that is the most elegant way to go XD.


Elegance is a distraction :)


As for the local exits, maybe an example of when you wanted to do one
in picolisp would be useful to point you in the right direction.

And the macros, here's a page that can help you find your way
around not having them:
https://picolisp.com/wiki/?macros

also see the functions 'fill and 'macro.
'fill replaces each occurence of a pattern @Pat with its value in the
list that you give it, and 'macro does the same, but evaluates the
resulting list too.

Hope this helps!


Thanks, I replied to this in abu's reply.

On Thu, Jul 12, 2018 at 1:34 PM Johan Persson  wrote: 
Hi, list!


First I'd like to say that I'm having a blast playing around with
PicoLisp lately. (It only took me about seven years to get around to
it!) The fact that it exists and work as well as it does is a fresh and
bold counterpoint to the conventional wisdom of the current programming
language design canon. I love it.

Anyhow, there are a few things that the Common Lisper in me find a bit
puzzling:

First off, I'm confused about what the correct way of doing local exits
There's no "return" or "return-from" -- instead the closest thing I've
found is "quit", which is sort of akin to "error" in CL, but without 
the

jump into the condition-system. It feels wrong. Is it wrong?

Then there's the conditional exits in "for", "do" and "loop" which
presents a real problem if you wish to terminate the loop from within a
sub-clause:

(for X (1 2 3 4 5)
(let Y (mumble-mumble X)
(NIL Y (println "this doesn't work"

What's the correct way of doing this? Throw the value and catch it 
right

outside of the for-loop?

I'm also a pathological meta-programmer, and the lack of macros doesn't
bother me as much as I thought it would. However, one thing I miss from
other lisps is a way of expanding macros. How would I go on about doing
that in PicoLisp?

/ Johan

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


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


Re: A few questions from a confused lisper

2018-07-13 Thread Johan Persson

On 2018-07-13 07:19, Alexander Burger wrote:

Hi Johan,

First off, I'm confused about what the correct way of doing local 
exits.
There's no "return" or "return-from" -- instead the closest thing I've 
found

is "quit", which is sort of akin to "error" in CL


Correct. There is no 'return' function jumping directly out of a nested
structure. There are, however, 'catch' and 'throw', which implement the 
same
mechanism (cleaning up all necessary stuff before doing the exit) - 
just not

syntactically as neat as a simple 'return'.

I use NIL as the catch tag in such cases, e.g.

   (de foo (Args)
  (catch NIL
 (while (something)
(let (A (bar)  B (mumble))
   (racker
  (for I A
 (when (lt0 (+ I B))
(throw) ) ) ) ) ) ) )

Here (throw) corresponds to a (return).

To return a value like (return 7) do (throw NIL 7).


The reason for not having a 'return' function is that it has to do a 
lot of
cleanup till it reaches the exit (unbind variables, close files and 
other

dynamic environments). This is initialized and set up by 'catch'.

When a function starts to run, the interpreter does not know yet that 
there
might be a call to 'return' somewhere deeply nested inside. So it would 
need to
setup the catch environment for *every* function. This would be too 
expensive,

as most functions will never call 'return'.

Instead, it is done the PicoLisp way: Let the programmer be in control! 
Just
insert '(catch NIL' at the beginning of a function (or at any other 
place).


If you insist, you can create your own return function:

   (de return (Val)
  (throw NIL Val) )

The '(catch NIL' is still needed though.


'quit' is similar to 'throw'. It throws an error message instead of a 
tag, and
is triggered internally also when an error occurs, which then can be 
caught with

'(catch '("Message 1" "Message 2") ...




I see, that makes a lot of sense. I generally expect stuff that is being 
thrown to include a hefty payload of stack traces, environments and 
other assorted guff. This approach is what I hoped for. :)




Then there's the conditional exits in "for", "do" and "loop" which 
presents
a real problem if you wish to terminate the loop from within a 
sub-clause:


(for X (1 2 3 4 5)
  (let Y (mumble-mumble X)
 (NIL Y (println "this doesn't work"


Yes. As also pointed out by Bruno, the 'T' and 'NIL' exit clauses must 
be on the

top level of the body. Usually code can be rearranged this way. If not,
catch/throw can be used here too.




Fair enough.

I'm also a pathological meta-programmer, and the lack of macros 
doesn't
bother me as much as I thought it would. However, one thing I miss 
from
other lisps is a way of expanding macros. How would I go on about 
doing that

in PicoLisp?


For one thing, there are read-macros which are expanded at read-time.

Then, there is - also pointed out by Bruno - 'fill' and 'macro' which 
may
be used to build and execute expressions at runtime. 'macro' is rather 
seldom

used, as it introduces quite some overhead in an interpreted system.

The way to go for meta-programming is to use FEXPRs. Examples are many 
in the
PicoLisp package itself, or at 
https://software-lab.de/doc/faq.html#macros or

http://rosettacode.org/wiki/Extend_your_language#PicoLisp



Oh, I know of all these things. (Though I don't have an appreciation for 
how heavy "macro" is.) My problem -- I guess -- is that I have a 
thoroughly ingrained idea of how meta-programming is supposed to behave 
in a lisp. For instance, expanding macros makes sense in a language that 
makes a distinction between macros and functions, but a language that 
support FEXPRs I guess it's not that clear. From what I gather, I need 
to shift mental gears here and not try to push a square peg into a round 
hole.
Though, Bruno's suggestion of using "fill" is a great idea for 
"macro-expanding" as one is coding along.


Thanks for the replies! :)


—Alex


/ Johan

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


A few questions from a confused lisper

2018-07-12 Thread Johan Persson

Hi, list!

First I'd like to say that I'm having a blast playing around with 
PicoLisp lately. (It only took me about seven years to get around to 
it!) The fact that it exists and work as well as it does is a fresh and 
bold counterpoint to the conventional wisdom of the current programming 
language design canon. I love it.


Anyhow, there are a few things that the Common Lisper in me find a bit 
puzzling:


First off, I'm confused about what the correct way of doing local exits. 
There's no "return" or "return-from" -- instead the closest thing I've 
found is "quit", which is sort of akin to "error" in CL, but without the 
jump into the condition-system. It feels wrong. Is it wrong?


Then there's the conditional exits in "for", "do" and "loop" which 
presents a real problem if you wish to terminate the loop from within a 
sub-clause:


(for X (1 2 3 4 5)
  (let Y (mumble-mumble X)
 (NIL Y (println "this doesn't work"

What's the correct way of doing this? Throw the value and catch it right 
outside of the for-loop?


I'm also a pathological meta-programmer, and the lack of macros doesn't 
bother me as much as I thought it would. However, one thing I miss from 
other lisps is a way of expanding macros. How would I go on about doing 
that in PicoLisp?


/ Johan

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


Subscribe

2018-06-09 Thread Johan Persson

Hello Johan Persson  :-)
You are now subscribed


I suppose the subject suffices?

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