Hi Alex,
I noticed here <http://code.google.com/p/picolisp/updates/list> that you
did an update re. "Check for repeating circular lists" the other day. Is
a "repeating circular lists" a special case of a circular lists? If so,
could you give an example of such
Hi Jon,
> you did an update re. "Check for repeating circular lists" the other
> day. Is a "repeating circular lists" a special case of a circular
> lists? If so, could you give an example of such a repeating circular
> lists?
Yes, it is a special case, for e
Hi Jon,
> (length '(de *Day . (Mon Tue Wed Thu Fri Sat Sun .)))
> ..
> Why does 'length' have such problems here?
Circular lists are generally rather dangerous. PicLisp supports (kind of
;-) only what I would call "primary circular lists", i.e. lists that
circu
Hi Alex,
After you made me aware of the circular list in lib/form.l, I changed
my 'ifwarn' function to skip circular lists by putting in the (nT
(length Prg)) test, like this:
(de ifwarn (Prg)
(when (and (lst? Prg) (nT (length Prg)))
(when (and (= (ca
Hi again,
> (length '(de *Day . (Mon Tue Wed Thu Fri Sat Sun .)))
..
Why does 'length' have such problems here?
Circular lists are generally rather dangerous. PicLisp supports (kind of
;-) only what I would call "primary circular lists", i.e. lists that
circ
There has been some prior discussion on the list:
http://www.mail-archive.com/search?q=circular+lists&l=picolisp%40software-lab.de
It might or might not be of help.
/Henrik
--
UNSUBSCRIBE: mailto:[EMAIL PROTECTED]
Hi everyone,
I had recently an issue with both pil64 and pil21. I was trying to create a
large circular list and got a segmentation fault with a size of >200'000
elements. Is that expected?
(apply circ (range 1 20))
Regards,
Davide
Only simple circular lists seem to work properly.
'(a b . (c d e .))
is equivalent to
'(a b c d e c d e ...)
: (de X . (a b .))
-> X
: X
-> (a b .)
: (de X . (a . (b c .)))
# X redefined
-> X
: (cdr X)
-> (b c .)
: X
-> (a b c b c b c b c b c b c b c b c b c b c b c
Hi List,
I try to figure out if it would be possible to map circular lists from
Emacs Lisp to PicoLisp. Here is a quote from the Emacs Lisp manual :
#+begin_quote
If the cdr of a list's last cons cell is some value other than nil, we call
the structure a dotted list, since its pr
Hi Thorsten,
> In PicoLisp, the cdr of a circular list always seems to point to the beginning
> of the list.
Yes, as far as the directy reader/printer syntax is concerned. But you
can easily specify a list where the last cell points to some other cell.
For example, in this list of 6 cel
Alexander Burger writes:
Hi Alex,
>> In PicoLisp, the cdr of a circular list always seems to point to the
>> beginning of the list.
>
> Yes, as far as the directy reader/printer syntax is concerned. But you
> can easily specify a list where the last cell points to some
an issue with both pil64 and pil21. I was trying to create
> a large circular list and got a segmentation fault with a size of >200'000
> elements. Is that expected?
>
> (apply circ (range 1 20))
>
> Regards,
> Davide
>
case, I would recommend 'fifo' to build large circular structures:
(let L NIL
(for I 20
(fifo 'L I) )
...
The result is a little different though:
: (let L NIL (for I 7 (fifo 'L I)) L)
-> (7 1 2 3 4 5 6 .)
Depends on the use case.
☺/ A!ex
On Thu, Nov 10, 2011 at 07:14:06PM +0700, Henrik Sarvell wrote:
> Why don't you guys make a wiki page out of this one too?
Well, José mumbled in IRC something in that direction ... ;-)
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Hi Davide,
> Just found out that it is an issue with apply. Probably the number of
> arguments is too large.
>
> (eval (cons 'circ (range 1 20)))
Yes, this is a known issue. It is a stack overflow.
'apply' builds structures on the stack.
The recommended way is to set
ulimit -s unlimite
Hi Tomas,
> : (pre '(1 2) '(1 2 3 4))
> -> T
> : (pre '(1 2) '(1 5 2 3 4))
> -> NIL
This would make sense. That functionality is covered by 'head', though.
> 'length' returns T for circular lists currently, which is not great.
On Wed, Dec 23, 2020 at 01:57:10PM +0100, Alexander Burger wrote:
> The result is a little different though:
>
>: (let L NIL (for I 7 (fifo 'L I)) L)
>-> (7 1 2 3 4 5 6 .)
.. but of course the fix is trivial :)
: (cdr (let L NIL (for I 7 (fifo 'L I)) L))
-> (1 2 3 4 5 6 7 .)
☺/ A!
José Romero
writes:
>> > (and 5 . ((prinl @) (gt0 (dec @)) .))
> If it helps, this is how that S-expression should look in memory, I
> omitted the technically correct representation of numbers and symbols
> to keep it simple:
>
> ,---,
> +---+---+ +---
Thanks for the clarification Alex! The ulimit command did the trick.
Cheers,
Davide
On Wed, Dec 23, 2020, 14:16 Alexander Burger wrote:
> On Wed, Dec 23, 2020 at 01:57:10PM +0100, Alexander Burger wrote:
> > The result is a little different though:
> >
> >: (let L NIL (for I 7 (fifo 'L I))
On Fri, Apr 11, 2008 at 04:46:14PM +0200, Alexander Burger wrote:
> Exact. The function 'MUL' is defined before that, but as you just read
> the file (without executing it), it will be undefined when you hit that
> read macro.
Well, and while thinking about it: Inspecting files in such a way (with
Why don't you guys make a wiki page out of this one too?
On Wed, Nov 9, 2011 at 6:54 AM, Thorsten wrote:
> José Romero
> writes:
>
>>> > (and 5 . ((prinl @) (gt0 (dec @)) .))
>
>> If it helps, this is how that S-expression should look in memory, I
>> omitted the technically correct representa
Hi Thorsten,
> And now I'm listed as the author of this wiki page, but it should
> actually be Jose. Maybe he can make a little change to the page, so
> that his name appears too?
BTW, there is of course an "illegal" way to change it, by going to the
maintenance GUI, clicking on "Documents", then
Hi Jon,
> the 'length' function, I've written a new function 'longer' that
> works OK, like this:
>
> # Returns N+1 if Lst is longer than N, otherwise NIL
> (de longer (Lst N)
> (for (I . X) Lst
> (T (> I N) I)
> NIL) )
Yep, this is a good solution.
> [rcsim/
Alexander Burger writes:
> Hi Thorsten,
>
>> And now I'm listed as the author of this wiki page, but it should
>> actually be Jose. Maybe he can make a little change to the page, so
>> that his name appears too?
>
> BTW, there is of course an "illegal" way to change it, by going to the
> maintena
etq P (cdr P) L (cdr L))
(off X) ) )
X ) )
: (pre '(1 2) '(1 2 3 4))
-> T
: (pre '(1 2) '(1 5 2 3 4))
-> NIL
'length' returns T for circular lists currently, which is not great.
It could return the real length too (as the number of 'car&
t i was passed, the first argument,
> > evaluating it results in a function call that returns 5, it's not
> > nil, so i shove it to @ and go on. The next element is another
> > list, a call to prinl happens, it returned 5, it's not nil, so i
> > shove it to @ and g
lls, no bignums, no garbage collection, no sharing of (sub)lists, no
circular structures - in my opinion the things which make up the real power of
Lisp. Even multiple variables pointing to the same object are not allowed.
An advantage of NewLisp is that it runs also on Windows, while PicoLisp require
e
names in 'pico', but still *new* symbols will be interned in 'pico'.
> - What is the purpose of the ‘~’ marker in the namespaces?
This is only used for error checking: To check in 'symbols' that the arguments
are really namespaces, and that 'nsp' in
t be overridden by symbols with the same
> names in 'pico', but still *new* symbols will be interned in 'pico'.
>
>
>> - What is the purpose of the ‘~’ marker in the namespaces?
>
> This is only used for error checking: To check in 'symbols' that the argum
Hi Alex, Joh-Tob,
Thank you. With the Knuth reference the code makes a lot more sense!
I had implemented a more basic version.
For large ranges, the performance difference of the Alex's iterative
version that utilizes the sequence is much better! It is a very nice use of
circular
e plus half a cell), accessing the pointer with CAR (offset
zero) and CDR (offset half a cell size) is legal and will always return
NIL again. This allows a very fast traversal of lists, without the need
for checking for end-of-list.
So (3) comes without any cost.
> Anyway, I just couldn'
iple of the
cell size plus half a cell), accessing the pointer with CAR (offset
zero) and CDR (offset half a cell size) is legal and will always return
NIL again. This allows a very fast traversal of lists, without the need
for checking for end-of-list.
So (3) comes without any cost.
I'll dig
ned dotted pair) ends in NIL we call it proper list and when not
ending in NIL but in any other atom, we call it improper list.
So picolisp HAS proper and improper list ;-) in fact a circular list is a
kind of improper list and we all known picolisp has circular lists
> As we are interpreter-o
. 1) -- Bad dotted pair
? -> 2
?
Is the error case "Bad dotted pair" necessary?
: '(. . .)
-> (\. . \.)
Why is the last dot treated as a symbol and not as a circular list?
: '(. . . .)
(\. . \.) -- Bad dotted pair
? Bad input ')' (41)
? :
What is (should be) this?
!? (.)
-- Und
3), because they are the
same.=20
The dotted pair is also called "cons cell", it's the building block for
more complex lisp data structures, like lists or trees. Each cons cell
has two parts, it's CAR and CDR (they used to be acronyms that used to
mean something, but now t
software.
Under the hood, an Org-mode document is a nested (Emacs Lisp) list,
which is of course very convenient from a PicoLisp point of
view. Unfortunately, the Org-mode parser (org-element.el) makes use of
some unique Emacs Lisp features (circular lists, text properties ...)
that complicated
plain "cells". "list" is a rather unprecise term, I feel it is not
> >> limited to "a
> >> chain of cells with NIL at the end". I use "list" for any sequence of
> >> cells (as
> >> opposed to other structures like "tre
rather unprecise term, I feel it is not limited
> to "a
> chain of cells with NIL at the end". I use "list" for any sequence of
> cells (as
> opposed to other structures like "tree", "graph" or "set"). These include
> also
> e.g. &q
If it is expanded as a macro, you'll
never feel safe when quoting a list that's supposed to be data, but if
it's not expanded you won't be able to use quoted lists to pass code
into other functions, at least not without feeling the agony of the
supposed runtime penalty. In a la
uot; for any sequence of
>> cells (as
>> opposed to other structures like "tree", "graph" or "set"). These include
>> also
>> e.g. "circular lists" like (1 2 3 .), which have no NIL at the end (in
>> fact, no
>> end at a
ology of "list" versus "cons pairs" and
plain "cells". "list" is a rather unprecise term, I feel it is not limited to "a
chain of cells with NIL at the end". I use "list" for any sequence of cells (as
opposed to other structures like "
41 matches
Mail list logo