Hi Charles,
It looks like you've found a bug. From basis/circular/circular.factor:
: circular-wrap ( n circular -- n circular )
[ start>> + ] keep
[ seq>> length rem ] keep ; inline
: rotate-circular ( circular -- )
[ start>> 1 + ] keep circular-wrap (>>start) ;
Looks like this second definition needs to be changed to:
: rotate-circular ( circular -- )
1 swap circular-wrap (>>start) ;
Try changing this and reload by hitting F2 and see if your tests work
better. By the way, your testing is very verbose due to your use of a
variable. You can just do this:
{ 1 2 3 4 } <circular>
dup rotate-circular
dup rotate-circular
dup rotate-circular
And watch the circular start change on the stack.
Alex
2009/6/10 Charles Turner <vze26...@optonline.net>
> Hey all:
>
> What don't I understand about circular sequences, or sequences in
> general? This using a recent (> 2 weeks old) Factor OSX x86_32 and _64
> binaries, 10.5.7:
>
>
>
> ( scratchpad ) Command: restart
> 1: Note:
> Added "circular" vocabulary to search path
> { 1 2 3 } <circular>
>
> --- Data stack:
> T{ circular f ~array~ 0 }
> ( scratchpad ) SYMBOL: mycirc
>
> --- Data stack:
> T{ circular f ~array~ 0 }
> ( scratchpad ) mycirc set
> ( scratchpad ) mycirc get .
> T{ circular { seq { 1 2 3 } } { start 0 } }
> ( scratchpad ) mycirc get rotate-circular
> ( scratchpad ) mycirc get .
> T{ circular { seq { 1 2 3 } } { start 1 } }
> ( scratchpad ) mycirc get rotate-circular
> ( scratchpad ) mycirc get .
> T{ circular { seq { 1 2 3 } } { start 0 } }
> ( scratchpad ) mycirc get rotate-circular
> ( scratchpad ) mycirc get .
> T{ circular { seq { 1 2 3 } } { start 1 } }
> ( scratchpad ) mycirc get length .
> 3
> ( scratchpad )
>
> - - - - -
>
> ( scratchpad ) { 1 2 3 4 } <circular> mycirc set
> ( scratchpad ) mycirc get length .
> 4
> ( scratchpad ) mycirc get .
> T{ circular { seq { 1 2 3 4 } } { start 0 } }
> ( scratchpad ) mycirc get rotate-circular
> ( scratchpad ) mycirc get .
> T{ circular { seq { 1 2 3 4 } } { start 1 } }
> ( scratchpad ) mycirc get rotate-circular
> ( scratchpad ) mycirc get .
> T{ circular { seq { 1 2 3 4 } } { start 3 } }
> ( scratchpad ) mycirc get rotate-circular
> ( scratchpad ) mycirc get .
> T{ circular { seq { 1 2 3 4 } } { start 3 } }
> ( scratchpad ) mycirc get rotate-circular
> ( scratchpad ) mycirc get .
> T{ circular { seq { 1 2 3 4 } } { start 3 } }
>
> - - - - -
>
> ( scratchpad ) { 1 2 3 4 5 } <circular> mycirc set
> ( scratchpad ) mycirc get length .
> 5
> ( scratchpad ) mycirc get rotate-circular
> ( scratchpad ) mycirc get .
> T{ circular { seq { 1 2 3 4 5 } } { start 1 } }
> ( scratchpad ) mycirc get rotate-circular
> ( scratchpad ) mycirc get .
> T{ circular { seq { 1 2 3 4 5 } } { start 3 } }
> ( scratchpad ) mycirc get rotate-circular
> ( scratchpad ) mycirc get .
> T{ circular { seq { 1 2 3 4 5 } } { start 2 } }
> ( scratchpad ) mycirc get rotate-circular
> ( scratchpad ) mycirc get .
> T{ circular { seq { 1 2 3 4 5 } } { start 0 } }
> ( scratchpad ) mycirc get rotate-circular
> ( scratchpad ) mycirc get .
> T{ circular { seq { 1 2 3 4 5 } } { start 1 } }
> ( scratchpad ) mycirc get rotate-circular
> ( scratchpad ) mycirc get .
> T{ circular { seq { 1 2 3 4 5 } } { start 3 } }
> ( scratchpad ) mycirc get rotate-circular
> ( scratchpad ) mycirc get .
> T{ circular { seq { 1 2 3 4 5 } } { start 2 } }
> ( scratchpad ) mycirc get rotate-circular
> ( scratchpad ) mycirc get .
> T{ circular { seq { 1 2 3 4 5 } } { start 0 } }
>
> - - - - -
>
> ( scratchpad ) { 0 1 2 3 4 5 6 7 8 9 } <circular> mycirc set
> ( scratchpad ) mycirc get length .
> 10
> ( scratchpad ) mycirc get .
> T{ circular { seq { 0 1 2 3 4 5 6 7 8 9 } } { start 0 } }
> ( scratchpad ) mycirc get rotate-circular
> ( scratchpad ) mycirc get .
> T{ circular { seq { 0 1 2 3 4 5 6 7 8 9 } } { start 1 } }
> ( scratchpad ) mycirc get rotate-circular
> ( scratchpad ) mycirc get .
> T{ circular { seq { 0 1 2 3 4 5 6 7 8 9 } } { start 3 } }
> ( scratchpad ) mycirc get rotate-circular
> ( scratchpad ) mycirc get .
> T{ circular { seq { 0 1 2 3 4 5 6 7 8 9 } } { start 7 } }
> ( scratchpad ) mycirc get rotate-circular
> ( scratchpad ) mycirc get .
> T{ circular { seq { 0 1 2 3 4 5 6 7 8 9 } } { start 5 } }
> ( scratchpad ) mycirc get rotate-circular
> ( scratchpad ) mycirc get .
> T{ circular { seq { 0 1 2 3 4 5 6 7 8 9 } } { start 1 } }
> ( scratchpad ) mycirc get rotate-circular
> ( scratchpad ) mycirc get .
> T{ circular { seq { 0 1 2 3 4 5 6 7 8 9 } } { start 3 } }
> ( scratchpad ) mycirc get rotate-circular
> ( scratchpad ) mycirc get .
> T{ circular { seq { 0 1 2 3 4 5 6 7 8 9 } } { start 7 } }
> ( scratchpad ) mycirc get rotate-circular
> ( scratchpad ) mycirc get .
> T{ circular { seq { 0 1 2 3 4 5 6 7 8 9 } } { start 5 } }
> ( scratchpad ) mycirc get rotate-circular
> ( scratchpad ) mycirc get .
> T{ circular { seq { 0 1 2 3 4 5 6 7 8 9 } } { start 1 } }
>
>
> ------------------------------------------------------------------------------
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensing option that enables unlimited
> royalty-free distribution of the report engine for externally facing
> server and web deployment.
> http://p.sf.net/sfu/businessobjects
> _______________________________________________
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk