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 <brunofrancosala...@gmail.com> 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 <j...@bahnhof.se> 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

Reply via email to