Re: [Factor-talk] problems with sequences

2007-01-13 Thread Slava Pestov
On 13-Jan-07, at 1:09 PM, Daniel Ehrenberg wrote: > Well, I didn't write the definitions in the interpreter; I loaded them > with load-module, but either way, you're right: the problem was that > things weren't compiled. Do you think it's possible for generic words > to automatically be decompile

Re: [Factor-talk] problems with sequences

2007-01-13 Thread Daniel Ehrenberg
Alex, Except for the constructor and last word, our two datastructures are very similar. Mind if I take your implementation and split it off into a separate library, adding a couple of utility functions that I need? Dan On 1/13/07, Alex Chapman <[EMAIL PROTECTED]> wrote: > I implemented something

Re: [Factor-talk] problems with sequences

2007-01-13 Thread Daniel Ehrenberg
Well, I didn't write the definitions in the interpreter; I loaded them with load-module, but either way, you're right: the problem was that things weren't compiled. Do you think it's possible for generic words to automatically be decompiled when an issue like this comes up? On 1/13/07, Slava Pesto

Re: [Factor-talk] problems with sequences

2007-01-13 Thread Slava Pestov
Just to clarify what is going on: On 13-Jan-07, at 1:14 AM, Chris Double wrote: > An easy way to show the problem is: You pasted the definitions in the listener. > > ! this works > 1 T{ circle f "abc" 0 } nth . Here, you're executing the interpreted definition of 'nth' (you just redefined nth

Re: [Factor-talk] problems with sequences

2007-01-13 Thread Slava Pestov
Hi Dan, The only possible way that you would get that error is if the sequence= word did not get a chance to be recompiled. This would happen if you paste your definitions in the listener, instead of loading them from a source file. While 'recompile' is called automatically by run-file, you

Re: [Factor-talk] problems with sequences

2007-01-12 Thread Alex Chapman
I implemented something similar when I wrote libs/gap-buffer. It's called 'circular' and wraps an underlying sequence, allowing indexing to start from any point in the sequence and wrap around. TUPLE: circular start ; C: circular ( seq -- circular ) 0 over set-circular-start [ set-delegate ]

Re: [Factor-talk] problems with sequences

2007-01-12 Thread Chris Double
An easy way to show the problem is: ! this works 1 T{ circle f "abc" 0 } nth . ! This gives an error about nth not being a method for circle 1 T{ circle f "abc" 0 } nth-unsafe . ! This works if you step-in through the code, but not if you 'continue' 1 T{ circle f "abc" 0 } [ nth-unsafe ] walk C

[Factor-talk] problems with sequences

2007-01-12 Thread Daniel Ehrenberg
Hi all I'm trying to implement a particular datastructure in Factor for XML parsing. It's sorta like a circular list. The code is at http://paste.lisp.org/display/35077 . For some reason, it works when I use things like length, nth and set-nth, but >string and sequence= don't work, complaining tha