recursive?
[1/7] from: rotenca::telvia::it at: 24-Jul-2001 12:49
> My solution of the new puzzle:
> >
> > Define a function RECURSIVE? able to find out, if a Rebol block is
> > recursive.
If i did copy all yours depentent functions well (why not a script with all
the function ready to use?), here are my results:
x: [1]
insert/only x x
print recursive? x ;true
x: [1]
insert/only x next x
print recursive? x ;false *** not strictly ricorsive?
x: [1]
insert/only next x next x
print recursive? x ;true
x: [1]
insert/only next x x
print recursive? x ; *** endless loop
---
Ciao
Romano
[2/7] from: lmecir:mbox:vol:cz at: 24-Jul-2001 17:07
Hi Romano,
thanks for finding the bug. I corrected the function and posted the code to
http://www.sweb.cz/LMecir/evaluation.r
[3/7] from: rotenca:telvia:it at: 24-Jul-2001 18:08
You have not changed the behaviour in this case:
x: [1]
insert/only x next x
recursive? x;== false
But copy/deep hates this index-hided-recursion also:
copy/deep x; -> crash
this could mean that copy/deep has a different idea of recursion? :-)
---
Ciao
Romano
[4/7] from: lmecir:mbox:vol:cz at: 24-Jul-2001 19:08
Hi Romano,
----- Original Message -----
From: Romano Paolo Tenca <[rotenca--telvia--it]>
To: <[rebol-list--rebol--com]>
Sent: Tuesday, July 24, 2001 6:08 PM
Subject: [REBOL] Re: recursive?
> You have not changed the behaviour in this case:
> x: [1]
<<quoted lines omitted: 6>>
> Ciao
> Romano
This really is a special case. If I try:
x: [1]
insert/only x next x
probe x ; == [[...] 1]
Mold is trying to convince me, that the block's textual transformation isn't
finite, which is not the case, because:
length? x ; == 2
first x ; == [1]
second x ; == 1
which means, that the block can be represented by:
[[1] 1]
And it neither contais itself nor any of its subblocks does.
Moreover, a pretty simple copy can be obtained by using:
simple-copy: reduce [copy first x second x] ; == [[1] 1]
without any "infinite cycling". Of course, I don't know, how COPY/DEEP
works. What do others think about that?
[5/7] from: lmecir:mbox:vol:cz at: 24-Jul-2001 17:07
Hi Romano,
thanks for finding the bug. I corrected the function and posted the code to
http://www.sweb.cz/LMecir/evaluation.r
[6/7] from: lmecir:mbox:vol:cz at: 24-Jul-2001 19:08
Hi Romano,
----- Original Message -----
From: Romano Paolo Tenca <[rotenca--telvia--it]>
To: <[rebol-list--rebol--com]>
Sent: Tuesday, July 24, 2001 6:08 PM
Subject: [REBOL] Re: recursive?
> You have not changed the behaviour in this case:
> x: [1]
<<quoted lines omitted: 6>>
> Ciao
> Romano
This really is a special case. If I try:
x: [1]
insert/only x next x
probe x ; == [[...] 1]
Mold is trying to convince me, that the block's textual transformation isn't
finite, which is not the case, because:
length? x ; == 2
first x ; == [1]
second x ; == 1
which means, that the block can be represented by:
[[1] 1]
And it neither contais itself nor any of its subblocks does.
Moreover, a pretty simple copy can be obtained by using:
simple-copy: reduce [copy first x second x] ; == [[1] 1]
without any "infinite cycling". Of course, I don't know, how COPY/DEEP
works. What do others think about that?
[7/7] from: rotenca:telvia:it at: 24-Jul-2001 18:08
You have not changed the behaviour in this case:
x: [1]
insert/only x next x
recursive? x;== false
But copy/deep hates this index-hided-recursion also:
copy/deep x; -> crash
this could mean that copy/deep has a different idea of recursion? :-)
---
Ciao
Romano
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted