Re: [Factor-talk] factor-mode: Closing characters

2008-11-18 Thread Eduardo Cavazos
On Monday 17 November 2008 20:54:42 Jose A. Ortega Ruiz wrote: > Here's an initial attempt at proper indentation, according to my > understanding of Ed's and Slava's guidelines. I haven't tested it > thoroughly yet (it's getting a bit late here), so please play a bit with > it if you have a little

Re: [Factor-talk] Safe parsing

2008-11-18 Thread Kobi Lurie
I thought about it a bit, and I think it's possible to exploit the dynamic namespace feature in order to solve this problem. a word 'with-sandbox' takes a configuration and a quotation, and acts as a proxy for the code in the quot. for example, if the configuration has { path-limit { current-dir }

[Factor-talk] Loading vocabularies from the command line

2008-11-18 Thread Kio M. Smallwood
Hi, When I try to run some factor code on the command line like this: (example taken from ~/factor/build-support/factor.sh) ./factor -run=none -e='"x86.32" USE: bootstrap.image make-image save 0 USE: system exit' 1: "x86.32" USE: bootstrap.image make-image save 0 USE: system exit

Re: [Factor-talk] Loading vocabularies from the command line

2008-11-18 Thread Slava Pestov
Hi, the 'save' word is in the system vocabulary, so put USE: system first, before you call save. On Tue, Nov 18, 2008 at 2:24 PM, Kio M. Smallwood <[EMAIL PROTECTED]> wrote: > Hi, > > When I try to run some factor code on the command line like this: > (example taken from ~/factor/build-support/fa

[Factor-talk] Idiomatic Factor

2008-11-18 Thread Mayson Lancaster
As a Factor newcomer, I'm having some difficulty figuring out how to express myself idiomatically. Here's an example, my first crack at a word to return the sum of a sequence of numbers on the stack. USING: kernel assocs namespaces math sequences prettyprint ; IN: mayson SYMBOL: mysum : sequence

Re: [Factor-talk] Idiomatic Factor

2008-11-18 Thread Alex Chapman
> Factor can tell you, try the following: > \ sum see > > Which prints the following: > USING: math ; > IN: sequences > : sum ( seq -- n ) 0 [ + ] binary-reduce ; > So the shortest solution is: : sequence-sum ( seq -- sum ) sum ; inline Which is pretty much pointless. If the 'sum' library word d

Re: [Factor-talk] Idiomatic Factor

2008-11-18 Thread Slava Pestov
On Tue, Nov 18, 2008 at 4:41 PM, Mayson Lancaster <[EMAIL PROTECTED]> wrote: > As a Factor newcomer, I'm having some difficulty figuring out how to express > myself idiomatically. > Here's an example, my first crack at a word to return the sum of a sequence > of numbers on the stack. > USING: kerne

Re: [Factor-talk] Idiomatic Factor

2008-11-18 Thread Harold Hausman
On Tue, Nov 18, 2008 at 4:11 PM, Alex Chapman <[EMAIL PROTECTED]> wrote: > >> Factor can tell you, try the following: >> \ sum see > > So the shortest solution is: > > : sequence-sum ( seq -- sum ) sum ; inline > > Which is pretty much pointless. hehe, yes... The lesson of course being that the l

Re: [Factor-talk] Idiomatic Factor

2008-11-18 Thread Harold Hausman
On Tue, Nov 18, 2008 at 3:41 PM, Mayson Lancaster <[EMAIL PROTECTED]> wrote: > As a Factor newcomer, I'm having some difficulty figuring out how to express > myself idiomatically. > ... snip ... > Are there any reasonably Factorial ways to clean this up? Factor can tell you, try the following: \ s

Re: [Factor-talk] Idiomatic Factor

2008-11-18 Thread Alex Chapman
Hi Mayson, In this case it's not necessary to use a variable. Factor's stack is more than sufficient for a problem like this. There's also a word that will help you: reduce. Try \ reduce help in the listener and I think you'll find the problem a lot easier. If you were using a variable, then at s

[Factor-talk] Pull request: emacs font lock and indentation for constructor and field setters

2008-11-18 Thread Jose A. Ortega Ruiz
Hi. The two patches below provide more font lock and indentation for stanzas with constructors: a >>bar b >>qux [if you write here a line without a >>setter, TAB will align with ] Alternatively, the continuation line of a setter/constructor could start aligned with the constructor

Re: [Factor-talk] Pull request: emacs font lock and indentation for constructor and field setters

2008-11-18 Thread Eduardo Cavazos
On Tuesday 18 November 2008 19:09:43 Jose A. Ortega Ruiz wrote: > >a >>bar >b >>qux >[if you write here a line without a >>setter, > TAB will align with ] Wow... this is nice! > Alternatively, the continuation line of a setter/constructor could start > aligned with the construct