[Factor-talk] benchmark comparing Factor to ANS-Forth

2016-03-22 Thread Hugh Aguilar
If a comparison in speed is to be made, we need somebody who cares about Factor 
to write the Factor code.
I think Factor is faster than other dynamic-OOP languages (R, Python, Ruby, 
etc.). Realistically however, no dynamic-OOP language is very fast. Having 
tagged data and garbage-collection is just inherently slow. 
Dynamic-OOP languages are primarily useful in regard to the code-libraries 
available. R or Python may be very slow, but they do have a lot of 
code-libraries available, especially for displaying data. I could write my 
programs that require speed in Forth and have them dump the raw data into a 
file, then use one of these languages to display the data graphically. Right 
now I display the data in the LowDraw.4th program, but it is just a text table 
--- this doesn't look very professional.
I mostly posted this challenge to find out if Factor is faster than SwiftForth. 
I don't think Factor is going to be anywhere near VFX for speed. SwiftForth is 
very inefficient though --- it would be somewhat amusing if a dynamic-OOP 
language generated faster code than SwiftForth.
Anyway --- benchmark challenges like this aren't very interesting, especially 
when the result is a foregone conclusion --- I just posted it because I was 
curious.
regards --- Hugh





   
Message: 1
Date: Fri, 26 Feb 2016 15:36:57 -0800
From: John Benediktsson 
Subject: Re: [Factor-talk] benchmark comparing Factor to ANS-Forth
To: Hugh Aguilar ,
    "factor-talk@lists.sourceforge.net"
    
Message-ID:
    
Content-Type: text/plain; charset="utf-8"

Hi Hugh,

Are you planning on implementing your program in Factor for comparison?

You can look over our statistics libraries here:

    http://docs.factorcode.org/content/vocab-math.statistics.html

Best,
John.

On Fri, Feb 26, 2016 at 2:47 PM, Hugh Aguilar 
wrote:

> My first-ever ANS-Forth program was LowDraw.4th that was written about
> 12-15 years ago. It is now one of my example programs in the novice
> package: http://www.forth.org/novice.html This program does a
> recursive-traversal of all the possible hands in LowDraw  poker given
> various drawing strategies and calculates the probabilities.
>
> The subject of bench-marking has been discussed a few times on
> comp.lang.forth and I have suggested that my program would make a good
> benchmark. Most benchmarks involve doing the same simple calculation
> repeatedly inside of a loop and/or testing what code-library functions are
> available, which provides almost no information about the language speed.
> My program is non-trivial at the level of a real-world program, but is yet
> simple enough that most programmers should be able to implement it in their
> favorite language over a weekend (note: today is Friday).
>
> I think that Factor has a good chance of beating SwiftForth, but is
> unlikely to come close to VFX (there are free evaluation versions of both
> available for download). I would be interested in seeing how Factor
> compares. I would also be interested in seeing how Oforth compares (is
> Oforth discussed on this forum at all?).
>
> I'm learning R right now, and intend to port my program over to R to
> benchmark R's speed (I'm not expecting R to be very fast). The advantage of
> R seems to be a lot of code-libraries for statistics, and convenient
> representation of arrays of numbers. Factor's sequences should be equally
> convenient --- how does Factor compare in regard to code-libraries for
> statistics? --- I'm trying to learn statistics these days, which is a
> subject I have always wanted to know more about.
>
> I still have my STUNDURD.TXT design of a micro-controller that supports
> quotations at the machine-language level --- right now you have to have me
> email it to you if you are interested, because thewww.forth.org website
> is stuck (the guy who maintains it had a stroke) --- afaik, Stundurd Forth
> is an appropriate topic for this forum, as is any Forth-derived language
> that supports quotations.
>
> regards --- Hugh

 
  --
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785351&iu=/4140___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] benchmark comparing Factor to ANS-Forth

2016-02-26 Thread Hugh Aguilar
My first-ever ANS-Forth program was LowDraw.4th that was written about 12-15 
years ago. It is now one of my example programs in the novice package: 
http://www.forth.org/novice.html This program does a recursive-traversal of all 
the possible hands in LowDraw  poker given various drawing strategies and 
calculates the probabilities. 
The subject of bench-marking has been discussed a few times on comp.lang.forth 
and I have suggested that my program would make a good benchmark. Most 
benchmarks involve doing the same simple calculation repeatedly inside of a 
loop and/or testing what code-library functions are available, which provides 
almost no information about the language speed. My program is non-trivial at 
the level of a real-world program, but is yet simple enough that most 
programmers should be able to implement it in their favorite language over a 
weekend (note: today is Friday).
I think that Factor has a good chance of beating SwiftForth, but is unlikely to 
come close to VFX (there are free evaluation versions of both available for 
download). I would be interested in seeing how Factor compares. I would also be 
interested in seeing how Oforth compares (is Oforth discussed on this forum at 
all?).
I'm learning R right now, and intend to port my program over to R to benchmark 
R's speed (I'm not expecting R to be very fast). The advantage of R seems to be 
a lot of code-libraries for statistics, and convenient representation of arrays 
of numbers. Factor's sequences should be equally convenient --- how does Factor 
compare in regard to code-libraries for statistics? --- I'm trying to learn 
statistics these days, which is a subject I have always wanted to know more 
about.
I still have my STUNDURD.TXT design of a micro-controller that supports 
quotations at the machine-language level --- right now you have to have me 
email it to you if you are interested, because thewww.forth.org website is 
stuck (the guy who maintains it had a stroke) --- afaik, Stundurd Forth is an 
appropriate topic for this forum, as is any Forth-derived language that 
supports quotations.
regards --- Hugh
--
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Factor-talk Digest, Vol 109, Issue 8

2015-07-13 Thread Hugh Aguilar
 I remember CURRY but didn't know about the '[ _ + ] notation.
I never understood what the point of CURRY was --- why not just use the local 
variable name [ N + ] for readability?
Anyway, where is the local-frame being held that it can persist after the 
function has exited? Is it on the heap like in Scheme/Lisp? Will it get GC'd 
eventually?
My FMITE is intended to be a micro-controller used for real-time programs. I 
think that GC is a no-go for real-time programming. I've already been "beat up" 
by Pascal Bourguignon on comp.lang.lisp for saying that GC is a no-go for 
real-time (https://groups.google.com/forum/#!topic/comp.lang.lisp/-nWfXAs_4ug). 
Languages such as Factor and Lisp are cool --- but I don't foresee them ever 
being used in real-time micro-controllers --- these are for desktop-computers. 
Slava once told me that the ColdFire was the smallest processor he could 
foresee Factor running on --- but that is a gigantic expensive processor! --- 
and he wasn't talking about real-time programming anyway, but he was thinking 
of Factor being a scripting language for smart-phones. The FMITE is intended to 
be used as a micro-controller.
How much of Factor could be implemented on the FMITE as part of LOTD? I would 
hope that 90% of Factor could be integrated into LOTD, with the other 10% being 
conveniences (anything relying on GC or dynamic-typing) that weren't critical 
anyway.
regards --- Hugh

 On Monday, July 13, 2015 7:20 PM, John Benediktsson  
wrote:

 These mean the same thing:
: add-quot ( n -- quot ) '[ _ + ] ;
: add-quot ( n -- quot ) [ + ] curry ;

:: add-quot ( n -- quot ) [ n + ] ;

They are basically different ways of currying the 'n' argument into the 
quotation that is produced by ``add-quot``.
Best,John.


 
  --
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Factor-talk Digest, Vol 109, Issue 8

2015-07-12 Thread Hugh Aguilar
Does that work if the quotation accesses the local variables?
Where are the local variables? Are they on the return-stack or in a heap block?
Why do you say '[ _ + ] rather than just [ + ] ?
thanks for your help --- Hugh




Do you mean something like this?

    : add-quot ( n -- quot ) '[ _ + ] ;

    { 1 2 3 } 10 add-quot map .

Yields:

{ 11 12 13 }

Note: this works in the listener with the non-optimizing compiler, but if
you tried to use this in compiled you'd need to add a static call effect to
the quot by either making ``add-quot`` inline, or currying it with ``[
call( x -- x ) ]``.




On Fri, Jul 10, 2015 at 8:09 PM, Hugh Aguilar 
wrote:

> Jul 9 at 8:19 PM
> I sent this yesterday but it seems to have gotten lost --- if it ends up
> being double-posted, I apologize.
>
> Can quotations in Factor still be executed after the parent function has
> gone out of scope (done its EXIT)? Scheme/Lisp allows this, and they hold
> the local frame of the parent function on the heap rather than on the stack
> so that it persists after the parent function has exited so the quotation
> can still use it. It has to eventually get GC'd. LOTD definitely doesn't
> have GC, because the FMITE is a micro-controller (also because we don't
> have tagged data so there is no way to tell the difference between an
> integer and a pointer except to know this a-priori).
>
> In LOTD I don't allow quotations to be executed after the parent function
> has gone out of scope; the parent function's local-frame is on the stack so
> it is lost when the parent function exits.
>
> In LOTD, a quotation could execute after the parent function has gone out
> of scope if it doesn't access the parent function's local variables --- but
> I disallow this too for consistency. The users should just use :NONAME for
> anonymous functions that persist indefinitely --- quotations are for
> situations where the anonymous function needs to communicate with the
> parent, and it does so either through local variables or (if a bar-feature
> higher-order function was used to call the quotation) on the data-stack.
>
> regards --- Hugh

 
  --
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Factor-talk Digest, Vol 109, Issue 6

2015-07-10 Thread Hugh Aguilar
Jul 9 at 8:19 PMI sent this yesterday but it seems to have gotten lost --- if 
it ends up being double-posted, I apologize.
Can quotations in Factor still be executed after the parent function has gone 
out of scope (done its EXIT)? Scheme/Lisp allows this, and they hold the local 
frame of the parent function on the heap rather than on the stack so that it 
persists after the parent function has exited so the quotation can still use 
it. It has to eventually get GC'd. LOTD definitely doesn't have GC, because the 
FMITE is a micro-controller (also because we don't have tagged data so there is 
no way to tell the difference between an integer and a pointer except to know 
this a-priori).
In LOTD I don't allow quotations to be executed after the parent function has 
gone out of scope; the parent function's local-frame is on the stack so it is 
lost when the parent function exits. 
In LOTD, a quotation could execute after the parent function has gone out of 
scope if it doesn't access the parent function's local variables --- but I 
disallow this too for consistency. The users should just use :NONAME for 
anonymous functions that persist indefinitely --- quotations are for situations 
where the anonymous function needs to communicate with the parent, and it does 
so either through local variables or (if a bar-feature higher-order function 
was used to call the quotation) on the data-stack.
regards --- Hugh 



 On Friday, July 10, 2015 8:55 AM, 
"factor-talk-requ...@lists.sourceforge.net" 
 wrote:
   
 

 Send Factor-talk mailing list submissions to
    factor-talk@lists.sourceforge.net

To subscribe or unsubscribe via the World Wide Web, visit
    https://lists.sourceforge.net/lists/listinfo/factor-talk
or, via email, send a message with subject or body 'help' to
    factor-talk-requ...@lists.sourceforge.net

You can reach the person managing the list at
    factor-talk-ow...@lists.sourceforge.net

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Factor-talk digest..."


Today's Topics:

  1. What do we call a collection of vocabs? (Bj?rn Lindqvist)
  2. Re: What do we call a collection of vocabs? (John Benediktsson)
  3. Re: What do we call a collection of vocabs? (Doug Coleman)
  4. Syntax Highlight in Atom (Steve Tsai ???)
  5. Re: What do we call a collection of vocabs? (John Porubek)


--

Message: 1
Date: Fri, 10 Jul 2015 02:46:41 +0200
From: Bj?rn Lindqvist 
Subject: [Factor-talk] What do we call a collection of vocabs?
To: factor-talk@lists.sourceforge.net
Message-ID:
    
Content-Type: text/plain; charset=UTF-8

There is a correspondence between common languages names for
programming objects and Forth-inspired languages names:

Python  => Java      => Factor
function => method    word
module  => class      vocabulary
package  => package    ???

So in Python, a collection of functions (and classes) in a file forms
a module and a collection of modules forms a package. In Java, a
collection of methods forms a class and a collection of classes forms
a package. In Factor, a file with words is a vocab but a collection of
vocabs is what? :) Do we have a name for it?


-- 
mvh/best regards Bj?rn Lindqvist



--

Message: 2
Date: Thu, 9 Jul 2015 18:19:10 -0700
From: John Benediktsson 
Subject: Re: [Factor-talk] What do we call a collection of vocabs?
To: "factor-talk@lists.sourceforge.net"
    
Message-ID:
    
Content-Type: text/plain; charset="utf-8"

The only names we have right now are "vocab-root" (vocabularies that share
a common file directory they are loaded from) or "dictionary" (mapping of
vocabulary names to vocabularies).

I think "package" would be the best name probably, and we have had some
ideas in the past on working on a module system:

    https://gist.github.com/jckarter/3440892

The issue is being tracked here:

    https://github.com/slavapestov/factor/issues/641



On Thu, Jul 9, 2015 at 5:46 PM, Bj?rn Lindqvist  wrote:

> There is a correspondence between common languages names for
> programming objects and Forth-inspired languages names:
>
> Python  => Java      => Factor
> function => method    word
> module  => class      vocabulary
> package  => package    ???
>
> So in Python, a collection of functions (and classes) in a file forms
> a module and a collection of modules forms a package. In Java, a
> collection of methods forms a class and a collection of classes forms
> a package. In Factor, a file with words is a vocab but a collection of
> vocabs is what? :) Do we have a name for it?
>
>
> --
> mvh/best regards Bj?rn Lindqvist
>
>
> --
> Don't Limit Your Business. Reach for the Cloud.
> GigeNET's Cloud Solutions provide you with the tools and support that
> you need to offload your IT needs and focus on growing your business.
> Configured For All Businesses. Start 

Re: [Factor-talk] Factor-talk Digest, Vol 109, Issue 1

2015-07-06 Thread Hugh Aguilar
Yes --- that is a good example.
I am actually well aware that Factor quotations do have access to the parent 
function's local variables --- I remember this from my brief foray into Factor 
about 5 or 6 years ago --- I just wanted to confirm it because, as I said, the 
Forth-200x committee is faking up :NONAME as a quotation and saying that Factor 
also has similar fake quotations (no access to the parent function's local 
variables).
To a large extent, my FMITE was designed for the purpose of proving that at 
least one Forth programmer in the world knows what quotations are --- I would 
like to see it implemented in an FPGA, but even if it doesn't come to fruition, 
I will have still made my point that true quotations are possible.
regards --- Hugh

 On Sunday, July 5, 2015 8:32 PM, John Benediktsson  
wrote:
   
 

 I'm not sure what you mean, but I assume something like this:
    :: foo ( seq -- seq' )
        1 :> temp
        seq [ temp + ] map ;
    IN: scratchpad { 1 3 5 } foo .    { 2 4 6 }
Yes, that works.
If thats not what you meant, can you clarify?
On Fri, Jul 3, 2015 at 3:58 PM, Hugh Aguilar  wrote:

Is it true that in Factor the quotation has access to the parent function's 
local variables?
Over on comp.lang.forth Bernd Payson has said that in Factor quotations do not 
have access to the parent function's local variables --- he uses this argument 
to justify that his "quotations" (just :NONAME with some syntactic sugar) don't 
need to have access to the parent function's locals.
Anyway, in LOTD my quotations have access to the parent function's local 
variables.
regards --- Hugh


 
  --
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Factor-talk Digest, Vol 109, Issue 1

2015-07-03 Thread Hugh Aguilar
Is it true that in Factor the quotation has access to the parent function's 
local variables?
Over on comp.lang.forth Bernd Payson has said that in Factor quotations do not 
have access to the parent function's local variables --- he uses this argument 
to justify that his "quotations" (just :NONAME with some syntactic sugar) don't 
need to have access to the parent function's locals.
Anyway, in LOTD my quotations have access to the parent function's local 
variables.
regards --- Hugh
 


 On Friday, July 3, 2015 10:53 AM, 
"factor-talk-requ...@lists.sourceforge.net" 
 wrote:
   
 

 Send Factor-talk mailing list submissions to
    factor-talk@lists.sourceforge.net

To subscribe or unsubscribe via the World Wide Web, visit
    https://lists.sourceforge.net/lists/listinfo/factor-talk
or, via email, send a message with subject or body 'help' to
    factor-talk-requ...@lists.sourceforge.net

You can reach the person managing the list at
    factor-talk-ow...@lists.sourceforge.net

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Factor-talk digest..."


Today's Topics:

  1. Re: displaying Lisp like nested lists (Iain Gray)
  2. Re: displaying Lisp like nested lists (Bj?rn Lindqvist)
  3. Re: displaying Lisp like nested lists (Iain Gray)
  4. nested nil lists (Iain Gray)
  5. Re: nested nil lists (Iain Gray)
  6. Re: nested nil lists (Jon Harper)


--

Message: 1
Date: Mon, 29 Jun 2015 16:49:03 +0100
From: Iain Gray 
Subject: Re: [Factor-talk] displaying Lisp like nested lists
To: factor-talk@lists.sourceforge.net
Message-ID: <272b8268-5938-4c23-bdbc-0408c5d97...@ednet.co.uk>
Content-Type: text/plain; charset="us-ascii"

that worked thanks

now just to sort my prefix Scheme code into postfix Factor

> On 29 Jun 2015, at 16:33, Jon Harper  wrote:
> 
> Looking at list>array,
> : list>array ( list -- array ) [ ] lmap>array ;
> 
> You can adapt it to recurse on lists:
> IN: scratchpad : deeplist>array ( list -- array ) [ dup list? [ 
> deeplist>array ] when ] lmap>array ;
> 
> IN: scratchpad 1 nil cons 2 nil cons nil cons nil cons cons deeplist>array .
> { { 1 } { { 2 } } }
> 
> Hope that helps,
> Jon
> 
> Jon
> 
> On Mon, Jun 29, 2015 at 5:03 PM, Iain Gray  > wrote:
> that gave me
> 
> { ~cons-state~ ~cons-state~ }
> 
>> On 29 Jun 2015, at 15:22, John Benediktsson > > wrote:
>> 
>> I think you need one more "cons" at the end, but list>array should work fine 
>> recursively.
>> 
>> 
>> 
>> On Mon, Jun 29, 2015 at 5:37 AM, Iain Gray > > wrote:
>> I make a list with
>> 
>> 1 nil cons 2 nil cons nil cons nil cons
>> 
>> but list>array displays only top level, can it descend recursively?
>> 
>> --
>> Monitor 25 network devices or servers for free with OpManager!
>> OpManager is web-based network management software that monitors
>> network devices and physical & virtual servers, alerts via email & sms
>> for fault. Monitor 25 devices for free with no restriction. Download now
>> http://ad.doubleclick.net/ddm/clk/292181274;119417398;o 
>> 
>> ___
>> Factor-talk mailing list
>> Factor-talk@lists.sourceforge.net 
>> https://lists.sourceforge.net/lists/listinfo/factor-talk 
>> 
>> 
>> --
>> Monitor 25 network devices or servers for free with OpManager!
>> OpManager is web-based network management software that monitors 
>> network devices and physical & virtual servers, alerts via email & sms 
>> for fault. Monitor 25 devices for free with no restriction. Download now
>> http://ad.doubleclick.net/ddm/clk/292181274;119417398;o___
>>  
>> 
>> Factor-talk mailing list
>> Factor-talk@lists.sourceforge.net 
>> https://lists.sourceforge.net/lists/listinfo/factor-talk 
>> 
> 
> 
> --
> Monitor 25 network devices or servers for free with OpManager!
> OpManager is web-based network management software that monitors
> network devices and physical & virtual servers, alerts via email & sms
> for fault. Monitor 25 devices for free with no restriction. Download now
> http://ad.doubleclick.net/ddm/clk/292181274;119417398;o 
> 
> ___
> Factor-talk mailing list
> Factor-talk@lists.s

[Factor-talk] the FMITE processor

2015-06-23 Thread Hugh Aguilar
I designed the FMITE processor that could be built into an FPGA. It is designed 
to have compact machine-code. It has support for quotations (a kind of lambda 
function) that Forth-200x lacks:http://www.forth.org/FMITE.txt
In order to dodge the disrepute of ANS-Forth, I have changed the name of the 
language from Forth to LOTD (Language Of The Damned). LOTD is closer to Lisp or 
Factor than it is to ANS-Forth or C --- LOTD is the only language available for 
micro-controllers (afaik) that supports lambda functions --- Factor is way too 
big and slow to be used in a micro-controller. Also, because Factor does GC, it 
is not deterministic in regard to how slow it is (it stutters), so it can't be 
used in real-time no matter how fast the processor is. LOTD is an attempt to 
bring ideas from the Factor world to the real world --- almost all processors 
used for real-time programs are 8-bit or 16-bit, and the big 32-bit processors 
are rare (this will likely continue to be true throughout the 21st century).
I am hoping that Slava will allow me to use this forum to support the FMITE and 
LOTD (he allows Joy and STAAPL to be supported here) --- I want to get away 
from comp.lang.forth that is unmoderated and where trolls routinely say that my 
code "sucks" or is "crap" or that I am "stupid." If the FMITE and LOTD are too 
off-topic for this forum though, then then I will drop out --- I don't really 
have much interest in Factor programming (all desktop-computer programming 
seems boring to me, whatever language may be used) --- I might consider making 
Factor a sister-language to LOTD though, as micro-controller programming 
sometimes involves programs running on a desktop-computer that generate tables 
of constants for use on the micro-controller (the calculations are done with 
higher-precision integers or even with floating-point such as Factor supports 
but LOTD does not support).

regards --- Hugh
--
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors 
network devices and physical & virtual servers, alerts via email & sms 
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] pictured numbers

2010-02-13 Thread Hugh Aguilar
Does Factor have anything comparable to Forth's pictured numbers (the <# ... #> 
functions)? What I am doing right now is using NUMBER>STRING and then modifying 
the string, but this makes for pretty ugly code.

Also, does Factor have anything comparable to Forth's [CHAR] function? Your 
 function expects a char parameter, but I don't want to use numeric 
values because this is hard to read. For example, in Forth I would use [CHAR] 0 
rather than the raw 48 value.


  --
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] website

2010-02-11 Thread Hugh Aguilar
Over on http://www.forthwiki.com I set up a forum devoted to Factor.

This forum allows people to attach programs to their posts and/or to upload 
programs into the gallery. The idea is that people can post Factor programs 
here, to make them public. These would be programs that aren't general-purpose 
enough to be included with the Factor compiler, but which the author still 
wants to make public. This website would be an alternative to git-hub as a 
place to post programs.

On this same forum I have my slide-rule program in the gallery. This program is 
actually written in Forth rather than Factor. It is an example of the kind of 
program that can be posted to this website though. Such a program, written in 
Factor, wouldn't be appropriate for inclusion with the Factor compiler because 
it is not general-purpose. On the other hand though, it is BSD-license and is 
intended to be made available to the public.

The forum also allows people to start discussion threads. In some cases people 
will want to discuss particular Factor programs in detail, and this would tend 
to clutter up the Factor mailing-list as most of the readers wouldn't be 
interested in that program. Such discussions can be diverted to forthwiki to 
leave the Factor mailing-list clear for general-purpose discussions.

I hope that this forum turns out to be useful to the Factor community. I'm 
certainly not competing against this mailing-list as a support center for 
Factor --- my forum over there is intended to be an extension of what is going 
on over here. 


  --
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] SVG

2010-02-08 Thread Hugh Aguilar
I have been reading the Factor documentation. I think that Factor is likely not 
capable of that slide-rule program that I described. I can write code to 
generate SVG in any language (including Forth), but I need some way to turn 
that SVG into an image that can be displayed on the screen. I don't see 
anything in the Factor library that can do this. I found some SVG functions, 
but they seemed to be used for generating SVG. That is somewhat helpful, but 
*using* the SVG is what I need.

I have a book on PyQT (the Python bindings for QT from TrollTech), and their 
library does provide a function for converting an SVG file into an image that 
can be displayed on the screen. I would really prefer to use Factor rather than 
Python though, as I like Factor and I already know some Factor --- but I need 
to be able to work with SVG.

One other question --- what editor do you guys prefer on Linux for working with 
Factor code? Has anybody written Factor support, such as syntax-coloring, for 
any editor?


  --
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] slide-rule

2010-02-05 Thread Hugh Aguilar



From: Jim mack 
To: factor-talk@lists.sourceforge.net
Sent: Wed, February 3, 2010 10:02:50 PM
Subject: Re: [Factor-talk] slide-rule

> I am just getting started in Factor, and am partially drawn to the ability to 
> do cross platform GUI development, but I thought I should mention a cool 
> ability to ship a self-contained HTTP server using their easy to use furnace 
> library.  It could launch a browser to itself on startup and produce the 
> output format file locally.  If you already do web programming it shouldn't 
> be much of a learning curve.



I have never done any GUI programming or web programming, so either approach 
would represent new ground for me. I am somewhat dubious of the idea of a 
browser/server, as there is a lot of data to work with. I could be wrong, 
considering that I've never done this, but my understanding of the 
browser/server idea is that the program running on the browser is dealing with 
a very small amount of data such as the fields in a data-entry form.

Perhaps it would help if I explained how my slide-rule program works: It is a 
three-stage process:

1.) I have words such as D-scale, A-scale, etc., that each generate a 
linked-list representing the scale. Each node is a MARK:

list
w field .kind\  the kind of mark this is (TNY, SML, MID, 
BIG or XTR)
f field .n   \ the numeric value of the mark 
(corresponds to .LABEL)
f field .dist   \ derived from N and measured in Lunits 
(distance from left edge)
w field .orientation   \ the direction of the label in relation to the 
mark
w field .label\ the hstr of the label if there is a label
constant mark

\ If .ORIENTATION is N/A, then there is no label and .LABEL is irrelevant.
\ The DIST value is nominally in the range [0,1], although it might extend over 
the edge slightly.

2.) I convert these MARK lists into SHAPE lists. These contain absolute 
coordinates (in inches) of all the marks and labels on a particular face of the 
slide-rule. Each node is a SHAPE:

list 
p field .src
p field .dst
w field .siz
w field .txt
constant shape \ a text string or a line segment

\ The P fields are .X and .Y pairs.
\ If the .SIZ field is a KIND (TNY, SML, MID, BIG or XTR), then the shape is a 
text string.
\ The .SRC field is the lower-left corner and the .DST field is not used.
\ If the .SIZ field is N/A, then the shape is a line segment.
\ The .SRC and .DST fields are the endpoints.

3.) I convert the SHAPE lists into gcode. All the information in each SHAPE 
node gets etched with G01 commands, and I also pick up the tool and move it 
with a G00 command from each element to the next.

The Factor program would be the same as the Forth except that I will use 
sequences rather than linked lists, as linked lists are apparently not 
idiomatic in Factor. The GUI would allow the user to drag-and-drop the scales 
into place to construct the slide-rule, and would also allow the user to 
simulate the use of the slide-rule by moving the slide and the cursor to and 
fro on the constructed slide-rule. There would have to be an alternative #3 
step above that generates some kind of graphical image rather than gcode.

Does Factor have the ability to display SVG on the screen? Or would I need to 
generate some other kind of graphical image? If Factor has support for 
displaying graphical images (of any kind) on the screen, then I think the whole 
thing would be best written in Factor as a GUI program. If Factor can't do 
this, then it might be better to have the Factor program generate SVG on the 
server side, and then write a JavaScript program to run in a browser and 
display the SVG images. 



  --
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] slide-rule

2010-02-03 Thread Hugh Aguilar
I completed my Forth program for generating gcode for etching aluminum 
slide-rules. I can email it to anybody who wants it, and it is also available 
on www.forth.org. It is pretty robust code and anybody with a little knowledge 
of Forth can upgrade it to include custom scales. There are a lot of 
applications-specific scales that people might want, but I only have the more 
generally useful scales. Even if a person knows nothing of Forth, he can do 
some cut-and-paste to rearrange the scales into whatever layout he wants. At 
this time I have these slide-rules written:

two-sided basic model
two-sided electrical-engineer model (has hyperbolic trig functions)
one-side pocket model
round key-fob model (has LL scale tied to A scale for calculating compound 
interest)

I am telling you Factor folks about this as most of you know some Forth. Also, 
the most likely next step with this program will be to port it over to Factor 
and give it a GUI so that people can construct slide-rules of their own design 
and also simulate them on the computer. I've never written a GUI program 
before, so this will be a pretty big step for me. Generating the gcode for 
milling machines was the most important part, as that is necessary for building 
physical slide-rules, but that part is done now.

These are the scales that I have at this time:

L-scale Common (base-10) logarithms.
D-scale The fundamental [1,10] scale.
DI-scale The D-scale inverted.
DF-scale The D-scale folded at pi.
DIF-scale The D-scale folded at pi and inverted.
R1-scale The lower square-root scale.
R2-scale The upper square-root scale.
K1-scale The lower cube-root scale.
K2-scale The middle cube-root scale.
K3-scale The upper cube-root scale.
A-scale The complete square-root scale.
K-scale The complete cube-root scale.
S-scale The sine scale in the range [5.7,90].
CS-scale The cosine scale in the range [0.0,84.3].
T-scale The tangent scale in the range [5.7,45].
T2-scale The tangent scale in the range [45,84.3].
AT-scale The tangent scale in the range [5.7,90] and tied to the A-scale.
ST-scale The sine/tangent scale in the range [0.57,5.7].
SH1-scale The hyperbolic sine in the range [0.1,0.88]
SH2-scale The hyperbolic sine in the range [0.88,3.0]
TH-scale The hyperbolic tangent in the range [0.1,3.0]
CH-scale The hyperbolic cosine in the range [0.0,3.0]
LL3-scale The log-log scale in the range [2.718,22026].
LL2-scale The log-log scale in the range [1.105,2.718].
LL1-scale The log-log scale in the range [1.010,1.105].
LL0-scale The log-log scale in the range [1.001,1.010].
LL-scale The log-log scale in the range [1.010,2.718] and tied to the A-scale.
LL0N-scale The log-log scale in the range [0.990,0.999].
LL1N-scale The log-log scale in the range [0.905,0.990].
LL2N-scale The log-log scale in the range [0.368,0.905].
LL3N-scale The log-log scale in the range [4.540e-5,0.368].
C-scale A synonym for D-SCALE.
CI-scale A synonym for DI-SCALE.
CF-scale A synonym for DF-SCALE.
CIF-scale A synonym for DIF-SCALE.
B-scale A synonym for A-SCALE.



  --
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] CNC

2009-12-31 Thread Hugh Aguilar
Hello again. I've changed my email address. It was hugoagui...@rosycrew.com 
previously, but that email is no longer in existence as my website is kaput 
now. I think I may have missed a couple of weeks worth of your posts --- 
hopefully you didn't say anything important while I was gone. :-)

I've been working on Forth mostly. Here is some of my code: 
http://www.forth.org/novice.html I almost have the slide-rule program 
completed. The biggest problem remaining is generating gcode to produce text 
characters for the labels on the marks (mostly numbers but some symbols such as 
for pi) and the names of the scales (C, D, S, T, etc.). Would you guys know 
where I can get gcode for alpha-numeric characters? I need to be able to scale 
it to different sizes (specifically 0.05 and 0.08 inch squares). Also do you 
know where I can get a gcode plotter? I have the CNC Handbook (which cost me 
$70!) which includes NCplot (http://www.ncplot.com/) and this should do the job 
for me, but I wondered if you had any alternative suggestions. I worked with a 
guy once who *hand-wrote* gcode for the entire alpha-numeric set! Lots of 
people have tackled this problem, although I think most try for a more 
automated solution. I want something that is free, as I'm not
 spending any more money on the project. 

The plan with the slide-rule is to make it out of aluminum. The aluminum will 
be anodized black or royal-blue, and then a milling machine will scratch off 
the anodization to make the marks and the text. The hope is that people will 
put these slide-rules in time-capsules. If our civilization does collapse, 
these time-capsules can be found centuries in the future and people can use the 
slide-rules to rebuild civilization. They are unlikely to be able to read 
English. A slide-rule is pretty self-explanatory though. With a little bit of 
experimentation they will be able to figure out what it does, even if they 
can't read the instruction manual. If they have the ability to do arithmetic, 
they can go on from there to reinvent science --- but science can't be 
recovered otherwise.

I never wrote the LaTeX code, as I have been focusing on gcode, but that should 
be easy. A problem with LaTeX though, is that the text characters can't be 
scaled to any size; they come in only certain fixed sizes. This is true AFAIK 
--- I will have to read up on LaTeX more to find out if this limitation can be 
gotten around.

The reason why I wrote the program in Forth rather than Factor is that Factor 
is too much in flux. Code written for previous versions has to be rewritten for 
newer versions. With my slide-rule program, I want to send the source-code out 
into the wild and have people who don't necessarily know very much about 
programming be able to recompile it. I don't really like the ANS-Forth 
standard, but at least it is stable. 

I can foresee switching over to Factor later on though. This would involve 
writing a GUI that would allow the user to modify the design of the slide-rule 
(one-sided or two-sided, which scales are included, and where the scales are 
positioned) without having to delve into modifying the source-code. Right now, 
these kinds of modifications are done with cut-and-paste modification of the 
source-code. One good thing about Factor is that I can write a gcode plotter in 
Factor using its graphical facilities. This can't be done in Forth unless I 
require the use of a commercial Forth system and its graphics library, but I 
don't want to force my users to spend money on any commercial system. Plotting 
would be a huge help as it would provide the user with immediate feedback on 
what his slide-rule is looking like. Pretty much any kind of CAM program is 
going to need plotting like this. A slide-rule just requires 2-dimensional 
plotting. Most machining would require a
 3-dimensional representation of some kind, which is much more complicated.

If anybody is interested, I can show you my Forth program. The complicated part 
was the generation of the scales, which is recursive. Each scale consists of 
sections, and each section consists of sections, and so forth. The sections on 
the left are wider and have more gradations of marks than the sections on the 
right, and that is the complicated part. Now that this is done though, I can 
generate any kind of scale that anybody can think of. For example, I have a 
scale that is a combination of the LL1 and LL2 scales, and is tied to the A 
scale rather than the D scale --- I've never seen such a thing on any other 
slide-rule ever made. It works well for calculating compound interest. So long 
as your FV (future-value) isn't any more than 2.72 times your principal, it 
won't overflow (and the FV isn't going to be this large unless you are a 
loan-shark). To help the user, I labeled the first ten marks as 1%, 2%, ... 10% 
rather than 1.01, 10.2 ... 1.1. The
 slide-rule is a lot faster than using a financial calculator. While you are 
talking to somebody, nego

[Factor-talk] symtab

2009-11-14 Thread Hugh Aguilar
I recently ported symtab.factor over to Forth. During that process I 
discovered a bug in the Factor version that I fixed. Here is the new 
version:
www.rosycrew.org/symtab.factor
Here is the Forth version and another file containing some basic support:
www.rosycrew.org/symtab.4th
www.rosycrew.org/novice.4th

In some respects, the Forth version is more readable than the Factor 
version. Look at these words: STRONG-SIDE and . The Factor version 
has a lot of stair-stepping IF conditionals, which I find to be very 
confusing. The Forth version avoid this by using EXIT.


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] 64-bit

2009-11-09 Thread Hugh Aguilar
Well, I decided to join the modern world and switch over from Windows to 
Ubuntu (9.04). I found that the 64-bit version of Factor wouldn't run on my 
computer (I got an error message that I can't execute a binary file), but 
the 32-bit version did run okay. I have an AMD Turion MK38, which is 64-bit. 
What are the requirements for the different versions of Factor? 


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] LC53 --- volunteers needed for porting

2009-11-08 Thread Hugh Aguilar
Cool! Thanks for volunteering.

Am I reading that correctly --- that it took 17 minutes and 28 seconds, 
compared to 10 minutes for Slava's Factor version? That's pretty slow. The 
next step will be to make the 0 and 1 tries run concurrently. That's my 
intention with Erlang but I haven't started yet due to being busy with other 
things.

The RosyCrew site isn't down. I don't know why you weren't able to connect. 
If you continue to have trouble connecting, let me know in a private email 
and I will talk to my ISP about the problem. My website (the non-programming 
parts) is politically-incorrect and it may be getting blocked. Library 
computers, for example, have software installed that blocks websites that 
have been black-listed. Mostly that is done to block porn sites, but it is 
also done to prevent access to sites that critisize the government --- which 
mine does.

These are the files once again:

http://www.rosycrew.org/LC53.factor
http://www.rosycrew.org/LC53.4th
http://www.rosycrew.org/test.txt

The test file doesn't matter. Any file of 7-bit ascii will work if it is 
long enough that only one seed value will encrypt it to the same result. I 
don't know how long that is, but it is likely around 10-ish bytes, so pretty 
much any file should be fine.

> Message: 2
> Date: Thu, 5 Nov 2009 00:38:53 +0900
> From: Jon Harper 
> Subject: Re: [Factor-talk] LC53 --- volunteers needed for porting
> To: factor-talk@lists.sourceforge.net
> Message-ID:
> <8c7c5e590911040738x650fc6des971d3df272dac...@mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> Hey,
> I translated Slava's program in Haskell. You can find it here :
> http://paste.factorcode.org/paste?id=1019
> Please note I have very little haskell experience and it's mostly
> rusty, so for all haskell pros here, please don't cry your eyes out!
> But please annotate :)
> I had trouble with types so I had to cast everything to Integers
> before doing Bits operations. That can probably be optimized.
>
> I couldn't download the test file from rosycrew.com (site is down?) so
> I benchmarked it on a random short file.
>
> $ ghc -o main LC53.hs
> $ time ./main
> ./main 988,61s user 4,66s system 94% cpu 17:28,24 total
>
> Slava's factor version runs in 600 seconds on the same file.
>
> Also, I'm running on : Linux zouglou 2.6.31-14-generic #48-Ubuntu SMP
> Fri Oct 16 14:04:26 UTC 2009 i686 GNU/Linux, with only 1 core


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] LC53 --- volunteers needed for porting

2009-10-30 Thread Hugh Aguilar
Note that, in the case of the HOW-FAR values being equal, I arbitrarily 
chose to try 1 first and 0 second. If this is done the other way around you 
still get a correct answer, but the time required will be different. For 
some seed values, this will be improve the speed, and for other seed values 
this will slow down the search. If you implement it the same as I did, then 
the number of visits to   will be equal to 464723587 (see the 
comment at the bottom of the source file). There is debugging code in the 
Forth program (optionally compiled if DEBUG? is set to true) that checks for 
this (not in Slava's Factor program though).

Note for Slava: Maybe you should include comparable debugging code in your 
version of LC53 to make sure that it is visiting  the same number 
of times as the Forth program. If it isn't, this might be why your program 
ran slower than expected, even though it produced the correct seed 
ultimately. When I was developing LC53, at one time my Forth, Factor and 
assembly-language versions were all out of whack with each other, even 
though they all produced the correct seed ultimately. I'll leave it up to 
you to do this, as I haven't yet figured out all of the new words that you 
introduced in your version, so I don't want to try modifying it.

As for the Clojure version, I would recommend first writing a version that 
is purely sequential and does exactly what the Forth program does (visiting 
 the same number of times). After this is done, write another 
version that takes advantage of Clojure's concurrency. In the event that the 
HOW-FAR values are equal, try both 1 and 0 simultaneously. If possible, run 
this on a multi-core computer.

If you have questions about LC53 implementation, contact me directly through 
my email --- we don't want to clutter up the Factor mailing list with 
discussions of Java and Clojure programming, which would be considered 
off-topic.

> Message: 2
> Date: Tue, 27 Oct 2009 16:37:47 +
> From: Emeka 
> Subject: Re: [Factor-talk] LC53 --- volunteers needed for porting
> To: factor-talk@lists.sourceforge.net
> Message-ID:
> <89c38c820910270937m53011e52v78c68dcbc3d89...@mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hugh,
>
> I would look into porting your  LC53 to Clojure and Java
>
> Regards,
> Emeka


--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] LC53 --- volunteers needed for porting

2009-10-26 Thread Hugh Aguilar
There was a bug in the 32-bit compiler that was preventing Slava's LC53 from 
running, but that has been fixed in the latest release. Here are the times:

Factor (Slava's)-- 11 minutes 14 seconds 
http://paste.factorcode.org/paste?id=998
Factor (mine) - 9 minutes 14 seconds  www.rosycrew.org/LC53.factor
SwiftForth  - 22 seconds www.rosycrew.org/LC53.4th
assembly-language - 17 seconds

It is unclear why Slava's Factor program is slower than mine, but I suspect 
that the DIP in HOW-FAR is the culprit. Slava assures me that an upcoming 
release of Factor (within a few weeks) will be more oriented toward 
integer-arithmetic and should run faster. In the meantime, I would like to 
port LC53 over to the following languages for comparison. If anybody here 
has experience in any of these languages (or in any languages not listed), 
please volunteer to do the porting.

Java
Clojure
Scala
GCC
Lazerus Pascal
Erlang
Haskell
Python
Ruby
Visual C++
Visual Basic

My Forth program should run under any ANS-Forth system, but SwiftForth is 
the only one that I use. If anybody uses iForth, VFX, BigForth, etc., we can 
test those as well. You may need a calender to time the Python and Ruby 
programs, but these are popular languages so we should include them. I'm 
going to do the Erlang, although anybody else who knows Erlang is welcome to 
do so also (this will actually be my first Erlang program, so it might take 
me a while to write it). The LC53 search uses the HOW-FAR value to determine 
if it should test a 1 or a 0 first. Considering that the HOW-FAR value is 
typically in the range [0,3], the two values being compared are often equal. 
In this case, LC53 arbitrarily chooses to test 1 first and 0 second. In the 
Erlang program, it will test both 1 and 0 simultaneously. Given a computer 
with multiple processors, this should result in a hella fast program, 
possibly even faster than the assembly-language program. We will see.

Does anybody here have access to a computer with multiple processors? If so, 
then we can use that computer as our official testing platform for all of 
the languages. This will tilt the table toward any languages (Erlang, 
Clojure, Haskell) that take advantage of multiple processors. That seems 
fair to me --- any serious effort at encryption cracking is going to involve 
using concurrency.

> Message: 4
> Date: Tue, 20 Oct 2009 23:16:19 -0500
> From: Slava Pestov 
> Subject: Re: [Factor-talk] LC53 encryption cracking
> To: factor-talk@lists.sourceforge.net
> Message-ID:
> <806f58f20910202116n40d1ca1ej7b602acb2d2aa...@mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> On Tue, Oct 20, 2009 at 8:58 PM, Hugh Aguilar  
> wrote:
>> In regard to Factor, all that I did was inlining as I wasn't able to 
>> figure out
>> what Slava was talking about in regard to rewriting HOW-FAR. This shaved 
>> off
>> about 3 minutes from the Factor time, which was pretty good, although not 
>> as
>> significant as the effect on Forth.
>
> Here is a version of LC53 that doesn't use dynamic variables:
>
> http://paste.factorcode.org/paste?id=998
>
> It also uses TYPED: in one place to make the Factor compiler generate
> a specialized 'find' loop over byte arrays, instead of dispatching on
> each iteration. I got a 30% speedup with these changes, they also have
> the nice effect of making the code simpler.
>
> Once Factor's compiler has support for native-size integers, it will
> be able to run this program much faster without any changes to the
> code, since it will not need to allocate bignum objects and dispatch
> between fixnum and bignum types anymore.
>
> On the other hand, I find the Forth version of the benchmark to be
> completely unreadable.
>
> Slava


--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] FLUSH bug

2009-10-22 Thread Hugh Aguilar
My understanding of the FLUSH word is that it is supposed to flush the 
output buffer before proceeding. The documentation says: "Waits for any 
pending output on output-stream to complete."

This isn't happening on my Windows system (the 10-20-09 download). I noticed 
this in regard to Slava's version of LC53 --- the "commencing cracking" 
message didn't appear until after the program had completed. It was supposed 
to appear before the main part of the program began.


--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] LC53 --- trash the assembly-language

2009-10-22 Thread Hugh Aguilar
Here is a new version of LC53: www.rosycrew.org/LC53.4th

I removed the assembly-language because it tended to clutter up the 
source-code. It was originally included to provide a baseline benchmark, but 
that is not particularly interesting and assembly-language is beyond the 
scope of the book that I am writing. Also, there might be confusion in that 
people may assume that the Forth program's speed is due to 
assembly-language, not realizing that the assembly-language was actually a 
separate program.

I also improved the readability of the Forth code somewhat --- smoothing 
over all of that r-stack access in . None of this had any effect 
on the time of the benchmark, which is still about 22 seconds.


--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] LC53 encryption cracking

2009-10-20 Thread Hugh Aguilar
I made some improvements to both the Factor and Forth versions of LC53 in 
both speed and style. I also fixed a bug in the games-and-simulations 
section, although that didn't have anything to do with the encryption. I 
also fixed my test.txt file so that it would say "Fourth Amendmend" rather 
than "Second Amendment." Here are the new files.

Factor: www.rosycrew.org/LC53.factor
Forth:   www.rosycrew.org/LC53.4th
test:  www.rosycrew.org/test.txt

Here are the new times:

Factor  9 minutes and 14 seconds
SwiftForth  --22 seconds
assembly-language --17 seconds

In regard to Forth, the biggest gain came from inlining a lot of the 
lower-level words. I also rewrote HOW-FAR to use a BEGIN loop rather than a 
DO loop, but that only shaved off a few more seconds (from 28 down to 
22) --- this is as compared to shaving off minutes just by inlining. In 
regard to Factor, all that I did was inlining as I wasn't able to figure out 
what Slava was talking about in regard to rewriting HOW-FAR. This shaved off 
about 3 minutes from the Factor time, which was pretty good, although not as 
significant as the effect on Forth.

Apparently, all of that calling of functions really kills the speed. I have 
read both of Michael Abrash's books on assembly language (first for the 8088 
and then for the Pentium), and he emphasizes the avoidance of jumps and 
calls as being important. Still, I was amazed at how much of an effect 
inlining had on the program. I also moved the functions closer together, 
which may have helped. I think what happened here is that, previously, the 
cache was having to be reloaded repeatedly. With the new arrangement, 
everything was in the cache and the entire shebang ran without any cache 
reloading. I say this as if I actually know what a cache is --- but I don't 
anymore. We have different manufacturers making Pentium-compatible 
processors nowadays, and there is not much compatibility in the low-level 
details. My laptop has an "AMD Turion 64 Mobile Technology MK38" (K8), if 
that means anything to you guys. Compiler-optimization has gotten so 
complicated nowadays that I just do it by guess and by golly --- I don't 
really have any way of predicting run-times the way that I did back in the 
pre-Pentium era.


--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] LC53 encryption cracking

2009-10-18 Thread Hugh Aguilar
I wrote a program to crack a linear-congruential (LC) encryption system. The 
system is called LC53 (my invention), and it uses these constants:

unity = 2^32-5
mult = 2^32-3

LC encryption is fairly easy to crack, so nobody uses it in practice, but it 
makes for a good test of a language in regard to integer arithmetic and 
recursion. Before I put this benchmark in my book, I hope that you guys will 
look over the Factor version with an eye toward improving the speed 
(primarily) and the style (secondarily).

If you want to port the program over to another language (especially C and 
Java), I would appreciate that too. In the Forth program, I have a 
compiler-directive called SwiftForth? that, if set true, will compile an 
assembly-language version of the program. This is written using the 
SwiftForth assembler, so it will only compile under SwiftForth. When 
SwiftForth? is set false, the program will compile under any 32-bit 
ANS-Forth system (I used SwiftForth for the benchmark given below).

The good news is that Factor came out about an order of magnitude faster 
than I expected. That really speaks well of Slava and the others who have 
worked on the optimizer in the Factor compiler. These are the times (on my 
laptop):

Factor - 12 minutes and 11 seconds
Forth --- 2 minutes and 23 seconds
assembly language  17 seconds

This is the Factor program: www.rosycrew.com/LC53.factor
This is the Forth program:   www.rosycrew.com/LC53.4th
This is the test file: www.rosycrew.com/test.txt


--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Factor-talk Digest, Vol 42, Issue 10

2009-10-13 Thread Hugh Aguilar
> Message: 1
> Date: Sat, 10 Oct 2009 17:33:37 -0700
> From: "William Tanksley, Jr" 
> Subject: Re: [Factor-talk] "Factor Versus Forth" --- the book
> To: factor-talk@lists.sourceforge.net
> Message-ID:
> <37d01e670910101733i544198f9hc42107dd9ee9d...@mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> Doug, I see your purpose and appreciate it; I think you explained well
> why Factor separates data flow from operators. However, Forth's */
> operator has one additional purpose; it's really merely to be able to
> avoid typing a space between star and slash. It's actually a scaling
> operator which uses a double-length intermediate result, so that as
> long as your final answer fits into a single-length integer, there
> will be no overflow. In Forth, at that time, that's a very significant
> guarantee.
>
> Factor doesn't need that; it has other ways to avoid integer overflow.

I agree that Factor is easier to use than Forth in regard to arithmetic, 
because the programmer doesn't have to worry about integer overflow and 
other such low-level concerns. On the other hand though, Forth is hella-fast 
largely because it supports mixed-precision arithmetic. Even in the 1980s 
when Forth was compiling to threaded code and C was compiling to 
machine-code, Forth still beat C in speed when used in applications that 
involved a lot of arithmetic (nowadays most Forth systems compile to 
machine-code and often beat C on all manner of applications).

I said in the book that Factor makes an excellent prototyping language for 
Forth. The programmer can get a prototype working in Factor, and only 
concern himself with the integer-overflow issue when he is porting it to 
Forth for the production version. This is better than trying to write a 
program from scratch, which involves a lot of high-level thinking, while 
simultaneously dealing with a lot of low-level issues --- as done in Forth 
right now.

It seems to me that Factor is tied to Forth because you decided to use a 
Forth-like syntax (rather than a Lisp-like or Java-like syntax) --- and the 
only reason for using Forth-like syntax was to support Factor/Forth ports. 
When Factor diverges too far from Forth syntax however, then Factor betrays 
the very purpose of Factor. Factor can be a super-Forth, that supports 
dynamic-OOP and garbage-collection and other niceties that Forth doesn't 
provide (because they would be too slow), but it should still continue to be 
a Forth. Even if you like Joy, with its DIP and all that, this is immaterial 
to the main purpose of programming, which is to write hella-fast programs. 
That is what the customer wants.


--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] "Factor Versus Forth" --- the book

2009-10-13 Thread Hugh Aguilar
>
> Message: 4
> Date: Mon, 12 Oct 2009 01:07:47 +0200
> From: Samuel Tardieu 
> Subject: Re: [Factor-talk] "Factor Versus Forth" --- the book
> To: factor-talk@lists.sourceforge.net
> Message-ID: <87iqelcyws@willow.rfc1149.net>
> Content-Type: text/plain; charset=us-ascii
>
> Hugh> A more modern microprocessor such as the PIC18 is also pretty
> Hugh> simple, and would be another reasonable choice.
>
> PIC18 with their unique work register are pretty awful to work
> with. Trust me, I've written a Forth compiler for this architecture...

Actually, after I suggested the PIC18 I realized that it would be a bad 
choice. It doesn't really have any addressing modes. There is no indexed 
addressing like in the 65c02 --- the programmer is expected to simulate 
addressing modes by writing macros. It is "pretty awful."

A much better choice would be the 8-bit AVR. That is a hella-fast modern 
processor that people would be interested in from a practical standpoint 
(unlike both the 65c02 and the 8080), and it has a fairly straightforward 
architecture complete with addressing modes. If this book is going to be 
read by Forth programmers, then it is going to have to discuss real-word 
programming --- meaning micro-controllers --- because that is what they care 
about.

P.S. for Chris Double --- I will read up on that Joy link that you provided. 
Maybe then I can come to grips with DIP and all that, which largely confuse 
me right now.


--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] "Factor Versus Forth" --- the book

2009-10-11 Thread Hugh Aguilar

> Message: 6
> Date: Sat, 10 Oct 2009 18:48:53 -0500
> From: Doug Coleman 
> Subject: Re: [Factor-talk] "Factor Versus Forth" --- the book
> To: factor-talk@lists.sourceforge.net
> Message-ID: <3a2525b0-76e7-4815-8641-f537d742e...@gmail.com>
> Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes
>
> Hi Hugh,
>
> In your book, you state that you know about the */ word in Forth,
> allowing you to quickly solve the resistor problem.  Why not go the
> whole hog and ship a new word in every Forth implementation:
>
> : *+/ ( x y -- z ) 2dup + */ ;
>
> This directly solves the problem -- any competent Forth programmer
> would be able to look at the formula for parallel resistors and
> immediately think of this solution.  It's so elegant!
>
> But how many three-operator words would you include by default?  What
> about /-* or +// or */* or some other combination?  Which ones should
> we package into our Forth distributions?

Forth is a *thin* language --- we don't go whole hog and ship a jillion 
secondary words in every Forth implementation; that was pretty much the 
point of my "bad things about Factor" section. Forth only ships a relative 
handful of words that have been found to be widely useful. One of these is 
star-slash the scalar. It is called that because it is typically used for 
scaling integer arithmetic. You use continued fractions to find rational 
approximations for real numbers, and this allows you to use integer 
arithmetic for the kind of calculations that are normally done in 
floating-point. For example, you could write a word like this:

: pi*  ( n -- n*pi )  355 113 */ ;

> The solution in Factor is to provide data flow constructs that the
> user fills in with operations, instead of combining the data flow and
> operators into the same word like */ does.
...
> In short, separating data flow from operators is a powerful feature.

If you had read the next section, "good things about Factor," you would have 
seen that I like quotations and want them to be introduced into Forth. I 
agree that separating data flow from operators is a powerful feature. My 
point is that this good idea shouldn't be taken to a pathological extreme. 
When you introduce this kind of programming into something as short and 
simple as the par function, just to get rid of the 2dup stack-shuffler, you 
are killing a fly with sledgehammer. I did like the use of reduce and 
map-reduce in the pars function (and I'm going to write those functions in 
Forth in the next chapter) --- but pars is a bigger function than par so now 
you are killing a mouse with a sledgehammer, which makes more sense.

The kind of programming that you are describing would shine a lot better 
employed in a larger example program than the ones that I provided in my 
first chapter. Since you feel so passionately about the elegance of 
quotations and sequences, as compared to the crudeness of Forth 
stack-shufflers, why don't you write the Factor version of the 65c02 
assembler? I don't want to write this myself, and then shoot it down like a 
clay pidgeon, as that would hardly be fair --- everybody will say: "If the 
Factor version had been written by a real Factor programmer, it wouldn't 
have been so easy to shoot down." Remember that I assume that anybody who 
complains about my writing is volunteering to step in and do a better job. 
:-)

To make the job easier, it is not necessary to translate traditional 
assembly such as this:

lda  #1234

You can use post-fix like this:

1234  lda#

Your lda# would be a Factor word that compiles the instruction into the 
target memory specific to the parameter (1234) that it is given. Your 
assembly-language code is actually a Factor program itself, and executing 
this Factor program generates the target image for the microprocessor. This 
is the typical way that Forth programmers write assemblers, and it is pretty 
easy. Is there a better way to write an assembler in Factor?

As I said before, I just chose the 65c02 because it is super-simple (and I 
wrote one already, a long time ago). A more modern microprocessor such as 
the PIC18 is also pretty simple, and would be another reasonable choice. 
Processors such as the PIC24 are too complicated for a book such as this 
though.


--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] "Factor Versus Forth" --- the book

2009-10-10 Thread Hugh Aguilar
I have an updated version. Please read it through all the way, rather than 
just go to the new sections, as there is a lot of rewriting throughout. 
Thanks for your continued help in improving this documentation.

The dvi is here: www.rosycrew.org/FactorVsForth.dvi
The pdf is here: www.rosycrew.org/FactorVsForth.pdf

Note that I have a section titled: "bad things about Factor." Don't stop 
reading here though --- the next section is titled: "good things about 
Factor." The book is supposed to be balanced and fair. :-)

BTW, I'm intending to present a 65c02 assembler later. I chose the 65c02 
because it is quite simple, everybody is familiar with it, and there are 
plenty of simulators available for it even today. The downside, of course, 
is that it has very little practical value anymore. If you would prefer a 
more modern microprocessor target, let me know. Of course, if you have an 
opinion on this, then that also means that you're volunteering to write the 
Factor version...


--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] "Factor vs. Forth" --- the book

2009-10-07 Thread Hugh Aguilar
> Message: 1
> Date: Tue, 6 Oct 2009 15:21:17 +1300
> From: Chris Double 
> Subject: Re: [Factor-talk] "Factor vs. Forth" --- the book
> To: factor-talk@lists.sourceforge.net
> Message-ID:
> 
> Content-Type: text/plain; charset=ISO-8859-1
> It's an interesting read - I like seeing what a Forth programmers
> perspective is on Factor. Personally I find your use of the term 'real
> world' odd since the meaning is obviously different depending on the
> type of development you do. To me, 'real world' is any application
> that gets used. Including web applications (What I tend to use and
> develop in Factor) and desktop applications.
>
> Some of the Factor examples could do with tweaking. One quick example
> is your first definition of 'pars':

Thanks for the feedback. It is not my intention with this book to represent 
myself as the big Factor export. I am a Forth programmer first and foremost. 
I think that my book is useful primarily for comparing Factor to Forth, as 
the title suggests, and that I am the most appropriate author given my 
background in Forth. I am going to need some help with the Factor code 
though --- both you and Slava have already provided good rewrites for my 
pars function.

If my inexperience in Factor makes me unqualified to write this book, then I 
will drop the project. That is largely up to the more experienced Factor 
programmers such as yourself --- whether or not they are willing to continue 
to provide rewrites and improvements for my Factor code that I include in 
the book. Slava did say that many people have started to write such a book, 
but that all of given up shortly thereafter. To a certain extent, I am 
writing this book for myself as much as for other people --- it is helping 
me to come to grips with Factor.

As for my use of the term "real-world," that is pretty typical among people 
who do motion-control work. You may not be aware of this, but those folks 
consider desktop computers to be *Boring* with a capital `B'. This is also 
what a lot of non-technical people think. Over the summer I worked on a 
cattle ranch helping with the haying. When I told my boss that I normally 
work as a computer programmer, he said: "I don't know how you do it. That is 
just so boring, because you are just sitting there in front of the computer 
all day." This is despite the fact that he had spent the entire day sitting 
in front of a computer. In his tractor there is a computer connected to the 
round baler that he is pulling, that provides continuous information about 
what is going on back there. It tells him how fat the bale is on each end so 
that he can steer into the windrow correctly, so as to get a nice 
cylindrical bale that is not tapered, nor fat in the middle like a whiskey 
barrel. This is the real world though --- this has nothing to do with 
sitting in front of a computer at a desk --- he thinks that the baler is 
hella cool technology (it cost $40,000, so it ought to be).

Of course, the avoidance of desktop computers can be taken to an extreme 
too. That guy's wife, who is the owner of the ranch, told me that she 
calculates her finances using a spreadsheet --- meaning a gigantic sheet of 
paper on the kitchen table. This is how her mother did it when she was 
alive, and most likely how her daughter does it, and how her grand-daughter 
will also do it when she grows up. That is actually somewhat ridiculous in 
the year 2009, though. :-)

P.S. for Emeka --- I will provide a postscript or pdf file in addition to 
the dvi file for my next update.


--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] "Factor vs. Forth" --- the book

2009-10-05 Thread Hugh Aguilar
Well, I've taken a stab at writing some documentation comparing Factor to 
Forth. Take a look at this (www.rosycrew.org/FactorVsForth.dvi) and let me 
know if this is going in a direction that you think will be useful.

Despite the title, I'm not allowing the book to become a "my language can 
beat up your language" type of discussion. It is a pretty fair comparison, 
IMHO.

If you don't have a dvi viewer, let me know and I will convert it into 
another format. Also, please excuse the primitive formatting. I was working 
on Windows and I didn't have all of the packages that I am accustomed to 
under Linux --- it can be made more professional looking later, but that is 
not a high priority right now.


--
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] trash list, but keep symtab

2009-10-01 Thread Hugh Aguilar
> Message: 2
> Date: Tue, 29 Sep 2009 13:10:55 +0900
> From: Jon Harper 
> Subject: Re: [Factor-talk] trash list, but keep symtab
> To: factor-talk@lists.sourceforge.net
> Message-ID:
> <8c7c5e590909282110j41e68543n674c82a7a4acf...@mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> Have you looked at these articles ?
> http://docs.factorcode.org/content/article-sequences-destructive.html
> http://docs.factorcode.org/content/article-sequences-destructive-discussion.html

No I hadn't, so thanks for the tip. I agree that making new sequences is 
generally better than modifying existing sequences because programming 
without side-effects is a virtue. What I had found cumbersome is that some 
sequence operations do it one way, and some the other way, whereas my lists 
had only supported in-place modification and required clone-list to be be 
called explicitely to make a new list. I'm pretty much getting the hang of 
sequences now though, and have put aside list.

I was primarily confused because I didn't realize that in Factor some datums 
(tuples) are passed by reference, and some datums (numbers) are passed by 
value. This confused the heck out of me because I am accustomed to languages 
such as C in which passing by reference is specified explicitely (with the 
&), but is not implicitely implied by the data type being used. A sequence 
with numbers in it would not be easily modified in place, but a sequence 
with tuples in it would be easilty modified in place because the datums are 
all references to the original data that is someplace else. A sequence with 
a mixture of numbers and tuples in it would be "corrupted" by the numbers in 
it, which would prevent it from being modified in place.

It seems to me that having the data type imply whether the datum is by 
reference or value is in contradiction to the philosophy of dynamic typing 
in which the programmer supposedly doesn't have to worry about what types 
his datums are. With Factor's system, the programmer has to know the type of 
the datum so that he can know if it is a reference or a value.

Is there anyway to know (other than by experimentation) which data types are 
passed by reference and which by value?


--
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] trash list, but keep symtab

2009-09-28 Thread Hugh Aguilar
> Message: 5
> Date: Sun, 27 Sep 2009 23:02:36 -0500
> From: Slava Pestov 
> Subject: Re: [Factor-talk] trash list, but keep symtab
> To: factor-talk@lists.sourceforge.net
> Message-ID:
> <806f58f20909272102h589686a2nf7bc15221463c...@mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1

> Circular linked lists are useful in some situations. For example
> inserting an element in the middle takes O(1) time.

This does apply to my slide-rule program, as it involves a lot of inserting 
and other manipulation. On the other hand, my slide-rule program isn't 
speed-critical as it is only run once per design. The slide-rule program is 
all about extensability in the sense that the user can write an extension 
program that produces a slide-rule of his own design (his choice of what 
scales to include, where to put them, the size of the slide-rule, whether it 
is one-sided or two-sided, etc.). In this environment, idiomatic style is 
more important than execution speed, as the user wants to minimize how much 
he has to learn before he can begin writing his extension.

I am converting my slide-rule program from lists to sequences using the 
functions that you pointed out to me. One thing that I have noticed is that 
my lists can be modified in place easily, but your sequences can't. This is 
the biggest problem that I'm encountering. With your sequence functions I 
have to make new sequences, which results in the source-code getting both 
larger and more complicated. Compare, for example, my traverse function to 
your each function.

> The first time you do a search in the browser, it scans your Factor
> source tree for vocabularies. Is this what you're noticing?

I have noticed that the first time I do a search it is extremely slow. The 
later searches are also quite slow though. It is not just searches 
either --- just moving around in the browser (with the  button, etc.) 
is slow. I am using Windows and I have a lot of programs open at the same 
time. Would this be affecting the speed?


--
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] trash list, but keep symtab

2009-09-27 Thread Hugh Aguilar
Thanks for the tips on sequences. What you pointed out should work for my 
slide-rule program. Even though I wrote list.factor I don't mind trashing it 
in favor of a more idiomatic approach. Its just basic programming.

On the other hand, I wouldn't consider www.rosycrew.org/symtab.factor to be 
basic programming. I have noticed that your browser search is extremely 
slow. Would symtab speed it up? What is going on in there that takes so 
long?

> Message: 5
> Date: Sat, 26 Sep 2009 21:14:13 -0500
> From: Slava Pestov 
> Subject: Re: [Factor-talk] list
> To: factor-talk@lists.sourceforge.net
> Message-ID:
> <806f58f20909261914l588bcf08kd9b63797cfd75...@mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
> You can use cut and cut* to split a sequence at an index from the start or 
> end:
> More generally, there is a whole set of words for slicing sequences;
> http://docs.factorcode.org/content/article-sequences-slices.html
> There is a word insert-nth that inserts a value at an index:
> To insert a sequence at a subrange, use replace-slice:
> You can define literals and a printed representation for your own lists, 
> too.


--
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Factor-talk Digest, Vol 41, Issue 27

2009-09-26 Thread Hugh Aguilar
> Message: 2
> Date: Sat, 26 Sep 2009 19:05:38 +
> From: Emeka 
> Subject: Re: [Factor-talk] documentation, examples and help...
> To: factor-talk@lists.sourceforge.net
> Message-ID:
> <89c38c820909261205h6d0c1d92sdcdb19c914f9d...@mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> I have been here for about three months and I am
> still confused.
...
> I must say learning C is exciting and with time I may give Factor enough
> time.

If you find the C language to be exciting, then that is a good indication 
that C is the best language for you at this time in your life. I know that I 
learn things best that I find to be exciting, and I can't learn things at 
all that I find to be dull. Also, I've noticed that other people's 
definition of exciting and dull is often the exact opposite of mine --- it 
depends more on the person than on any inherent aspect of quality in the 
subject being studied.


--
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] list

2009-09-26 Thread Hugh Aguilar
I use my list (www.rosycrew.org/list.factor) rather than sequences because I 
have trouble doing what I want with sequences.

For example, I want to find a node in the list and split the list into two 
lists at that point. With sequences, the function find returns an index into 
the sequence. None of the spliting functions take an index however. All of 
them are splitting on a particular subsequence. For me to use these, I would 
have to actually create a subsequence that is a model for what I'm looking 
for. That is complicated. Besides that, it will likely not work anyway, as I 
only want to test for some particular aspect of the node, rather than for a 
complete match. What I do with the lists is find my node by giving traverse 
a quotation that tests each node and stops on the one that I want. I then 
give split the head of the list and the middle node, and I get my two lists.

Also, sometimes I want to insert a list into the middle of another list at a 
certain point. This is easily done with my insert function. The problems 
with inserting into sequences are very similar to the problems with 
splitting sequences. Also, sometimes I want to remove a portion of a list 
from a list. This is also cumbersome with sequences.

Sequences are nice because they can be written as literals in the 
source-code using the curly brackets. Also, they print out in a nice visual 
manner, whereas my lists are a big unreadable mess. I find sequences to be 
difficult to manipulate though. It is possible that I just haven't learned 
enough about sequences. As I've said before, I'm not very good at learning 
OPC (other people's code), and it is generally easier for me to just write 
what I need from scratch. The downside though, is that my programs aren't 
idiomatic.

I had programmed in Forth for all of my life, and I had never even heard the 
word "idiomatic" until I started learning Factor. Most Forth programmers 
would be completely baffled by the suggestion that there is virtue in doing 
things the way that other people do them. They would consider that to be a 
most bizarre superstition.


--
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] documentation, examples and help...

2009-09-26 Thread Hugh Aguilar
> Message: 2
> Date: Fri, 25 Sep 2009 19:57:07 -0500
> From: Slava Pestov 
> Subject: Re: [Factor-talk] documentation, examples and help...
> To: factor-talk@lists.sourceforge.net
> Message-ID:
> <806f58f20909251757m16927f5oab3e7b34477f5...@mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> On Fri, Sep 25, 2009 at 7:36 PM, Chris Double 
> wrote:
>> I think what's needed, and what a lot of people have asked for, is
>> more cookbook style documentation and tutorials. Quick examples of how
>> to do small talks. Most of this type of stuff is in peoples blog
>> posts.
>>
>> You're not the first to offer to do what you're doing btw. A few
>> people have started, but never finished, moving on to other tasks.
>
> I would also highly encourage people who want better
> tutorials/cookbooks to help write some ;-)
>
> Slava

I did a lot of complaining about the documentation when I started in on
Factor, but I don't anymore. For one thing, I'm starting to get the hang of
Factor more now. For another thing, the documentation has improved with this
new release that I just downloaded. I will complain however that the browser
is still so slow that I wonder if it has crashed while I wait for it. Also,
I think there should be something on the main screen of the listener that
says: "Press F1 for help" --- so the first-timer doesn't just sit there
looking at the flashing cursor in wonderment.

I do think that a book would be useful. A good title would be: "Lisp and
Forth and Factor, oh my!" The idea would be to present a few non-trivial
programs written in all three of these languages and compared to each other.
I know Forth a lot better than Factor (about 25 years at it), so I can write
the Forth code. I don't know Lisp hardly at all though, so somebody else
would have to be Lisp's champion. I am making progress on my slide-rule
program (written in Factor) and will present it to you guys one of these
days. That would be the kind of program that could be used in the book. We 
could start out with short programs, move up to middling-sized programs, and 
then on to longer programs (my slide-rule). We could use some well-known 
programs (such as Towers of Hanoi and Eight Queens, for our short programs), 
but we should try to largely present original material (I invented the 
symtab algorithm myself, so it would be a good middling-sized example).

I upgraded these programs to the new version of Factor:
www.rosycrew.org/list.factor
www.rosycrew.org/symtab.factor
www.rosycrew.org/votsim.factor

The list program has some improvments, such as being able to convert to and
from sequences. The advantage of lists over sequences is that lists are
doubly-linked and circular, so they can do more. I like them better than
sequences, as I consider them to be more robust, although sequences do seem
to be improving in what all functions are provided for working with them. My 
slide-rule uses lists extensively. If it were included in the book it would 
likely have to be rewritten to use sequences in order to be more idiomatic.


--
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] returning a variable number of values

2009-09-23 Thread Hugh Aguilar
This problem is related to the problem I mentioned earlier in regard to 
upgrading list.factor. I am now upgrading symtab.factor 
(www.rosycrew.org/symtab.factor) and it won't compile. All of the functions 
involved in finding a key in the tree fail, and all for the same reason 
("unbalanced branches"). These are a couple of the functions that are 
failing::

::  ( root target -- node new-root | 0 )
... ;

: find-key ( key root -- node new-root | 0 )
dup 0 = [ nip ] [ swap  ] if ;

The vertical bar in the stack-frame means "OR." The idea is that the word 
either returns two values (node and new-root) OR it returns one value (0). 
This is pretty typical in Forth, and Factor is derived from Forth, so I 
would hope for it to work here also.

In C the work-around is to return a pointer to a struct that contains the 
two values (node and new-root), or to return a 0 (null pointer) in the event 
that the key isn't found. This has to be done because C doesn't support 
returning multiple values. Also, C is a strongly-typed language, so you 
can't return a struct or a 0, because they are different types --- you can 
only return a pointer to a struct or a 0, because the 0 is considered to be 
a null pointer to any type. All of this is very kludgy though. I would 
really want to avoid messing around with structs (or tuples) at all, and 
just return the values on the stack, the way that I would do in Forth.

The problem in Factor seems to be related to returning a variable number of 
values (two or one), rather than returning multiple values, which Factor 
seems to be okay with.


--
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] a serious problem --- solved in a cool way

2009-09-20 Thread Hugh Aguilar
I tried call( and that worked. Here is the new list program 
(www.rosycrew.com/list.factor) for anybody that is interested. You may 
notice that I have a new word --- clone-list --- that clones a list. This 
just uses clone in a a simple and straightforward manner. So far it has 
worked for me in my slide-rule program. It may not work under more 
complicated usage --- I'm still pretty hazy in regard to the limitations of 
clone that we discussed earlier.

I like the call( word. This is way cool, as it is self-documenting. In Forth 
I would pass a cfa as I described, but I would have to put a comment 
somewhere nearby that described the stack effect of the anonymous word. This 
was never very clear. With your call(, the stack effect is documented right 
where I need it, and the compiler checks that everything corresponds. I'm 
starting to find some aspects of Factor that I like.

> Message: 8
> Date: Sun, 20 Sep 2009 12:59:52 -0500
> From: Slava Pestov 
> Subject: Re: [Factor-talk] a serious problem
> To: factor-talk@lists.sourceforge.net
> Message-ID:
> <806f58f20909201059u71e0405fi7233faad34d22...@mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> On Sun, Sep 20, 2009 at 11:25 AM, Hugh Aguilar  
> wrote:
>> I upgraded as you requested and tried to also upgrade my software.
>> Previously, I had been allowed to pass quotations around on the stack, 
>> store
>> them in symbols and get them out again, and generally treat them as
>> first-class datums. Now I'm getting an error message that says: "Got a
>> computed value where a literal quotation was expected."
>
> Stack effect checking got stricter recently. Take a look at the call( 
> word:
>
> http://docs.factorcode.org/content/article-call.html
>
> Slava


--
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] a serious problem

2009-09-20 Thread Hugh Aguilar
I upgraded as you requested and tried to also upgrade my software. 
Previously, I had been allowed to pass quotations around on the stack, store 
them in symbols and get them out again, and generally treat them as 
first-class datums. Now I'm getting an error message that says: "Got a 
computed value where a literal quotation was expected." This is a serious 
problem for me because my Forth programming relies heavily upon passing cfa 
values (the Forth equivalent of quotations) as parameters, and I'm largely 
trying to port Forth to Factor. I think modern terminology refers to these 
as "closures," although I'm not very familiar with the computer-sciency 
terms that people use nowadays.

Specifically, the problem arises on the definition of traverse is shown 
below (see www.rosycrew.org/list.factor for the entire program):

 ( node -- )
dup fore>>  swap   ! --  
next-node node
toucher get call! --  
next-node
dup  first-node get  eq? [ drop ] [  ] if ;
inline recursive

!  gets next-node before calling toucher on node, in case toucher 
clobbers the node

PRIVATE>

: traverse ( node toucher -- )
over first-node set  toucher set! -- node
 ;


> Message: 5
> Date: Thu, 10 Sep 2009 21:44:26 -0500
> From: Slava Pestov 
> Subject: Re: [Factor-talk] confusion
> To: factor-talk@lists.sourceforge.net
> Message-ID:
> <806f58f20909101944t313e79b3qe9313551bfc49...@mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> Hugh,
>
> Please update to the latest Factor release from the download grid at
> http://factorcode.org. Stack effect declarations are now mandatory,
> and have been since January or so. Your code below won't work with the
> latest Factor. 


--
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] abort" and coerce

2009-09-18 Thread Hugh Aguilar
In Forth we have abort" that terminates execution with an error message. 
Does Factor have this? Can this be wrapped in conditional-compilation code 
so that compilation of all these tests can be turned off after the program 
is debugged and running?

How do I coerce numbers into a floats (in case they are integers or 
rationals or whatever)? Right now I am just multiplying by 1.0. Is there a 
more elegant way?


--
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Is it possible to define new literal forms?

2009-09-17 Thread Hugh Aguilar
FICL will do what you want. See this page in the FICL documentation: 
http://ficl.sourceforge.net/parsesteps.html

FICL has a lot of limitations, especially in regard to floating-point 
support, but if you are willing to write wrappers for C functions as 
necessary, it will work. Briefly, the doc says this about parsing:

Unlike every other FORTH we know of, Ficl features an extensible parser 
chain. The Ficl parser is not a monolithic function; instead, it is 
comprised of a simple tokenizer and a series of parse steps. A parse step is 
a step in the parser chain that handles a particular kind of token, acting 
on the token as appropriate. Example parse steps, in terms of traditional 
FORTH lore, would be the "number runner" and the "colon compiler".
...
Parse steps can be written as native functions, or as Ficl script functions. 
New parse steps can be appended to the chain at any time.

>
> Message: 4
> Date: Thu, 17 Sep 2009 17:53:33 +0100
> From: Paul Moore 
> Subject: [Factor-talk] Is it possible to define new literal forms?
> To: Factor 
> Message-ID:
> <79990c6b0909170953w339f21f0ia0222927e17b4...@mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> This is mostly just curiosity, but is it possible to hook into
> Factor's parser/lexer to define new forms of literal? I know it's
> possible to write parsing words like V{ but I'm more interested in
> "standalone" forms like rationals 2/3. From what I can tell, rational
> syntax is hard-wired into Factor's parser as part of string>number. I
> don't see an easy way to extend it.
>
> The background is that I'm playing with ideas around game simulation
> programs, where die rolls are a common need. I can obviously write a
> word dieroll ( n m -- roll ) to roll n m-sided dice and produce a
> result - but where n and m are literals (as they often are) the usual
> syntax is nDm (for example, 3D6) and it'd be nice to be able to
> express that directly in Factor.
>
> Is that possible? From what I recall of old-style forths, it wasn't -
> they hard coded the word splitter and numeric parsing code. What I've
> been able to dig into with Factor indicates that the parser's
> structure is similar, but I could easily have missed something.
>
> As I say, it's not a big deal (it may never even make it into real
> code, it's just ideas) but if anyone can point me at an example, or
> tell me it's not possible, that's be nice.
>
> Paul.


--
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] compile-time code

2009-09-16 Thread Hugh Aguilar
Non-text messages don't seem to get through the mailing list. Can you email 
this, whatever it is, to me directly?

To everybody --- thanks for all of your responses. I'm still learning Factor 
and I'm sure there is a lot there that I don't know about. I'll look into 
those parsing words that you mentioned.

In regard to enum, I do need the numbers to be ordered integers as they are 
intended to be used as indices into an array of values as well as being used 
in case statements.

> Message: 1
> Date: Wed, 16 Sep 2009 12:57:55 +0100
> From: Rupert Swarbrick 
> Subject: Re: [Factor-talk] compile-time code
> To: factor-talk@lists.sourceforge.net
> Message-ID: <87eiq73xvg@gmail.com>
> Content-Type: text/plain; charset="us-ascii"
>
> A non-text attachment was scrubbed...
> Name: not available
> Type: application/pgp-signature
> Size: 315 bytes
> Desc: not available
>
> --


--
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] compile-time code

2009-09-15 Thread Hugh Aguilar
The major feature of Forth is that it allows the programmer to write code 
that executes at compile-time. To a large extent, this is not necessary in 
Factor because the structure statements (if, while, etc.) use quots, and it 
is possible to write your own in a similar manner.

I still see a need for writing compile-time code though. For example, in 
ANS-Forth enum is not part of the standard, but writing it is easy (and is a 
typical assignment for Forth students):

: enum ( n -- new-n )
dup constant
1+ ;

It is used like this:

0
enum large
enum extra
enum huge
enum massive
drop

The reason why I am struggling with Factor is that I'm not accustomed to 
looking things up in the documentation. In Forth I wouldn't even consider 
looking up something like enum to find out if it is included in the language 
or in the libraries; I would just write it myself. In most computer jobs, an 
"expert" is somebody who has familiarized himself with a massive library of 
functions (such as enum) and therefore can write code without having to 
continually look things up in the documentation. In Forth, the concept of 
expertise is pretty-much meaningless because spending too much time looking 
things up is not the typical reason why people fail at their job.

Does Factor provide any facility for writing compile-time code? The enum 
example was very simple, but this idea can be expanded upon to build 
something similar to C's structs, or even an OOP package. Forth is very 
extensible. By comparison, to extend C to include OOP you would have to 
write a preprocessor (as Brad Cox did to invent Objective-C), and you would 
have to eventually upgrade the compiler (as done in GCC) so that your 
debugger continues to work, and the error-messages continue to make sense 
(at least as much as they ever did), and so forth. This is way beyond most 
people's means.

>
> Message: 6
> Date: Fri, 11 Sep 2009 00:16:35 -0500
> From: doug.cole...@gmail.com
> Subject: Re: [Factor-talk] confusion
> To: "factor-talk@lists.sourceforge.net"
> 
> Message-ID: <4a18104d-73fc-45f4-afd2-dc048c7a1...@gmail.com>
> Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes
>
> SYMBOLS: large xtra huge massive ;
>
> You can case off these:
>
> : fill-drink ( drink size -- )
> {
> { large [ .3 fill-it ] }
> ...
> } case ;
>
> This way there are no Funny numbers to deal with, just symbols.
>
> For method dispatch, make singletons instead.
>
> Doug
>


--
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] confusion

2009-09-10 Thread Hugh Aguilar
Thanks for the help regarding clone; I'll work through it.

Another question I have is regarding enum. I didn't understand the docs on 
this. This is the code that I have right now:

: inf   4 ; ! this size isn't supported; it is just used as a 
place-marker
: big   3 ; ! this is our super-size
: mid   2 ;
: sml   1 ;
: tny   0 ; ! this is our itty-bitty

: mark-sizes{ .05 .10 .15 .20 } ;   ! these sizes correspond to tny, 
sml, mid and big

Is there a more elegant way to do this? The numbers have to be as I have 
them because they are used as indices into mark-sizes. Sometimes I write 
code like this though, and the numbers are just arbitrary as I am only using 
them in IF and CASE statements.

> --
>
> Message: 1
> Date: Wed, 9 Sep 2009 16:42:27 -0500
> From: Slava Pestov 
> Subject: Re: [Factor-talk] clone confusion
> To: factor-talk@lists.sourceforge.net
> Message-ID:
> <806f58f20909091442v46184f15u271f0c497728...@mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> On Wed, Sep 9, 2009 at 3:38 PM, Hugh Aguilar 
> wrote:
>> The problem
>> is that I want the nodes in the new linked list to be of some child type
>> rather than the parent type of the nodes in the source linked-list.
>
> Sounds like you want to write a 'map' combinator that operates on your
> list type.


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] clone confusion

2009-09-09 Thread Hugh Aguilar
Your clone doc says this:
"Outputs a new object equal to the given object. This is not guaranteed to 
actually copy the object; it does nothing with immutable objects, and does 
not copy words either. However, sequences and tuples can be cloned to obtain 
a shallow copy of the original."

I am confused as to what these limitation mean. What does "does not copy 
words" mean? If any of the slots contain objects rather than primitive 
datums, will they get their data moved over as well?

I don't want to just clone a tuple, but change its type as well. If I have a 
child tuple that is derived from the parent tuple but has some extra slots, 
I want to clone an object of the parent type but simultaneously make it an 
object of the child type so that I can then manually fill in the extra 
slots, but have all of the original slots copied over automatically during 
the cloning process. Another possibility would be to just clone the tuple of 
the parent type using your clone word, but then have a word that converts it 
into the child type leaving the data alone in the original slots but 
appending the extra slots onto the object empty of data and ready to be 
manually filled in. Ideas?

I don't want to have to manually fill in all of the original slots because 
the parent type is defined in another file and I don't necessarily know what 
all slots it contains, or what they are for. I am writing my slide-rule 
program that makes use of my list program. It is a three-step process. First 
I generate linked lists representing the scales, with each node being a mark 
on the scale. Then from these I generate linked lists representing the 
workpieces, with each node being a shape (either a line or an alpha-numeric 
character). Then from these I generate linked lists (of type file) 
representing the LaTeX and gcode programs (these get dumped to disk as ascii 
seq files). I have lots of tuples derived from the list tuple. I am using my 
own lists rather than the ones that come with Factor because I need to 
manipulate them --- split lists apart, link lists together, insert lists 
into the middle of other lists, fold lists at a specific node, etc..

I don't want a deep copy because my lists are circular and trying to copy 
the links will result in infinite recursion. I already wrote a word to clone 
a linked list by creating a new linked list with new link data. The problem 
is that I want the nodes in the new linked list to be of some child type 
rather than the parent type of the nodes in the source linked-list. Also, 
sometimes I want a variety of types of nodes in the same linked list, all of 
which are children of the list type. An example would be to have lines and 
characters and possibly other kinds of shapes as well (arcs, for example), 
all in a workpiece list.


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] Rewriting

2009-09-06 Thread Hugh Aguilar
I don't really understand how the concept of stack optimization can exist on
a processor such as the PIC18. I wrote a Forth cross-compiler for the 65c02
a long time ago; it has three registers (X, Y and A), with all data going
through the A. The PIC18 is essentially the same. There just isn't any
flexibility with so few registers --- and the registers are 8-bit while the
data stack is 16-bit. Dan Ehrenberg said:
>> On register-based architectures (like the PIC18, right?), doing
>> everything with a stack is inherently inefficient because of peeks and
>> replaces on the top of the stack.
The PIC18 is not register-based though, with so few registers.

The PIC24 provides a lot more opportunity for optimization. The compiler can
hold data in registers. Nominally, each word expects and leaves the stack
with the top value in register and everything else in memory. Optimization
mostly involves removing the code at the end of each macro that pushes data
from register(s) to memory, and removing the corresponding code at the start
of each macro that pops data from memory into register(s). To do this
though, you have to have free registers available for holding data. The
PIC24 has sixteen 16-bit registers. That is a huge step up from three 8-bit
registers. Both the PIC18 and PIC24 cost about $3 per chip. There are some
PIC18 chips that run at a faster clock-speed than the PIC24, but it is not
enough to make up for the PIC18's severe limitations. Also, with the PIC24
we have the ASM30 assembler, which has much easier to use macros than
the assembler that comes with the PIC18. I think that the PIC18 is soon
going to join the 65c02 in the ranks of the obsolete 8-bit processors. The
16-bit PIC24 is the future.

Tom asked about seeing my PIC24 compiler code. I don't have very much. All I
really have is the floating-point, and even that is not complete yet. I
consider FP to be the heart of the compiler, so I wanted to get it right
first and then build the compiler around it, rather than try to tack the FP
onto a compiler that had been written without FP as a consideration. My FP
is based upon the book, "Computer Approximations" (John Hart).

This is my register map:

.equiv AL,  W0
.equiv AH,  W1  ; AL and AH are for multiplication and division
.equiv BL,  W2
.equiv BH,  W3  ; AL, AH, BL and BH are for temporary use, and in ISRs
.equiv GL,  W4
.equiv GH,  W5  ; GL and GH are local variables used within { } brackets
.equiv SOS, W6  ; second of parameter stack; also float arithmetic sign bit
.equiv TOS, W7  ; top of parameter stack
.equiv M0,  W8  ; float mantissa low
.equiv M1,  W9  ; float mantissa
.equiv M2,  W10  ; float mantissa
.equiv M3,  W11  ; float mantissa high
.equiv EX,  W12  ; float exponent
.equiv FP,  W13  ; float stack pointer
.equiv SP,  W14  ; parameter stack pointer
.equiv RP,  W15  ; return stack pointer

Note that my mantissa is 64-bit. The plus, minus and times all have 64-bit
precision, but the division has 32-bit precision (dividend at 64 bits,
divisor rounded to 32 bits, with quotient provided as 32 bits). Also, the
transcendentals all aim for about 10 decimal digits of precision. They
are polynomial approximations, so less precision requires fewer
multiplications. The book provides the coefficients to 15 or more digits of
precision, so the multiplication and addition have to be done at 64-bit
precision (19.2 decimal digits) to obtain the 10 decimal digit result.
The floats only have 64-bit precision when they are on the FP stack. When I
store the floats into memory variables I round off the mantissa at 37 bits
(11.1 decimal digits) and pack them into 48 bits total (37-bit mantissa and
11-bit exponent). If anybody wants more than the 10ish digits of precision
that I am providing, I also have a slow division that provides 64 bits of
precision, and they can write their own trancendentals to whatever precision
they want. I have fat memory variables (64 bits total) that have a 48-bit
mantissa and a 16-bit exponent. These provide 14.4 decimal digits of
precision, which should be plenty for anybody. I can't imagine any
application that needs more than 10 digits of precision, but somebody might.

Note that I only have two local variables, and they are held in registers
(GL and GH). If this limitation is a big problem, I could change to having a
local-variable stack which would allow for an unlimited number of local
variables, but would be slower.

> Message: 2
> Date: Wed, 26 Aug 2009 06:50:09 -0500
> From: Slava Pestov 
> Subject: Re: [Factor-talk] Rewriting
> To: factor-talk@lists.sourceforge.net
> Message-ID:
> <806f58f20908260450u2a1e9bdewce4d0da8d2f57...@mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> On Tue, Aug 25, 2009 at 12:49 PM, Daniel Ehrenberg
> wrote:
>> On register-based architectures (like the PIC18, right?), doing
>> everything with a stack is inherently inefficient because of peeks and
>> replaces on the top of the stack.
>
> Dan didn't explain this, but a 'peek' is a l

[Factor-talk] Joy and cnc

2009-09-03 Thread Hugh Aguilar
In regard to the slide-rule project, I'm making progress although I don't
hav much time for it, working 10-7 at my job; I'll show you the result when
done. I dropped SVG because it doesn't have very good support for print and
I went with LaTeX as originally planned. My program generates both LaTeX and
cnc gcode simultaneously. The idea with the gcode is to anodize aluminum
blue and then scratch off the anodization to reveal the shiny aluminum
underneath. The purpose of this exercise is to make slide-rules that will
last for several centuries and which can be stashed in time-capsules so
that, if our civilization collapses, the people of the future will have a
seed for a new civilization. Slide-rules are pretty much self-explanatory in
the case that the manual gets lost (or English is no longer read). Also,
slide-rules can be duplicated by hand if necessary, although the job would
be very laborious.

As you may remember, my original interest in Factor was for the generation
of gcode for cnc machines. This, btw, is my big project that will require
Berkeley DB.

I dropped Factor because it is too complicated. Also, it doesn't provide a
safe "sandbox" that the management would feel comfortable with for their
employees. I am very interested in Tim's idea of a Joy>Factor compiler. This
might be a perfect solution to the safe-sandbox issue and the complexity
issue as well. Building Joy on top of Factor is a lot better idea than
trying to cripple Factor to deal with these issues.

I agree with Slava that Joy has a fundamental problem in that lists of
instructions and lists of data are the same thing, which seriously
complicates compilation. This is the same problem that Lisp has. This
wouldn't be an issue for me because I am not concerned about execution
speed. Generating gcode is not a real-time job, and it is pretty easy
anyway. Also, the difficult aspects (the arithmetic) can be written in the
underlying language (C or Factor).

You mentioned the need for linked-list software. You might try mine:
(www.rosycrew.com/list.factor). I would not need a lot of OOP like Factor
has, but would need automatic conversion between floating-point and
integers.


> Message: 1
> Date: Tue, 25 Aug 2009 18:18:43 -0500
> From: Tim Wawrzynczak 
> Subject: Re: [Factor-talk] Joy
> To: factor-talk@lists.sourceforge.net
> Message-ID:
> <4335a3260908251618l1660f6b2xeffe61697748a...@mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi Slava,
>
> Thank you much for all the advice and suggestions.  I do appreciate it :)
>
> This is only a first attempt at Joy, so there will definitely be more work
> as times goes on.
> I do intend to put some unit tests and docs in there before I put it in
> extra/.
>
> FYI, [1] [2] [3 4] ifte in my Joy does indeed work, leaving '2' on the
> stack, just like the C Joy.
>
> It sounds like your suggestion is to use a linked-list as the data stack
> in
> Joy,
> and use your 'custom' cons type for quotations in Joy, meaning I would
> have
> to implement all the words in terms of the linked-list.
>
> E.g., to execute 1 2 3 * +
> USE: lists
> +nil+ ! initial list
> 1 swons 2 swons 3 swons ! each one is added to the list
> dup car [ cdr ] dip ! get the first item
> [ dup car [ cdr ] dip ] dip ! get second item
> * swons ! do the multiplication and put result back on top of stack
> dup car [ cdr ] dip ! get first item
> [ dup car [ cdr ] dip ] dip ! get second item
> + swons
>
> The list then looks like T{ cons f 7 +nil+ } after the end of that.
> Doing things in this manner means very limited use of the Factor
> datastack.
> But I do see what you are saying, b/c then it is cheap to replace the
> "stack"
> for words like 'infra', 'ifte' and others that "technically" can dig
> arbitrarily deep
> into the stack b/c of the quotations they are passed can just reuse the
> original "stack."
>
> It looks to me like this is the process that you're referring to
> (naturally
> with better words defined for getting
> data off the "stack") ?
>
> Thanks again for your suggestions, I will be bugging you in the future
> about
>
> some of this I'm sure :)
>
> Cheers,
> - Tim


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] BerkeleyDB

2009-08-25 Thread Hugh Aguilar

I've got a big project in mind that will make use of BerkeleyDB but is on 
the back burner for now, so there is no hurry. I'm working 7 days a week at 
my job right now, which is preventing me from delving into any big projects; 
I'll contact you when I have more time. I would be needing this for Linux.

Note for everybody --- sorry for bombarding you with the same post 
repeatedly earlier today; my internet connection was acting flaky. Also, 
thanks for your help regarding SVG; I'll show you the results when I'm done.

> Message: 4
> Date: Mon, 24 Aug 2009 18:48:53 -0400
> From: Glenn Tarcea 
> Subject: Re: [Factor-talk] SVG
> To: factor-talk@lists.sourceforge.net
> Message-ID: 
> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
>
>> BTW, how is the Berkely DB bindings project going?
>
> Hugh,
>
> Is this something you would use in the near future? I keep picking it
> up and then putting it down again as other things pop up (mostly work
> taking up a lot of my free time). I've got a mostly working (MacOSX)
> version but not something I'm very proud. I've been intending to move
> the C code over to the interfaces that Jeremy Hughes came up with for
> writing C code in Factor. It will require me to make some
> modifications to his libraries so that I can use a Makefile.
>
> If the BerkeleyDB port is something you are interested in I'd be
> willing to review with you what I have and we could go from there.
>
> Thanks,
>
> Glenn


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] staapl for the PIC24

2009-08-25 Thread Hugh Aguilar
I had never heard of staapl before but am now reading up on it at your
website; it looks pretty cool from what I've read so far. Do you have any 
plans for upgrading from the PIC18 to the PIC24? I'm working on a PIC24 
Forth compiler myself. I am mostly focused on the floating-point. I have 
found the 32-bit IEEE-754 to be too small and imprecise, and the 64-bit too 
big and slow, so I developed a 48-bit FP --- the goldilocks size. This isn't 
IEEE-754 standard, but it is easy to convert, so it can be used in 
conjunction with GCC. What are you using for FP?

> Message: 4
> Date: Tue, 25 Aug 2009 08:21:28 +0200
> From: Tom Schouten 
> Subject: [Factor-talk] Rewriting
> To: factor-talk@lists.sourceforge.net
> Message-ID: <20090825062127.gb1...@giebrok.zwizwa.be>
> Content-Type: text/plain; charset=us-ascii
>
> Hello list,
>
> I guess this is mostly for Daniel, but anyone else of course feel free
> to chime in...


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] staapl for the PIC24

2009-08-25 Thread Hugh Aguilar
I had never heard of staapl before but am now reading up on it at your
website; it looks pretty cool from what I've read so far. Do you have any 
plans for upgrading from the PIC18 to the PIC24? I'm working on a PIC24 
Forth compiler myself. I am mostly focused on the floating-point. I have 
found the 32-bit IEEE-754 to be too small and imprecise, and the 64-bit too 
big and slow, so I developed a 48-bit FP --- the goldilocks size. This isn't 
IEEE-754 standard, but it is easy to convert, so it can be used in 
conjunction with GCC. What are you using for FP?

> Message: 4
> Date: Tue, 25 Aug 2009 08:21:28 +0200
> From: Tom Schouten 
> Subject: [Factor-talk] Rewriting
> To: factor-talk@lists.sourceforge.net
> Message-ID: <20090825062127.gb1...@giebrok.zwizwa.be>
> Content-Type: text/plain; charset=us-ascii
>
> Hello list,
>
> I guess this is mostly for Daniel, but anyone else of course feel free
> to chime in...


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] staapl for the PIC24

2009-08-25 Thread Hugh Aguilar
I had never heard of staapl before but am now reading up on it at your 
website. Do you have any plans for upgrading from the PIC18 to the PIC24? 
I'm working on a PIC24 Forth compiler myself.

> Message: 4
> Date: Tue, 25 Aug 2009 08:21:28 +0200
> From: Tom Schouten 
> Subject: [Factor-talk] Rewriting
> To: factor-talk@lists.sourceforge.net
> Message-ID: <20090825062127.gb1...@giebrok.zwizwa.be>
> Content-Type: text/plain; charset=us-ascii
>
> Hello list,
>
> I guess this is mostly for Daniel, but anyone else of course feel free
> to chime in...


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] SVG

2009-08-24 Thread Hugh Aguilar
I've given some more thought to the subject of slide-rule construction.
LaTeX would work but is overly complicated as I am just working with the
vector graphics aspect. A simpler solution would be to write a Factor
program to generate an SVG file. I found an SVG library called Cairo
(http://cairographics.org/) that has bindings for a variety of languages
(Python, Common Lisp, Haskell, etc.), but not for Factor. Maybe in the
future I will take a stab at writing Cairo bindings for Factor. Right now
though, I can write a Factor program that generates SVG directly. My
slide-rule just uses straight lines, so it is pretty simple; Cairo would be
an overkill.

On a related note, do any of you know of any software that converts SVG into
g-code suitable for a CNC milling machine or laser-etcher? I wrote a program
once (in Forth) to convert AutoCad dxf files into g-code; an SVG to g-code
program would be similar.

Right now my slide rule is going to be made with adhesive labels printed out
on a laser printer. Avery Office Products has weatherproof labels that
should be resistant to smudging. Eventually I would like to try to build my
slide-rule in a more professional manner. One idea that I had is to make it
out of aluminum and then anodize it blue. I could then use a CNC milling
machine to make shiny marks by scratching off the anodization. Another idea
would be to make it out of some kind of material that chars (rather than
melts), and then use a laser-etcher to burn the marks onto it. It might be
possible to make it out of aluminum and then spray some kind of coating over
it, and then use the laser-etcher to burn through the coating to reveal the
aluminum underneath. The blue-anodized aluminum would be the coolest
aesthetically, but also the slowest to make (the milling machine is going to
take forever to scratch out hundreds of tiny little marks). Thoughts?

This isn't a machinists' mailing list, so I'm getting off the subject of
Factor somewhat by talking about slide-rule construction. I will let you
know how the Factor/SVG program comes out. I noticed that you have an XML
library, so I'll likely be asking some questions about that as I write the
program.

BTW, how is the Berkely DB bindings project going?

> Message: 5
> Date: Sun, 23 Aug 2009 20:22:25 -0700
> From: Adam 
> Subject: Re: [Factor-talk] LaTeX
> To: factor-talk@lists.sourceforge.net
> Message-ID:
> 
> Content-Type: text/plain; charset="iso-8859-1"
>
> I don't think any one has worked on LaTeX support at this point.  Nothing
> in
> the library that I can see anyway.


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] LaTeX

2009-08-23 Thread Hugh Aguilar
Does Factor offer any support for LaTeX? I'm working on building a 
slide-rule and want to use Factor to generate the LaTeX code for the images 
to be printed out as a pdf. I have my own idea for the design, so I can't 
use any of the pdf files available by people who've already built 
slide-rules. This shouldn't be too complicated to write. If Factor already 
has LaTeX support though, I would rather use it as a jumping off point 
rather than reinvent the wheel.

AutoCad and AutoLisp would probably be a better choice than LaTeX and 
Factor, but I already know LaTeX --- and LaTeX is free.

BTW, I'm still working on that voting software. Most of what I'm doing now 
is reading about the theory. The software is fairly simple, so I haven't had 
to ask any questions in regard to Factor.


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] ICON-style generators

2009-07-16 Thread Hugh Aguilar
Does Factor have anything akin to the generators in the ICON language?

Generators are useful for recursive-descent searches. They aren't necessary; 
it is possible to write these kinds of programs without generators (I did 
one such program in IBM370 assembly-language). When you do without 
generators, you have both the code that generates the datums, and the code 
that tests the datums, and the recursive call (in the event of failure of 
the test), all together in one big complicated function. With generators, 
you can factor the code into separate functions that can be tested in 
isolation. As factoring is what Factor is all about, I would hope for 
generators, but I couldn't find anything in the documentation. If they are 
there, can anybody point me toward them?

Generators are not something that I can write myself, as they require the 
function to store its internal state ("suspend" itself, in ICON terminology) 
somewhere --- then, the next time that it is called, it reanimates itself 
from this suspended state rather than start from the beginning again. To 
code this, I would have to know more about the internal workings of Factor 
functions than I do. I might be able to write something like this in Forth 
using CATCH and THROW, but I'm not sure about that without having tried it.

BTW, I have read about Python's generators, and they seem comparable to 
ICON's, but haven't tried them out. Do any other languages have generators? 
I have read that Prolog has something similar, but I don't know the first 
thing about Prolog. Both ICON and Prolog seem to have largely disappeared; I 
never hear anything about them anymore.


--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] New Here

2009-06-20 Thread Hugh Aguilar
Forth is primarily focused on micro-controllers, although it can be used on 
desktop computers. Factor is primarily focused on desktop computers, 
although it can be used on micro-controllers (a 32-bit chip running embedded 
Linux).

My MFX Forth cross-compiler was for the MiniForth chip, which was used for 
controlling a laser-etching machine. With a laser etcher, you have to 
calculate quickly. You can not let your laser sit in one place while you 
perform some calculations, because the laser will burn a big hole in that 
place --- the laser has to be moving steadily in order to burn a nice smooth 
line into whatever you are etching --- it can't go slower when drawing 
curves rather than straight lines. I think that it is fair to say that 
Factor will never be used for real-time applications like this, no matter 
how fast the 32-bit processors become. Forth can be extremely fast, 
especially when running on custom hardware such as the MiniForth chip. Also, 
those 32-bit processors cost an order of magnitude more than 16-bit chips 
such as the MiniForth. Our competition was using a 68020 and the C language 
and they failed badly because of speed problems and had to give up the 
project, losing all of the money that they had invested in it. That kind of 
catastrophic failure does happen sometimes in the computer programming 
business. Before I was employed at Forth, I worked as a C++ programmer. We 
had a project that went badly. The boss refused to give the customers back 
their money, telling them that he would deliver the product "real soon now." 
Then one day he showed up at work in a wheelchair with his leg twisted 
around backwards, and he said that he had decided to give the customers back 
their money after all, but the bad news was that he was also going to lay 
off over half of his employees. So I left, and I got hired down the street 
as a Forth programmer. I haven't programmed in C++ since, and I don't miss 
it.

On the other hand, if you need to write a quick one-off program under Linux, 
you can likely get it written in hours using Factor, compared to days using 
Forth. If it involves something like XML that Factor has a library for and 
Forth doesn't, then the time difference would be even more extreme (assuming 
that you've already figured out how Factor's XML library works, which I 
haven't).

> Message: 5
> Date: Sat, 20 Jun 2009 13:34:42 -0500
> From: Slava Pestov 
> Subject: Re: [Factor-talk] New here
> To: factor-talk@lists.sourceforge.net
> Message-ID:
> <806f58f20906201134s3df1bddcu59e7df9cb1008...@mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> On Sat, Jun 20, 2009 at 4:25 AM, Emeka wrote:
>> What I still need? to get cleared is the difference between Factor and
>> Forth?
>
> Two different languages -- its like C versus Java. Forth is low level
> and close to the machine, Factor is higher level, with automatic
> memory management, a large library, etc.
>
> Slava


--
Are you an open source citizen? Join us for the Open Source Bridge conference!
Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
Need another reason to go? 24-hour hacker lounge. Register today!
http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] New here

2009-06-19 Thread Hugh Aguilar
> Message: 2
> Date: Fri, 19 Jun 2009 10:39:30 +0200
> From: Samuel Tardieu 
> Subject: Re: [Factor-talk] New here
> To: factor-talk@lists.sourceforge.net
> Message-ID: <877hz862il@willow.rfc1149.net>
> Content-Type: text/plain; charset=us-ascii
>
>>From my two years experience using Factor, I never had any problem
> defining any data structure I needed. And if by "built-in data
> structures" you refer to builtin types (as opposed to builtin type
> constructors), I fail to see what basic type would be missing. Could you
> please explain what you mean here?

Just as a quick example, my list program provided the ability to link two 
lists together. Factor sequences don't; they only provide the ability to 
append or prepend elements onto a list. Mine were also circular, and the 
sequences (including dlink) don't seem to be. I say "don't seem to be" 
because it is not real clear what the underlying data structure is exactly. 
Most likely sequences are lists, but we aren't told how they are 
implemented.

The point that I was making is that in languages such as Factor (Python, 
etc.) there is the concept of "idiomatic programming." In Forth, this 
concept doesn't exist; you do things however you want to. In Factor, writing 
packages like list is frowned upon because it is not idiomatic. In Forth, 
writing packages like this is typical. Often, it takes less time to write 
your own code than to figure out how somebody else's code works. This is 
true for me anyway; I'm not very good at learning things.

> As a side note, I am also a big Forth supporter and wrote several Forth
> native and cross compilers that are used in production. But recently, I
> noticed that Factor combinators were so useful an abstraction that
> reimplementing them in my Forth compilers made me write even clearer and
> simpler code.  For this reason, I wouldn't recommend learning Forth first
> as an helper step. Jumping right into Factor is the best way to catch
> Factor idioms early.

I like Factor combinators too. Combinators are by far the coolest thing 
about Factor. The problem in Lisp (and Joy) is that there was no distinction 
between data lists and executable lists. Factor makes this distinction, 
which is a big part of why Factor is as efficient as it is. Lisp was cool, 
but it suffered from efficiency problems for so long that it became 
sidelined.

Factor is derived from Forth, but it has a different philosophy. It is 
likely that a Factor programmer will also know other idiomatic languages 
such as Python and Ruby, and a Forth programmer will also know several 
assembly languages --- but not vice-versa.

BTW, I've only written one Forth cross-compiler. This was called MFX and it 
was for the MiniForth chip (built on the Lattice 1048isp PLD). This was when 
I worked at Testra.


--
Are you an open source citizen? Join us for the Open Source Bridge conference!
Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
Need another reason to go? 24-hour hacker lounge. Register today!
http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] New here

2009-06-18 Thread Hugh Aguilar
I remember when I took French in H.S.; I didn't learn to speak French, and 
it made my Spanish even worse than it already was because I would sometimes 
insert French words into Spanish speech. The same thing would happen if you 
tried to learn both Factor and Forth. This is especially true because Factor 
didn't follow Forth very closely. For example, a comment in Forth starts 
with \, and in Factor starts with !. Why couldn't Factor have used the \ for 
compatibility? Differences like this trip me up all the time. I doubt that 
Slava is a Forth programmer; I think he derived Factor mostly from Joy, 
which is a Forth/Lisp hybrid --- so Factor is twice-removed from its Forth 
origins.

Factor has an emphasis on being idiomatic (similar to how in Python you are 
supposed to be "pythonic"). Forth has an emphasis on being minimalistic, 
which makes it easy to learn. The downside of Forth is that you reinvent the 
wheel quite a lot, as there aren't any built-in data structures (arrays, 
lists, etc.), but you have to develop these yourself. This is also why 
employers don't like Forth; they can't easily fire one Forth programmer and 
hire another to replace him, because the new guy will have a steep 
learning-curve before he can begin maintaining the existing program. The 
concept of idiomatic programming is pretty much unknown in the Forth 
community. Honestly, I had never even heard the term before I began learning 
Factor.

On the other hand, the downside of Factor is that the built-in data 
structures may not do exactly what you want them to do. Programming in 
Factor is like buying a suit off the rack; it is not going to be a perfect 
fit for your application. Programming in Forth is like buying a tailored 
suit, except that you have to be your own tailor.

Forth is stable. Here is the ANSI document describing the language: 
http://www.taygeta.com/forth/dpans.html. You will notice that OOP is not 
part of the standard. There are several incompatible implementations 
available, or you can write your own. The "Starting Forth" book is excellent 
(it is how I learned back in 1984 when I was a H.S. senior), but it is also 
obsolete as it covers Forth-83 rather than ANS-Forth (1994). There are 
several novice-level texts available but I am not familiar with any of them 
and can't make a recommendation. Novice Forth programmers don't really 
exist; you are expected to be an advanced programmer from day-one --- it is 
a minimalist language after all; there is not that much to learn.

> Message: 7
> Date: Thu, 18 Jun 2009 15:40:42 +
> From: Emeka 
> Subject: Re: [Factor-talk] New here
> To: factor-talk@lists.sourceforge.net
> Message-ID:
> <89c38c820906180840y43f21898kd1057ad8d23f0...@mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>>If you are new to stack languages or RPN, a gentle introduction might
>>be Leo Brodie's "Starting Forth": >sf.html>. Factor isn't Forth, but many of the concepts have been used,
>>and Brodie's examples shouldn't be too hard to (re)write in Factor.
>
> So, I should first study Forth... It may be overwhelming for a mere mortal
> like me. Is Forth a stable language?
>
> Regards,
> Emeka


--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] OpenSTV

2009-06-15 Thread Hugh Aguilar
I found some software www.OpenSTV.org that does voting simulation.

I think that I want my votsim to allow the user to write his own voting 
method in Factor. It is fairly easy to invent a voting method, such as my 
double method, and I think that most users will want to try their hand at 
doing this.

OpenSTV involves the voters handing in paper ballots, and then an 
administrator enters the data into the computer manually. Well, this isn't 
the 1980s anymore. I think votsim can be a little bit more modern by using 
the internet. It can be the back-end for a Javascript program that provides 
the user-interface. The Javascript program would be where the user inputs 
his own vote in an election, checks the overall results, and possibly inputs 
a Factor function to implement a voting-method of his own invention.

Votsim will have to include the Factor compiler as part of the application 
so that it can be user-upgradable. OpenSTV isn't really taking advantage of 
Python being dynamic; it could have just as well been written in C++ or 
whatever. The user shouldn't have to recompile and redeploy votsim in order 
to introduce his new voting-method function. Any thoughts?

OpenSTV has voting-method functions written in Python that can be imported 
into user-written programs. I can rewrite these in Factor. That should be 
easier than writing them from scratch (some of them are quite complicated). 
This will also involve adopting the OpenSTV ballot-file format, which is 
fine with me.


--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] voting simulation

2009-06-12 Thread Hugh Aguilar
Thanks for your advice. This is why I made the code public ---
to get specific advice on how to improve.

I didn't take your advice in regard to this one however:

: show-vote ( codes -- )
[ ballot get  nth . ] each ;

I think show-vote has to stay as it is. Your suggestions just print out all
of the elements in the ballot sequence. What I have is a sequence of numbers
(called codes). These numbers are indices into ballot. I only want to print
out those elements in ballot that are specified by the indices in codes.
This prints out the subset of the ballot that the voter selected rather than
the entire ballot.

Also, I didn't understand what you meant regarding with-scope. My
understanding is that with-scope allows a function to modify its own version
of a symbol, without modifying the global version of that symbol. In order
to reduce namespace clutter however, I would want to use  rather than with-scope. Is this correct?

I have a new version of votsim available. I realized that plurality,
approval and borda are actually all the same. They can be implemented with
identical code, but each use a different sequence of point values.
Plurality is { 1 0 0 0 0 0 0 0 }
Approval is   { 1 1 1 1 1 1 1 1 }
Borda is{ 7 6 5 4 3 2 1 0 } (given eight candidates)
 { 3 2 1 0 0 0 0 0 } (given four candidates)
Double is   { 128 64 32 16 8 4 2 1 } (my own invention)

Where all of this is going is that I will develop a user-interface that
allows the user to implement whatever point values he wants; he can go with
one of the famous systems (plurality, approval or borda) or invent one of
his own. He can also adjust the number of votes for the various candidate
configurations and see an immediate change in the results.

I hope to make this available to H.S. social-studies classes. Voting systems
weren't taught when I was in H.S., and I don't think they are taught today
either. Everybody just assumes that plurality voting is the end-all of
voting. People get trapped in this dichotomy of liberal/neo-con and they 
fail
to see the big picture. This dichotomy didn't even exist at the time that
America was founded, and now people believe that it completely defines
politics.

BTW, I got a couple of Donald Saari's books on voting and am reading them.
Thanks for the suggestion, Justin DeVries. These books are more readable
than Brams' book. Also, Brams is promoting approval voting, and Saari is not
promoting any particular system; his book is more well-rounded.

> Message: 2
> Date: Mon, 8 Jun 2009 02:40:51 -0500
> From: Slava Pestov 
> Subject: Re: [Factor-talk] voting simulation
> To: factor-talk@lists.sourceforge.net
> Message-ID:
> <806f58f20906080040m26652720g49f0b18354d05...@mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> Hi Hugh,
>
> I have some suggestions for your code.
>
> This,
>
> { }  swap [ candidate? suffix ] each
>
> this could be written using map instead, ie
>
> [ candidate? ] map
>
> And this,
>
> [ ballot get  nth . ] each
>
> can be simplified to
>
> ballot get [ . ] each
>
> or
>
> ballot get stack.
>
> Finally,
>
> [ count>> + ] each
>
> Can be written using the sigma combinator:
>
> [ count>> ] sigma
>
> One more piece of advice: you might want to wrap your top-level
> word(s) in a with-scope, so that the temporary dynamic variables you
> use with get/set don't clutter the namespace of the caller.
>
> Slava
>


--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] voting simulation

2009-06-07 Thread Hugh Aguilar
This has been a rough week for me due to automotive problems. I did find 
time however to put together a simple voting simulation package: 
www.rosycrew.com/votsim.factor. I am only supporting plurality voting (PV), 
approval voting (AV), and borda voting at this time. Maybe later I will 
provide hare voting as well. That one is somewhat discredited as it tends to 
be susceptible to voting paradoxes. It is also quite complicated and tends 
to confuse the average voter. AV has the advantage of being easy to explain, 
which helps convince people to vote.

The most important next step will be some code to determine a condorcet 
winner. This is very much a work in progress, so any suggestions on what you 
would like to see would be appreciated.

I still like approval voting. The borda system looks good at first glance 
because it takes into account ranking, but it has weaknesses. The results 
are dependent upon how many candidates there are. If there is a liberal 
qualification method, then there might be a lot of candidates in the 
election (Communist Party, Free-Beer Party, etc.) who have no chance of 
winning. This would effect how the borda system tallies the votes for the 
important candidates and could even change the outcome, even though the 
marginal candidates aren't receiving hardly any votes at all.

Thoughts?


--
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] voting simulation

2009-05-30 Thread Hugh Aguilar
Thanks for the pointers to books on voting systems; I'll look into them. 
BTW, you are correct that PV means "plurality voting," not "preferential 
voting." Personally, I call it "tribal voting" because it tends to segregate 
people into tribes (liberals versus conservatives, etc.), with each tribe 
pushing their headman forward, and the election essentially becoming a 
census to determine which tribe has the largest population. In some places, 
such as African nations, the tribes are actually ethnic groups in the 
traditional sense of the term "tribe."

The voting paradoxes that you mentioned seem to arise mostly in the more 
complicated systems where the voters rank their preferences; I don't think 
that this is a concern in AV (approval voting). The more important criticism 
of AV is that it tends to elect bland and uninspiring candidates --- those 
whose best accomplishment is having avoided offending anybody. I can see 
this becoming a problem. In our last election using PV we elected Barrack 
Obama. He would have likely been elected using AV too. His campaign was 
based entirely on vague meaningless words such as "hope" and "change." None 
of that means anything! I didn't bother to buy his book because it wasn't 
worth the money, but I did read the chapter on the Constitution when I was 
in the bookstore. All he really said was that he had read the document. Who 
hasn't? Why is he more qualified to be President than I am? In regard to the 
Second Amendment, he said that it was a contentious issue. Well, we can all 
agree on that. Does this mean that he is going to crack down on gun 
ownership or focus on prosecuting crimes that have victims? He didn't say. 
He is a complete unknown. With AV our elections could devolve into a circus 
of the bland, in which every candidate strives only to avoid saying anything 
that could possibly cause any voter to disapprove of him.

On the subject of our new leader, here is an interesting article: 
http://www.pennypresslv.com/Obama's_Use_of_Hidden_Hypnosis_techniques_in_His_Speeches.pdf

I was going to upload the voting simulation program (votsim) this weekend, 
but it will likely be next weekend when I do. It is going to be pretty 
simple. It won't take into account what Brams refers to as "strategic 
voting," but will only consider "sincere voting." For example, imagine an 
election where the early results show that the Republican is a certain 
winner. Republicans who haven't voted yet may decide to vote for Ralph Nader 
rather than the Republican candidate. The idea is that the Republican is 
going to win anyway and doesn't need the vote. Voting for Ralph Nader 
encourages him to keep running. Perhaps the next election will be closer and 
Nader's presence will steal votes from the Democrat and tip the scales to 
the Republican. This kind of strategic voting can't really be incorporated 
into simulation software. As for a test of fairness, I am just going to 
compare the results to the Condorcet winner to see if they are the same.

> Message: 3
> Date: Wed, 27 May 2009 12:17:26 -0500
> From: Justin DeVries 
> Subject: Re: [Factor-talk] voting-system simulation
> To: factor-talk@lists.sourceforge.net
> Message-ID: <74513ba5-3b63-4706-a81b-18d26f33a...@gmail.com>
> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
>
> I don't know about voting simulations, but for the mathematics of
> voting I can recommend a few good books.
>
> "Geometry of Voting" and "Basic Geometry of Voting" by Donald Saari
> cover the basic theory (the books are similar, but both cover some
> different things; one is aimed at a graduate-level audience, but I
> can't remember which. Neither uses very heavy math, but they are
> definitely math books).
>
> "Voting Paradoxes and How to Deal with Them" by Hannu Nurmi talks
> about various fairness criteria, how they fail, and what that means
> for voting.
>
> This may be getting off-topic, but you'll find that approval voting
> isn't a panacea. Since it contains plurality and anti-plurality voting
> as a subset it is still subject to many of the problems of both
> systems. One in particular is the "reversal paradox" where a candidate
> is elected even though a majority of the voters disapprove of that
> candidate.
>
> I'd find it interesting to have various vote counting systems
> implemented in Factor. Perhaps one could do some sort of automated
> test of fairness criteria.
>
> Cheers,
> Justin


--
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
___
Factor-talk mailing list
Factor-talk@lists.source

[Factor-talk] list

2009-05-29 Thread Hugh Aguilar
I'm aware of unit testing, having read about it in a book: "Foundations of 
Agile Python Development" (Jeff Younker). I don't have much experience with 
it in any language though (I'm learning Python simultaneously with learning 
Factor). Unit testing seems complicated for recursive functions. It might 
work with list, that only uses tail-recursion, but I am very dubious that it 
could be done with the functions in symtab (especially optimize) that are 
truly recursive. I'll give it some thought and possibly take a stab at it.

That dlist class looks interesting. I don't see anything comparable to my 
link function though. I want something like a + for lists, that appends or 
prepends one list onto another. Also, my link function can be used for 
inserting one list into the middle of another list. This works because my 
lists are circular. It is not clear to me if the dlists are circular or if 
they have null pointers at the ends. I also like my remove because it 
returns the next node; it can be called repeatedly to delete a section of 
the list. I would prefer to use dlist rather than my own list if I can 
though. Factor is already quite complicated, so having two implementations 
of doubly-linked lists that are slightly different would just be unnecessary 
complication.

My background is primarily Forth. When the ANSI committee developed 
ANS-Forth, they specifically made it a "thin" definition. The goal was to 
not include anything that the user could easily enough define himself, but 
to not be so limited as to prevent anything from being defined. The 
committee didn't even provide arrays, which are a pretty fundamental aspect 
of programming, and they definitely didn't provide linked lists. By 
comparison, Factor is a "fat" definition; you provide pretty much everything 
that could conceivably be needed. I would be a lot more comfortable with 
Factor if you had implemented a two-level definition, similar to ANS-Forth 
(http://www.taygeta.com/forth/dpans.htm#toc) --- that is, you have a basic 
definition of the language that is thin, but you also have a higher-level 
layer of optional extensions. This way I could focus on learning the basic 
definition first, which is small enough to not overwhelm my scant neural 
resources, and only later tackle the extensions. As it is, everything in 
Factor is at a single level. There is so much to learn that I feel like I'm 
getting a truck-load of bricks dumped on top of me.

The downside of ANS-Forth is that it is a little bit too thin. It has some 
gaps in the definition that are impossible to fill without taking recourse 
in non-standard code, and doing so defeats the whole purpose of having a 
standard.

- Original Message - 
From: 
To: 
> Message: 2
> Date: Wed, 27 May 2009 19:44:08 +0300
> From: Kobi Lurie 
> Subject: Re: [Factor-talk] list
> To: factor-talk@lists.sourceforge.net
> Message-ID: <4a1d6dd8.6050...@gbrener.org.il>
> Content-Type: text/plain; charset=windows-1255
>
> Hi Hugh, are you aware of unit testing?
> it's very simple and short to write.
> In other languages it's sometimes a pain, but here it's very short.
> you should try it, instead of the test utils at the end :-)
>
> Kobi
>
> Slava Pestov wrote:
>> Hugh,
>>
>> What you've implemented is like Factor's dlists,
>> http://docs.factorcode.org/content/article-dlists.html.
>>
>> They are an implementation of the deque abstract data type,
>> http://docs.factorcode.org/content/article-deques.html
>>
>> Slava


--
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] list

2009-05-26 Thread Hugh Aguilar
Here is a very simple program that I wrote (www.rosycrew.org/list.factor) 
that you might be interested in. I think that I am just duplicating what 
Factor's vectors do, but I haven't really figured out vectors yet and it was 
easier for me to just write my own --- I'm not very good at learning things.


--
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] voting-system simulation

2009-05-26 Thread Hugh Aguilar
My symtab program was somewhat boring. I am working on another program now 
that should hopefully be more interesting. This is a simulation of voting 
systems, derived from the book: "Mathematics and Democracy" (Steven Brams). 
Brams is a long-time proponent of Approval Voting. This is a system where a 
voter can cast more than one vote (but only one vote per candidate). For 
example, a person who prefers the Democrat but would be okay with the 
Libertarian, can vote for both the Democrat and the Libertarian, but not the 
Republican (who he disapproves of). Similarly, a person who prefers the 
Republican but would be okay with the Libertarian, can vote for both the 
Republican and the Libertarian, but not the Democrat (who he disapproves 
of). Such a system would (hopefully) break the Democrat/Republican 
dichotomization that we have in America today. As it is, die-hard Democrats 
won't vote for a Libertarian because they believe (correctly) that they are 
"wasting" their vote, and that a vote cast for anybody other than the 
Democrat is effectively a vote for the Republican. Similarly, the 
Republicans also believe that the Libertarians are "stealing" the Republican 
votes and throwing the election to the Democrats, so they won't vote 
Libertarian either. This is why the Libertarians get about 1% of the vote, 
despite the fact that almost everybody in America would be comfortable with 
a Libertarian winning, even if this isn't their first choice.

I have heard that voting-system simulation programs have been written (I 
think in Common LISP), but I haven't been able to find them. Can any of you 
provide links to any such programs that have already been written? The 
system that we use here in America (one vote per citizen) is actually just 
one of several systems that have been suggested. It is called Preferential 
Voting and it is a bad system --- it tends to reward extremist candidates 
(left-wing or right-wing), and to punish moderates. Have any of you read 
Brams book mentioned above, or any other books on voting-system design?

The book also discusses voting-systems that could be used for elections of 
several candidates (such as for membership in a ruling committee), and also 
fair division of limited resources. Simulation of these systems could also 
be done, but I am just working on the winner-take-all election right now, as 
this is what is on my mind --- as we have just come away from our 
Presidential election.


--
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] OOP tutorial

2009-05-26 Thread Hugh Aguilar
Thanks for your help; that first form is a lot clearer.

I have a slightly upgraded version of my program 
(www.rosycrew.com/symtab.factor) that adds the words new-symtab and 
new-forth-word --- as this seems to be the idiomatic way to do it (rather 
than require the user to do his own xxx new and then call init-xxx). The key 
to making the whole thing work, however, is to have init-xxx as a separate 
function from xxx new so that it can be called by the init-child function 
without doing a new of the parent tuple (we want to do a new of the child 
tuple, not the parent tuple, in order to get all of the child slots in 
addition to the parent slots).

The documentation in Factor is quite extensive. I still wish there were a 
tutorial available though. Your documentation is all at the same level, 
meaning that looking up elementary concepts is no easier than looking up 
advanced concepts. I tend to get bogged down in searching through the 
documentation. Most of my questions are pretty elementary; these are 
questions that could have all been answered in one place --- rather than 
have the answers scattered around throughout the on-line documentation.

I have experience with LaTeX. When you guys are ready to write a tutorial, I 
could be the technical writer. If you provide a roughly formatted text file, 
I could create a neatly-formatted pdf file. Being a novice myself, I can 
also be a judge of what is clearly explained, and what is likely to baffle 
the novice --- depending on whether I understand it or not myself.

> Message: 3
> Date: Mon, 18 May 2009 22:56:19 -0500
> From: Slava Pestov 
> Subject: Re: [Factor-talk] OOP tutorial
> To: factor-talk@lists.sourceforge.net
> Message-ID:
> <806f58f20905182056la3afff6n2fa9d21bed3db...@mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> Hi Hugh,
>
> That's not a slot, its just part of the syntax. There are two forms of
> tuple literal:
>
> TUPLE: point x y ;
>
> T{ point { x 1 } { y 2 } }
> T{ point f 1 2 }
>
> Both are equivalent. With the former you name slots with the latter
> you write 'f' followed by slot values in order.
>
> Slava


--
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] OOP tutorial

2009-05-18 Thread Hugh Aguilar
Thanks for the tip on parameterized constructers; that did help. I think
that I should have been using new rather than boa. I have I changed symtab
and it is uploaded to the website if you want to look at it:
www.rosycrew.org/symtab.factor. I also fixed a bug in optimize that I
discovered.

There is one strange thing that puzzles me. When I use new to create an
object, I get an extra slot in the front. What is that? My tuple looks like
this:

TUPLE: symtab  key count left rite ;

When I create one with
symtab new
I get this:

T{ symtab f f f f f }

Notice that there are 5 slots, rather than the 4 that I would have expected.
I have the following code to initialize the tuple:

:  ( key initial-count node -- node )
0 >>left
0 >>rite
swap >>count
swap >>key
;
inline

: init-symtab ( key node -- node )
1 swap  ;
inline

When I create a tuple like this
"simple"  symtab new  init-symtab
I get this:

T{ symtab f "simple" 1 0 0 }

Notice that my 4 slots are initialized (key="simple", count=1, left=0,
rite=0), but we have a mystery slot in the front that is set to f. This
doesn't prevent the program from running, but it seems to be wasting memory,
and it is confusing me. The boa function did the same thing, but I just
didn't notice it previously. Any idea what that slot might be?

> Message: 7
> Date: Fri, 15 May 2009 14:17:54 +0900
> From: Matthew Willis 
> Subject: Re: [Factor-talk] OOP tutorial
> To: factor-talk@lists.sourceforge.net
> Message-ID: 
> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
>
> Hugh,
>
> I think you should look at "Parameterized constructers" in the help to
> answer your question about arranging parent/child constructors.
>
> About overriding the methods of the parent class: just define a method
> for the child class.
>
> From my experience with OOP in Factor, nearly all code is written as
> "external functions" rather than "member functions".  Methods are used
> only in the case that code needs to dispatch based on the type of an
> object.  These dispatching words are "low-level" in the sense that
> words that call them don't need to involve dispatching and hence tend
> not to be methods.
>
> The point of Factor OOP (to me) is to allow one to quickly write code
> that does different things for different objects while not forcing one
> to write extra boilerplate for non-dispatching code.
>
> Have fun!
> Matthew Willis


--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited royalty-free distribution of the report engine 
for externally facing server and web deployment. 
http://p.sf.net/sfu/businessobjects
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] OOP tutorial

2009-05-14 Thread Hugh Aguilar
I've already seen those links you mentioned, but I'm still confused. How do
I define a constructor that will chain-call the constructors for the parent
classes? I want to define a class that is derived from symtab
(www.rosycrew.org/symtab.factor) and which adds some new slots. The
constructor for this new class shouldn't have to concern itself with (or
even know about) the symtab slots: count, left and rite. In C++ these would
be private, as they are low-level details that the user of the class (the
programmer of the derived class) doesn't need to know about. How do I
override the member functions of the parent class? My symtab program used
TUPLE, but it wasn't OOP at all because the functions that dealt with the
tuple weren't member functions of that tuple; they were just external
functions. My symtab was like a C program except that it used the
computer-sciency term "tuple" rather than "struct." I'm still not getting
how OOP works in Factor.


> Message: 3
> Date: Sat, 9 May 2009 19:51:17 +0200
> From: zimbatm 
> Subject: Re: [Factor-talk] OOP tutorial
> To: factor-talk@lists.sourceforge.net
> Message-ID:
> 
> Content-Type: text/plain; charset=UTF-8
>
> Basically, a class is defined with a TUPLE. Some examples :
> http://docs.factorcode.org/content/article-tuple-examples.html
>
> For a more general description, see:
> http://docs.factorcode.org/content/article-objects.html
>
> The doc is generally well constructed. The idea is to put as much
> informations in the factor documentation system so it doesn't get out
> of sync. Contributors also accept comments and patches if you feel for
> it.
>
> Regarding CLOS, I've read somewhere Slava saying it heavily influenced
> factor but I don't know much about it.
>
> Cheers,
>   zimbatm


--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited royalty-free distribution of the report engine 
for externally facing server and web deployment. 
http://p.sf.net/sfu/businessobjects
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] OOP tutorial

2009-05-09 Thread Hugh Aguilar
Has anybody ever written a tutorial on Factor OOP? I'm unclear on how this 
works, but I don't want to waste everybody's time with dumb questions. If 
there is no tutorial, can you point me towards example programs that 
demonstrate Factor OOP fairly well? The Factor code that I've examined so 
far is pretty much procedural. I'm familiar with the OOP concept from 
Objective-C, C++, SwiftForth, and a little bit of CLOS. Is it true that 
Factor OOP was modeled after CLOS?


--
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] assembly language

2009-05-08 Thread Hugh Aguilar
> Message: 4
> Date: Thu, 7 May 2009 21:04:15 -0500
> From: Daniel Ehrenberg 
> Subject: Re: [Factor-talk] assembly language
> To: factor-talk@lists.sourceforge.net
> Message-ID:
> 
> Content-Type: text/plain; charset=ISO-8859-1
>
> There's an x86, x86-64, and PPC port right now. Anyway, if you're able
> to get good performance while writing in a high-level language, the
> result will be less buggy, shorter code and more maintainable.

When I was programming in ANS-Forth, I considered myself to be an 
assembly-language programmer, and ANS-Forth to be an overgrown 
macro-assembler. The philosophy in Factor is obviously different. I have to 
try to think more high-level when working with Factor, it seems.


--
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] Berkeley DB

2009-05-07 Thread Hugh Aguilar
Has anybody ever written a Factor wrapper for Berkeley DB? 

--
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] assembly language

2009-05-07 Thread Hugh Aguilar
> Message: 3
> Date: Wed, 6 May 2009 22:44:30 -0500
> From: Daniel Ehrenberg 
> Subject: Re: [Factor-talk] symtab
> To: factor-talk@lists.sourceforge.net
> Message-ID:
> 
> Content-Type: text/plain; charset=ISO-8859-1
>
> There are a number of ways that you can optimize the Factor code
> before resorting to unportable assembly language. For one, making all
> combinators inline allows the compiler to perform defunctionalization,
> removing all extra overhead associated with higher-order functions.
> Other well-placed inline declarations would allow the compiler to
> perform stronger optimizations. You can also experiment with hints to
> instruct the compiler to make specialized versions of words for
> certain types of inputs. The Factor implementation frequently becomes
> faster, so using the a recent version will also help performance.

Now that symtab is debugged, I can experiment with improvements such as the 
use of inline. Why is assembly language unportable? Isn't the Pentium series 
the only processor that Factor runs on? Maybe in the future if there is an 
ARM version, portability might be an issue. These are pretty short functions 
though, so I doubt that rewriting them in ARM assembly would be all that 
much work. For something like a symbol table, which is at the very heart of 
the compiler, it seems like work worth doing. Compilation speed is a big 
part of making an interactive environment, which is Forth's (and Factor's) 
main selling point. Lack of an interactive environment is why languages such 
as C++ and Pascal are pretty much dead (and unlamented, as far as I'm 
concerned).


--
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] erlang

2009-05-06 Thread Hugh Aguilar
This is off the topic of Factor, but are any of you familiar with Erlang? I 
have wondered if it might be possible to get an Erlang-like multi-processor 
system running on the 16-bit PIC24. The idea is that a robot would not have 
one big processor (such as the ARM), but would have multiple small 
processors (PIC24s). When you have one processor, you typically have a lack 
of I/O ports. Also, the whole business of prioritizing interrupts becomes 
complicated and error-prone. Also, those big processors typically have bad 
interrupt latency because they have so many registers that need to be saved 
and restored. My idea is to simplify the software by having each PIC24 deal 
with a specific set of I/O. The main program though, rather than running on 
a big 32-bit central processor, would be running in distributed fashion on 
all of the PIC24 processors. The system would be more robust than the 
central-processor system, because extra PIC24 processors could be added at a 
fairly late date in the design of the robot. By comparison, if you are using 
an ARM and it turns out to be too slow, upgrading to a bigger central 
processor in the middle of the project would be a major hassle. Another 
point in favor of the PIC24 is that they only costs like $3 apiece. I'm not 
really sure how much an ARM costs, but I think that it is like an order of 
magnitude more expensive.

This is all just a pipe-dream right now, but that is my vision for robotic 
software. Do any of you know of any system built along these lines?


--
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] symtab

2009-05-06 Thread Hugh Aguilar
I have my symtab program ready for you guys to look at. I havn't got it onto 
github yet because my Linux system isn't working, so I just uploaded it to 
my website where you can grab it: http://www.rosycrew.com/symtab.factor

This is a symbol table that uses an algorithm of my own invention. I 
originally wrote this in IBM370 assembly language about 10-13 years ago. 
There was no damping then. Later, I upgraded to ANS-Forth and added a small 
damping (value of 5) to reduce "churning" (described in the comments). Now I 
have upgraded to Factor. I added the ability to smudge (hide) words. I also 
have a prune function that deletes smudged nodes at the leaves. Having done 
this, I realized that I needed some way to optimize the tree, which would 
push all of the smudged nodes down to the leaves. I wrote the optimize 
function in the last few days to do this. Now that I have an optimize 
function, I have also raised my damping level to 30. The idea is that the 
user can have this high damping level during normal usage, but can also 
periodically run optimize (at the end of every work session would be a good 
time). Alternatively, you can set the damping level at 0, in which case you 
don't need to run optimize at all; the tree is continually maintained in an 
optimized state (except for the smudged nodes that take some time to work 
their way down to the leaves).

The previous paragraph will make a lot more sense after you have studied the 
source file. It is pretty short, with only a handful of functions, so you 
should be able to figure it out quickly. It is not too complicated, and it 
is heavily documented; if you do have trouble though, let me know and I will 
answer your questions. I am likely not using very idiomatic Factor, as this 
is my first effort at Factor programming. I'm still mentally translating 
everything from ANS-Forth. I definitely want to hear your criticisms in this 
regard to help me learn more idiomatic Factor. I am also interested in any 
criticism you may have of my algorithm. I don't know of anybody who has ever 
done a symbol table in this manner before; I think my algorithm is original.

The program is recursive and would benefit a lot from being rewritten in 
assembly language. The functions that insert nodes and find nodes are both 
short, and would be the most likely candidates for assembly language. If 
there is any interest, I will do this. I read somewhere that Factor has a 
Pentium assembler available, but I haven't examined it yet. That is my next 
project.

Is it true that Factor internally uses a hash table resolved with linked 
lists? In my comments in the source file I compare my algorithm to hash 
tables and explain why I think that my algorithm is better.


--
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] question about [] [] if

2009-05-01 Thread Hugh Aguilar
My understanding is that the if function does the first combinator for
nonzero numbers and the second combinator for zero numbers. This
doesn't seem to be working correctly though. Consider this code:

TUPLE: symtab  key count weight left rite ;

:  ( key -- node )
1 0 0 0 symtab boa ;

"hello" 

: jjj ( node -- )
left>> [
"there is a left node" .
] [
"the left node is empty" . ] if ;

If you examine the node created by  you will see that the left link
is 0. If you give this node to the jjj function, however, jjj will tell you
that there is a left node. If you interactively use left>> on the node,
however, you can see that it is zero. I can force this to work by inserting
some code after the left>> in jjj:  0 = not

Another question: Does Factor optimize tail recursion even if the recursive
call is buried inside of combinators given to the if function?

Another question: Will Factor garbage-collect any nodes that no longer
referenced? If I want to delete a child node from the tree, can I just store
a 0 into the parent node's link to that child node, and this will cause the
child node's memory to be recovered?


--
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Factor-talk Digest, Vol 37, Issue 1

2009-05-01 Thread Hugh Aguilar
> Message: 1
> Date: Thu, 30 Apr 2009 16:02:03 -0500
> From: Doug Coleman 
> Subject: Re: [Factor-talk] question about <=>
> To: factor-talk@lists.sourceforge.net
> Message-ID: <82fa67e4-efac-4502-9984-c8c07c3f7...@gmail.com>
> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
>
> Factor used to return -1, 0, and 1 but it's higher-level to return
> symbols than magic numbers.  There's an 'invert-comparison' word to
> invert the +lt+ and +gt+ symbols.
>
I can appreciate the idea of not using magic numbers, although the [-1,0,1] 
set is a convention in Forth. Daniel Ehrenberg made a good point yesterday 
that arithmetic with +lt+ etc. will get caught as an error.

> Your code is calling quotations with arbitrary stack effects so it
> should be inlined.  Words that call this combinator can be compiled,
> but the combinator itself doesn't compile and no error is thrown by
> the compiler because this is a Factor idiom used everywhere.
>
I'll keep this in mind regarding inlines. I assume that inlines are also 
faster, but bulkier?

> There's a word in the system vocabulary called 'exit' that quits
> Factor and returns an integer to the shell.  I'm not entirely sure if
> this is Forth's EXIT or not.
>
No; in ANS-Forth (and Forth-83, etc.) the EXIT is used for exiting out of a 
function. This is typically done to clean up messy control structures. For 
example, when searching for something in a loop, when you find it you EXIT 
right then and there; the loop only completes if you don't find what you're 
looking for. This is both cleaner and more efficient than setting a flag 
inside of the loop and then checking that flag after the loop completes. 
With BEGIN-WHILE loops, this is straightforward. With DO loops, you have to 
do an UNLOOP prior to your EXIT to get the DO parameters off the return 
stack and re-expose the return address.


--
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] QT bindings

2009-05-01 Thread Hugh Aguilar
> Message: 4
> Date: Fri, 01 May 2009 10:47:59 +1200
> From: Jeremy 
> Subject: Re: [Factor-talk] c-struct offset problem
> To: factor-talk@lists.sourceforge.net
> Message-ID: <87pret3gio.wl%jed...@gmail.com>
> Content-Type: text/plain; charset=US-ASCII
>
> FWIW, I've posted some code at http://paste.factorcode.org/paste?id=630
>
> It's part of a binding to Qt using smoke.
>
One reason why I was using FICL for my CAMF project is primarily that it 
runs under C/C++ that I needed for running QT. If Factor has bindings for 
QT, I may drop FICL and C/C++ altogether and use Factor for CAMF. I like 
Factor better than C++. 


--
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] question about <=>

2009-04-30 Thread Hugh Aguilar
Here is a function that I wrote:

: ?sgn ( value negative-combinator zero-combinator positive-combinator -- )
roll! -- neg zer pos value
dup 0 > [ drop  2nip  call ] [
nip ! -- neg zer value
0 = [ nip ] [ drop ] if  call
] if ;

My question is, why does the <=> function return the values: +lt+, +eq+ and 
+gt+? Wouldn't it make more sense for it to return 1-, 0 and 1? This is what 
the COMPARE function does in ANS-Forth. This results in a kind of 
polymorphism because a function such as my ?sgn will work whether it follows 
an integer subtraction or a call to COMPARE, or what not. In Factor I would 
have to write another version of ?sgn specific to <=>. This is like how C 
function names often have the type prefixed onto them, and there are 
multiple versions of the same function for the various data types. That is 
one of the many reasons why C is difficult to program in. Note that I'm not 
criticizing Factor; I'm just trying to learn Factor's philosophy. I've long 
noted many problems with ANS-Forth and have been looking for something 
better --- which might be Factor.

One other quick question: Does Factor have something like the EXIT function 
of ANS-Forth?

Also, I am translating a symbol-table program into Factor (originally 
written in IBM370 assembly-language and later upgraded to ANS-Forth). How do 
I go about making this available to the Factor community? This uses an 
algorithm that I invented myself, which provides faster execution speed than 
hash-tables IMHO.


--
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] SwiftForth vs. Factor

2009-04-28 Thread Hugh Aguilar
I had previously used SwiftForth ver. 2 from Forth Inc. under Windows XP, which 
cost me $500. Now it doesn't work properly under Windows Vista (the help system 
is kaput, for one thing). Forth Inc.'s help desk says: "You can buy a cheap 
upgrade to the current version [3]." This would cost $296, which is not cheap 
--- and it is still just a Windows product, with no support for Linux. It seems 
to me that they should have upgraded me at no charge beyond the $500 that I 
already paid. It is not my fault that Microsoft came out with this weirdly 
incompatible Vista. Considering that Factor is free, I don't see any reason to 
spend $296 at Forth Inc. --- that would be throwing good money after bad.

Do any of you have experience with SwiftForth or SwiftX? Their main selling 
point is cross-compilation to microcontrollers (the SwiftX product series). 
When I wrote my MFX (MiniForth X-compiler) though, I wrote it from scratch in 
UR/Forth because Forth Inc. wouldn't provide source-code for SwiftForth/SwiftX, 
but LMI did provide source-code for UR/Forth (requiring a non-disclosure 
statement). In some ways, my cross-compiler was actually better than the SwiftX 
products, despite being written in UR/Forth which is rather primitive compared 
to SwiftForth. Have any of you guys done any cross-compilation in Factor? 
--
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] CAMF

2009-04-16 Thread Hugh Aguilar
> Message: 2
> Date: Wed, 15 Apr 2009 07:06:34 -0700
> From: William Tanksley 
> Subject: Re: [Factor-talk] CAMF
> To: factor-talk@lists.sourceforge.net
> Message-ID: <1239804394.5559.83.ca...@tanksley>
> Content-Type: text/plain
>
> FICL is a tiny and elegant embedded language; Factor is a complete
> application language.

I have experimented with Factor a little bit now and I'm very impressed. At 
this time however, I think that FICL is the best choice for my CAMF project. 
There is no way that the company owners are going to allow factory-floor 
employees to run a compiler such as Factor on company-owned computers. By 
comparison, FICL is an interpreter. I can make a highly restrictive 
environment that can only be used for gcode generation, and that can't crash 
the computer or access any other data on the computer. I don't know if you 
guys are Americans or not, but my experience here in the land of the free is 
that employees are very restricted in what they can do on company time. 
Getting CAMF accepted is going to take a lot of diplomacy on my part. I have 
to convince the bosses that CAMF is safe, and that the employees won't be 
using it to play computer games. Originally I was going to use Groovy, that 
runs on the JVM, but I chose FICL instead because Forth is a lot easier to 
explain to non-programmers. CAMF has to be super-simple, as a lot of 
employees just aren't into learning new skills --- if you know what I mean.

I agree that Factor is a oriented toward writing applications, and I'm still 
interested in Factor for this purpose. Specifically, I would like to try 
writing a text editor in Factor. It might eventually become the IDE for 
CAMF, although that would be quite a ways down the road. Is there one 
available that I could study?


--
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] CAMF

2009-04-14 Thread Hugh Aguilar
Hello; I just learned about Factor today, and signed up for this mailing list.

I have programmed in Forth all of my life. I wrote the MFX cross-compiler for 
the MiniForth processor at Testra, but I haven't worked there in many years now.

Currently, I am writing a library of functions that can be used for generating 
gcode for CNC machines. There is to be a basic library, and then extensions 
specific to the different machines. I have experience with 5-axis laser 
cutters, milling machines, and lathes, so I would want to support these at 
least. I have started with FICL. Now that I have discovered Factor I am 
considering using it instead.

Does anybody know of any projects using Factor (or FICL, or Python, or Ruby, or 
anything else) for gcode generation? 

How safe is Factor? For a company to let factory-floor employees program some 
CAM software, they have to be sure that incompetent (or malicious) employees 
don't crash their computer, and definitely not their server. Does the Factor 
virtual-machine have safeguards similar to Java's to keep everybody inside of a 
"walled garden" where they can't do any harm? Right now, most CAM software is 
used only in the front-office, but the flunkies on the floor (me!) aren't 
allowed to touch it. My goal with this project is to make CAM available to 
people who normally only get to work with raw gcode.

Does anybody have an opinion on Factor compared to FICL? How are they for 
speed? How are they for ease of incorporating C (or Objective-C) code? How do 
their OOP systems compare?

Does anybody have an opinion on Factor compared to Python or Ruby?

Right now, my project is called CAMF, which means "Computer-Aided Manufacturing 
from FICL." Who knows though, maybe I will change the `F' to mean Factor. Ruby 
seems to have found a home as a website framework, with the Rails project. I 
need to find a language to be a CNC framework. It has to be easy enough that 
machinists with little or no programming experience (other than writing gcode) 
can use it, but still robust enough to do the job. Maybe Factor will be to CNC 
what Ruby is to websites!
--
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk