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

2011-08-20 Thread Slava Pestov
Hi Andrew, On Sat, Aug 20, 2011 at 12:42 AM, Andrew Pennebaker wrote: > I agree, we should prefer USING for all imports. Why does Factor still have > USE when USING is more comprehensive? USE: is mostly intended for interactive use. In the listener, USE: foo is more concise than USING: foo ;

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

2011-08-20 Thread Andrew Pennebaker
I agree, we should prefer USING for all imports. Why does Factor still have USE when USING is more comprehensive? Cheers, Andrew Pennebaker www.yellosoft.us On Sat, Aug 20, 2011 at 12:46 AM, Slava Pestov wrote: > Hi Andrew, > > On Fri, Aug 19, 2011 at 8:30 PM, Andrew Pennebaker > wrote: > > I

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 work

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 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. Read the article I linked y

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 - INC

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 Slava Pestov
Hi Andrew, On Fri, 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. Take

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" mac

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
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 th

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 wrote: > > On Aug 19, 2011, at 5:14 PM, Andrew Pennebaker wrote: > > The RELATIVE trick looks promising. Though, it g

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.

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 ./test.factor

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 namespa

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

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

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 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 wrote: > On Aug 19, 2011, at 11:35 AM, A

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? "

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 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 indicat

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 ~/.fac

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 m

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, John

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", "e