[Factor-talk] Metadata

2011-08-27 Thread Matt Gushee
Hi, all--

I'm wondering what the Factor community would think of including certain
kinds of metadata in the source code for vocabularies and for the Factor
itself.

My starting point for this line of thinking was that I had played with
Factor for a while a couple of years ago, then dropped it for a while
... and I wanted to know what version I had installed. So my first
thought was to go to the listener and try

  version

Nope. Okay, how about

  factor-version

? No again. And so on through several variations ... nothing. Nor could
I find anything in the online help. Nor any file in the source directory
to indicate the version (or revision date). And it occurs to now, which
should be obvious, that I can probably use Git to find out some
pertinent info. However:

 * Not everyone is using Git.

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

 * It seems desirable to be able to query version info via the listener,
 and probably also programatically
   for the purpose of checking dependencies among vocabularies.

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.

Personally, I feel pretty strongly about this; if I were in charge of
development I would make at least the above-mentioned items *mandatory*
for all language components, such that a vocabulary would fail to load
or compile if it didn't include the required metadata. But I think I've
said enough. I will leave it up to more experienced folks to decide
whether and how to implement this idea. Thanks for reading!

-- 
Matt Gushee
m...@gushee.net

--
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] Trouble w/ html.forms

2010-04-17 Thread Matt Gushee
Hey-ho--

I am attempting to learn how to do web programming with Factor. Now, I
understand that it is generally recommended to use the high-level
API--page actions and such--but I am finding that with all the magic
that happens behind the scenes, I can't understand how to usefully
modify any of the existing example apps, let alone write my own. So I'm
trying to start with some of the lower-level vocabularies, such as
html.forms. However:

( scratchpad ) form my-form set
( scratchpad ) my-form get

--- Data stack:
T{ form f ~vector~ ~hashtable~ f }
( scratchpad ) my-form [ Jim Bob who set-value ] with-form

Here I get an error saying 

  Generic word values does not define a method for the POSTPONE: f
  class.

... which I guess means that the form is not actually getting bound to
the form variable in the scope of with-form. Can anyone tell me what I'm
doing wrong? I am running the last development version of Factor on
Linux.

Also, I'd be interested to know the rationale for with-form taking a
variable represented by a string rather than a symbol or a form object.

Finally, I asked a question on April 6 about webapps.blogs, but never
got any responses. Anybody have any answers for that one?

Thanks!

--
Matt Gushee
m...@gushee.net

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Trouble w/ html.forms

2010-04-17 Thread Matt Gushee
Ah-ha!

On Sat, 17 Apr 2010 20:21 -0600, Matt Gushee m...@gushee.net wrote:

 ( scratchpad ) form my-form set
 ( scratchpad ) my-form get
 
 --- Data stack:
 T{ form f ~vector~ ~hashtable~ f }
 ( scratchpad ) my-form [ Jim Bob who set-value ] with-form
 
 Here I get an error saying 
 
   Generic word values does not define a method for the POSTPONE: f
   class.
 
 ... which I guess means that the form is not actually getting bound to
 the form variable in the scope of with-form. Can anyone tell me what I'm
 doing wrong?

Apparently this works if I use a nested form--though I don't understand
why. Nor do I understand if this is *the* way to do it, or just *a* way.
The docs could really stand to be a bit clearer.

-- 
Matt Gushee
m...@gushee.net

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] Why clone SBUF ?

2010-03-12 Thread Matt Gushee
Hello people--

According to the documentation,

 If you don't care about initial capacity, a more elegant way to
 create a new string buffer is to write:
 SBUF  clone

However, according to my listener,

 (scratchpad) SBUF  SBUF  eq?

 --- Data stack
 f

... from which I infer that the SBUF  word actually creates a new
string-buffer instance each time it is called. So, is there some
non-obvious reason why it is preferable to use 'clone', or are the docs
wrong/out-of-date?

BTW, the same question applies to BV{ } and, I would imagine, some other
empty literal sequences.

-- 
Matt Gushee
m...@gushee.net

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Why clone SBUF ?

2010-03-12 Thread Matt Gushee


On Fri, 12 Mar 2010 17:00 -0500, William Schlieper schlie...@unc.edu
wrote:

  string-buffer instance each time it is called. So, is there some
  non-obvious reason why it is preferable to use 'clone', or are the docs
  wrong/out-of-date?

 When SBUF  and the like are put in a word, they are only actually 
 called once, and the new string-buffer is stored inside the word's 
 definition.

Ah ... because it is a parsing word, right? In that case, I suppose that
in principle the point should be obvious once you understand how parsing
words work. In practice, though, it seems like a stumbling block for
people new to Factor. So please put this on the list of issues to cover
in the improved new-user documentation, whenever somebody gets around to
writing it (somebody could be me at some point, though I don't think
I'm quite ready just yet).

Thanks for the clarification!

-- 
Matt Gushee
m...@gushee.net

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] How to use Freetype?

2010-02-13 Thread Matt Gushee
On Sat, 13 Feb 2010 18:46 -0800, Joe Groff arc...@gmail.com wrote:
 On Feb 13, 2010, at 6:23 PM, Matt Gushee wrote:
 
  Thanks, but I'm pretty sure I need Freetype. It's not for a GUI app. In
  fact, what I am contemplating is a PDF vocabulary.
 
 My apologies for assuming you just wanted to render text. For PDF

Don't apologize. I'm sure that's what most people want to do.

 generation, I think you would still be better served by Pango and Cairo.
 Pango will handle text direction, ligatures, character composition, and
 other text rendering considerations that you would need to reinvent over
 Freetype, and Cairo provides a nice vector graphics API that maps very
 well to the PDF graphics model—I think Cairo even supports PDF as an
 output target.

That thought has occurred to me, and I certainly haven't ruled out using
those libraries (and yes, you're right--Cairo does support PDF output).
There are a couple of reasons I might still want to use Freetype
directly:

 * I'm thinking in terms of Web apps that generate PDF. AFAIK, Cairo and
 Pango aren't normally found on Web servers, though one could certainly
 put them there if one wished.

 * I want to use--and develop if need be--not just a simple PDF
 generator, but a complete PDF processing solution. You see, my ambition
 knows no bounds ;-) Seriously, though: to make a long story short, my
 day job is in the printing industry (broadly defined), and while I like
 printing and publishing in general, my particular job is tedious and
 rather dead-endish, and I need to do something about my career. On the
 other hand, I see on a day-to-day basis a lot of really half-assed
 software, involving a lot of missed opportunities to improve
 productivity and quality, and I want to do something about that.

Sorry, that's getting a bit off-topic. Just wanted to explain that if I
seem a bit stubborn, it's because I want to gain a thorough
understanding of the problem space. So I still want to see what I can do
with Freetype, even though I might well end up using a higher-level API.

With that said, I still stubbornly want to know how to use Freetype.
Maybe the answer to the following will be enough to get me going:

 * I think I need to start by calling FT_Init_FreeType, right? Well,
   that has a stack effect of ( library -- FT_Error ). What I don't
   get is, where does the 'library' argument come from? I tried 

 freetype /usr/lib/libfreetype.so.6 cdecl add-library
 freetype load-library

   and got
 
 DLL /usr/lib/libfreetype.so.6

   on the stack, but apparently that's not the right type of object,
   because if I then call

 FT_Init_FreeType

   I get an error saying

 Generic word underlying does not define a method for the dll
 class. Dispatching on object: DLL /usr/lib/libfreetype.so.6

   [ this is on linux-x86-32, by the way ]
   So  ?

Thanks for all the good info.

-- 
Matt Gushee
m...@gushee.net

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] How to use Freetype?

2010-02-13 Thread Matt Gushee
 On Sat, 13 Feb 2010 21:31 -0800, Joe Groff arc...@gmail.com
wrote:

On Feb 13, 2010, at 8:43 PM, Matt Gushee wrote:

* I think I need to start by calling FT_Init_FreeType, right?
Well,
  that has a stack effect of ( library -- FT_Error ). What I
don't
  get is, where does the 'library' argument come from? I tried

When calling a C function, the arguments in Factor map directly
to the arguments in C. Looking at the FreeType docs
at [1]http://freetype.sourceforge.net/freetype2/docs/reference/ft
2-toc.html, the library argument is an out parameter that
points to an FT_Library


Ahh, okay. I started looking through freetype.h, and thought that
FT_Library was probably the key, but wasn't sure how to use it in
Factor. Thanks!

--
Matt Gushee
m...@gushee.net

References

1. http://freetype.sourceforge.net/freetype2/docs/reference/ft2-toc.html
--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] GUIless binary packages?

2010-02-09 Thread Matt Gushee


On Tue, 09 Feb 2010 14:14 +1300, Slava Pestov sl...@factorcode.org
wrote:

 You can link the Factor VM without any GUI libraries:
 
 make freebsd-x86-64 NO_UI=1

Well, that *almost* worked ... had to make 'make' into 'gmake' for it to
really work.

Thanks!

-- 
Matt Gushee
m...@gushee.net

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] GUIless binary packages?

2010-02-08 Thread Matt Gushee
Hi, all--

I have a pretty simple question: I would like to set up Factor on my Web
server, for the obvious purpose of deploying Web apps. Said server is a
virtual private host running FreeBSD on x86-64 ... no problem as far as
that goes, but I have not installed and don't wish to install any of the
GUI-related libraries that are required for the standard build. So, are
there any alternate binaries that would be suitable for my situation, or
do I need to do a custom build (I have the impression that's possible,
though I don't know exactly how)?

-- 
Matt Gushee
m...@gushee.net

--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] Perplexing no-method error

2010-01-28 Thread Matt Gushee
Hello, folks--

As part of a rather ambitious project that I'm not quite ready to
discuss[*], I have created a class called 'vobject', meaning 'validated
object'. Basically, it is a tuple that wraps an object whose value is
constrained by an arbitrary predicate; whenever you create an instance
of the class or try to set the value, the new value is checked against
the predicate. Here's what the code looks like:

MACRO: or-null-predicate ( quot -- )
[ { [ null = ] } swap suffix '[ _ || ] ] ;

TUPLE: vobject predicate value ;
: vobject ( predicate value -- vobject )
swap [ call t assert= ] 2keep
vobject new
swap predicate swap value ; inline

TUPLE: nullable-vobject  vobject ;
: nullable-vobject ( predicate value -- vobject )
swap or-null-predicate [ call t assert= ] 2keep
nullable-vobject new
swap predicate swap value ; inline

TUPLE: free-vobject  vobject ;
: free-vobject ( value -- vobject )
free-vobject new [ drop t ] predicate swap value ;

GENERIC: :: ( vobject -- value )
GENERIC: :: ( vobject newval -- vobject )

M: vobject ::
value ;
M: vobject ::
over predicate dupd call( val -- ? ) t assert= value ;
M: free-vobject ::
value ;

[The purpose of having the free-vobject class is to be able to easily
mix constrained and unconstrained values, and be able to access them in
a consistent way]

For the most part, this all seems to work as expected. However, I find
that the setter word, ::, raises an error but I don't understand why.
Here's what happens:

( scratchpad ) ! Here's a silly example
( scratchpad ) [ [ string? ] [ length 3 = ] bi and ] abc vobject

--- Data stack:
T{ vobject f ~quotation~ abc }
( scratchpad ) ! First, I'll manually perform the steps to validate and
set the value:

--- Data stack:
T{ vobject f ~quotation~ abc }
( scratchpad ) xyz

--- Data stack:
T{ vobject f ~quotation~ abc }
xyz
( scratchpad ) over predicate dupd call( val -- ? ) t assert= value 

--- Data stack:
T{ vobject f ~quotation~ xyz }
( scratchpad ) ! Yes, that's what's supposed to happen. Now I'll use the
:: word:

--- Data stack:
T{ vobject f ~quotation~ xyz }
( scratchpad ) mmm ::

At this point I get an error popup saying:

Generic word :: does not define a method for the string class.
Dispatching on object: mmm

Why is it dispatching on the object mmm? I would appreciate your
insights into this puzzle.


  [*] because I think what I have in mind may be way over my head, but I
  need to
  mess around with the idea a bit before deciding whether I really
  want to do it
-- 
Matt Gushee
m...@gushee.net

--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Perplexing no-method error

2010-01-28 Thread Matt Gushee
Hi, Slava--

On Fri, 29 Jan 2010 18:15 +1300, Slava Pestov sl...@factorcode.org
wrote:
 Hi Matt,
 
 GENERIC: dispatches on the value at the top of the stack. Try GENERIC#
 instead.
 
 \ GENERIC# help

Thanks. Actually, I just realized that myself. I had seen GENERIC#
before, but didn't really comprehend how to apply it. But I took a nice
long shower and the answer occurred to me. Maybe I should take several
showers a day ;-)

Sorry for the needless distraction.

-- 
Matt Gushee
m...@gushee.net

--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Newbie question on customizing gadgets

2010-01-22 Thread Matt Gushee
Hello--

On Fri, 22 Jan 2010 02:33 +1300, Slava Pestov sl...@factorcode.org
wrote:

  First post, sort of (I made an attempt to learn Factor early last year,
  and didn't get very far, but now I'm trying again--maybe this time I'll
  reach escape velocity).
 
 Sorry for the late reply, I've been stuck doing VM hacking :-)

No need to apologize for improving the project. Now if you had been,
say,
drinking beer with your friends, *that* would require an apology :-)

Haven't had time to get back to this yet, but I appreciate your
suggestions
and Jon's, and I'll give them a try.

-- 
Matt Gushee
m...@gushee.net

--
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Newbie question on customizing gadgets

2010-01-19 Thread Matt Gushee
Hi, Jon--

On Tue, 19 Jan 2010 18:22 +0100, Jon Harper
jon.harpe...@gmail.com wrote:

  Hi,
  did you get any help with your problem ? Here's what I could
  come up with..


You're the first respondent ... thanks for the tips! I'd still
like to hear something
about the graphics.

PS: Does nobody watch this list on weekends? If so, too bad for
me, since that's
about the only time I can experiment with Factor.
--
Matt Gushee
m...@gushee.net
--
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] Newbie question on customizing gadgets

2010-01-16 Thread Matt Gushee
Hello, folks--

First post, sort of (I made an attempt to learn Factor early last year,
and didn't get very far, but now I'm trying again--maybe this time I'll
reach escape velocity).

As a learning exercise (and maybe an excuse to have a game on my laptop,
which thus far has been free of such distractions ;-) I am trying to
implement the classic Minesweeper game. So, for each cell in the grid, I
need a gadget with the following characteristics:

 * At least 2 visual states, clicked and un-clicked, typically shown
 with a raised or flat appearance

 * Left-click and right-click event handlers

 * The ability to display an icon or a character, and to change the icon
 at runtime

It doesn't appear that there is any existing gadget that has all these
characteristics, and I'm not sure what would be the best one to
customize, but in other GUI toolkits I've worked with, button widgets
work pretty well for this kind of thing, so I thought I would start by
taking the border-button gadget and giving it a raised appearance. I
created 3 TIFF images the same sizes as those used by the plain tile pen
of the button pen of the border-button gadget. Then I created a new
tile-pen using those images and new BG and FG colors, and assigned them
to the plain slot of the button-pen.

The result does indeed look different from the default, but it also
looks different from what I expected, and quite ugly. I thought I would
keep looking through the docs for an answer, but I'm just getting lost.
I can post my code if people want to see it, but I think the real
problem is not really a programming error, but rather that I don't
understand how the various images and colors are used in constructing
the button.

So can someone explain how border-buttons are rendered (noting that,
while I am reasonably familiar with 2D graphics terminology, I do *not*
understand OpenGL [I've tried to learn it, failed, maybe try again
someday, but not today, please])? Or perhaps provide a working example
of gadget customization?

Thanks for any  all info!

-- 
Matt Gushee
m...@gushee.net

--
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk