Re: [Factor-talk] images: new words to handle sprites and extract parts of an image

2015-11-30 Thread Joe Groff
I don't believe I ever implemented atlases in that demo. I did write a
quick and dirty atlas generator in extra/images/atlas you might be able to
start with:

http://docs.factorcode.org/content/vocab-images.atlas.html

On Monday, November 30, 2015, John Benediktsson  wrote:

> We welcome all contributions!  It's alright if you want to put these words
> into a new vocabulary in extra and then migrate them somewhere else after
> you get a sense of how useful they are.  Or if you feel they fit somewhere
> in particular, by all means send a pull request!
>
> You might want to check out Papier, which is a sprite-based game that is
> kinda a fun example of some Factor GL stuff:
>
> https://github.com/jckarter/papier
>
> Should run on 0.97 and latest code:
>
> "/path/to/papier" add-vocab-root
>
> "papier" run
>
>
>
> On Sun, Nov 29, 2015 at 8:48 AM, Sankaranarayanan Viswanathan <
> rationalrev...@gmail.com
> > wrote:
>
>> Hi,
>>
>> For a small game that I was making in order to get accustomed to factor,
>> I needed to load textures from a sprite sheet. Basically, I wanted to
>> take an image and split it into pieces of fixed dimensions. I wasn't
>> able to find words to help me there (may be there are and I am unaware).
>> So I ended up introducing a few new words:
>>
>> new-image-like: create a new empty image having properties of an
>> existing image but with modified dimensions
>>
>> image-part: extract a part of an image into a separate image
>>
>> generate-sprite-sheet: given an image, produce a sequence of images
>> having fixed width and heights
>>
>> These new words can be seen implemented here:
>>
>> https://github.com/rationalrevolt/factor-practice/blob/master/images/sprites/sprites.factor
>>
>> A small test program using these words is present here:
>>
>> https://github.com/rationalrevolt/factor-practice/blob/master/sprite-test/sprite-test.factor
>>
>> If these are useful, could someone recommend a vocabulary that could
>> contain them? The words new-image-like and image-part could reside in
>> the images vocab. I'm not sure where the generate-sprite-sheet word
>> could fit in or if it is sufficiently useful to include.
>>
>> Thanks,
>> Sankar
>>
>>
>>
>> --
>> ___
>> Factor-talk mailing list
>> Factor-talk@lists.sourceforge.net
>> 
>> https://lists.sourceforge.net/lists/listinfo/factor-talk
>>
>
>
--
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911=/4140___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] ActiveX DLL

2015-02-19 Thread Joe Groff
Factor has a simple COM bridge which may help. Check out the windows.com
vocabulary.

On Thursday, February 19, 2015, John Sampson jrs@ntlworld.com wrote:

 Can third-party ActiveX DLL's be called from Factor? I have a
 proprietary program with a command interface in the form of an ActiveX
 DLL. The author
 intends it to be called from programs in Visual Basic 6 or Visual Basic
 .NET, but I can make it work from Python programs as well.

 Regards

 John Sampson


 --
 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=190641631iu=/4140/ostg.clktrk
 ___
 Factor-talk mailing list
 Factor-talk@lists.sourceforge.net javascript:;
 https://lists.sourceforge.net/lists/listinfo/factor-talk

--
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=190641631iu=/4140/ostg.clktrk___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] What exactly is the retain stack?

2014-05-16 Thread Joe Groff
On Fri, May 16, 2014 at 7:38 AM, Björn Lindqvist bjou...@gmail.com wrote:

 2014-05-16 0:29 GMT+02:00 Jon Purdy evincarofaut...@gmail.com:
  Is that it's only use? Then why? dip can easily be formulated using
  non-retain stack using primitives:
 
  For example: a b c [ append ] dip - a b c -rot append swap
 
 
  That implementation assumes the quotation takes two operands and
  produces one result, which is not always the case. More generally, the
  functional argument of “dip” is not really supposed to be able to
  touch the argument it’s operating under. If you don’t have types or a
  stack checker enforcing this, the formulations with a retain stack or
  dynamically composing quotations are safe by construction, but the
  “-rot” version is not. Consider “[ 3drop ] dip” or “[ append dup ]
  dip”.

 But factor *does* have a stack checker. Since the stack effect of the
 quotation given to dip can be inferred, you can always (I think?)
 rewrite them using nothing but normal stack shuffling operations. Like
 so:

 : make-shuffle-effect ( n dir -- effect )
 swap 1 + iota swap dupd rotated [ array ] bi@ effect ;

 : emit-dip ( quot -- )
 dup infer
 [ nip in length -1 make-shuffle-effect , \ shuffle-effect , ]
 [ swap , , \ call-effect , ]
 [ nip out length 1 make-shuffle-effect , \ shuffle-effect , ] 2tri ;

 : rewrite-dip ( quot -- quot' )
 first2 drop [ emit-dip ] [ ] make ;

 [ [ append over ] dip ] rewrite-dip will output the quotation:

 [
 ( 0 1 2 3 -- 3 0 1 2 ) shuffle-effect
 [ append over ] ( x x x -- x x x ) call-effect
 ( 0 1 2 3 -- 1 2 3 0 ) shuffle-effect
 ]

 Now neither shuffle-effect nor call-effect are Factor primitives but
 they easily could have been and then dip would only need to touch the
 data stack.


There are still escape hatches from the static checker, like
'with-datastack', 'clear', 'execute( -- )', etc., and before the compiler
comes online, the VM JIT uses a dynamic stack model. The retain stack could
however be folded into the callstack, as is traditionally done in Forth,
since even the dynamic stack model relies on retain stack balance being
preserved. That's one of those little optimizations we never got around to
doing.

-Joe
--
Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free.
http://p.sf.net/sfu/SauceLabs___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] OCR via docsplit in Factor

2014-02-08 Thread Joe Groff
On Sat, Feb 8, 2014 at 7:30 PM, CW Alston cwalsto...@gmail.com wrote:

 Hi -
 Ok, I've upgraded using factor-macosx-x86-32-2013-07-25-14-21.dmg,
 still Version 0.97. Same issue with Factor's which:

 IN: scratchpad USE: tools.which
 IN: scratchpad couchdb which .
 f

 IN: scratchpad python which .
 /usr/bin/python

 - The trouble appears to be with reporting my PATH properly, via getenv:

 IN: scratchpad USE: environment
 IN: scratchpad PATH os-env .
 /usr/bin:/bin:/usr/sbin:/sbin

 IN: scratchpad USE: unix.ffi
 IN: scratchpad PATH getenv .
 /usr/bin:/bin:/usr/sbin:/sbin

 IN: scratchpad \ getenv see
 USING: alien.c-types alien.syntax ;
 IN: unix.ffi
 LIBRARY: libc FUNCTION: c-string getenv ( c-string name ) ;
 inline

 - Here's my actual PATH, as seen in the terminal:

 ➜  ~ git:(master) ✗ echo $PATH

 /usr/local/bin:/usr/local/opt/ruby/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/cwalston/factor:/Users/cwalston/bin:/usr/local/go/bin:/usr/local/lib/node_modules:/usr/local/narwhal/bin:/usr/texbin:/usr/X11/bin:/usr/local/sbin:/Users/cwalston/.gem/ruby/1.8/bin:/Applications/Mozart.app/Contents/Resources/bin

 - whereby which correctly finds couchdb:

 ➜  ~ git:(master) ✗ which couchdb
 /usr/local/bin/couchdb

 So, Factor's which (et al.) doesn't search beyond
 /usr/bin:/bin:/usr/sbin:/sbin.

 Reading through man getenv (GETENV(3), on OSX 10.6.8 ), doesn't give me
 a clue as to how to rectify this short-sightedness via the libc getenv.

 This is probably a side issue to my docsplit quandary (but maybe not).
 Anyone see a way to report my actual PATH to which in Factor? My PATH is
 augmented in my .zshrc. I don't understand why the libc function doesn't
 read it. Odd, indeed!

 If you're starting Factor from the Finder, you're not going to get a PATH
set from your .profile or other shell dotfiles, since UI apps are launched
under the loginwindow session and not under any shell. To set environment
variables for UI apps, try setting them in ~/.MacOSX/environment.plist:


https://developer.apple.com/library/mac/documentation/MacOSX/Conceptual/BPRuntimeConfig/Articles/EnvironmentVars.html

-Joe
--
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] building factor with mingw?

2013-09-28 Thread Joe Groff
You should build Factor for Windows using the platform SDK or Visual
Studio. Mingw isn't supported.

-Joe

On Saturday, September 28, 2013, michikaze wrote:

 Anybody know how? Can somebody write a makefile?


 --
 October Webinars: Code for Performance
 Free Intel webinars can help you accelerate application performance.
 Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most
 from
 the latest Intel processors and coprocessors. See abstracts and register 
 http://pubads.g.doubleclick.net/gampad/clk?id=60133471iu=/4140/ostg.clktrk
 ___
 Factor-talk mailing list
 Factor-talk@lists.sourceforge.net javascript:;
 https://lists.sourceforge.net/lists/listinfo/factor-talk

--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register 
http://pubads.g.doubleclick.net/gampad/clk?id=60133471iu=/4140/ostg.clktrk___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] A Factor tutorial

2013-07-09 Thread Joe Groff
On Tue, Jul 9, 2013 at 4:35 AM, Björn Lindqvist bjou...@gmail.com wrote:

 I didn't know that was a convention! Is there any page in the manual for
 special characters? ? obviously indicates a boolean predicate but
 what about the other characters? Would word be a setter for example?

 For example, I've tried implementing state using the namespaces vocab
 (which I'm not at all sure is right) and setter and getter words named
 set-pagesize and get-pagesize. But I thought long and hard whether
 set-pagesize should be called pagesize and get-pagesize
 pagesize instead.


Some naming conventions are documented under the Word naming conventions
section of this page:

http://docs.factorcode.org/content/article-conventions.html

-Joe
--
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831iu=/4140/ostg.clktrk___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] n-slice

2013-04-14 Thread Joe Groff
groups will give you a sequences-of-sequences view over an existing
sequence.

-Joe


On Sun, Apr 14, 2013 at 6:18 AM, mr w wzr...@gmail.com wrote:

 On Sun, Apr 14, 2013 at 9:10 AM, Samuel Tardieu s...@rfc1149.net wrote:
 
 
 
  2013/4/14 Boyko Bantchev boyk...@gmail.com
 
  On 14 April 2013 15:03, Samuel Tardieu s...@rfc1149.net wrote:
   If you start with a sequence of length 6, how do you split it into 4
   slices?
   1 1 1 3? 2 2 2 0? 3 2 1 0?
 
  I would think of 2 2 1 1, which is monotonically non-increasing and
  has minimal variation.
 
 
  My point was that there isn't a one-suits-them-all solution for grouping
 an
  arbitrary sized sequence into a fixed number of slices.

 Yeah, good point.

 Say we limit the input to sequences of length n^2.

 Then there should be a one-suits-them-all solution.

 Just not sure what it is.


 --
 Precog is a next-generation analytics platform capable of advanced
 analytics on semi-structured data. The platform includes APIs for building
 apps and a phenomenal toolset for data science. Developers can use
 our toolset for easy data analysis  visualization. Get a free account!
 http://www2.precog.com/precogplatform/slashdotnewsletter
 ___
 Factor-talk mailing list
 Factor-talk@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/factor-talk

--
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis  visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] optimizing refactorer

2013-04-10 Thread Joe Groff
There's an implementation of Pattern matching as inverse in the 'inverse'
vocabulary.

-Joe


On Tue, Apr 9, 2013 at 9:05 PM, leonard leonard14...@gmail.com wrote:

 On Tue, Apr 9, 2013 at 11:59 PM, John Benediktsson mrj...@gmail.com
 wrote:
  Apologies for thinking out loud.
 
 
  Not a problem!
 
  Keep thinking and contributing!

 Pattern matching as function inverse could be an example.

 For example, swap swap is a noop.


 --
 Precog is a next-generation analytics platform capable of advanced
 analytics on semi-structured data. The platform includes APIs for building
 apps and a phenomenal toolset for data science. Developers can use
 our toolset for easy data analysis  visualization. Get a free account!
 http://www2.precog.com/precogplatform/slashdotnewsletter
 ___
 Factor-talk mailing list
 Factor-talk@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/factor-talk

--
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis  visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] using PREDICATEs

2013-03-08 Thread Joe Groff
On Friday, March 8, 2013, Loryn Jenkins wrote:

 I was playing around with predicates today.

 It seems that when I attempt to run a default constructor directly on a
 predicate type, I get a macro expansion error.

 I quickly grepped through the codebase in basis and extras, and couldn't
 find an instance where a constructor was used off a predicate class.

 Can I assume that predicate types are not intended to be instantiated
 directly? Or am I assuming that erroneously?


Indeed, a predicate type isn't a concrete type, and it doesn't really make
sense to construct one. C: is intended to be used only for concrete TUPLE:
types. It's a bug that it appears to work on non-tuples.

-Joe
--
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester  
Wave(TM): Endpoint Security, Q1 2013 and remains a good choice in the  
endpoint security space. For insight on selecting the right partner to 
tackle endpoint security challenges, access the full report. 
http://p.sf.net/sfu/symantec-dev2dev___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Iterating over arrays and string

2013-01-20 Thread Joe Groff
On Sun, Jan 20, 2013 at 8:20 AM, Alex Vondrak ajvond...@gmail.com wrote:

 and noticed the same types being inferred (object vs string).  So, looking
 at the definitions,

   IN: scratchpad \ array see
   USING: sequences ;
   IN: arrays
   : array ( seq -- array ) { } clone-like ;
   IN: scratchpad \ string see
   USING: sequences ;
   IN: strings
   : string ( seq -- str )  clone-like ; inline

 we notice that array isn't inlined, while string is.  So perhaps the type
 information of array isn't getting propagated because it's not inlined?


That's it. Inlining `array` makes `{ } like` propagate its type as you'd
expect.

-Joe
--
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/learnmore_123012___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Iterating over arrays and string

2013-01-19 Thread Joe Groff
On Sat, Jan 19, 2013 at 5:35 PM, Jon Harper jon.harpe...@gmail.com wrote:

 Here are my questions:
 1) in bar1,  like is enough to allow the compiler to infer type and
 generate code using string-nth-fast and set-string-nth-fast instead of
 nth-unsafe and set-nth-unsafe (just like using TYPED: in bar2); However, in
 foo1, { } like is not enough (but TYPED: in foo2 works). Is this normal ?


This is a bug. It should know that `M\ array like` returns an array. (Why
it's unable to infer that from the definition isn't immediately obvious to
me—from the definition of `M\ array like` it seems to me it ought to.)
Monkey-patching an `{ array } declare` onto the end of the method makes it
optimize as you'd expect.


 2) in bar5, calling baz prevents the compiler from infering the type when
 mapping, although it clearly outputs a string. Inlining it makes the
 compiler infer again. But when the word you are calling before mapping is
 from the library (for example reverse, which uses the pattern  [ X ] keep
 like), you can't inline it, so this prevents optimization of pipeline
 code that can't change the type of the data (this would only apply to final
 classes like strings or arrays, or else the output of like might be a
 subclass).


Factor's compiler doesn't propagate types across non-inlined call
boundaries in the general case, so unless you call one of the words the
compiler knows about (or a word that inlines down to known words), the type
information of the outputs disappears. TYPED: is probably your best bet if
you want static type optimization without inlining.

-Joe
--
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/learnmore_123012___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] OpenGL version in OSX

2012-10-13 Thread Joe Groff
On Sat, Oct 13, 2012 at 8:27 AM, PGGB grizzlysc...@gmail.com wrote:
 I have encountered a new problem.
 Generating and binding vertex arrays seems to be broken with core-profile. 
 The problem is that in core-profile it needs to use gl3.h and not gl.h (I had 
 the same problem with GLFW in C++) which I assume is the source of the 
 problem.

 Any ideas how to fix that?

The header only affects what symbols are visible to a C program; the
underlying entry points are the same from Factor's point of view. The
problem in Factor is that it tries to substitute equivalent extension
functions where it can, because under compatibility profile the
extensions are usually equivalent to the standardized. However, in the
case of a core profile context, only the standard entry points are
available. Unfortunately, Apple made the annoying decision to have it
so only `glBindVertexArrayAPPLE` works in compatibility profile, and
only `glBindVertexArray` works in core profile. Since until now Factor
only supported the compatibility profile, it favors the extension
entry points over the standard ones. You can flip it around by going
into `opengl.gl.extensions` and modifying the `GL-FUNCTION:` syntax
word's implementation to `prefix` rather than `suffix` the standard
name to the list of candidates it checks:

```
SYNTAX: GL-FUNCTION:
gl-function-calling-convention
scan-function-name
{ expect } parse-tokens over prefix ! -- was suffix
gl-function-counter '[ _ _ gl-function-pointer ]
; scan-c-args define-indirect ;
```

You'll probably have to re-bootstrap for that to take effect. A
longer-term fix would be for the `gl-function-pointer` code to detect
whether it's currently running in a core or compatibility context and
adjust its behavior appropriately.

-Joe

--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] OpenGL version in OSX

2012-10-12 Thread Joe Groff
On Fri, Oct 12, 2012 at 1:04 PM, PGGB grizzlysc...@gmail.com wrote:
 Thanks so much, I missed that bit!
 It is working now, if I can get the core-profile to work it will be perfect. 
 :)

Does your graphics card driver actually support 3.2? IIRC Apple only
supports 3.2 for the discrete nVidia/AMD GPUs and the latest-gen Intel
graphics, listed on
https://developer.apple.com/graphicsimaging/opengl/capabilities/ .

-Joe

--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] OpenGL version in OSX

2012-10-12 Thread Joe Groff
On Fri, Oct 12, 2012 at 1:24 PM, PGGB grizzlysc...@gmail.com wrote:
 Yes it does, it is a Geforce 9400M. I have been using OpenGL 3.2 in C++ code 
 before.

OK, just making sure. Because of some limitations of the
metaprogramming features the ui.pixel-formats code uses, you may need
to force-reload the `ui.pixel-formats` and `ui.backend.cocoa` modules
you edited over the automatic-reloading Factor's UI performs in order
to get the code up to date after changing the pixel format table. To
be safe, try rebootstrapping from source if you haven't already.

-Joe

--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] OpenGL version in OSX

2012-10-12 Thread Joe Groff
On Fri, Oct 12, 2012 at 2:09 PM, PGGB grizzlysc...@gmail.com wrote:
 I did 'build-support/factor.sh bootstrap' but it still gives me the same 
 error.
 When I add core-profile to my gl-tut program I get another error:

 T{ gl-error { code 1280 } { string Invalid enumerant } }

That's probably because the Factor gadget system makes pretty heavy
use of OpenGL 1.1 calls that aren't available in the core profile. The
core profile is definitely not going to work with the gadget
system—you'll need to subclass the world object that represents the
window and GL context directly. See terrain for an example of how to
do this. Even then, there are possibly compatibilty profile
dependencies in the basic window management code. It'd be great if you
could get core profile to work, but I think the least-resistance path
would be to use 2.1 with extensions. GLSL 1.20 with `#extension
GL_EXT_gpu_shader4` and `#extension GL_EXT_geometry_shader4` is mostly
equivalent to GLSL 1.50.

-Joe

--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] OpenGL version in OSX

2012-10-12 Thread Joe Groff
On Fri, Oct 12, 2012 at 2:32 PM, PGGB grizzlysc...@gmail.com wrote:
 I've made big progress! I googled for the invalid-pixel-format-attributes 
 error on a whim and I ended up on some Java forum. Apparently the 
 core-profile flags clash with the windowed flag. Removing that I can create 
 now a window where

 [ gl-version . ] into-window

 reports 3.2 and all the other usual GL functions work as well. I am very 
 happy about this!

Excellent! Good to know you can set up a standalone window in core
profile and have it work in the Factor UI. When you're ready to move
up from messing with null-world in the listener, you can subclass
world and implement these generics to control the window's behavior:

```
TUPLE: null-world  world ;
M: null-world begin-world drop ;
M: null-world end-world drop ;
M: null-world draw-world* drop ;
M: null-world resize-world drop ;
```

There's also a `game-world` base class that provides some integration
with Factor's various game libraries, like the game loop, raw
keyboard/mouse/gamepad input, and audio engine. The terrain demo
uses this directly with raw OpenGL; there are additional demos in
gpu.demos.* that use game-world with a higher-level thick binding
library over OpenGL.

-Joe

--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] OpenGL version in OSX

2012-10-11 Thread Joe Groff
On Thu, Oct 11, 2012 at 8:39 AM, PGGB grizzlysc...@gmail.com wrote:
 I've been messing around with Factor the last couple weeks and it is a lot of 
 fun. At the same time I am learning some graphics programming with OpenGL. 
 Now even though version 3.2 was added with Lion, the windows Factor creates 
 only seem to allow version 2.1.

 I was looking for a way to add the required flag but my knowledge of both 
 Cocoa and Factor is to small to really know what I am doing. Does anyone have 
 any suggestions?

OS X only supports core profile OpenGL 3.2, so to get a 3.2-capable
context, you have to ask for one explicitly by initializing the
NSOpenGLPixelFormat with these attributes:

```
NSOpenGLPixelFormatAttribute pfa[] = {
/* ... other attributes ... */
NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core,
0
};
```

You could make this work in Factor by adding a `core-profile` symbol
to `ui.pixel-formats`, and updating `ui.backend.cocoa` to use those
pixel format attributes. You could then create a core profile window
with this code:

```
USE: ui.gadgets.worlds.null
world-attributes
Core Profile World title
null-world world-class
{
windowed
double-buffered
backing-store
T{ depth-bits f 24 }
core-profile
} pixel-format-attributes
{ 512 512 } pref-dim
f swap open-window*
```

That will open a window and leave the window object on the listener's
stack. You can then use `into-window` to send GL commands to the
window interactively:

```
dup [ 1.0 1.0 0.0 0.0 glClearColor GL_COLOR_BUFFER_BIT glClear ] into-window
```

Note that, although compatibility profile contexts in OS X report 2.1,
on most 3.2-capable graphics cards, all of the 3.2 features are also
supported by ARB extensions to 2.1, and Factor's OpenGL binding is
smart enough to substitute ARB or EXT entry points for standardized
entry points when the standard entry points are unavailable. If you
can't get core profile mode to work, you should be able to write 3.2
code and have it still just work, if your graphics driver supports
3.2.

-Joe

--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Mac OS X

2012-10-02 Thread Joe Groff
On Tue, Oct 2, 2012 at 3:47 PM, Brian Prentice bprent...@webenet.net wrote:
 The page here:

 http://factorcode.org/

 States that Factor applications are portable between all common platforms,  
 but the stable release of Factor 0.95 requires Mac OS X 10.5 Leopard.

 Apple has released three new versions of OS X since Leopard, namely Snow 
 Leopard,  Lion and Mountain Lion and most users no longer run Leopard.

Leopard is a minimum requirement. Factor should also build and run on
any version since.

-Joe

--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Comments on 'Your First Program

2012-08-31 Thread Joe Groff
On Fri, Aug 31, 2012 at 5:19 PM, Michael Clagett mclag...@hotmail.com wrote:
 Just thought I would mention that there is no Ctrl key on the Mac, so this
 change might not be so good for the Mac folks.

Yes, there is. (Unless you mean the original Mac 128k and 512k, which
Factor does not yet support.)

-Joe

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Comments on 'Your First Program

2012-08-31 Thread Joe Groff
On Fri, Aug 31, 2012 at 6:25 PM, Michael Clagett mclag...@hotmail.com wrote:
 I just meant that it's not called control, it's called command.  So you
 could probably get by with something like Ctrl(Cmd)-C.  Or Cmd(Ctrl)-C, if
 you favor Macs.  Or you could stick with the C-c and just explain somewhere
 at the top that on a PC that means Control and on a Mac it means Command.
 Not a big deal, just thought you might want to make it completely clear to
 everyone.

Ctrl and Cmd are different keys.

-Joe

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Comments on 'Your First Program

2012-08-31 Thread Joe Groff
On Fri, Aug 31, 2012 at 6:33 PM, Michael Clagett mclag...@hotmail.com wrote:
 Okay, never mind.   Not being a Mac guy, I must not understand it well
 enough.   But on my wife's and daughter's MacBook Pros I usually find that
 Command + some key is roughly equivalent to Ctrl + the same key on the PC.
 Never noticed that there was also a Ctrl key.  Sorry for the noise.

Well, to address your concern about platform-specific bindings: The
Factor documentation markup has rules for displaying command keyboard
shortcuts by command name, so that the key bound to a command is
displayed. On OS X it even uses the funny symbols for
shift/ctrl/option/cmd. The Factor UI doesn't currently have many
platform-specific bindings, instead preferring the one-size-fits-none
approach, but if it did, the help system is ready for it.

-Joe

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Literate Programming

2012-08-29 Thread Joe Groff
On Wed, Aug 29, 2012 at 12:22 PM, John Benediktsson mrj...@gmail.com wrote:
 I just pushed a vocab with some ideas that might help you get started:

 USE: literate

 LITERATE

 This is a section that is mostly text... you can even include factor stuff
 that doesn't get parsed like the following:

 : does-this-work? ( -- x ) no it doesn't! ;

 But, then if you want to run some code, you can do this:

 : this-totally-works! ( -- x ) 12345 ;

 And then some more text, for fun...

 LITERATE

 Try it and you'll see that the first definition is ignored, but the second
 is parsed:

 IN: scratchpad \ does-this-work? see
 No word named “does-this-work?” found in current vocabulary search path

 IN: scratchpad \ this-totally-works! see
 : this-totally-works! ( -- x ) 12345 ;

 Is something like this what you're looking for?

It would be cool to be able to extend the vocab loader with file
extension associations, each with a different default syntax and lexer
environment. `.factor` would of course be associated with the core
`syntax` and `lexer`, but you could then have for example `.lfactor`
files be searched for and loaded as if implicitly inside LITERATE
LITERATE tags. Other languages we've implemented as factor syntax
extensions, such as peg, infix, lisp, and smalltalk, could also have
top-level associations.

-Joe

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Out of memory error

2012-08-25 Thread Joe Groff
On Sat, Aug 25, 2012 at 1:36 PM, Jim Mack j...@less2do.com wrote:
 In a way, too many possible culprits mask each other.

 I remember a problem like this that I solved by reducing the amount of
 memory so the problem would show quickly, then testing small things in
 isolation and volume.  Pick a subset of tests and run them multiple times at
 low memory until it fails or becomes clear it won't.   Rinse and repeat.

An out of memory error could also be caused by things other than a
lack of memory. If the heap is getting corrupted or there is a
compiler bug, the system could end up passing a garbage size to malloc
or mmap that is too big to be fulfilled.

-Joe

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Modules/packages for Factor

2012-08-24 Thread Joe Groff
On Fri, Aug 24, 2012 at 12:33 AM, Tim Allen screwt...@froup.com wrote:
 I'm no expert in these matters, but it worries me a little that you
 mention Ruby Gems as one potential inspiration: I know that (for
 example) Debian doesn't package many Ruby libraries because the Gem
 system interacts poorly with a system-wide package-manager. Other
 languages like Perl and Python seem to have tons of libraries packaged
 in Debian, so they might be better models.

I'd call this a plus, because Debian's update schedule is glacial, and
you don't want to be limited by your system package manager when
installing a library for yourself for a local project. Systems like
gem and npm let you easily install up-to-date packages at a user- or
project-local location without requiring admin access or coordination
with the system's update schedule.

 Having a image.factorimage file in a package might make life a bit
 complicated - aren't Factor images platform specific? What happens if
 somebody launches the Factor VM from inside the package directory but
 the image is for a different architecture?

Images would not be distributed with packages. `image.factorimage`
would just be a standard default location for `save-image` and image
loading during package development.

-Joe

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Modules/packages for Factor

2012-08-24 Thread Joe Groff
On Fri, Aug 24, 2012 at 2:56 PM, P. uploa...@gmail.com wrote:
 Here's an unpopular vote, but I'll say it anyway.
 How about portable packages?
 As in, if you download package P that is dependent on packages D, E, F, then
 package P comes with the correct versions of D, E, F embedded in it?
 That way we do away with dependencies altogether.
 (yes, there'll be redundancy for the sake of convenience. I don't know the
 implications re compiling)

As Doug noted, generally you don't want to bundle dependencies.
However, I believe the proposed would handle this use case if you
really wanted to, since you could distribute a populated `packages`
subdirectory inside your top-level package's distribution.

-Joe

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Modules/packages for Factor

2012-08-24 Thread Joe Groff
On Fri, Aug 24, 2012 at 3:05 PM, P. uploa...@gmail.com wrote:
 Hey Doug, thanks for the link, I'll read it when I'm not at work. (oops :P)

 What about mimicking something like OCaml's functors or whatever they call
 their dependency interfaces?

An idea I had was to use test suites to describe dependencies. You
could say if this package implementation passes this test suite, then
it fulfills this dependency. Whether it's practical to write detailed
enough test suites in practice is a good question, but in theory it
could allow you to express implementation requirements in a more
flexible way than module signatures or version numbers.

-Joe

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Modules/packages for Factor

2012-08-24 Thread Joe Groff
On Fri, Aug 24, 2012 at 3:13 PM, P. uploa...@gmail.com wrote:
 Joe, I was looking for something more enforced than that - so that I can
 expect a package I download to just work and not waste time with
 dependence issues.

A package metadata file could perhaps have a `self-contained` flag
that would restrict the search path to only the package-local and
standard library directories.

-Joe

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Is there a Factor.js ?

2012-08-23 Thread Joe Groff
On Thu, Aug 23, 2012 at 11:46 AM, Michael Clagett mclag...@hotmail.com wrote:
 That, I would guess, is a result of its being implemented in C#.  But what
 you lose at that point is the ability for the language to be used outside of
 the CLR and the extreme portability of something like Factor.  What I'm
 envisioning is something closer to Microsoft's C++, which now has built-in
 support for generating MSIL, while still remaining completely viable on a
 native code platform.  Such a capability for Factor (with the ability to
 generate JVM byte code as well) would allow Factor to act as a DSL layer
 above real-world code bases that organizations are always going to be using
 for a significant portion of their development.

The JVM and CLR both have native code interfaces a Factor bridge could
take advantage of. I think that would be a more realistic avenue
toward interfacing with those platforms than rearchitecting Factor to
target the JVM or CLR directly.

-Joe

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Time for some Tutorials

2012-08-21 Thread Joe Groff
On Tue, Aug 21, 2012 at 9:27 PM, Market 0ne-Source.com
mar...@0ne-source.com wrote:
 Thanks,

 I did just that, that's when the compiler error popped up. Can the issue be
 over the version of the DLL ?

The error you posted is an OpenGL error and has nothing to do with
OpenAL. Are you using the latest OpenGL drivers for your platform?
That error appears to be a bug in your driver.

-Joe

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Any way of making sense of what's in the boot image?

2012-08-09 Thread Joe Groff
On Wed, Aug 8, 2012 at 9:56 PM, Michael Clagett mclag...@hotmail.com wrote:
 Hi Joe --

 Thank you so much for your guidance.  I'm assuming that it is the
 basis\bootstrap\image\image.factor and the core\bootstrap\primitives.factor,
 stage1.factor and syntax.factor that you are referring to?

 One question just to help me get oriented before I go into heavy
 head-twisting mode.  I notice that all these files have significant numbers
 of pre-existing vocabularies that they use.  If this is what is used to
 generate the early stage1 bootstrapping stuff, then am I correct to assume
 that this is done from some version of factor where all this stuff has built
 already from scratch (that would be the implication, if all these files are
 able to use those vocabularies)?  Or is there some other mechanism at work
 here that I should know about, and if so, is it written up anywhere that you
 know about.

 I have just read Slava's January 2010 post on the bootstrapping mechanism,
 so I understand the mechanism a bit better now, but am still thinking there
 has to be some Factor system somewhere that was built without a bootstrap
 image in order to have the vocabularies available that are used to generate
 the bootstrapping.  Is there anything anywhere documenting that aspect of
 the picture.  The reason I ask is that I would like to get a sense of how
 extensive that core fundamental set of vocabularies is that is needed to
 process the primitives and stage1 factor files.

 Here's the USING statement for primitives.factor:

 USING: alien alien.strings arrays byte-arrays generic hashtables
 hashtables.private io io.encodings.ascii kernel math
 math.private math.order namespaces make parser sequences strings
 vectors words quotations assocs layouts classes classes.private
 classes.builtin classes.singleton classes.tuple
 classes.tuple.private kernel.private vocabs vocabs.loader
 source-files definitions slots classes.union
 classes.intersection classes.predicate compiler.units
 bootstrap.image.private io.files accessors combinators ;
 IN: bootstrap.primitives

 It's got a lot of stuff there.  Is a lot of this built in the C++ code that
 constitutes the VM?  Or is some fundamental processing capability put into
 place that allows the processing of factor files to build these
 vocabularies?  And if so, is the factor source used also included in the
 downloaded platform?  Or was this a special primordial code base that was
 used once and never really needed again?

Although core/bootstrap/primitives.factor is in core/, it's not
actually loaded as-is into the boot image; it's really a script
designed to run as part of `make-image` in the host image. All of
those modules are loaded and run in the host image. While there of
course had to have been a primordial Factor that could boot itself, I
think it would be too different now to resemble current Factor.
Factor's bootstrapping loop evolved somewhat organically.

You can tell whether a word is a C++ primitive by `see`ing it in the
listener. Primitive words show up as `PRIMITIVE:` when prettyprinted.

At a high level, `make-image` has two stages: First, it executes
`core/bootstrap/stage1.factor`, which runs 'bootstrap/syntax.factor`
to transfer the basic syntax from the host image to the boot image,
`bootstrap/primitives.factor` to set up primitive words corresponding
to VM primitives, and a CPU-specific `basis/cpu/*/bootstrap.factor`
script to assemble sub-primitives which are blobs of assembly
language code composed by the VM's compiler. It also composes a
startup quotation to begin the second stage of bootstrap when the boot
image is started. Second, after the bootstrapping elements have been
loaded, it serializes the data structures loaded by the bootstrap
scripts into a boot image. Again, it does this without help from the
VM, though it does borrow some knowledge of layouts from the compiler
and other Factor libraries.

 P.S.   Incidentally, while I am on the subject, I find myself able to trace
 through the VM startup code in Visual Studio with no problem at all, until I
 get to the factor_vm::c_to_factor, which wraps a c-to-factor sub-primitive
 inside of a callback stub and then invokes that function.  On both a Windows
 7 platform and a Windows Server 2008 platform, my Visual Studio blows up
 when the callback address loaded into EDX is called.  Anybody ever
 encountered this and any idea how to get around it?

Factor code doesn't follow the C calling convention so it's unlikely
that a debugger will be able to walk a stack with Factor frames. In
recent versions of Factor you can trigger Factor's own low-level
debugger with ^C, which will let you backtrace and step through Factor
frames.

-Joe

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint 

Re: [Factor-talk] Any way of making sense of what's in the boot image?

2012-08-08 Thread Joe Groff
On Wed, Aug 8, 2012 at 3:24 PM, Michael Clagett mclag...@hotmail.com wrote:
 Hi --

 I've been tracing through the initial vm initialization code trying to get a
 picture of how Factor bootstraps itself.  Does anyone know if there is a way
 to resolve code in the initial boot image that is being jit-compiled by
 factor_vm::prepare_boot_image to a set of symbolic names that can give a
 hint as to what functionality is included there?  I'm trying to get a sense
 of the minimal functional set included here that allows higher-level initial
 code to be compiled.  The comment on prepare_boot-image says /* Compile
 code in boot image so that we can execute the startup quotation */.  It
 would be nice to know what this code includes.  My guess is that the answer
 is no, there is no way and that one just has to be in possession of
 whatever code generated it (and there's nothing to say that this was even a
 Factor system that did this in the first place; could have easily been some
 C++ code that just knew what bits to emit).

 But it never hurts to ask...

 Presumably if I proceed past this to a point where actual Factor code is
 being parsed and compiled, I'll be able to get a feel for what primitives
 are already being depended on?  Or maybe not.  Maybe it's just a big bang
 where earlier word definitions can depend on later word definitions having
 been initialized before they start their execution.  Is mine a hopeless
 effort?  Would be nice to know before I suck up too much time with it.

 Thanks for any guidance anyone can provide.

 Regards,

 Mike

The code in the bootstrap.image module outputs the bootstrap image as
a binary blob. You can get a sense for the format of the bootstrap
image and its contents by looking at that module.

-Joe

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Any way of making sense of what's in the boot image?

2012-08-08 Thread Joe Groff
On Wed, Aug 8, 2012 at 8:23 PM, Joe Groff arc...@gmail.com wrote:

 The code in the bootstrap.image module outputs the bootstrap image as
 a binary blob. You can get a sense for the format of the bootstrap
 image and its contents by looking at that module.

To clarify, by output as a binary blob I mean the code in
bootstrap.image doesn't have any special help from the VM—it just
generates a byte array whose contents resemble a Factor image and
outputs that to a file. It could be transliterated to another language
and still generate a valid boot image.

-Joe

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Factor on multicores

2012-05-30 Thread Joe Groff
On May 29, 2012, at 11:47 PM, Konrad Hinsen konrad.hin...@fastmail.net
wrote:


Is there support for memory-mapped files? I'd have to be able to create data
structures in such memory areas.


Yes. Factor has a full-featured C FFI, and you can define and use structs
and packed arrays that live in mapped or malloced memory. There are however
no atomic or synchronization primitives implemented, which you would want
for using memory mapped files as shared memory.


Is there a technical reason for not having better thread support, or is
it just something that nobody got around to do yet? At first sight, the
language seems well adapted to parallelism: give each thread its own
data stack, and use immutable data structures at the interfaces. If the
VM could enforce the immutable data structures at the interfaces rule,
it wouldn't have to worry about data access synchronization at all.


If Factor were to gain concurrency support, this would probably be the best
model to use. Even an immutable shared heap would still require some fairly
substantial VM infrastructure improvements.

-Joe
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Factor on multicores

2012-05-29 Thread Joe Groff
On May 29, 2012, at 12:42 PM, Konrad Hinsen konrad.hin...@fastmail.net wrote:

 What I couldn't figure out is how Factor programmers deal with
 today's multicore processors. Threads are apparently cooperative,
 so that's not the answer. That leaves communicating processes
 as an option, but is there some support library?

Factor doesn't really handle multicore. There is some half finished
code to support a one-VM-per-thread model, each with its own heap, but
the benefits over simply using processes would be minimal. You may be
able to leverage the IPC features of io.launcher with a serialization
mechanism of some sort to build programs that share data across
processes.

 I also wonder if there are any real-life applications that one could
 learn from. I know the Factor compiler is written in Factor, but I am
 not a compiler expert so that is not the best example for me to look
 at. Are there any other Factor applications floating around?

Factor's continuous integration system and the web server that runs
all of the web applications on concatenative.org and factorcode.org
are also written in Factor.

-Joe

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Beginner question about style and stack shuffling

2012-03-12 Thread Joe Groff
On Mon, Mar 12, 2012 at 6:00 AM, nicolas.o...@gmail.com
nicolas.o...@gmail.com wrote:
 I quite like the style of something along the lines of:

 : swap-element ( i1 array1 i2 array2 -- )
  [  [ nth  ] 2keep  ] 2bi@  [ set-nth ] 2 smart-apply ;

 because it shows the dataflow better than with lexical variables.

Instead of collecting piles of related values on the data stack and
using n-ary variants of dataflow words, dataflow often becomes clearer
when you construct an object to contain related values. In your
swap-element case, each index-array pair could each be collected into
an `array-ref` object. After defining some operations on `array-ref`s,
the swap functionality becomes much easier to express (aside from the
somewhat awkward `bi-curry bi*` necessary to express transposed 2x2
dataflow):

```
TUPLE: array-ref index array ;
C: array-ref array-ref
: array-ref ( array-ref -- index array )
[ index ] [ array ] bi ;
: get-ref ( array-ref -- elt )
array-ref nth ;
: set-ref ( value array-ref -- elt )
array-ref set-nth ;

: swap-refs ( x-ref y-ref -- )
[ [ get-ref ] bi@ swap ] 2keep
[ set-ref ] bi-curry bi* ;
```

--
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Learning Factor - string, array and io handling - beginner

2012-03-11 Thread Joe Groff
 I am still not clear on the use of USE: or USING: when I am coding in SciTE 
 and
 copying and pasting to the Listener. Also, now that I have a working bunch of
 code lines, I would like to be able to execute it, but when I type 'filename
 run' or 'filename load' it faults. I know I need t define a MAIN entry 
 point,
 and possibly turn my code into one big word (starting with : and ending with
 ;, or vocabulary, but I am not sure how yet.

USE: is for importing a single module, as in `USE: foo`. It's
primarily intended as a shorthand for interactive use. In source code
you should always write out USING: as in `USING: foo bar ;`.

 To continue with this task, I now need to figure out how to process a 
 directory
 of csv files, extract the same bits as above and append them in one big csv 
 file
 like so:

 24/02/2012,1029,998
 22/02/2012,1803,1799
 and so on...

 The big directory of csv files was created by running a Windows shell command,
 and then a Python OpenOffice-to-csv script from original Excel xls files. I
 would love to re-create that part by using only Factor.

 After I complete the task, I really want to go back over the code above and 
 see
 if I can make it more 'elegant' or 'Factorish'.

To iterate over the files in a directory, I would recommend looking at
the `with-directory-files` function, which will change to a directory
then call a quotation with a sequence containing the names of the
files in that directory. You should be able to just use `each` to
apply your existing code over that sequence.

-Joe

--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Trying factor

2012-02-21 Thread Joe Groff
On Tue, Feb 21, 2012 at 1:52 AM, Yuri D'Elia wav...@users.sf.net wrote:
 I've cloned git master directly.

What video card and drivers are you using? Do the demos work with
OpenGL acceleration disabled?

-Joe

--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Teaching myself Factor - code review, please?

2012-02-20 Thread Joe Groff
You could use `each-morsel` from the io module to implement the input
loop, which would be a bit cleaner. Try laying your code out something
like this:

: each-window ( quot: ( index packet -- ) -- )
[ WINDOW read ] each-morsel ; inline

: main ( -- )
binary decode-input binary encode-output
[ format-packet write ] each-window
eot-packet write ;

-Joe

--
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Trying factor

2012-02-20 Thread Joe Groff
On Mon, Feb 20, 2012 at 6:49 AM, Yuri D'Elia wav...@users.sf.net wrote:
 I'm just trying them at work here and I have the same issue, so maybe there 
 is a problem with the examples themselves?

If you're using 0.94, try upgrading to git master.

-Joe

--
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] A word that lets me ommit stack comments

2011-12-18 Thread Joe Groff
On Sun, Dec 18, 2011 at 2:32 PM, P. uploa...@gmail.com wrote:

 I've wondered the same. Theoretically, since Factor can infer stack
 effects, one should be able to leave them out.


Stack effects can't be fully inferred in a safe manner. I forget the full
details, but somewhere in the archives or his blog, Slava explains why
stack effects are mandatory. Also, reading source code without declared
stack effects is a few orders of magnitude more difficult, and writing it
is more bug-prone.

-Joe
--
Learn Windows Azure Live!  Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for 
developers. It will provide a great way to learn Windows Azure and what it 
provides. You can attend the event by watching it streamed LIVE online.  
Learn more at http://p.sf.net/sfu/ms-windowsazure___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] More than one obj quot recovery

2011-12-05 Thread Joe Groff
On Mon, Dec 5, 2011 at 8:50 AM, Michele Pes mp8...@rambler.ru wrote:

 Hi!
 In my latest factor source, I encountered copy-file, which takes 2 input
 strings.
 At first I used recover, but the try quot takes 1 argument only.


recover's try quotation can take any number of inputs. ..a in a stack
effect represents zero or more values, the number of which must match other
..a in the same effect.

-Joe
--
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] listener color theme

2011-12-05 Thread Joe Groff
On Mon, Dec 5, 2011 at 11:20 AM, L N leonardne...@gmail.com wrote:

 Anyone know how to change the color theme of the listener, in linux?

  - Leonard


You can't change the color scheme without hacking the source code.
ui.gadgets.worlds:initial-background-color controls the background color,
while individual methods on prettyprint.stylesheet:word-style control how
each word is formatted in the listener.

-Joe
--
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Weird behavior on button-up

2011-11-21 Thread Joe Groff
On Mon, Nov 21, 2011 at 1:21 PM, Ben Schlingelhof b...@benseins.de wrote:

 Yeah, I agree. Special events would be wonderful. Factor does not seem to
 have them, though. There's a drag gesture, but that is only for
 motion-while-button-down, not for the drop itself. I'll have to accept that
 button-up does not work and find some workaround. The price one has to pay
 for working with a newish language.


The UI was pretty much developed only for the developer tools and is pretty
YAGNI all around, so you'll probably find it deficient in a lot of ways.
You may want to use the gtk, cocoa, or win32 bindings to create a native UI
if it doesn't meet your demands.

-Joe
--
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Weird behavior on button-up

2011-11-21 Thread Joe Groff
On Mon, Nov 21, 2011 at 1:33 PM, Ben Schlingelhof b...@benseins.de wrote:

 Yes, I understand. I could learn cocoa and win32 apis but that's a lot of
 work for one guy and my customers are an impatient bunch. Also these apis
 seem not to be supported very high-level on the factor side either, or am I
 overseeing something?


There aren't high level wrappers per se, but the Cocoa and GTK APIs are
already fairly high-level, and there are general utilities to ease resource
management with Objective-C and GObject objects. Both bridges are fairly
complete; the Cocoa bridge uses the Objective-C runtime to automatically
generate class and method bindings, and the GObject libraries automatically
generate bindings from the upstream XML API descriptions.

-Joe
--
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Where can I get this Factor Listener?

2011-11-19 Thread Joe Groff
On Sat, Nov 19, 2011 at 5:16 AM, missingfaktor
rahul.phulore@gmail.comwrote:

 Where can I get the Factor Listener used in this video:
 http://www.youtube.com/watch?v=f_0QlhYlS8g?

 The one I downloaded from the project site is different and less
 convenient to use.


The listener you get now is the same one as in the video. The only
difference from the video is how the data stack is displayed. I think it
was changed so that the data stack would also be displayed during terminal
listener sessions.

-Joe
--
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] group-by word

2011-11-19 Thread Joe Groff
You can look at math.statistics:collect-by as a reference:

USE: math.statistics

{ hello hola ball scala java factor python } [ length
] collect-by
--
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Shared libraries considered harmful

2011-11-17 Thread Joe Groff
On Thu, Nov 17, 2011 at 6:36 AM, Michael Clagett mclag...@hotmail.comwrote:

 That brings a cost, however, as I've seen up to this point.  It
 distributes responsibility for documenting behavior across a community that
 like most communiteis is uneven in its fulfillment of responsibility.  The
 greater the dependency on just read the code to figure out what's going
 on, the greater the barrier to entry to newcomers.  I have talked to more
 than one such person who has come to take a look and turned away for this
 very reason.  The power and flexibility is tremendous, no question.  But
 power and flexibility aren't always the only thing you need.


This is definitely a problem, and a similar problem afflicts most languages
that rely heavily on metaprogramming, such as Lisps and even C++. The
common substrate is too thin, and different users' code looks too different
to easily read or interoperate with. Factor at least benefits from having a
relatively small community and a well-centralized code base, so when we do
promote idioms and libraries to the core language it's easier for us to
propagate those benefits across all the bundled code. That said, being a
small community, we also lack the free hands to keep the documentation
polished and accessible to newcomers a lot of the time.


  But wouldn't it be nice to have a platform that offers the power and
 flexibility of Factor that also plays nicely with OSes and other runtime
 environments?


I think Factor goes much further than most languages of its kind in
integrating with the host platform. Unlike Smalltalks, the canonical source
code isn't hidden in the image, and you can use your own text editor. More
OS features have bindings and bundled high-level APIs than your typical
Lisp or Scheme. The UI doesn't pretend to be a desktop in and of itself
(though granted, it still uses goofy non-native widgets). Deployed programs
aren't tens of megabytes in size. What do you feel is lacking in this
regard? Maybe I misunderstand your notion of integrating.

-Joe
--
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Abstraction like Clojure's protocols?

2011-11-17 Thread Joe Groff
On Thu, Nov 17, 2011 at 12:44 PM, missingfaktor rahul.phulore@gmail.com
 wrote:

 Factor's generic words are similar to Clojure's multimethods. However
 there are times when protocols (in Clojure speak) are more appropriate
 abstraction. Does Factor support a construct similar to protocols?


There is a protocol construct used by the delegation mechanism, which
groups together related generics:

GENERIC: succ ( n -- n' )
GENERIC: pred ( n -- n' )

PROTOCOL: enumerable succ pred ;

TUPLE: derived-enumerable from ;

CONSULT: derived-enumerable enumerable
from ;

It's not used as extensively in the Factor library as it perhaps should be.
In particular, protocols don't function as types.

-Joe
--
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] type-checking

2011-11-05 Thread Joe Groff
On Sat, Nov 5, 2011 at 11:35 AM, L N leonardne...@gmail.com wrote:

 Wondering if there is a way to do type-checking in Factor.

 Sorry for the inundation of questions.

 Factor is a fascinating new environment.

 Runtime type checking is provided by the `typed` module:

USE: typed

TYPED: f+ ( x: float y: float -- z: float ) + ;

1.0 2.0 + . ! = 3.0
1 2 + . ! error

The compiler doesn't yet detect type errors at compile time. We hope to
integrate type checking features more tightly into Factor's core in the
future.

-Joe
--
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] MetaCat

2011-11-05 Thread Joe Groff
On Sat, Nov 5, 2011 at 11:21 AM, L N leonardne...@gmail.com wrote:

 Wondering if Factor has something similar.


For trivial things like rewriting 'swap swap', we let the compiler's
optimizer deal with those. It performs many of those optimizations. To
implement your own compile-time transforms, you can use Factor's MACRO:
words. They return a quotation which replaces the macro call at compile
time:

MACRO: or ( -- quot )
[ [ t ] swap if ] ;

However, such things are rarely necessary since the compiler is good at
unraveling and optimizing higher-order functions already.

-Joe
--
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] conditional combinator proposal

2011-09-30 Thread Joe Groff

On Sep 30, 2011, at 2:53 PM, Michele Pes wrote:

 Hi to all!
 While writing my little factor programs, I often find a situation in
 which I have an object,
 I test it and if test is ok then some action is performed on it, else it
 is simply dropped.
 
 Ex.: (obj on top of stack)
 dup test-condition [ do something with obj ] [ drop ] if
 
 I think this would be better expressed this way: (always with obj on top
 of stack)
 [ do-test ] [ do-action-on-obj ] when-drop

The words if* and when* already do this:

do-test [ do-action-on-obj ] [ else ] if*
do-test [ do-action-on-obj ] when*

-Joe

--
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] building a native factor GUI toolkit

2011-09-29 Thread Joe Groff

On Sep 29, 2011, at 6:21 AM, Patrick Mc(avery patr...@spellingbeewinnars.org 
wrote:

 FLTK is small but is still 90,305 SLOC, so it would be a huge task to 
 port all the code to factor but if this was done I was thinking that it 
 might give the community something to build on. It sounds like factors 
 ability to reuse code is even greater then C++ so perhaps the factor 
 version would be smaller too and factor coroutines might work well 
 within a gui toolkit. It might be trivial for people to add new widgets 
 later.

Factor already has a native UI toolkit and bindings to Win32, Mac OS X, X11, 
and GTK. FLTK is a relic and should be put to pasture. Modern UI toolkits are 
intricate things, and writing yet another one won't help anybody.

-Joe
--
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Printing the docs

2011-09-18 Thread Joe Groff

On Sep 18, 2011, at 9:54 AM, Patrick Mc(avery patr...@spellingbeewinnars.org 
wrote:

 I would like a hard copy of the documentation and I asked for help on 
 the IRC last night and got some help:
 
  documentation is in **/*-docs.factor. you can run USE: help.html 
 generate-help to generate HTML help, which will give you the same thing 
 that's on docs.factorcode.org
 
 I tried to run this in the listener but if it generated the 
 documentation in a folder I can't find it.

It looks like the files are generated into temp/docs under the Factor 
directory.

-Joe

smime.p7s
Description: S/MIME cryptographic signature
--
BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Printing the docs

2011-09-18 Thread Joe Groff

On Sep 18, 2011, at 3:03 PM, Patrick Mc(avery patr...@spellingbeewinnars.org 
wrote:

 I'm not joking, I am thinking about factor at night when I dream, it's 
 absolutely fascinating but I am having a hard time learning it. With 
 most languages you can learn the core first and the libraries later, 
 with factor the line between the two is fuzzy and it seems like a full 
 blown effort is required. -Patrick

Trying to learn all the libraries before using Factor is like trying to learn 
all of CPAN before using Perl (or Hackage before using Haskell, or PyPI before 
using Python—pick your favorite). Try picking a problem to solve in Factor and 
you can learn the libraries as you go. As John recommended, the contents of 
core/ are a decent definition for core language—that's the essential part of 
Factor that it requires to bootstrap itself.

-Joe

smime.p7s
Description: S/MIME cryptographic signature
--
BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Use of While Loop

2011-09-15 Thread Joe Groff

On Sep 15, 2011, at 8:58 PM, graham telfer wrote:

 Hi,
 
 I am trying to get to grips with Factor. My first attempt is to write a 
 program to the following spec:
 
 Pick some positive integer and call it n.
 If n is odd, multiply it by three and add one.
 If n is even, divide it by two.
 Continue this process until n is equal to one.

In Factor, while and if are higher-order functions that take their branches as 
quotations, bracketed by [ ]. So your example would be:

: wondrous ( n -- )
[ dup 1 = not ] [ dup odd? [ 3 * 1 + ] [ 2 / ] if dup . ] while drop ;

Factor has extensive reference documentation. To find help on a topic, try the 
apropos word to search the docs:

while apropos

Or if you know the name of a word, use the help word to look up its 
documentation:

\ while help

-Joe

smime.p7s
Description: S/MIME cryptographic signature
--
BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Raven link

2011-09-14 Thread Joe Groff

On Sep 14, 2011, at 5:46 PM, Patrick Mc(avery wrote:

 Not sure if this is the right place for it but there is a bad link on :
 
 http://concatenative.org/wiki/view/Raven
 
 
 Raven: is a link farm now
 http://mythago.net/language.html

Thank you for the report. Note that concatenative.org is a public wiki, and 
you're welcome to make an account and update it.

-Joe

smime.p7s
Description: S/MIME cryptographic signature
--
Doing More with Less: The Next Generation Virtual Desktop 
What are the key obstacles that have prevented many mid-market businesses
from deploying virtual desktops?   How do next-generation virtual desktops
provide companies an easier-to-deploy, easier-to-manage and more affordable
virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] bootstrap error

2011-09-13 Thread Joe Groff

On Sep 13, 2011, at 9:17 AM, Doug Coleman wrote:

 alien.syntax depends on alien.libraries, and alien.libraries.unix depends on 
 alien.syntax
 
 It's causing bootstrap to fail; not sure how we want to fix it.

Fixed it by eliminating the alien.syntax dependency in alien.libraries.unix.

-Joe

smime.p7s
Description: S/MIME cryptographic signature
--
BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA
Learn about the latest advances in developing for the 
BlackBerryreg; mobile platform with sessions, labs  more.
See new tools and technologies. Register for BlackBerryreg; DevCon today!
http://p.sf.net/sfu/rim-devcon-copy1 ___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] frequency of vocabularies

2011-09-11 Thread Joe Groff
On Sep 11, 2011, at 1:42 PM, Patrick Mc(avery patr...@spellingbeewinnars.org 
wrote:

 Referencing the using count of 5575 do the other counts seem 
 reasonable? (some may be junk from my commands)

Those numbers look believable. You could check them against the cross-reference 
information Factor keeps itself using the vocab-usage word from tools.crossref. 
For example:

USE: tools.crossref
kernel vocab-usage length .

-Joe

smime.p7s
Description: S/MIME cryptographic signature
--
Using storage to extend the benefits of virtualization and iSCSI
Virtualization increases hardware utilization and delivers a new level of
agility. Learn what those decisions are and how to modernize your storage 
and backup environments for virtualization.
http://www.accelacomm.com/jaw/sfnl/114/51434361/___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] exe deploy files

2011-09-06 Thread Joe Groff
On Sep 6, 2011, at 2:34 AM, Michele Pes wrote:

 Hi to all!
 AFAIK, the deployed exe need a second file, the image file I think.
 If I rename/delete this file, the app quits showing an error message.

Rename both the .exe and .image so they have the same name without their 
extensions.

 Is there a way to deploy to a SINGLE exe file as big as you want
 that I can compress with upx?
 This would make deployed apps much more attractive!

Not currently.

-Joe



smime.p7s
Description: S/MIME cryptographic signature
--
Malware Security Report: Protecting Your Business, Customers, and the 
Bottom Line. Protect your business and customers by understanding the 
threat from malware and how it can impact your online business. 
http://www.accelacomm.com/jaw/sfnl/114/51427462/___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Unused USE's

2011-09-02 Thread Joe Groff
On Sep 2, 2011, at 11:06 AM, John Benediktsson wrote:

 Is there a way to tell for a given vocabulary what is USE'd, but not required 
 (i.e., unused imports)?

The only way I know is to remove a vocab's imports then reload it with auto-use 
enabled, to get an automatically generated, shrinkwrapped manifest from Factor 
itself. I believe FUEL has some code to do this automatically. It's a 
suboptimal solution because you have to manually re-resolve any ambiguous or 
qualified symbols, and auto-use doesn't understand automatically-generated 
vocabs such as those created by specialized-arrays, but it's the closest thing 
we have now.

-Joe

smime.p7s
Description: S/MIME cryptographic signature
--
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better 
price-free! And you'll get a free Love Thy Logs t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] TryRuby, etc.

2011-08-28 Thread Joe Groff
On Aug 28, 2011, at 1:56 PM, John Porubek wrote:

 It's dated February 27,2008, FWIW.
 
 I think there would be value in a Factor 0.94 PDF. Does one exist? Could it 
 be easily created from the online reference?
 
 A PDF is a serviceable format when using a Kindle to carry documentation 
 although a real ebook format would be even better!

You can try crawling docs.factorcode.org (or locally generating HTML 
documentation with USE: help.html generate-help), and using KindleGen or a 
similar tool to convert the resulting HTML files into a mobi or epub format. 
The current documentation is unfortunately poorly accessible to newcomers; I 
think several years of incremental updating have taken their toll on the 
documentation's overall coherence.

-Joe

smime.p7s
Description: S/MIME cryptographic signature
--
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.

2011-08-28 Thread Joe Groff

On Aug 28, 2011, at 3:07 PM, John Porubek wrote:

 Thanks Joe for pointing me in the right direction. I hadn't thought of
 using Factor to transcribe it's own help system. I'll let you (all)
 know if I'm successful.

Sure thing. You might also be interested in the codebook vocabulary, which 
Doug and I wrote to format and generate source code trees as .mobi files for 
viewing on the Kindle. It depends on the kindlegen executable from 
http://www.amazon.com/gp/feature.html?ie=UTF8docId=1000234621 being in your 
PATH; once that's installed, try for example:

USE: codebook
resource:vm codebook

to generate a .mobi file of the Factor VM source.

-Joe

smime.p7s
Description: S/MIME cryptographic signature
--
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.

2011-08-28 Thread Joe Groff

On Aug 28, 2011, at 5:22 PM, John Porubek wrote:

 By the way, I come from a Forth background where I could implement a
 simple delay word by using a simple do loop for something quick and
 dirty or use a hardware timer for something more efficient. I know I'm
 not in Kansas anymore, but what's the easiest way to implement a
 simple delay word in Factor?

Use the sleep word.

USING: calendar threads ;

2 seconds sleep

-Joe

smime.p7s
Description: S/MIME cryptographic signature
--
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] Metadata

2011-08-27 Thread Joe Groff

On Aug 27, 2011, at 12:32 PM, Matt Gushee wrote:

 * Version info is useful, not just for the purpose I mentioned, but
 also for debugging.

I agree that there ought to be a user-readable version number available 
programmatically. There is a build number in the image (accessible by USE: 
kernel build) that can be correlated to the build farm's nightly builds, but 
it's not humanly relatable to a git revision or version number, which sucks.

 Furthermore, there is probably other metadata that would be a good idea
 to maintain. For example, if Factor becomes widely used, there might be
 a situation where different developers distribute similarly- or
 identically-named vocabularies. So we should have the developer's name,
 or email address, or some other identifier that serves to distinguish a
 given vocabulary from a different one with the same name.

Factor vocabularies can already store author information and other metadata; 
however, I don't know that those are good axes for vocab differentiation. 
Vocabs are canonically objects in Factor, and their names are just used as 
assoc indexes by the standard loader; someone could construct their own vocab 
loader that used, say, a git URL/refid/path triple as the vocab key. What if 
you could say something like:

FROM-GIT: https://github.com/cptahab/pequod.git 1a2b3c4e
starbuck ishmael queequeg ;
FROM-GIT: https://savannah.gnu.org/adama/galactica.git 5f607182
starbuck ; ! this is a different starbuck vocab from the previous

to download a particular version of a repo and import vocabs from it, not 
worrying about clashing with other repos?

-Joe

smime.p7s
Description: S/MIME cryptographic signature
--
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] Merged native-image-loader branch

2011-08-27 Thread Joe Groff
I updated and merged my old native-image-loader branch, which makes Factor
use the native Cocoa/Win32 facilities for loading images, along with Philipp
Brueschweiler's gtk-image-loader branch that adds the same functionality for
the GTK backend. I've tested that Windows and OS X work; could somebody test
the GTK code? I've committed my merge to git://
github.com/jckarter/factor.git, branch merge-native-image-loader.

-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


Re: [Factor-talk] Metadata

2011-08-27 Thread Joe Groff

On Aug 27, 2011, at 2:36 PM, John Benediktsson wrote:

 I don't think versioning the vocabularies included in Factor is necessary.  
 You don't see versions in standard libraries of other languages.

Sure, but some sane and convenient mechanism for loading and versioning 
third-party modules is pretty much a must-have these days.

-Joe

smime.p7s
Description: S/MIME cryptographic signature
--
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] Merged native-image-loader branch

2011-08-27 Thread Joe Groff

On Aug 27, 2011, at 5:15 PM, Slava Pestov wrote:

 Hi Joe,
 
 I saw you merged your changes. However bootstrap fails on Linux now:

I thought you said you tested them...

Regardless, I also went ahead and moved the pure Factor image libraries to 
extra/ as you suggested.

-Joe

smime.p7s
Description: S/MIME cryptographic signature
--
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

2011-08-25 Thread Joe Groff

On Aug 25, 2011, at 12:34 AM, Andrew Pennebaker wrote:

 Aha! How could I rewrite for-all? so that it prints the first stack that 
 fails the predicate?

The most straightforward thing I can think of is to package up the generated 
values with outputsequence, then feed the array to the predicate via 
inputsequence:

:: for-all ( generator: ( -- ..a ) predicate: ( ..a -- ? ) -- ? )
1000 iota [ drop 
generator { } outputsequence : generated
generated predicate inputsequence : ok?
ok? [ generated . ] unless
ok? not
] find drop not ; inline

-Joe

smime.p7s
Description: S/MIME cryptographic signature
--
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] Relative vocab roots

2011-08-25 Thread Joe Groff
Here's a patch to have the vocab loader save Factor's initial current directory 
at startup time and use it as the base for relative vocab roots such as .. 
That way, the program changing the current directory as part of its normal 
operation won't affect the vocab loader.

https://github.com/jckarter/factor/commit/dc619acbfc4ba4b6f2c6d0ff93f909ff718881b5

Is this a good approach? Will this break anything?

-Joe

smime.p7s
Description: S/MIME cryptographic signature
--
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] Relative vocab roots

2011-08-25 Thread Joe Groff

On Aug 25, 2011, at 7:26 PM, Slava Pestov wrote:

 Hi Joe,
 
 This looks good. I assume you tested it :-) My only objection is the
 name vocab-base-directory. Is there a better name for this?

I'm not crazy about the name either, but I couldn't think of anything better. 
My other choice was initial-current-directory, but I wasn't sure if that 
adequately described the variable's purpose.

-Joe

smime.p7s
Description: S/MIME cryptographic signature
--
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

2011-08-24 Thread Joe Groff

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

smime.p7s
Description: S/MIME cryptographic signature
--
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

2011-08-24 Thread Joe Groff

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

smime.p7s
Description: S/MIME cryptographic signature
--
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

2011-08-24 Thread Joe Groff
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

smime.p7s
Description: S/MIME cryptographic signature
--
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

2011-08-24 Thread Joe Groff

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

smime.p7s
Description: S/MIME cryptographic signature
--
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

2011-08-24 Thread Joe Groff

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

smime.p7s
Description: S/MIME cryptographic signature
--
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

2011-08-24 Thread Joe Groff

On Aug 24, 2011, at 9:50 PM, Andrew Pennebaker wrote:

 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.

True. Unfortunately Factor doesn't support CLOS-style eq generics, otherwise 
you could dispatch on the class names themselves, and use Factor's predicate 
classes and class algebra to naturally describe more specific constraints:

EQ-GENERIC: arbitrary ( class -- value ) ! not in factor, unfortunately

M: integer arbitrary 2 64 ^ random ;

PREDICATE: even-integer  integer
even? ;

M: even-integer arbitrary 2 63 ^ random 2 * ;

\ integer arbitrary . ! would print e.g. 12345
\ even-integer arbitrary . ! would print e.g. 12346

INTERSECTION: even-fixnum
fixnum even-integer ;

M: even-fixnum arbitrary most-positive-fixnum 2 / random 2 * ;

\ even-fixnum arbitrary .

-Joe

smime.p7s
Description: S/MIME cryptographic signature
--
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] getopt; commandline parsing Re: Invoke MAIN: from commandline script file?

2011-08-20 Thread Joe Groff

On Aug 20, 2011, at 9:42 AM, Andrew Pennebaker wrote:

 Okay, factor -help ios7crypt.factor works. It seems Factor ignores arguments 
 after the first script name.

It looks like arguments after the script name aren't ignored, but put into a 
command-line variable unprocessed, and the script name is put in a script 
variable:

$ cat foo.factor
#! /Applications/factor/factor
USING: command-line prettyprint ;

script get .
command-line get .
$ ./foo.factor -a -b -c
foo.factor
{ -a -b -c }

I guess the intent is that you process the contents of command-line yourself 
separately from the VM's own argument processing.

 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.

You could implement #| |# as comment syntax in Factor:

USING: kernel multiline ;
SYNTAX: #| |# parse-multiline-string drop ;

Then you could do the embedded-shellscript trick.

-Joe

smime.p7s
Description: S/MIME cryptographic signature
--
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

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 ~/.factor-roots , which gets loaded every time 
Factor starts up and can contain a newline-separated list of paths that will be 
searched for USING: modules.

-Joe



smime.p7s
Description: S/MIME cryptographic signature
--
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

2011-08-19 Thread Joe Groff
On Aug 19, 2011, at 8:26 AM, Andrew Pennebaker wrote:

 Is there an import command that doesn't require moving my files into the 
 Factor work directory?
 
 I like version controlling my scripts and it would be a pain to copy them 
 from my git directory over to work and back.

As Doug indicated, 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



smime.p7s
Description: S/MIME cryptographic signature
--
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

2011-08-19 Thread Joe Groff
On Aug 19, 2011, at 11:35 AM, Andrew Pennebaker wrote:

 I made ~/.factor-roots with a dot (.) to indicate it should search the 
 current directory for Factor files, but it doesn't seem to help.
 
 Is there a way to add the current directory to ~/.factor-roots similar to 
 Java's CLASSPATH?

. is 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



smime.p7s
Description: S/MIME cryptographic signature
--
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

2011-08-19 Thread Joe Groff
On Aug 18, 2011, at 8:07 PM, Andrew Pennebaker wrote:

 USE: ui.backend.cocoa.tools menu-run-files successfully brings up an open 
 dialog which loads Factor code.

There might an FFI bug in the compiler. What does USE: cpu.x86.features 
sse-version report?

-Joe



smime.p7s
Description: S/MIME cryptographic signature
--
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

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 called. . 
is already treated as the current directory, which is inherited normally from 
the parent process. What exactly do you have in mind?

-Joe



smime.p7s
Description: S/MIME cryptographic signature
--
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

2011-08-19 Thread Joe Groff
On Aug 19, 2011, at 2:57 PM, Andrew Pennebaker wrote:

 There must be a more dynamic way than configuring Factor for every piece of 
 code I write. What if Factor interpreted . as the directory from which 
 Factor was called?

If you're trying to load modules relative to a main script file, a bit 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

smime.p7s
Description: S/MIME cryptographic signature
--
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

2011-08-19 Thread Joe Groff

On Aug 19, 2011, at 3:51 PM, Andrew Pennebaker wrote:

 The parse-time trick is helpful, but it's not perfect. I'm getting an error:
 
 Generic word length does not define a method for the source-file class.

Oops, that was a typo on my part. Should be:


USING: accessors io.pathnames namespaces 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.factor into 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

smime.p7s
Description: S/MIME cryptographic signature
--
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

2011-08-19 Thread Joe Groff

On Aug 19, 2011, at 5:14 PM, Andrew Pennebaker wrote:

 The RELATIVE trick looks promising. Though, it gives me an error.
 
 scriptedmain.factor
 https://github.com/mcandre/scriptedmain/blob/master/scriptedmain.factor
 
 test.factor
 https://github.com/mcandre/scriptedmain/blob/master/test.factor
 
 $ ./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

smime.p7s
Description: S/MIME cryptographic signature
--
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

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
- INCLUDE: looks for foo/bar.factor; USE: looks for foo/bar/bar.factor

It wouldn't be difficult to include the current directory in the default search 
path. USE: could also conceivably look for vocab foo.bar at foo/bar.factor 
in addition to foo/bar/bar.factor, which would be convenient for small 
projects, but I don't know how deeply the one-vocab:one-directory assumption is 
in the vocab infrastructure. Slava would.

-Joe

smime.p7s
Description: S/MIME cryptographic signature
--
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

2011-08-19 Thread Joe Groff

On Aug 19, 2011, at 9:46 PM, Slava Pestov wrote:

 Well, using vocabulary roots you can use USING: for everything. Read
 the article I linked you to, it's pretty easy to add your own
 directories to the search path.

Well, Andrew is objecting to a couple of things with how the vocab loader works:

- adding . to include the current directory among the vocab-roots doesn't 
work the way he expects, and
- a vocab foo.bar maps to foo/bar/bar.factor instead of foo/bar.factor.

The second one is bikesheddy, but the first one seems like something we could 
try to fix.

-Joe

smime.p7s
Description: S/MIME cryptographic signature
--
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

2011-08-18 Thread Joe Groff
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

smime.p7s
Description: S/MIME cryptographic signature
--
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

2011-08-18 Thread Joe Groff

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

smime.p7s
Description: S/MIME cryptographic signature
--
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 yak shaving

2011-08-17 Thread Joe Groff
On Aug 17, 2011, at 4:56 PM, Andrew Pennebaker wrote:

 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

Mac installers shouldn't mess with your configuration. That should be left to 
the user. Your installer could perhaps put a script in /usr/local/bin to start 
Factor from /Applications/factor.

-Joe



smime.p7s
Description: S/MIME cryptographic signature
--
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

2011-08-17 Thread Joe Groff
On Aug 17, 2011, at 7:03 PM, Andrew Pennebaker wrote:

 Factor doesn't accept shebang lines :(
 

It does. You need to have -script in the #! line, and the #! line must be 
followed by a space.

#! /Applications/factor/factor -script
USING: io ;
hello world print

The startup and compilation time for loading scripts into the dev image is a 
bit high for scripts, so you may want to consider deploying instead.

-Joe

smime.p7s
Description: S/MIME cryptographic signature
--
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

2011-08-17 Thread Joe Groff

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

smime.p7s
Description: S/MIME cryptographic signature
--
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

2011-08-17 Thread Joe Groff
On Aug 17, 2011, at 7:26 PM, Andrew Pennebaker wrote:

 When I select Factor - Run Factor Source..., the Factor UI crashes.
 
 Specs:
 Factor 0.94
 Mac OS X 10.7 Lion
I just tested on Factor HEAD and 10.7.1 (x86-64), and it works for me. Maybe 
try updating OS X and/or Factor, and let us know if it still doesn't work.

-Joe

smime.p7s
Description: S/MIME cryptographic signature
--
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

2011-08-17 Thread Joe Groff
On Aug 17, 2011, at 7:40 PM, Andrew Pennebaker wrote:

 Thanks Joe, that helps a lot. Do you know if Factor has an equivalent this 
 Python's idiom?
 
 if __name__==__main__:
main()

The idiomatic equivalent is the MAIN: annotation. USING: a module from another 
module will not invoke its MAIN: entry point, but run-ing a module or deploying 
it will start execution from its MAIN:, which is similar to what the Python 
idiom tries to achieve. However, as you noted, the MAIN: entry will also not be 
invoked for a script evaluated from the commandline. Factor is geared more 
toward interactive development and standalone deployment, and its usability as 
a #!-style scripting language is a bit of an afterthought (as you've seen).

-Joe



smime.p7s
Description: S/MIME cryptographic signature
--
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] Invoke MAIN: from commandline script file?

2011-08-17 Thread Joe Groff
As Andrew Pennebaker pointed out, it's likely the user's intended behavior for 
something like:

#! /usr/bin/env factor -script
USING: io ;
IN: foo

: foo ( -- ) foo print

MAIN: foo

to actually invoke foo, instead of just falling through and doing nothing after 
parsing the definitions. It wouldn't be too difficult to alter startup so it 
checks the evaluated script for a MAIN: entry point and runs it if present. Any 
reason not to?

-Joe

smime.p7s
Description: S/MIME cryptographic signature
--
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] Invoke MAIN: from commandline script file?

2011-08-17 Thread Joe Groff
Slava gave me the go-ahead, so I committed a patch to head so that scripts will 
now run their MAIN: entry point if present.

-Joe

smime.p7s
Description: S/MIME cryptographic signature
--
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] getopt; commandline parsing Re: Invoke MAIN: from commandline script file?

2011-08-17 Thread Joe Groff

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

smime.p7s
Description: S/MIME cryptographic signature
--
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] Test that game demos still work on OS X 10.5 and 10.6

2011-07-29 Thread Joe Groff
I just committed some fixes so that game.input.* and gpu.* work in OS X 10.7. 
If any of you have Macs still running 10.5 or 10.6 and have an OpenGL 2-capable 
graphics card (basically, not Intel integrated), I'd appreciate it if you 
spot-checked that things still worked there. Try gpu.demos.raytrace run, for 
example.

-Joe

smime.p7s
Description: S/MIME cryptographic signature
--
Got Input?   Slashdot Needs You.
Take our quick survey online.  Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] deploy trouble

2011-07-26 Thread Joe Groff
On Jul 26, 2011, at 1:44 AM, Michele Pes wrote:

 Hi factorers!
 I want to use my factored file-copier in my MS vista, but when I
 deploy with the deploy-tool, it aborts (die was called by library...
 please report), and the listener hangs.
 Can someone tell if can get exe from this source?

What are your deploy-tool settings? Generally you always want level 3 I/O 
support, rational and complex number support, and threading support. If the 
program still does not work without these settings, try deploying with the 
highest possible reflection level, which should allow you to see the actual 
error raised by your deployed program.

-Joe
--
Magic Quadrant for Content-Aware Data Loss Prevention
Research study explores the data loss prevention market. Includes in-depth
analysis on the changes within the DLP market, and the criteria used to
evaluate the strengths and weaknesses of these DLP solutions.
http://www.accelacomm.com/jaw/sfnl/114/51385063/
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Bug in string ?

2011-07-20 Thread Joe Groff
On Jul 19, 2011, at 2:44 PM, Bjarke Dahl Ebert wrote:

 Hi Factor-talk,
 
 I'm new to Factor.
 
 When I do
 { -1 } string
 my listener hangs (version 0.94).
 I would expect a runtime error instead.
 Is this a bug?

Definitely. It appears to be a bug in the set-string-nth primitive operation. 
I'll fix it.

Just to be clear, string does an element-wise conversion of a sequence of 
integers into a string, so for example, { CHAR: a CHAR: b CHAR: c } string 
(or equivalently { 65 66 67 } string) gives the string abc. If you're 
expecting to get a string representation of an object, you need to use 
unparse or numberstring. Some new users get confused by that.

-Joe
--
10 Tips for Better Web Security
Learn 10 ways to better secure your business today. Topics covered include:
Web security, SSL, hacker attacks  Denial of Service (DoS), private keys,
security Microsoft Exchange, secure Instant Messaging, and much more.
http://www.accelacomm.com/jaw/sfnl/114/51426210/
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


  1   2   3   >