Re: [Factor-talk] USE/USING and scripting

2011-08-19 Thread John Benediktsson
Hi Andrew, It would help if you attached some code, but you should be able to get your code to work if you put the files in the work folder of Factor like this: /work/ant/ant.factor /work/antfarm/antfarm.factor When you USE: ant, it will look through the vocabulary roots (core, basis, extra,

Re: [Factor-talk] USE/USING and scripting

2011-08-19 Thread Andrew Pennebaker
Is there an import command that doesn't require moving my files into the Factor work directory? I like version controlling my scripts and it would be a pain to copy them from my git directory over to work and back. Cheers, Andrew Pennebaker www.yellosoft.us On Fri, Aug 19, 2011 at 3:28 AM,

Re: [Factor-talk] USE/USING and scripting

2011-08-19 Thread Doug Coleman
You can add your own vocabulary root, and if you put it in .factor-boot-rc then it will get run every time you bootstrap: USE: vocabs.loader /Users/erg/sekrets add-vocab-root Doug On Aug 19, 2011, at 8:26 AM, Andrew Pennebaker wrote: Is there an import command that doesn't require moving my

Re: [Factor-talk] USE/USING and scripting

2011-08-19 Thread Joe Groff
On Aug 19, 2011, at 8:36 AM, Doug Coleman wrote: You can add your own vocabulary root, and if you put it in .factor-boot-rc then it will get run every time you bootstrap: .factor-boot-rc only gets loaded once when you rebuild Factor. A better idea is to list your root directories in

Re: [Factor-talk] USE/USING and scripting

2011-08-19 Thread Joe Groff
On Aug 19, 2011, at 8:26 AM, Andrew Pennebaker wrote: Is there an import command that doesn't require moving my files into the Factor work directory? I like version controlling my scripts and it would be a pain to copy them from my git directory over to work and back. As Doug indicated,

Re: [Factor-talk] USE/USING and scripting

2011-08-19 Thread Andrew Pennebaker
I made ~/.factor-roots with a dot (.) to indicate it should search the current directory for Factor files, but it doesn't seem to help. Is there a way to add the current directory to ~/.factor-roots similar to Java's CLASSPATH? Cheers, Andrew Pennebaker www.yellosoft.us On Fri, Aug 19, 2011 at

Re: [Factor-talk] USE/USING and scripting

2011-08-19 Thread Joe Groff
On Aug 19, 2011, at 11:35 AM, Andrew Pennebaker wrote: I made ~/.factor-roots with a dot (.) to indicate it should search the current directory for Factor files, but it doesn't seem to help. Is there a way to add the current directory to ~/.factor-roots similar to Java's CLASSPATH? . is

Re: [Factor-talk] Factor UI crashes in Mac OS X Lion

2011-08-19 Thread Joe Groff
On Aug 18, 2011, at 8:07 PM, Andrew Pennebaker wrote: USE: ui.backend.cocoa.tools menu-run-files successfully brings up an open dialog which loads Factor code. There might an FFI bug in the compiler. What does USE: cpu.x86.features sse-version report? -Joe smime.p7s Description: S/MIME

Re: [Factor-talk] Factor UI crashes in Mac OS X Lion

2011-08-19 Thread Andrew Pennebaker
$ factor ( scratchpad ) USE: cpu.x86.features sse-version --- Data stack: 41 Cheers, Andrew Pennebaker www.yellosoft.us On Fri, Aug 19, 2011 at 2:48 PM, Joe Groff arc...@gmail.com wrote: On Aug 18, 2011, at 8:07 PM, Andrew Pennebaker wrote: USE: ui.backend.cocoa.tools menu-run-files

Re: [Factor-talk] USE/USING and scripting

2011-08-19 Thread Andrew Pennebaker
There must be a more dynamic way than configuring Factor for every piece of code I write. What if Factor interpreted . as the directory from which Factor was called? Cheers, Andrew Pennebaker www.yellosoft.us On Fri, Aug 19, 2011 at 2:46 PM, Joe Groff arc...@gmail.com wrote: On Aug 19, 2011,

Re: [Factor-talk] USE/USING and scripting

2011-08-19 Thread Joe Groff
On Aug 19, 2011, at 2:57 PM, Andrew Pennebaker wrote: There must be a more dynamic way than configuring Factor for every piece of code I write. What if Factor interpreted . as the directory from which Factor was called? I'm not sure what you mean by the directory from which Factor was

Re: [Factor-talk] USE/USING and scripting

2011-08-19 Thread Joe Groff
On Aug 19, 2011, at 2:57 PM, Andrew Pennebaker wrote: There must be a more dynamic way than configuring Factor for every piece of code I write. What if Factor interpreted . as the directory from which Factor was called? If you're trying to load modules relative to a main script file, a bit

Re: [Factor-talk] USE/USING and scripting

2011-08-19 Thread Andrew Pennebaker
The parse-time trick is helpful, but it's not perfect. I'm getting an error: Generic word length does not define a method for the source-file class. If you're familiar with Ruby's require or Python's import, they look in the user's current directory, i.e. C:\CoolStuff\ python coolstuff.py will

Re: [Factor-talk] USE/USING and scripting

2011-08-19 Thread Joe Groff
On Aug 19, 2011, at 3:51 PM, Andrew Pennebaker wrote: The parse-time trick is helpful, but it's not perfect. I'm getting an error: Generic word length does not define a method for the source-file class. Oops, that was a typo on my part. Should be: USING: accessors io.pathnames namespaces

Re: [Factor-talk] USE/USING and scripting

2011-08-19 Thread Andrew Pennebaker
The RELATIVE trick looks promising. Though, it gives me an error. scriptedmain.factor https://github.com/mcandre/scriptedmain/blob/master/scriptedmain.factor test.factor https://github.com/mcandre/scriptedmain/blob/master/test.factor $ ./test.factor Loading /Users/andrew/.factor-rc

Re: [Factor-talk] USE/USING and scripting

2011-08-19 Thread Joe Groff
On Aug 19, 2011, at 5:14 PM, Andrew Pennebaker wrote: The RELATIVE trick looks promising. Though, it gives me an error. scriptedmain.factor https://github.com/mcandre/scriptedmain/blob/master/scriptedmain.factor test.factor https://github.com/mcandre/scriptedmain/blob/master/test.factor

Re: [Factor-talk] USE/USING and scripting

2011-08-19 Thread Andrew Pennebaker
Could you tweak the RELATIVE macro so that it doesn't require blob.factor to be in blob/ ? Cheers, Andrew Pennebaker www.yellosoft.us On Fri, Aug 19, 2011 at 8:22 PM, Joe Groff arc...@gmail.com wrote: On Aug 19, 2011, at 5:14 PM, Andrew Pennebaker wrote: The RELATIVE trick looks promising.

Re: [Factor-talk] USE/USING and scripting

2011-08-19 Thread John Benediktsson
You could define this syntax word: SYNTAX: INCLUDE: scan-object parse-file append ; Then use it: INCLUDE: foo.factor It adds all words from foo.factor into the current vocab. On Fri, Aug 19, 2011 at 6:06 PM, Andrew Pennebaker andrew.penneba...@gmail.com wrote: Could you tweak the

Re: [Factor-talk] USE/USING and scripting

2011-08-19 Thread Andrew Pennebaker
I'm trying to tweak INCLUDE so that it appends .factor for you (and thereby looks more natural, like USE/USING). $ cat ~/.factor-rc ! An INCLUDE macro that imports source code files in the current directory USING: accessors io.pathnames namespaces source-files vocabs.loader parser sequences ;

Re: [Factor-talk] USE/USING and scripting

2011-08-19 Thread John Benediktsson
Try with a string: INCLUDE: scriptedmain On Fri, Aug 19, 2011 at 6:53 PM, Andrew Pennebaker andrew.penneba...@gmail.com wrote: I'm trying to tweak INCLUDE so that it appends .factor for you (and thereby looks more natural, like USE/USING). $ cat ~/.factor-rc ! An INCLUDE macro that

Re: [Factor-talk] USE/USING and scripting

2011-08-19 Thread Slava Pestov
Hi Andrew, On Fri, Aug 19, 2011 at 8:26 AM, Andrew Pennebaker andrew.penneba...@gmail.com wrote: Is there an import command that doesn't require moving my files into the Factor work directory? I like version controlling my scripts and it would be a pain to copy them from my git directory over

Re: [Factor-talk] USE/USING and scripting

2011-08-19 Thread Andrew Pennebaker
Egads, it works! Thanks to Joe, John, and Slava, I've made a little macro pair that emulates Ruby's require in Factor's USE/USING fashion. $ cat ~/.factor-rc ! Andrew Pennebaker ! INCLUDE/INCLUDING macros that import source code files in the current directory USING: kernel vocabs.loader parser

Re: [Factor-talk] USE/USING and scripting

2011-08-19 Thread Joe Groff
On Aug 19, 2011, at 8:30 PM, Andrew Pennebaker wrote: It would really be neat if you didn't have to use INCLUDE/INCLUDING for user code and USE/USING for Factor's standard library code. The differences are: - INCLUDE: looks only in the current directory; USE: looks in the search path -

Re: [Factor-talk] USE/USING and scripting

2011-08-19 Thread Slava Pestov
Hi Andrew, On Fri, Aug 19, 2011 at 8:30 PM, Andrew Pennebaker andrew.penneba...@gmail.com wrote: It would really be neat if you didn't have to use INCLUDE/INCLUDING for user code and USE/USING for Factor's standard library code. Well, using vocabulary roots you can use USING: for everything.

Re: [Factor-talk] USE/USING and scripting

2011-08-19 Thread Joe Groff
On Aug 19, 2011, at 9:46 PM, Slava Pestov wrote: Well, using vocabulary roots you can use USING: for everything. Read the article I linked you to, it's pretty easy to add your own directories to the search path. Well, Andrew is objecting to a couple of things with how the vocab loader works: