[Factor-talk] Help fix the Homebrew formula
Could someone help fix the Homebrew Cask formula for Factor? If we could get this formula working, it would make Factor that much easier to install. https://github.com/caskroom/homebrew-cask/issues/7766 -- Cheers, Andrew Pennebaker www.yellosoft.us -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151iu=/4140/ostg.clktrk___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] installation packages for CI?
Thanks for the ppa! That's exactly what I was looking for. On Thu, Feb 27, 2014 at 9:30 AM, Björn Lindqvist bjou...@gmail.com wrote: 2014-02-10 6:56 GMT+01:00 Andrew Pennebaker andrew.penneba...@gmail.com: I can add that ppa to my source list, but when I `apt-get install factor`, I get a program for factoring compound numbers, not the Factor programming language. Could we rename the ppa to work around the name collision? No you do get the Factor language. But the binary is called factor-lang not factor which is a number factoring program shipped with coreutils. Btw you may also wish to uninstall and reinstall factor as I've recently published new packages here: https://launchpad.net/~bjourne/+archive/factor I plan to update them frequently to keep them in sync with Factor's main master branch. -- mvh/best regards Björn Lindqvist http://www.bjornlindqvist.se/ -- Flow-based real-time traffic analytics software. Cisco certified tool. Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer Customize your own dashboards, set traffic alerts and generate reports. Network behavioral analysis security monitoring. All-in-one tool. http://pubads.g.doubleclick.net/gampad/clk?id=126839071iu=/4140/ostg.clktrk ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Cheers, Andrew Pennebaker www.yellosoft.us -- Flow-based real-time traffic analytics software. Cisco certified tool. Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer Customize your own dashboards, set traffic alerts and generate reports. Network behavioral analysis security monitoring. All-in-one tool. http://pubads.g.doubleclick.net/gampad/clk?id=126839071iu=/4140/ostg.clktrk___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] installation packages for CI?
I can add that ppa to my source list, but when I `apt-get install factor`, I get a program for factoring compound numbers, not the Factor programming language. Could we rename the ppa to work around the name collision? On Sun, Feb 9, 2014 at 9:59 PM, Björn Lindqvist bjou...@gmail.com wrote: 2014-02-08 11:56 GMT+01:00 Gabriel Kerneis gabr...@kerneis.info: On Fri, Feb 07, 2014 at 06:44:32PM -0500, Andrew Pennebaker wrote: If we met users half way, presenting .deb's, .rpm's, maybe a ppa repo, that would be a great start. As a first step, I recommend using https://build.opensuse.org/ It is slightly openSUSE centered, but makes it easy to check that your basic rpm deb build for ubuntu, debian, fedora and openSUSE. A while ago I created Ubuntu packages for Factor and put them in my PPA here: https://launchpad.net/~bjourne/+archive/factor Someone has also packaged Factor for Arch: https://aur.archlinux.org/packages/factor/ A big problem is that Factors build doesn't make it easy to install system-wide in a typical Linux setup. So you have to add lots of hacks to the build to add support for prefixed installation, with binary and support files split in different directories. It's a lot of work and hard to keep it in sync with Factors github repository. A smaller problem is that some Factor words wants to overwrite the image and file and write in directories relative to the executable file which obviously is problematic on Linux where writes outside of $HOME is forbidden. But I think most Linux users can live with that limitation. So to address the problematic build I've created an alternate build process which you are welcome to check out here: https://github.com/slavapestov/factor/pull/934 It's written using waf which I think is great for complicated build-processes like Factor's. With the branch, the build command becomes python waf.py configure --prefix=/opt/factor2 build sudo python waf.py install. Using that as their base, I believe someone knowledgable of their distro's build system could very easily package Factor. Then to actually get distros to put Factor in their repos would entail reopening tickets like this: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=471925 Plus, Debian has some bureaucratic rules on packages they ship. Like requiring a man page. -- mvh/best regards Björn Lindqvist -- Managing the Performance of Cloud-Based Applications Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. Read the Whitepaper. http://pubads.g.doubleclick.net/gampad/clk?id=121051231iu=/4140/ostg.clktrk ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Cheers, Andrew Pennebaker www.yellosoft.us -- Managing the Performance of Cloud-Based Applications Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. Read the Whitepaper. http://pubads.g.doubleclick.net/gampad/clk?id=121051231iu=/4140/ostg.clktrk___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
[Factor-talk] installation packages for CI?
Could we start building .deb's, .rpm's, etc. as part of continuous integration? Ideally, Linux users could get factor straight from their package manager. -- Cheers, Andrew Pennebaker www.yellosoft.us -- Managing the Performance of Cloud-Based Applications Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. Read the Whitepaper. http://pubads.g.doubleclick.net/gampad/clk?id=121051231iu=/4140/ostg.clktrk___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] installation packages for CI?
Package geneartion can be scripted. At worst, deployment to official repo's would require manual intervention each time. If we met users half way, presenting .deb's, .rpm's, maybe a ppa repo, that would be a great start. On Feb 7, 2014 5:13 PM, Doug Coleman doug.cole...@gmail.com wrote: We could do that if we automate the entire process. That would entail someone writing some code to generate those packages and possibly automatically submitting them to the package managers. Is that possible? Doug On Fri, Feb 7, 2014 at 1:00 PM, Andrew Pennebaker andrew.penneba...@gmail.com wrote: Could we start building .deb's, .rpm's, etc. as part of continuous integration? Ideally, Linux users could get factor straight from their package manager. -- Cheers, Andrew Pennebaker www.yellosoft.us -- Managing the Performance of Cloud-Based Applications Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. Read the Whitepaper. http://pubads.g.doubleclick.net/gampad/clk?id=121051231iu=/4140/ostg.clktrk ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Managing the Performance of Cloud-Based Applications Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. Read the Whitepaper. http://pubads.g.doubleclick.net/gampad/clk?id=121051231iu=/4140/ostg.clktrk ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Managing the Performance of Cloud-Based Applications Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. Read the Whitepaper. http://pubads.g.doubleclick.net/gampad/clk?id=121051231iu=/4140/ostg.clktrk___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
[Factor-talk] factor-mode.el for Emacs?
Is there an Emacs syntax highlighter for Factor code? -- Cheers, Andrew Pennebaker www.yellosoft.us -- Minimize network downtime and maximize team effectiveness. Reduce network management and security costs.Learn how to hire the most talented Cisco Certified professionals. Visit the Employer Resources Portal http://www.cisco.com/web/learning/employer_resources/index.html___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
[Factor-talk] Mobile app support?
Can we get Factor going in Android, iOS, and Windows RT? There are very few cross-platform mobile languages; if Factor were one of them, it would be a huge feature to tout. -- Cheers, Andrew Pennebaker www.yellosoft.us -- Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. ON SALE this month only -- learn more at: http://p.sf.net/sfu/learnnow-d2d___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
[Factor-talk] Vector logo
Can we adopt a vector logo, one that's scalable? For example: http://www.yellosoft.us/logos#factor -- Cheers, Andrew Pennebaker www.yellosoft.us -- LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
[Factor-talk] Shebang syntax
Can we remove the requirement that shebang arguments be preceded by a space? Most programming languages don't require this, so Factor's shebang syntax is a bit unintuitive. http://rosettacode.org/wiki/Multiline_shebang#Factor -- Cheers, Andrew Pennebaker www.yellosoft.us -- LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Shebang syntax
Wonderful! Which version added this? On Dec 6, 2012 12:18 PM, John Benediktsson mrj...@gmail.com wrote: This is no longer true: $ cat test.factor #!/path/to/factor USE: io hello, world print $ ./test.factor hello, world On Thu, Dec 6, 2012 at 8:43 AM, Andrew Pennebaker andrew.penneba...@gmail.com wrote: Can we remove the requirement that shebang arguments be preceded by a space? Most programming languages don't require this, so Factor's shebang syntax is a bit unintuitive. http://rosettacode.org/wiki/Multiline_shebang#Factor -- Cheers, Andrew Pennebaker www.yellosoft.us -- LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Vector logo
Making any derivative artwork is a hassle. E.g. wallpapers, icons marking download links. SVG or EPS would go a long way for anyone who wants to put Factor logos in Web tutorials, blog articles, t-shirts... On Dec 6, 2012 12:37 PM, John Benediktsson mrj...@gmail.com wrote: Unfortunately, the current logo (and the previous one) are not vector-based. Out of curiosity, is there some particular use-case you have for this? Or just preparing for a higher resolution future? Best, John. On Thu, Dec 6, 2012 at 8:42 AM, Andrew Pennebaker andrew.penneba...@gmail.com wrote: Can we adopt a vector logo, one that's scalable? For example: http://www.yellosoft.us/logos#factor -- Cheers, Andrew Pennebaker www.yellosoft.us -- LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Vector logo
I've uploaded a basic .SVG of a velociraptor. It's public domain. http://www.yellosoft.us/logos#factor -- Cheers, Andrew Pennebaker www.yellosoft.us -- LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] sequences and the stack
Aha! How could I rewrite for-all? so that it prints the first stack that fails the predicate? Cheers, Andrew Pennebaker www.yellosoft.us On Thu, Aug 25, 2011 at 1:11 AM, Joe Groff arc...@gmail.com wrote: On Aug 24, 2011, at 10:05 PM, Andrew Pennebaker wrote: Joe, your for-all? looks promising (and it's incredibly short). However, when I try it, I'm still getting that macro error. In your main you missed the [ ] around prop-even. This line: https://github.com/mcandre/factcheck/blob/master/example.factor#L12 should read: [ prop-even ] [ gen-even ] for-all? . -Joe -- EMC VNX: the world's simplest storage, starting under $10K The only unified storage solution that offers unified management Up to 160% more powerful than alternatives and 25% more efficient. Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- EMC VNX: the world's simplest storage, starting under $10K The only unified storage solution that offers unified management Up to 160% more powerful than alternatives and 25% more efficient. Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] TryRuby, etc.
Note that this handbook is not a tutorial... --Forward to the Factor Developer's Handbook It's still a valuable resource. Thanks. Cheers, Andrew Pennebaker www.yellosoft.us On Tue, Aug 23, 2011 at 11:15 PM, Michael Clagett mclag...@hotmail.comwrote: Hi Andrew -- Not a video tutorial, but I found this useful: http://www.bluishcoder.co.nz/handbook.pdf Regards, Mike -- From: andrew.penneba...@gmail.com Date: Tue, 23 Aug 2011 20:25:58 -0400 To: factor-talk@lists.sourceforge.net Subject: [Factor-talk] TryRuby, etc. Has anyone made an interactive online tutorial for Factor comparable to TryRuby http://tryruby.org/? Cheers, Andrew Pennebaker www.yellosoft.us -- EMC VNX: the world's simplest storage, starting under $10K The only unified storage solution that offers unified management Up to 160% more powerful than alternatives and 25% more efficient. Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- EMC VNX: the world's simplest storage, starting under $10K The only unified storage solution that offers unified management Up to 160% more powerful than alternatives and 25% more efficient. Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- EMC VNX: the world's simplest storage, starting under $10K The only unified storage solution that offers unified management Up to 160% more powerful than alternatives and 25% more efficient. Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] TryRuby, etc.
http://factor.bluishcoder.co.nz/responder/fjsc is down :( Cheers, Andrew Pennebaker www.yellosoft.us On Tue, Aug 23, 2011 at 11:29 PM, Chris Double chris.dou...@double.co.nzwrote: On Wed, Aug 24, 2011 at 12:25 PM, Andrew Pennebaker andrew.penneba...@gmail.com wrote: Has anyone made an interactive online tutorial for Factor comparable to TryRuby? I used to run an Factor to JavaScript instance online. I think the code 'fjsc' still in the repository. Blog posts about it here: http://www.bluishcoder.co.nz/2006/12/12/compiling-factor-to-javascript.html http://www.bluishcoder.co.nz/2006/12/17/factor-to-javascript-compiler-updates.html http://www.bluishcoder.co.nz/2006/12/18/continuations-added-to-fjsc.html http://www.bluishcoder.co.nz/2006/12/18/cross-domain-json-with-fjsc.html -- http://www.bluishcoder.co.nz -- EMC VNX: the world's simplest storage, starting under $10K The only unified storage solution that offers unified management Up to 160% more powerful than alternatives and 25% more efficient. Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- EMC VNX: the world's simplest storage, starting under $10K The only unified storage solution that offers unified management Up to 160% more powerful than alternatives and 25% more efficient. Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
[Factor-talk] No word named “--” found in current vocabulary search path
I'm porting the QuickCheck unit test framework to Factor. The idea is to test properties (quotations) against test values. For example, to test whether all integers have the property even: [ even? ] { gen-integer } for-all The property is a quotation because isn't evaluated directly but passed values from gen-integer. for-all will test properties with different types and numbers of arguments, that's why gen-integer is inside a sequence. So for-all's type hint should be something like : for-all ( quot seq -- ? ) ! ... ; And gen-integer's type hint would be something like : gen-integer ( -- quot | quot: -- n ) ! ... ; I'm getting an error, though. Factor doesn't like my type hint for gen-integer. $ ./example.factor Loading /Users/andrew/.factor-rc ./example.factor 3: INCLUDING: factcheck ; ^ factcheck.factor 5: : gen-integer ( -- quot | quot: -- n ) [ random-32 ] ; ^ No word named “--” found in current vocabulary search path In factcheck.factorhttps://github.com/mcandre/factcheck/blob/master/factcheck.factor : ! A quotation generating a random integer. : gen-integer ( -- quot | quot: -- n ) [ random-32 ] ; In example.factorhttps://github.com/mcandre/factcheck/blob/master/example.factor : #! /usr/bin/env factor INCLUDING: factcheck ; USING: math prettyprint ; IN: example : main ( -- ) gen-integer apply . Am I not using the pipe (|) correctly in the type hint? Cheers, Andrew Pennebaker www.yellosoft.us -- EMC VNX: the world's simplest storage, starting under $10K The only unified storage solution that offers unified management Up to 160% more powerful than alternatives and 25% more efficient. Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] No word named “--” found in current vocabulary search path
Thanks. I see the type hint syntax is close to Haskell's. Excellent! Cheers, Andrew Pennebaker www.yellosoft.us On Wed, Aug 24, 2011 at 6:36 PM, Joe Groff arc...@gmail.com wrote: On Aug 24, 2011, at 3:16 PM, Slava Pestov wrote: Hi Andrew, You're using the old convention (from handbook.pdf? :-) ) Please review recent docs: http://docs.factorcode.org/content/article-inference.html http://docs.factorcode.org/content/article-effects.html Even I'm having trouble finding a straightforward answer to this in those docs. More to the point, the modern syntax for higher-order stack effects is ( name: ( nested -- effect ) -- ). For example: : foo ( a b quot: ( a b -- c d e ) -- c d e ) call ; : bar ( a b quot1: ( a b -- c d e ) quot2: ( c d e -- f ) -- f ) [ call ] bi@ ; -Joe -- EMC VNX: the world's simplest storage, starting under $10K The only unified storage solution that offers unified management Up to 160% more powerful than alternatives and 25% more efficient. Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- EMC VNX: the world's simplest storage, starting under $10K The only unified storage solution that offers unified management Up to 160% more powerful than alternatives and 25% more efficient. Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] sequences and the stack
Is there a word more general than firstn? I'd like to push all the elements of a sequence onto the stack. Cheers, Andrew Pennebaker www.yellosoft.us On Sun, Aug 21, 2011 at 2:26 PM, Alexander J. Vondrak ajvond...@csupomona.edu wrote: first2: http://docs.factorcode.org/content/word-first2,sequences.html In general, firstn: http://docs.factorcode.org/content/word-firstn,sequences.generalizations.html Regards, --Alex Vondrak From: Andrew Pennebaker [andrew.penneba...@gmail.com] Sent: Sunday, August 21, 2011 11:20 AM To: Factor Subject: [Factor-talk] sequences and the stack The stack contains a sequence of number pairs: { { x1 y1 } { x2 y2 } { x3 y3 } ... } I want to map over the pairs, accessing xi and yi. [ ! stack = { xi yi } ! ... ! stack = xi yi ] map What's the code that goes in !... ? Other than using nth, how can I do this? Is there a word that pops the elements of a sequence onto the stack? Cheers, Andrew Pennebaker www.yellosoft.ushttp://www.yellosoft.us -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- EMC VNX: the world's simplest storage, starting under $10K The only unified storage solution that offers unified management Up to 160% more powerful than alternatives and 25% more efficient. Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] sequences and the stack
I've got a function that I want to call over a sequence of values (both are determined at run time). Is there something like call that accepts a sequence of arguments? Something like this: f args call-seq Cheers, Andrew Pennebaker www.yellosoft.us On Wed, Aug 24, 2011 at 10:04 PM, John Benediktsson mrj...@gmail.comwrote: Typically there are better ways to operate on sequences than to put all the elements on the stack, but you could: ( scratchpad ) { 0 1 2 3 } dup length firstn Better might be to use some combinators to act on the sequence each grabbing the element that they need (bi, tri, or the more general cleave): ( scratchpad ) { 0 1 2 3 } { [ first ] [ second ] [ third ] } cleave On Wed, Aug 24, 2011 at 6:50 PM, Andrew Pennebaker andrew.penneba...@gmail.com wrote: Is there a word more general than firstn? I'd like to push all the elements of a sequence onto the stack. Cheers, Andrew Pennebaker www.yellosoft.us On Sun, Aug 21, 2011 at 2:26 PM, Alexander J. Vondrak ajvond...@csupomona.edu wrote: first2: http://docs.factorcode.org/content/word-first2,sequences.html In general, firstn: http://docs.factorcode.org/content/word-firstn,sequences.generalizations.html Regards, --Alex Vondrak From: Andrew Pennebaker [andrew.penneba...@gmail.com] Sent: Sunday, August 21, 2011 11:20 AM To: Factor Subject: [Factor-talk] sequences and the stack The stack contains a sequence of number pairs: { { x1 y1 } { x2 y2 } { x3 y3 } ... } I want to map over the pairs, accessing xi and yi. [ ! stack = { xi yi } ! ... ! stack = xi yi ] map What's the code that goes in !... ? Other than using nth, how can I do this? Is there a word that pops the elements of a sequence onto the stack? Cheers, Andrew Pennebaker www.yellosoft.ushttp://www.yellosoft.us -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- EMC VNX: the world's simplest storage, starting under $10K The only unified storage solution that offers unified management Up to 160% more powerful than alternatives and 25% more efficient. Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- EMC VNX: the world's simplest storage, starting under $10K The only unified storage solution that offers unified management Up to 160% more powerful than alternatives and 25% more efficient. Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- EMC VNX: the world's simplest storage, starting under $10K The only unified storage solution that offers unified management Up to 160% more powerful than alternatives and 25% more efficient. Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] sequences and the stack
Thanks, inputsequence seems to be what I'm looking for. I must be incorrectly declaring and passing the quotations, because I get a compilation error. Code at GitHub https://github.com/mcandre/factcheck. $ ./example.factor Loading /Users/andrew/.factor-rc The word for-all cannot be executed because it failed to compile Cannot apply “inputsequence” to an input parameter of a non-inline word macro inputsequence Cheers, Andrew Pennebaker www.yellosoft.us On Wed, Aug 24, 2011 at 10:25 PM, John Benediktsson mrj...@gmail.comwrote: Look at inputsequence from combinators.smart. On Wed, Aug 24, 2011 at 7:19 PM, Andrew Pennebaker andrew.penneba...@gmail.com wrote: I've got a function that I want to call over a sequence of values (both are determined at run time). Is there something like call that accepts a sequence of arguments? Something like this: f args call-seq Cheers, Andrew Pennebaker www.yellosoft.us On Wed, Aug 24, 2011 at 10:04 PM, John Benediktsson mrj...@gmail.comwrote: Typically there are better ways to operate on sequences than to put all the elements on the stack, but you could: ( scratchpad ) { 0 1 2 3 } dup length firstn Better might be to use some combinators to act on the sequence each grabbing the element that they need (bi, tri, or the more general cleave): ( scratchpad ) { 0 1 2 3 } { [ first ] [ second ] [ third ] } cleave On Wed, Aug 24, 2011 at 6:50 PM, Andrew Pennebaker andrew.penneba...@gmail.com wrote: Is there a word more general than firstn? I'd like to push all the elements of a sequence onto the stack. Cheers, Andrew Pennebaker www.yellosoft.us On Sun, Aug 21, 2011 at 2:26 PM, Alexander J. Vondrak ajvond...@csupomona.edu wrote: first2: http://docs.factorcode.org/content/word-first2,sequences.html In general, firstn: http://docs.factorcode.org/content/word-firstn,sequences.generalizations.html Regards, --Alex Vondrak From: Andrew Pennebaker [andrew.penneba...@gmail.com] Sent: Sunday, August 21, 2011 11:20 AM To: Factor Subject: [Factor-talk] sequences and the stack The stack contains a sequence of number pairs: { { x1 y1 } { x2 y2 } { x3 y3 } ... } I want to map over the pairs, accessing xi and yi. [ ! stack = { xi yi } ! ... ! stack = xi yi ] map What's the code that goes in !... ? Other than using nth, how can I do this? Is there a word that pops the elements of a sequence onto the stack? Cheers, Andrew Pennebaker www.yellosoft.ushttp://www.yellosoft.us -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- EMC VNX: the world's simplest storage, starting under $10K The only unified storage solution that offers unified management Up to 160% more powerful than alternatives and 25% more efficient. Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- EMC VNX: the world's simplest storage, starting under $10K The only unified storage solution that offers unified management Up to 160% more powerful than alternatives and 25% more efficient. Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- EMC VNX: the world's simplest storage, starting under $10K The only unified storage solution that offers unified management Up to 160% more powerful than alternatives and 25% more efficient. Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- EMC VNX: the world's simplest storage, starting under $10K The only unified storage solution that offers unified management Up to 160% more powerful than alternatives and 25% more efficient. Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev
Re: [Factor-talk] sequences and the stack
Aye, it's a bit awkward, but I know that Haskell can do it because that's how Haskell's QuickCheck library works. It even goes one step further and creates the appropriate list of value generators according to the predicate's type. Cheers, Andrew Pennebaker www.yellosoft.us On Wed, Aug 24, 2011 at 10:32 PM, Joe Groff arc...@gmail.com wrote: On Aug 24, 2011, at 6:50 PM, Andrew Pennebaker wrote: Is there a word more general than firstn? I'd like to push all the elements of a sequence onto the stack. Asking for a function that pushes all the elements of an arbitrary sequence onto the stack is like asking for an [a] - (a,a,a,...) function in Haskell. The stack in Factor is an abstract notational convenience akin to function composition (or more generally, arrows), not a real place. firstn is a macro; the expression 5 firstn is evaluated at compile time and replaced in-line by a ( seq -- x x x x x ) function; this still only works when the value 5 is known at compile time. Guessing from your previous post, you're probably trying to turn this: [ even? ] { gen-integer } check into something like: { t } [ 1,000 [ gen-integer ] replicate [ even? not ] find drop not ] unit-test You'd do this as a macro. Macros are functions from their compile-time arguments to a quotation. Something like this (not tested): MACRO: check ( predicates generators -- quot ) [ swap '[ { t } [ 1,000 [ _ execute( -- x ) ] replicate [ @ not ] find drop not ] unit-test ] ] with map concat ; -Joe -- EMC VNX: the world's simplest storage, starting under $10K The only unified storage solution that offers unified management Up to 160% more powerful than alternatives and 25% more efficient. Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- EMC VNX: the world's simplest storage, starting under $10K The only unified storage solution that offers unified management Up to 160% more powerful than alternatives and 25% more efficient. Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] sequences and the stack
My goal is to test a user-supplied predicate, e.g. even? with a function for-all that checks even? for all values (actually just 100 random values), in other words, that arbitrary-integer even? is always true. Obviously this is not true, but we need a predicate that fails in order to test the test framework itself. If the predicate is the odd? property of integers, then we have: [ even? ] { gen-integer } for-all Which should fail on odd numbers. If we make a generator for just even numbers (gen-even), we have: [ even? ] { gen-even } for-all Which should always succeed. It's difficult to dynamically determine test values for a given predicate. Therefore, the user must supply an array of quotations which generate input for the predicate. Some predicates take a single integer (even?), others take a sequence (length), still others take multiple inputs, each of different types. So the user calls for-all as follows: *predicate* { *gen-type1* *gen-type2* *gen-type3* ... } for-all If this test framework only handled unary predicates, then we could simply: *predicate* *gen-type* for-all I want to construct a for-all that tests predicates of arbitrary complexity. For instance, there is already a generator for arbitrary arrays, which we use to construct a generator of arbitrary strings. ! A quotation generating a random sequence. : gen-seq ( quot: ( -- obj ) -- quot: ( -- seq ) ) [ gen-integer call 100 mod swap replicate ] ; inline ! A quotation generating a random string. : gen-string ( -- str ) [ gen-char gen-seq call string ] ; inline That's why I want to emulate Smalltalk's valueWithArguments, a way to call a quotation on an array of arguments rather than the stack. Imagine a call-with that accepts a quotation and an array of values to operate on. Cheers, Andrew Pennebaker www.yellosoft.us On Thu, Aug 25, 2011 at 12:05 AM, Joe Groff arc...@gmail.com wrote: On Aug 24, 2011, at 8:38 PM, Andrew Pennebaker wrote: $ ./example.factor Loading /Users/andrew/.factor-rc The word for-all cannot be executed because it failed to compile Cannot apply “inputsequence” to an input parameter of a non-inline word macro inputsequence inputsequence is also a macro; it's essentially firstn with the n determined by stack effect inference on the input quotation. Since it's a macro, that input quotation needs to be statically determinable by the compiler. The compiler isn't smart enough to reach up to the caller's frame without the inline annotation on the callee: : foo ( quot -- x ) inputsequence ; inline ! *must* be inline : bar ( -- six ) { 1 2 3 } [ + + ] foo ; The stack is ultimately not a dynamic thing in Factor, and while there are hacks to pretend it is, you'll be happier if you find a more data-structure-oriented approach. You said you had an array of quotations; a better approach would be to iterate over the array, call each quotation with call( -- ) and process the outputs in a single pass, something akin like this: : generate-and-print ( generators -- ) [ call( -- x ) . ] each ; -Joe -- EMC VNX: the world's simplest storage, starting under $10K The only unified storage solution that offers unified management Up to 160% more powerful than alternatives and 25% more efficient. Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- EMC VNX: the world's simplest storage, starting under $10K The only unified storage solution that offers unified management Up to 160% more powerful than alternatives and 25% more efficient. Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] sequences and the stack
The exemplar idea is attractive, especially since it's idiomatic in Factor. However, an exemplar of 1 may not be precise enough for certain predicates. How can we define sufficiently specific exemplars for predicates like non-negative? positive? divides-by-three? byte? char? lowercase char? vowel? I imagine classes could reduce the ambiguity of exemplars. How much boilerplate would be required to make classes for the above? non-negative, positive, divides-by-three, byte? It's starting to look circular: How can we define legal inputs for a predicate in order to test whether the predicate is succeeds for all legal inputs? A conceptually easy solution is to make quotations that generate the desired input, slap 'em in an array, and call predicate { generators ... } forall100 times. I'm just not sure how to do call(function, arguments) in factor. Cheers, Andrew Pennebaker www.yellosoft.us On Thu, Aug 25, 2011 at 12:22 AM, Joe Groff arc...@gmail.com wrote: On Aug 24, 2011, at 8:44 PM, Andrew Pennebaker wrote: Aye, it's a bit awkward, but I know that Haskell can do it because that's how Haskell's QuickCheck library works. It even goes one step further and creates the appropriate list of value generators according to the predicate's type. Perhaps you could do something similar in Factor. Instead of using generator functions, you could make a single generic function that lets types describe how to generate arbitrary members of themselves: GENERIC: something-like ( exemplar -- arbitrary ) ERROR: don't-know-how-to-make-something-like exemplar ; M: object something-like don't-know-how-to-make-something-like ; M: integer something-like 2 64 ^ random ; M: float something-like -1.0 1.0 uniform-random-float ; Then pass an exemplar of the type to something-like: ( scratchpad ) 1 something-like . 16789018172707 ( scratchpad ) 1.0 something-like . -0.13980920020477 Union types and tuple types could then naturally implement something-like in terms of their constituent types. -Joe -- EMC VNX: the world's simplest storage, starting under $10K The only unified storage solution that offers unified management Up to 160% more powerful than alternatives and 25% more efficient. Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- EMC VNX: the world's simplest storage, starting under $10K The only unified storage solution that offers unified management Up to 160% more powerful than alternatives and 25% more efficient. Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] sequences and the stack
Joe, your for-all? looks promising (and it's incredibly short). However, when I try it, I'm still getting that macro error. Latest code incorporating your for-all?: https://github.com/mcandre/factcheck Macro Error: $ ./example.factor Loading /Users/andrew/.factor-rc The word main cannot be executed because it failed to compile Cannot apply “call” to a run-time computed value macro call Cheers, Andrew Pennebaker www.yellosoft.us On Thu, Aug 25, 2011 at 12:49 AM, Joe Groff arc...@gmail.com wrote: On Aug 24, 2011, at 9:30 PM, Andrew Pennebaker wrote: *predicate* { *gen-type1* *gen-type2* *gen-type3* ... } for-all The generators needn't be in an array; they could be a simple quotation. Simply calling each generator function in turn will line up their outputs on the stack in the proper order. Assuming the net output effect of the generators is supposed to match the input effect of the predicate, the generators and predicate together would have a constant effect ( -- ? ). The following works, and should be general enough for everything you describe: CONSTANT: number-of-tries 1,000 : for-all? ( generator: ( -- ..a ) predicate: ( ..a -- ? ) -- ? ) [ number-of-tries iota ] 2dip '[ drop @ @ not ] find drop not ; inline ( scratchpad ) [ 2 64 ^ random ] [ even? ] for-all? . f ( scratchpad ) [ 2 64 ^ random 2 * ] [ even? ] for-all? . t : random-string ( -- x ) 32 random [ HEX: 10 random ] replicate-as ; ( scratchpad ) [ random-string random-string ] [ [ [ length ] bi@ + ] [ append length ] 2bi = ] for-all? t -Joe -- EMC VNX: the world's simplest storage, starting under $10K The only unified storage solution that offers unified management Up to 160% more powerful than alternatives and 25% more efficient. Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- EMC VNX: the world's simplest storage, starting under $10K The only unified storage solution that offers unified management Up to 160% more powerful than alternatives and 25% more efficient. Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
[Factor-talk] TryRuby, etc.
Has anyone made an interactive online tutorial for Factor comparable to TryRuby http://tryruby.org/? Cheers, Andrew Pennebaker www.yellosoft.us -- EMC VNX: the world's simplest storage, starting under $10K The only unified storage solution that offers unified management Up to 160% more powerful than alternatives and 25% more efficient. Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
[Factor-talk] sequences and the stack
The stack contains a sequence of number pairs: { { x1 y1 } { x2 y2 } { x3 y3 } ... } I want to map over the pairs, accessing xi and yi. [ ! stack = { xi yi } ! ... ! stack = xi yi ] map What's the code that goes in !... ? Other than using nth, how can I do this? Is there a word that pops the elements of a sequence onto the stack? Cheers, Andrew Pennebaker www.yellosoft.us -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] USE/USING and scripting
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 sl...@factorcode.org wrote: 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. Read the article I linked you to, it's pretty easy to add your own directories to the search path. Cheers, Slava -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] getopt; commandline parsing Re: Invoke MAIN: from commandline script file?
This works in the interpreter, but I'm having trouble passing command line arguments to my scripts. For some reason, Factor isn't setting the global variable help when I pass it -help. $ cat ios7crypt.factor #! /usr/bin/env factor USING: kernel namespaces io prettyprint ; IN: ios7crypt : usage ( -- ) Usage: ios7crypt.factor [options] print -encrypt password print -decrypt hash print -test print -help print ; : main ( -- ) help get . ; MAIN: main $ ./ios7crypt.factor Loading /Users/andrew/.factor-rc f $ ./ios7crypt.factor -help Loading /Users/andrew/.factor-rc f Cheers, Andrew Pennebaker www.yellosoft.us On Thu, Aug 18, 2011 at 1:50 AM, Joe Groff arc...@gmail.com wrote: On Aug 17, 2011, at 10:32 PM, Andrew Pennebaker wrote: Awesome! By the way, I don't get any usage info for Factor that would list the -script option. (no factor -h, factor --help, etc.) Is there a getopt for Factor? I think -script was a relic of the past; it doesn't appear to be necessary anymore. The main remaining caveat with #! is that it needs to be followed by whitespace. There might be a getopt-like parser library, but I don't know of it. Maybe someone else does. However, the VM will parse options of the form -foo or -foo=bar and set them as variables in the global namespace for you, which you can access with the get function. For example: $ ./factor -foo -zim=zang -flux=rad ( scratchpad ) foo get . t ( scratchpad ) zim get . zang ( scratchpad ) flux get . rad -Joe -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] getopt; commandline parsing Re: Invoke MAIN: from commandline script file?
Okay, factor -help ios7crypt.factor works. It seems Factor ignores arguments after the first script name. How can I rearrange the shebang so that ./ios7crypt.factor -help sends the argument to factor after the script name? For example, in Common Lisp a multilineshebang rearranges arguments so that the script name is forcibly passed twice: #!/bin/bash #| exec clisp -q -q $0 $0 ${1+$@} exit |# If there's a way to do multiline shebangs in Factor, then ./ios7crypt.factor -help can be run correctly. Cheers, Andrew Pennebaker www.yellosoft.us On Sat, Aug 20, 2011 at 12:37 PM, Andrew Pennebaker andrew.penneba...@gmail.com wrote: This works in the interpreter, but I'm having trouble passing command line arguments to my scripts. For some reason, Factor isn't setting the global variable help when I pass it -help. $ cat ios7crypt.factor #! /usr/bin/env factor USING: kernel namespaces io prettyprint ; IN: ios7crypt : usage ( -- ) Usage: ios7crypt.factor [options] print -encrypt password print -decrypt hash print -test print -help print ; : main ( -- ) help get . ; MAIN: main $ ./ios7crypt.factor Loading /Users/andrew/.factor-rc f $ ./ios7crypt.factor -help Loading /Users/andrew/.factor-rc f Cheers, Andrew Pennebaker www.yellosoft.us On Thu, Aug 18, 2011 at 1:50 AM, Joe Groff arc...@gmail.com wrote: On Aug 17, 2011, at 10:32 PM, Andrew Pennebaker wrote: Awesome! By the way, I don't get any usage info for Factor that would list the -script option. (no factor -h, factor --help, etc.) Is there a getopt for Factor? I think -script was a relic of the past; it doesn't appear to be necessary anymore. The main remaining caveat with #! is that it needs to be followed by whitespace. There might be a getopt-like parser library, but I don't know of it. Maybe someone else does. However, the VM will parse options of the form -foo or -foo=bar and set them as variables in the global namespace for you, which you can access with the get function. For example: $ ./factor -foo -zim=zang -flux=rad ( scratchpad ) foo get . t ( scratchpad ) zim get . zang ( scratchpad ) flux get . rad -Joe -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] getopt; commandline parsing Re: Invoke MAIN: from commandline script file?
Thanks John, works for me! Cheers, Andrew Pennebaker www.yellosoft.us On Sat, Aug 20, 2011 at 1:20 PM, John Benediktsson mrj...@gmail.com wrote: If you want to use your arg get code, you can: USE: command-line : main ( -- ) command-line get parse-command-line help get . ; In this case, command-line is the list of arguments to your script. Best, John. On Sat, Aug 20, 2011 at 9:42 AM, Andrew Pennebaker andrew.penneba...@gmail.com wrote: Okay, factor -help ios7crypt.factor works. It seems Factor ignores arguments after the first script name. How can I rearrange the shebang so that ./ios7crypt.factor -help sends the argument to factor after the script name? For example, in Common Lisp a multilineshebang rearranges arguments so that the script name is forcibly passed twice: #!/bin/bash #| exec clisp -q -q $0 $0 ${1+$@} exit |# If there's a way to do multiline shebangs in Factor, then ./ios7crypt.factor -help can be run correctly. Cheers, Andrew Pennebaker www.yellosoft.us On Sat, Aug 20, 2011 at 12:37 PM, Andrew Pennebaker andrew.penneba...@gmail.com wrote: This works in the interpreter, but I'm having trouble passing command line arguments to my scripts. For some reason, Factor isn't setting the global variable help when I pass it -help. $ cat ios7crypt.factor #! /usr/bin/env factor USING: kernel namespaces io prettyprint ; IN: ios7crypt : usage ( -- ) Usage: ios7crypt.factor [options] print -encrypt password print -decrypt hash print -test print -help print ; : main ( -- ) help get . ; MAIN: main $ ./ios7crypt.factor Loading /Users/andrew/.factor-rc f $ ./ios7crypt.factor -help Loading /Users/andrew/.factor-rc f Cheers, Andrew Pennebaker www.yellosoft.us On Thu, Aug 18, 2011 at 1:50 AM, Joe Groff arc...@gmail.com wrote: On Aug 17, 2011, at 10:32 PM, Andrew Pennebaker wrote: Awesome! By the way, I don't get any usage info for Factor that would list the -script option. (no factor -h, factor --help, etc.) Is there a getopt for Factor? I think -script was a relic of the past; it doesn't appear to be necessary anymore. The main remaining caveat with #! is that it needs to be followed by whitespace. There might be a getopt-like parser library, but I don't know of it. Maybe someone else does. However, the VM will parse options of the form -foo or -foo=bar and set them as variables in the global namespace for you, which you can access with the get function. For example: $ ./factor -foo -zim=zang -flux=rad ( scratchpad ) foo get . t ( scratchpad ) zim get . zang ( scratchpad ) flux get . rad -Joe -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] USE/USING and scripting
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 Benediktsson mrj...@gmail.com wrote: 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, work, etc.) for a directory ant with an ant.factor file in it. Best, John. On Thu, Aug 18, 2011 at 10:14 PM, Andrew Pennebaker andrew.penneba...@gmail.com wrote: ant.factor contains code manipulating ant objects. antfarm.factor is a demo of a hundred ants. How does antfarm.factor import code from ant.factor? I tried USING: ant ;but Factor complains Vocabulary does not exist name ant. Cheers, Andrew Pennebaker www.yellosoft.us -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] USE/USING and scripting
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 12:34 PM, Joe Groff arc...@gmail.com wrote: 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, you can use the add-vocab-root function or write a ~/.factor-roots file to add additional search paths. For more info on the module system, try vocabs.loader help which describes the search mechanism and the layout of a module directory. -Joe -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Factor UI crashes in Mac OS X Lion
$ 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 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 -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] USE/USING and scripting
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, 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 going to be relative to the Factor process's current directory. If you're starting Factor.app from the Finder that'll be / (the root directory) . Adding . to .factor-roots works for me for Factor processes started from a terminal, though it doesn't seem like a good idea compared to having a predictable search path. I usually just add all my project directories to .factor-roots directly. -Joe -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] USE/USING and scripting
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 have Python search in C:\CoolStuff\ for relevant modules. I hope that your macro does this. I'm trying to import code from scriptedmain.factorhttps://github.com/mcandre/scriptedmain/blob/master/scriptedmain.factorinto test.factorhttps://github.com/mcandre/scriptedmain/blob/master/test.factor in such a way that no matter which directory those two files are in, as long as they're in the same directory, factor test.factor would work. If this is what the macro does, could Factor do this automatically? I think USE and USING would have to be modified in order for that to work. Cheers, Andrew Pennebaker www.yellosoft.us On Fri, Aug 19, 2011 at 6:32 PM, Joe Groff arc...@gmail.com wrote: 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 of parse-time evaluation before the USING: line will do the trick: USING: io.pathnames namespaces source-files vocabs.loader ; ! add the script file's parent directory to the search path file get parent-directory add-vocab-root USING: something.relative.to.this.file ; Is that what you're going for? -Joe -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] USE/USING and scripting
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 4: USING: scriptedmain ; ^ Vocabulary does not exist name scriptedmain Side note: Could the Loading /Users/andrew/.factor-rc message be silenced so that it doesn't obscure a script's command line interface? Cheers, Andrew Pennebaker www.yellosoft.us On Fri, Aug 19, 2011 at 7:20 PM, Joe Groff arc...@gmail.com wrote: 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 source-files vocabs.loader ; file get path parent-directory add-vocab-root Note the path after file get. 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 have Python search in C:\CoolStuff\ for relevant modules. With . in .factor-roots, running factor from the command line will have the same behavior. I hope that your macro does this. I'm trying to import code from scriptedmain.factorhttps://github.com/mcandre/scriptedmain/blob/master/scriptedmain.factorinto test.factorhttps://github.com/mcandre/scriptedmain/blob/master/test.factor in such a way that no matter which directory those two files are in, as long as they're in the same directory, factor test.factor would work. If this is what the macro does, could Factor do this automatically? I think USE and USING would have to be modified in order for that to work. That is indeed what the above snippet does, though the imported module scriptedmain will still need to be placed in scriptedmain/scriptedmain.factor rather than just scriptedmain.factor under the script file directory for USING: to find it. The search path is orthogonal to USING:/USE:, so you could package the above snippet into a parsing word in your .factor-rc: ! in .factor-rc USING: accessors io.pathnames namespaces source-files vocabs.loader ; ! add a RELATIVE word to the base syntax IN: syntax SYNTAX: RELATIVE file get path parent-directory add-vocab-root ; You could then use RELATIVE in your script: ! in test.factor RELATIVE USING: scriptedmain ; -Joe -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] USE/USING and scripting
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. 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 4: USING: scriptedmain ; ^ Vocabulary does not exist name scriptedmain scriptedmain.factor needs to be in a scriptedmain subdirectory: mkdir scriptedmain mv scriptedmain.factor scriptedmain/ Side note: Could the Loading /Users/andrew/.factor-rc message be silenced so that it doesn't obscure a script's command line interface? That looks like a bug—in script mode, loading messages should be suppressed. I'll fix it. -Joe -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] USE/USING and scripting
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 ; IN: syntax SYNTAX: INCLUDE: scan-object .factor append parse-file append ; $ ./test.factor Loading /Users/andrew/.factor-rc ./test.factor 3: INCLUDE: scriptedmain ^ No word named “scriptedmain” found in current vocabulary search path By the way, aren't USE and USING redundant? Would it make sense to deprecate USE? Cheers, Andrew Pennebaker www.yellosoft.us On Fri, Aug 19, 2011 at 9:15 PM, John Benediktsson mrj...@gmail.com wrote: 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 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. 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 4: USING: scriptedmain ; ^ Vocabulary does not exist name scriptedmain scriptedmain.factor needs to be in a scriptedmain subdirectory: mkdir scriptedmain mv scriptedmain.factor scriptedmain/ Side note: Could the Loading /Users/andrew/.factor-rc message be silenced so that it doesn't obscure a script's command line interface? That looks like a bug—in script mode, loading messages should be suppressed. I'll fix it. -Joe -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] USE/USING and scripting
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 sequences lexer vocabs.parser ; IN: syntax : include-vocab ( vocab -- ) dup .factor append parse-file append use-vocab ; SYNTAX: INCLUDE: scan-token include-vocab ; SYNTAX: INCLUDING: ; [ include-vocab ] each-token ; $ cat scriptedmain.factor #! /usr/bin/env factor USING: io math.parser ; IN: scriptedmain : meaning-of-life ( -- n ) 42 ; : main ( -- ) meaning-of-life Main: The meaning of life is write numberstring print ; MAIN: main $ cat test.factor #! /usr/bin/env factor INCLUDING: scriptedmain ; USING: io math.parser ; IN: test : main ( -- ) meaning-of-life Test: The meaning of life is write numberstring print ; MAIN: main $ ./scriptedmain.factor Loading /Users/andrew/.factor-rc Main: The meaning of life is 42 $ ./test.factor Loading /Users/andrew/.factor-rc Test: The meaning of life is 42 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. Cheers, Andrew Pennebaker www.yellosoft.us On Fri, Aug 19, 2011 at 10:05 PM, John Benediktsson mrj...@gmail.comwrote: 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 imports source code files in the current directory USING: accessors io.pathnames namespaces source-files vocabs.loader parser sequences ; IN: syntax SYNTAX: INCLUDE: scan-object .factor append parse-file append ; $ ./test.factor Loading /Users/andrew/.factor-rc ./test.factor 3: INCLUDE: scriptedmain ^ No word named “scriptedmain” found in current vocabulary search path By the way, aren't USE and USING redundant? Would it make sense to deprecate USE? Cheers, Andrew Pennebaker www.yellosoft.us On Fri, Aug 19, 2011 at 9:15 PM, John Benediktsson mrj...@gmail.comwrote: 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 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. 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 4: USING: scriptedmain ; ^ Vocabulary does not exist name scriptedmain scriptedmain.factor needs to be in a scriptedmain subdirectory: mkdir scriptedmain mv scriptedmain.factor scriptedmain/ Side note: Could the Loading /Users/andrew/.factor-rc message be silenced so that it doesn't obscure a script's command line interface? That looks like a bug—in script mode, loading messages should be suppressed. I'll fix it. -Joe -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
Re: [Factor-talk] Factor UI crashes in Mac OS X Lion
Okay. This time the UI builds and runs, but it still crashes on Factor - Run Factor Source... I was able to run .s .r .c, but I can't make anything of Factor's debug output. $ make ... $ build-support/factor.sh update ... $ Factor.app/Contents/MacOS/factor The die word was called by the library. Unless you called it yourself, you have triggered a bug in Factor. Please report. Starting low level debugger... Basic commands: q-- continue executing Factor - NOT SAFE im -- save image to fep.image x-- exit Factor Advanced commands: d addr count -- dump memory u addr -- dump object at tagged addr . addr -- print object at tagged addr t-- toggle output trimming s r -- dump data, retain stacks .s .r .c -- print data, retain, call stacks e-- dump environment g-- dump generations data -- data heap dump words-- words dump tuples -- tuples dump refs addr -- find data heap references to object push addr -- push object on data stack - NOT SAFE code -- code heap dump READY .s .r .c DATA STACK: T{ words:undefined ui.backend.cocoa.tools:menu-run-files } READY RETAIN STACK: 130 READY CALL STACK: frame: 11c4a6fc8 executing: ( callback ) scan: f word/quot addr: 1103b85ec word/quot xt: 118c20240 return address: 118c2028f frame: 11c4a6f98 executing: ui.backend.cocoa.tools:menu-run-files scan: 0 word/quot addr: 110310fdc word/quot xt: 118c5f980 return address: 118c5f999 frame: 11c4a6f78 executing: words:undefined scan: f word/quot addr: 10b4129cc word/quot xt: 118396ad0 return address: 118396b4d frame: 11c4a6f58 executing: object=throw scan: f word/quot addr: 10b4b96cc word/quot xt: 11820cd30 return address: 11820cd6a frame: 11c4a6f38 executing: continuations:rethrow scan: f word/quot addr: 10b1b106c word/quot xt: 118625b20 return address: 118625b92 frame: 11c4a6f18 executing: [ threads:self threads:error-in-thread threads:stop ] scan: 1 word/quot addr: 10c833974 word/quot xt: 118ccdc70 return address: 118ccdc8e frame: 11c4a6ef8 executing: thread=error-in-thread scan: f word/quot addr: 10c87eccc word/quot xt: 11844f720 return address: 11844f762 frame: 11c4a6ed8 executing: kernel:die scan: 1 word/quot addr: 10b4a65dc word/quot xt: 118204a20 return address: 118204a5b READY Terminated: 15 Cheers, Andrew Pennebaker www.yellosoft.us On Thu, Aug 18, 2011 at 4:31 PM, Joe Groff arc...@gmail.com wrote: On Aug 18, 2011, at 10:24 AM, Andrew Pennebaker wrote: Factor - Run Factor Source... still crashes in Mac OS X 10.7.1. One thing to try would be running Factor from a terminal, so that if it dies, you can access its debugger. $ ./Factor.app/Contents/MacOS/factor After choosing Run Factor Source you may see You have triggered a bug in Factor. Please report. in the terminal followed by the error and a debugger prompt. If so, type .s .r .c to dump the current execution context and paste the output here. On the other hand, if the process is dying before the Factor debugger can kick in, a gdb backtrace would be helpful. -Joe -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Factor UI crashes in Mac OS X Lion
USE: ui.backend.cocoa.tools menu-run-files successfully brings up an open dialog which loads Factor code. Cheers, Andrew Pennebaker www.yellosoft.us On Thu, Aug 18, 2011 at 7:23 PM, Slava Pestov sl...@factorcode.org wrote: Also try this: \ menu-run-files see On Thu, Aug 18, 2011 at 4:22 PM, Joe Groff arc...@gmail.com wrote: On Aug 18, 2011, at 4:12 PM, Andrew Pennebaker wrote: DATA STACK: T{ words:undefined ui.backend.cocoa.tools:menu-run-files } CALL STACK: frame: 11c4a6fc8 executing: ( callback ) scan: f word/quot addr: 1103b85ec word/quot xt: 118c20240 return address: 118c2028f frame: 11c4a6f98 executing: ui.backend.cocoa.tools:menu-run-files scan: 0 word/quot addr: 110310fdc word/quot xt: 118c5f980 return address: 118c5f999 frame: 11c4a6f78 executing: words:undefined It looks like menu-run-files is throwing an undefined error, which is bizarre. What happens if you do USE: ui.backend.cocoa.tools menu-run-files from the listener? -Joe -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
[Factor-talk] USE/USING and scripting
ant.factor contains code manipulating ant objects. antfarm.factor is a demo of a hundred ants. How does antfarm.factor import code from ant.factor? I tried USING: ant ;but Factor complains Vocabulary does not exist name ant. Cheers, Andrew Pennebaker www.yellosoft.us -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
[Factor-talk] Factor yak shaving
Can someone make a PKG Mac installer that adds the factor binary to $PATH? I tried using PackageMaker.app, but I can't figure out how to run cli.sh as a postinstall script. cli.sh: #!/usr/bin/env sh echo \n# Factor\nexport PATH=\$PATH:/Applications/factor ~/.profile Cheers, Andrew Pennebaker www.yellosoft.us -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
[Factor-talk] Factor, shebangs, and Hello World
Factor doesn't accept shebang lines :( $ cat hello.factor #!/usr/bin/env factor USE: io IN: hello : hello ( -- ) Hello World! print ; MAIN: hello $ ./hello.factor ./hello.factor 1: #!/usr/bin/env factor ^ No word named “#!/usr/bin/env” found in current vocabulary search path Ignore the shebangs. For some reason, my simple Hello World program produces no output. $ cat hello.factor USE: io IN: hello : hello ( -- ) Hello World! print ; MAIN: hello $ factor hello.factor $ (no output) Cheers, Andrew Pennebaker www.yellosoft.us -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
[Factor-talk] Factor UI crashes in Mac OS X Lion
When I select Factor - Run Factor Source..., the Factor UI crashes. Specs: - Factor 0.94 - Mac OS X 10.7 Lion Cheers, Andrew Pennebaker www.yellosoft.us -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Factor, shebangs, and Hello World
Thanks Joe, that helps a lot. Do you know if Factor has an equivalent this Python's idiom? if __name__==__main__: main() More examples at Rosetta Code http://rosettacode.org/wiki/ScriptedMain. Cheers, Andrew Pennebaker www.yellosoft.us On Wed, Aug 17, 2011 at 10:20 PM, Joe Groff arc...@gmail.com wrote: On Aug 17, 2011, at 7:03 PM, Andrew Pennebaker wrote: Ignore the shebangs. For some reason, my simple Hello World program produces no output. $ cat hello.factor USE: io IN: hello : hello ( -- ) Hello World! print ; MAIN: hello $ factor hello.factor factor foo.factor only loads the file, and MAIN: by itself doesn't execute any code. To run the MAIN: entry point for a module, you need to use the -run option from the commandline: ./factor -run=hello Or use the run word from the listener: hello run Put hello/hello.factor under the work/ directory so it will be found as a module. standard-cli-args help gives a rundown of the standard commandline arguments. You can also use the deploy tool to build a stripped-down, standalone image that will run a MAIN: entry point directly. See tools.deploy help for more info. -Joe -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk