Re: [Factor-talk] DLS paper: section 2.1.5 and 2.1.6

2010-06-01 Thread Daniel Ehrenberg
Factor has lots of influences. For example, the compiler is influenced
by SBCL and its predecessor, CMUCL. The interactive environment is
also influenced by many previous interactive environments. We talk
about the compiler's design and the features and implementation of
those, and mention them in the introduction as important features, but
we don't have enough room to cite things for them, because we just
have 12 pages! Anyway, what you did for the dataflow combinators was
nice, but they and fry were not very useful until they were made
efficient and until fry was generalized to what it is now. I don't
think that the dataflow combinators are the most important part of the
paper, but they're essential for understanding code written in Factor,
so they must be discussed. For papers, not every contributor can be an
author, and some contributors must just be mentioned in the
acknowledgments.

I'll try to remove claims that the dataflow combinators are original
(this is really just a matter of wording, and deleting that bullet
point from the introduction) and resubmit the paper, but I'm not sure
whether they'll accept a resubmition. In any case, you're not going to
be an author of the paper.

Dan

On Tue, Jun 1, 2010 at 2:42 PM, Eduardo Cavazos  wrote:
> Dan wrote:
>
>  > Factor is the work of many people, not all of which are coauthors of
> the paper
>
> This is true. However, the subject of my note is the paper specifically,
> not the Factor project. The paper's introduction states:
>
>   This paper contributes the following:
>
>  · New abstractions for managing the flow of data in
>    stack-based languages
>
> To publish this and sections 2.1.5 and 2.1.6 under the three listed
> authors is plagiarism.
>
>  > I didn't invite you
>  > to be a coauthor because you're no longer active in the project, and I
>  > assumed you wouldn't be interested.
>
> Proper citations don't have expiration dates.
>
> I've never published a paper in a journal before so I'm not familiar
> with the proper academic etiquette. However, my understanding is that if
> one person does the work and another person writes the paper, they are
> both listed as authors.
>
> Ed
>
> --
>
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

--

___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] DLS paper: section 2.1.5 and 2.1.6

2010-06-01 Thread Daniel Ehrenberg
Sorry Ed. I already submitted the paper before getting your email, but
we can add you to the acknowledgments, as well as more references to
Joy's prior work, in the final version of the paper if it gets
accepted to the conference. If this is accepted, it will still be the
first published work on the general version of these combinators, so
we thought it would be worth mentioning them. Factor is the work of
many people, not all of which are coauthors of the paper, and we don't
claim otherwise, though probably we should have included
acknowledgments (which might also mention Doug Coleman and Chris
Double as important contributors, as well as you). I didn't invite you
to be a coauthor because you're no longer active in the project, and I
assumed you wouldn't be interested.

Dan

On Tue, Jun 1, 2010 at 1:31 PM, Eduardo Cavazos  wrote:
> Guys,
>
> As you know, Joy has a combinator called 'cleave' which is like Factor's
> 'bi'.
>
> This is the paper in which I discovered Joy's 'cleave' and which served
> as inspiration for Factor's related combinators:
>
>     http://www.latrobe.edu.au/philosophy/phimvt/joy/j01tut.html
>
> If I were writing the paper, I'd cite the Joy tutorial, at least in the
> "related work" section.
>
> 'spread' and 'napply' were indeed "home grown" by myself and just made
> sense after 'cleave'.
>
> Joy has 'unary1' through 'unary4':
>
>     http://www.latrobe.edu.au/philosophy/phimvt/joy/html-manual.html
>
> which appear to be like Factor's 'napply' family.
>
> The Introduction says that these are:
>
>     New abstractions for managing the flow of data in stack-based
>     languages
>
> As I mention above, 'cleave' and 'napply are not new to stack languages.
> spread appears to be new to stack languages.
>
> So I think it's a bit of a stretch to say that (section 2.1):
>
>     We introduce two original contributions: a set of combinators which
>     replace the stack shuffling words found in other stack languages,
>     and a syntax for partial application.
>
> That bit of text raises another point; section 2.1.6 says:
>
>     We propose a syntax for the construction of point-free
>     closures in a stack-based language.
>
> As you also know, this (fry) was in fact originally designed,
> implemented and proposed by me. Check the git logs around Jan-Mar 2008.
> Slava immediately took to liking this and implemented a much more
> efficient implementation. It's also a stretch to claim that "we propose"
> when the authors list doesn't include my name.
>
> Ed
>
> --
>
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

--

___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Some quick notes on the first few pages of the paper

2010-05-31 Thread Daniel Ehrenberg
Thanks, I've made some changes based on what you said.

Dan

On Sun, May 30, 2010 at 11:14 AM, Harold Hausman  wrote:
> Hello,
>
> The paper appears interesting, valuable, and for the most part well
> written. I only had time to look over the first 5 pages this morning,
> but perhaps some of these notes will be helpful as you polish the
> paper... If this is useful I can try to look at the rest later.
>
> In the abstract: "Factor's metaprogramming features have allowed it to
> implement..." The word "it" here is weird, what is "it" referring to?
> Factor? Did Factor implement anything? Perhaps "us" would be better?
> Or just rewrite the whole sentence.
>
> In the introduction: "It was originally conceived as an experiment to
> create ... which is ...", mixing 'was' and 'is' like this is bad. Are
> we in the past or present tense?
>
> "One of our goals is to make Factor suitable for development of larger
> applications, ..." replace with: "The inclusion of a robust module
> system makes Factor suitable for the development of larger
> applications"
>
> "Factor has extensive support for low-level..." This sentence is a
> run-on. Split it into at least two separate sentences. Perhaps at "...
> C and other languages. This allows for ..."
>
> "A system for staged metaprogramming, offering flexibility and ease of
> use" replace with "A flexible and easy to use staged metaprogramming
> system.
>
> Figures 1 and 2 are placed very goofily at the top of page two,
> uncheck noob in MacTex or pass -no-noob to LaTex. ;)
>
> "(cite something about row polymorphism)" <-- Make sure you actually do this.
>
> It's unfortunate that figure 6 appears on a different page than the
> description of what it's doing.
>
> In Lexical Variables: "low rate of use" is weird, maybe "infrequent
> use" would be better?
>
> In Object System: "(methods)" replace with "..., called methods, ..."
>
> Regards,
> -Harold
>
> --
>
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

--

___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] A few questions

2010-05-27 Thread Daniel Ehrenberg
The best way to make loading programs fast is to use the deploy tool.
This builds a new image that's smaller and should load a lot faster.
But this might be inconvenient for shell scripting. For that, you
might want to build an image that just has fewer things in it. This
can be done by specifying what you want loaded when you're
bootstrapping.

For your first question, what do you mean working with two bits of
data only? The smallest addressable unit on most computers is 8 bits,
and in Factor it's actually a bit larger than that. But this shouldn't
really matter. If you want an array of 2-bit items, that's another
story. For this, we'd probably want to add a library similar to
bitarrays that operates on 2-bit items; this library doesn't exist
yet, but it wouldn't be too hard to whip up.

Dan

On Thu, May 27, 2010 at 8:18 AM, Vladimir Darmanian
 wrote:
> Hi there,
>
> - how do you work with 2bits of data only?  I looked at bit-arrays but they
> use an integer in the backend which defeats the purpose.
> - using factor in shell scripts is really slow - takes forever to load the
> vm it seems.  will saving the image for each script be the best way to
> improve the speed?
> Thanks, keep up the good work with factor!
> --
>
>
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
>

--

___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] fun cheating in word puzzles with Factor

2010-03-19 Thread Daniel Ehrenberg
Hi Alex,

I hope I'm not being too pedantic here, but...

Your code still works, though I want to remove unique eventually in
favor of  (or HS{ } set-like). A higher-level way to express
"unique values" is to use the word "members". Before the change to the
set protocol, you'd use "prune", which is similar but specific to
sequences (which you're using here). A minor difference between
members on sequences and prune is that members tries to return a
sequence of the same type as the input, whereas prune returns a
vector.

Dan

On Fri, Mar 19, 2010 at 7:15 AM, Alex Chapman  wrote:
> Hi anyone who's interested,
>
> I was frustrated by a word puzzle in a newspaper which in Factor can
> be stated as:
>
> Find a permutation of the string "mtnymisei" which is a valid English word.
>
> I gave up doing it in my head so I opened up Factor to solve it for
> me. I needed a list of valid English words which I got from aspell:
>
> cd ~/tmp
> wget http://ftp.gnu.org/gnu/aspell/dict/en/aspell6-en-6.0-0.tar.bz2
> tar xjvf aspell6-en-6.0-0.tar.bz2
> cd aspell6-en-6.0-0
> preunzip en-common.cwl # outputs en-common.wl which is a
> newline-separated list of words
>
> The easy part was Factor:
> "mtnymisei" all-permutations unique values [ >string ] map ! leaves a
> seq of the 90720 strings which are unique combinations of "mtnymisei"
> "/Users/ajc/tmp/aspell6-en-6.0-0/en-common.wl" ascii [ lines ]
> with-file-reader ! leaves a seq of valid English words
> intersect
>
> ... and that's it! I'm left with an array containing the one word that fits :)
>
> Of course my path to the solution wasn't quite such a fairy tale, but
> it only took around 30 minutes in total, and most of that was trying
> to find a valid word list. I originally tried to print each
> permutation in the listener, but that kept crashing Factor.
>
> Anyway, I had fun so I thought I'd share. Apologies to littledan if
> I'm not using the latest set protocol words, I haven't updated in a
> week or so.
>
> Alex
>
> --
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

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


Re: [Factor-talk] A protocol for sets

2010-03-16 Thread Daniel Ehrenberg
Since no one objected, I pushed the sets to the main repository. There
are still the conjoin, conjoin-at and unique words, because not all
code has been updated to use sets rather than hashtables. I added two
additional words, within and without, which generalize the old
intersect and diff in a slightly different way, preserving duplication
in the first input.

Dan

On Sat, Feb 27, 2010 at 1:34 AM, Daniel Ehrenberg  wrote:
> I've been working on this sets project for a little bit. Now, in the
> bags branch of my repository, the sets have replaced the core sets
> vocabulary. The main thing left at this point is updating all of the
> libraries to use the new sets. In their current form, I have three
> words (prune, conjoin, conjoin-at and unique) which I want to
> eliminate in favor of new set-based words (members, adjoin, adjoin-at
> and , respectively). But this will be a bit of work to
> update all the code in the repository, since this is a little more
> complicated than just changing names--assoc operations must be
> replaced with their equivalent set operations, and doing this requires
> some understanding of the flow of data of the program. If anyone wants
> to help update their own code, I would be grateful for the help: you
> will probably find the update easier than me to do, and it will give
> you a chance to learn about the new sets.
>
> I apologize for the trouble that the backwards incompatiblity creates,
> but the new set protocol should make it easier to write and change
> code in the future. By not tying your code into a specific
> representation of a set, it should be much easier to change
> representations as the code evolves. On the end of set implementors,
> the protocol gives efficient utilities based on some simple primitive
> operations.
>
> Scripting languages often don't have the power that a well-designed
> class library provides, but Factor gives you the concise syntax and
> easy-to-manipulate datastructures of a scripting language together
> with something approaching the extensibility of more mature languages
> using the sequence, assoc and set protocols, among others. The
> high-profile efforts to give OCaml a new standard library and Java a
> new library of data structures demonstrate the importance of getting
> this right the first time.
>
> Note that if you have Factor code that is not included in the Factor
> repository, you will have to update this on your own if you want to
> update to the next version of Factor once this is merged in. You have
> a couple options: you can just copy the old sets defintions in, or you
> can think about how to make the minor changes it will take to actually
> use the new set protocol. Neither should take much effort.
>
> Dan
>
> On Tue, Feb 16, 2010 at 10:45 AM, Daniel Ehrenberg  wrote:
>> Hi everyone,
>>
>> Right now, there are a bunch of different ways to represent sets in
>> Factor. You could use a hashtable for a set, where key? tests
>> membership, or you could use a sequence for a set, where member? tests
>> membership, or you could use a bit array for a set, where ?nth tests
>> membership. Each of these are used different places in the Factor code
>> base. Changing representations for a set then takes a bunch of work:
>> all the code to construct and process the set has to be updated.
>>
>> Sequences and assocs have protocols, and it seems like it'd be useful
>> for sets to have one too. This way, the only thing that you need to
>> change in your code, if you want to change representations, is how you
>> construct the set. I drafted out the basics of a set protocol in my
>> git repository at
>> http://github.com/littledan/Factor/blob/bags/extra/bags/bags.factor .
>> The most important generic words in the protocol are:
>>
>> MIXIN: set
>> GENERIC: adjoin ( elt set -- )
>> GENERIC: in? ( elt set -- ? )
>> GENERIC: delete ( elt set -- )
>> GENERIC: set-like ( set exemplar -- set' )
>> GENERIC: fast-set ( set -- set' )
>> GENERIC: members ( set -- sequence )
>>
>> To add something to a set, use the adjoin word. This word currently
>> works just on sequences. To test if something is in a set, use the in?
>> word. For sequences, this is implemented as member?. For
>> hashtable-based sets, this is key?. If sets get moved to core, then
>> maybe in? will be renamed to member?, subsuming the current member?
>> word.To remove an item from the set, use delete. This does nothing if
>> the set does not contain the element deleted. set-like is analogous to
>> like on sequences; it casts a set to a different set type based on an
>> exemplar. fast-set gets a representation of a set that'

Re: [Factor-talk] Upcoming language change: stack effect checking for parameters to inline combinators

2010-03-08 Thread Daniel Ehrenberg
Great work, Joe! I hope this is accepted for inclusion in core soon.

It might not be clear from Joe's post, but this new checking applies
to all combinators that use stack effects like

: combinator ( ... quot: ( ... -- ... ) --- ... )
blah blah blah ; inline

It *only* applies if a 'stack effect variable' beginning with .. is in
the stack effect of the quotation (given after quot: ). A more precise
checker would also check code like this:

: combinator ( quot: ( -- ) -- )

It would make sure that, when the combinator is invoked, that the
quotation given to it actually has that effect. This change has a
higher chance of breaking existing code, but it comes with the benefit
of even more checking, useful for when combinators *aren't*
row-polymorphic. As I understand, this is easy to integrate into your
code, and the real challenges are making sure this is a language
change we want and updating all the code in the repository.

Dan

On Mon, Mar 8, 2010 at 10:31 PM, Joe Groff  wrote:
> Hi guys. I'm working on improving Factor's stack checker so that it can
> check the stack effect of input quotations to higher-order words such as
> "each" and "if*" and give a more helpful error message when they would cause
> stack imbalances. Currently, if your quotation would lead to an imbalanced
> stack, you'll get an opaque "Unbalanced branches" or "digs arbitrarily deep
> into the stack" error, usually reporting some word or set of quotations from
> an implementation detail word five levels deep with no apparent relation to
> the code that caused the error. If this isn't the #1 worst usability problem
> for Factor, it's definitely up there. With my changes, you'll get a detailed
> error message that lays your sloppy stack discipline out in full detail:
> ( scratchpad ) [ '[ _ + ] [ + + ] if* ] infer.
> The input quotations to if* don't match their expected effects
> Input   Expected           Got
> [ _ + ] (( ..a ? -- ..b )) (( x -- x ))
> [ + + ] (( ..a -- ..b ))   (( x x x -- x ))
> The "..a" and "..b" identifiers you see in the "expected" column are a new
> addition to the stack effect syntax that let you declare variable stack
> effects. You can declare these effects on input parameters in the stack
> effect for your combinator like so:
> : if* ( ..a ? true: ( ..a ? -- ..b ) false: ( ..a -- ..b ) -- ..b )
> : each ( ... seq quot: ( ... x -- ... ) -- ... )
> : while ( ..a pred: ( ..a -- ..b ? ) body: ( ..b -- ..a ) -- ..b )
> When the updated stack checker sees nested stack effect declarations
> attached to input parameters, it verifies that the corresponding quotations'
> stack effects actually match those declarations, with ..a, ..b, etc.
> standing in for some number of stack values that has to be consistent among
> all of the parameters. In order to get the improved error checking for your
> own inline combinators, you will need to add stack effect declarations to
> their quotation inputs. Without an effect declaration, the old stack checker
> mechanism still exists, and it can still give you the same old cryptic error
> messages. However, in many cases, even without declarations on your own
> combinators, you'll still get better error messages, since all the
> foundational loop and branching combinators in core have been given declared
> effects.
> This change should be mostly backward compatible. There will be, however,
> some language changes that could break existing code:
> - If you have code that use inline combinators with invalid quotations that
> somehow still managed to compile, that code will no longer compile with the
> new checks.
> - Similarly, if you've declared effects on the inputs of an inline
> combinator and then used it with quotations that don't match that exact
> effect, you'll now get compiler errors. You might need to add ".." variables
> to generalize your declared effects.
> - The effect parser now only allows a variable of the form "..a" to appear
> at the begin of the inputs or outputs list, so if you have been using "..."
> in your stack effects (perhaps for a macro), you will need to change the
> stack effect slightly to parse under the new rules. An ellipsis can still be
> used as a normal value name if preceded by a letter, so "quots...",
> "inputs...", "etc..." are valid substitutes.
> - If you were manually constructing stack effect objects with "effect boa",
> that will no longer work, because the effect object layout changed slightly
> to accommodate the ".." variables. However, the "" constructor word
> remains the same, and there are new "" and
> "" constructors (to construct potentially throwing stack
> effects and effects with variables, respectively) to handle more general
> cases.
> Any complaints or comments about these changes?
> -Joe
> --
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for

Re: [Factor-talk] Adding a stack effect to a quotation

2010-02-27 Thread Daniel Ehrenberg
> A possible GSoC project?
>
> Miles

Sure, though it would be difficult to e accepted without demonstrating
to us that you would have a good chance in completing this task, with
a concrete plan of what you're going to do. (I'm not sure if I would
be.)

In general, you're much more likely to be accepted for GSoC if you
have prior contributions to Factor to show off. This demonstrates to
us that you're engaged in the Factor project and capable of writing
good code within Factor's unique model. The experience you would get
in this way would help you be capable of competing the task, too. Even
short of contributions, having some Factor code you've written to show
us would also help. The code doesn't need to be in the area that the
project is; the important thing is to show that you can do Factor.

For many people, the big thing of GSoC is not the money Google pays
you but the mentorship opportunities. If you're one of these people,
regardless of the GSoC outcome, you should be aware (if you're not
already) that the Factor community, though the mailing list and
#concatenative IRC channel, is already willing to mentor people who
are working on libraries or applications in Factor. I personally would
be willing to mentor anyone who comes to me wanting to contribute to
Factor, and I'm already doing this with one contributor.

Dan

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


Re: [Factor-talk] A protocol for sets

2010-02-26 Thread Daniel Ehrenberg
I've been working on this sets project for a little bit. Now, in the
bags branch of my repository, the sets have replaced the core sets
vocabulary. The main thing left at this point is updating all of the
libraries to use the new sets. In their current form, I have three
words (prune, conjoin, conjoin-at and unique) which I want to
eliminate in favor of new set-based words (members, adjoin, adjoin-at
and , respectively). But this will be a bit of work to
update all the code in the repository, since this is a little more
complicated than just changing names--assoc operations must be
replaced with their equivalent set operations, and doing this requires
some understanding of the flow of data of the program. If anyone wants
to help update their own code, I would be grateful for the help: you
will probably find the update easier than me to do, and it will give
you a chance to learn about the new sets.

I apologize for the trouble that the backwards incompatiblity creates,
but the new set protocol should make it easier to write and change
code in the future. By not tying your code into a specific
representation of a set, it should be much easier to change
representations as the code evolves. On the end of set implementors,
the protocol gives efficient utilities based on some simple primitive
operations.

Scripting languages often don't have the power that a well-designed
class library provides, but Factor gives you the concise syntax and
easy-to-manipulate datastructures of a scripting language together
with something approaching the extensibility of more mature languages
using the sequence, assoc and set protocols, among others. The
high-profile efforts to give OCaml a new standard library and Java a
new library of data structures demonstrate the importance of getting
this right the first time.

Note that if you have Factor code that is not included in the Factor
repository, you will have to update this on your own if you want to
update to the next version of Factor once this is merged in. You have
a couple options: you can just copy the old sets defintions in, or you
can think about how to make the minor changes it will take to actually
use the new set protocol. Neither should take much effort.

Dan

On Tue, Feb 16, 2010 at 10:45 AM, Daniel Ehrenberg  wrote:
> Hi everyone,
>
> Right now, there are a bunch of different ways to represent sets in
> Factor. You could use a hashtable for a set, where key? tests
> membership, or you could use a sequence for a set, where member? tests
> membership, or you could use a bit array for a set, where ?nth tests
> membership. Each of these are used different places in the Factor code
> base. Changing representations for a set then takes a bunch of work:
> all the code to construct and process the set has to be updated.
>
> Sequences and assocs have protocols, and it seems like it'd be useful
> for sets to have one too. This way, the only thing that you need to
> change in your code, if you want to change representations, is how you
> construct the set. I drafted out the basics of a set protocol in my
> git repository at
> http://github.com/littledan/Factor/blob/bags/extra/bags/bags.factor .
> The most important generic words in the protocol are:
>
> MIXIN: set
> GENERIC: adjoin ( elt set -- )
> GENERIC: in? ( elt set -- ? )
> GENERIC: delete ( elt set -- )
> GENERIC: set-like ( set exemplar -- set' )
> GENERIC: fast-set ( set -- set' )
> GENERIC: members ( set -- sequence )
>
> To add something to a set, use the adjoin word. This word currently
> works just on sequences. To test if something is in a set, use the in?
> word. For sequences, this is implemented as member?. For
> hashtable-based sets, this is key?. If sets get moved to core, then
> maybe in? will be renamed to member?, subsuming the current member?
> word.To remove an item from the set, use delete. This does nothing if
> the set does not contain the element deleted. set-like is analogous to
> like on sequences; it casts a set to a different set type based on an
> exemplar. fast-set gets a representation of a set that's fast to
> query--for most sets, this does nothing, but for sequences, it
> converts them into a hash-set. members gives a sequence of the
> contents of the set.
>
> The set protocol was designed with two goals: that it be easy to
> change set representations, and that the interface is a superset of
> what's currently there in the sets vocab for sequences. Binary set
> operations that are in sets now are also in the new sets system.
> Actually, they are all generic words, so that other set
> implementations (like bit sets) can override them for more efficient
> implementations. But their default implementations work based just on
> those simpler words listed above. I didn't make any binary destructive
> set operat

Re: [Factor-talk] Factor and the Google Summer of Code

2010-02-26 Thread Daniel Ehrenberg
> - allow marking a word as pure, that is, no side effects, so
> optimizations like merging subsequent maps into one are possible in this
> context.

The compiler already allows this, through 'foldable' and 'flushable'
declarations. They are used in the high-level optimizer's constant
folding and dead code elimination transformations, respectively. Loop
fusion would require  a substantial reorganization of the compiler,
with an intermediate representation that represents map directly,
rather than its inlined form. I'm not sure if this would really be
possible as long as map uses call and not call(.

Dan

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


Re: [Factor-talk] Adding a stack effect to a quotation

2010-02-26 Thread Daniel Ehrenberg
A good starting point is the article, "Combinator stack effects"

On Fri, Feb 26, 2010 at 1:39 PM, Paul Moore  wrote:
> On 26 February 2010 19:31, Daniel Ehrenberg  wrote:
>> One solution to the whole set of incompatiblities between call and
>> call( would be to eliminate call in favor of call(, eliminating the
>> combinator inlining system in the process. In my opinion, this would
>> make the whole language much cleaner and nicer. No combinator inlining
>> semantics to remember when writing your program; you can just think
>> about how the compiler works when optimizing your code.
>
> That intrigued me - for the (pretty simple) code I've written, I've
> never thought about combinator inlining semantics - makes me wonder
> what I'm missing :-)
>
> Can you give a pointer to the docs where I can find out a bit more
> about this (or explain it here)? Factor's performance features
> fascinate me...
>
> Thanks,
> Paul
>
> --
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

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


Re: [Factor-talk] Adding a stack effect to a quotation

2010-02-26 Thread Daniel Ehrenberg
Well, almost everything uses call rather than call(, because it is
more flexible in a subtle way. The difference is that call allows what
the shadowy Factor council likes to refer to as "row polymorphism",
that is, quotations passed to call can refer to items lower on the
stack. For example, you can use this to define reduce in terms of
each: you can pass any quotation you want to each, as long as its
stack effect is that it reduces the height of the stack by one.
Another example is that the quotation for with-scope can have any
stack effect.

One solution to the whole set of incompatiblities between call and
call( would be to eliminate call in favor of call(, eliminating the
combinator inlining system in the process. In my opinion, this would
make the whole language much cleaner and nicer. No combinator inlining
semantics to remember when writing your program; you can just think
about how the compiler works when optimizing your code. Everything
would work with dynamic quotations just like static ones. Unlike call,
call( has a runtime fallback and doesn't require that quotations are
inlined. Call( gives better error messages because it is actually
explicitly specified what the intended stack effect of quotations is.

However, no concatenative language has yet been designed which is both
dynamically typed and supports call( with row polymorphism. Andreas
Rossberg specified a static type system for a concatenative language
with row polymorphism
(http://lambda-the-ultimate.org/node/1899#comment-23169), but that
alone wouldn't be enough for Factor. It has to be worked out how this
feature would interact with the rest of Factor, not to mention the
need for convenient and intuitive syntax. It would also be nice to
have type inference here, though that's not necessary.

This would be an interesting project for a theoretically-inclined
contributor who is OK with a high chance of failure (or even in the
event of some kind of success, a chance that the result will not be
included in the core Factor language). I would be very pleased to see
someone work on a project like this.

Coming back to your original point, it would cause a lot of
duplication to have 'paren' versions of several combinators: bi@(,
cleave(, map(, with-variable(--there's no end! So this wouldn't be a
very good idea. It's not *too* verbose, I think, to just write '[ _
call( x -- y ) ] bi@ rather than bi@( x -- y ), in my opinion, and it
expresses the programmer's intent very clearly.

Dan

On Fri, Feb 26, 2010 at 11:57 AM, Jon Harper  wrote:
> Here's where the code is : http://rosettacode.org/wiki/Active_object#Factor
> I really need dynamic quotations because quotations are inputted by the user.
>
> I was surprised that no combinator defines a similar word to call(.
> For example, I thought there would be a bi@( word. Maybe even for all
> combinators : cleave(, keep(, etc. However that makes many many new
> words.. So add-stack-effect seemed like a good compromise. It's true
> though that dynamic quotations are rarely needed and I guess that's
> why those words aren't defined.
>
> Also, I was wondering why the slot changer uses "call" instead of
> "call( x -- x )". I find it easier to understand when extra arguments
> are currified in the quotation rather than left on the stack behind
> the object with "with" anyway. And that makes it work with dynamic
> quotations.
>
> Jon Harper
>
>
>
> On Fri, Feb 26, 2010 at 6:31 PM, Samuel Tardieu  wrote:
>>
>>
>> 2010/2/26 Daniel Ehrenberg 
>>
>>> Well, I think you could also do this:
>>>
>>> build-dynamic-quotation '[ _ call( x -- y ) ] bi@
>>
>> Sure, this is equivalent.But we wanted to be able to "tag" several
>> quotations with different stack effects, hence the separate word.
>>
>>>
>>> However, you should reconsider whether you really need to build a
>>> dynamic quotation. Remember, building a quotation with curry and
>>> compose and fry doesn't necessarily make it dynamic.
>>
>> Agreed. I'll let Jon explain in which context he did it. I only assisted in
>> answering a specific question :)
>>
>>   Sam
>>
>> --
>> Download Intel® Parallel Studio Eval
>> Try the new software tools for yourself. Speed compiling, find bugs
>> proactively, and fine-tune applications for parallel performance.
>> See why Intel Parallel Studio got high marks during beta.
>> http://p.sf.net/sfu/intel-sw-dev
>> ___
>> Factor-talk mailing list
>> Factor-talk@lists.sourceforge.net
>> https://list

Re: [Factor-talk] Adding a stack effect to a quotation

2010-02-26 Thread Daniel Ehrenberg
Well, I think you could also do this:

build-dynamic-quotation '[ _ call( x -- y ) ] bi@

However, you should reconsider whether you really need to build a
dynamic quotation. Remember, building a quotation with curry and
compose and fry doesn't necessarily make it dynamic. In the current
Factor code base, the main use cases of dynamic quotations is when
using quotations stored in places like dynamically scoped variables
(for example in the parser), word properties (in the compiler) or
tuple slots (in Furnace), or in genuinely dynamic situations (like the
listener). Most other situations can be handled with high-level code
without building quotations dynamically.

Dan

On Fri, Feb 26, 2010 at 11:13 AM, Samuel Tardieu  wrote:
> Jon and I were discussing earlier today of a way to use a dynamically built
> quotation with "bi@" and other combinators.
>
> I suggested the word
>
> : add-stack-effect ( quot effect -- quot' ) [ call-effect ] 2curry ; inline
>
> so that we can call
>
> build-dynamic-quotation (( x -- y )) add-stack-effect bi@
>
> Is there a better way to do it?
>
>   Sam
>
> --
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
>

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


[Factor-talk] A protocol for sets

2010-02-16 Thread Daniel Ehrenberg
Hi everyone,

Right now, there are a bunch of different ways to represent sets in
Factor. You could use a hashtable for a set, where key? tests
membership, or you could use a sequence for a set, where member? tests
membership, or you could use a bit array for a set, where ?nth tests
membership. Each of these are used different places in the Factor code
base. Changing representations for a set then takes a bunch of work:
all the code to construct and process the set has to be updated.

Sequences and assocs have protocols, and it seems like it'd be useful
for sets to have one too. This way, the only thing that you need to
change in your code, if you want to change representations, is how you
construct the set. I drafted out the basics of a set protocol in my
git repository at
http://github.com/littledan/Factor/blob/bags/extra/bags/bags.factor .
The most important generic words in the protocol are:

MIXIN: set
GENERIC: adjoin ( elt set -- )
GENERIC: in? ( elt set -- ? )
GENERIC: delete ( elt set -- )
GENERIC: set-like ( set exemplar -- set' )
GENERIC: fast-set ( set -- set' )
GENERIC: members ( set -- sequence )

To add something to a set, use the adjoin word. This word currently
works just on sequences. To test if something is in a set, use the in?
word. For sequences, this is implemented as member?. For
hashtable-based sets, this is key?. If sets get moved to core, then
maybe in? will be renamed to member?, subsuming the current member?
word.To remove an item from the set, use delete. This does nothing if
the set does not contain the element deleted. set-like is analogous to
like on sequences; it casts a set to a different set type based on an
exemplar. fast-set gets a representation of a set that's fast to
query--for most sets, this does nothing, but for sequences, it
converts them into a hash-set. members gives a sequence of the
contents of the set.

The set protocol was designed with two goals: that it be easy to
change set representations, and that the interface is a superset of
what's currently there in the sets vocab for sequences. Binary set
operations that are in sets now are also in the new sets system.
Actually, they are all generic words, so that other set
implementations (like bit sets) can override them for more efficient
implementations. But their default implementations work based just on
those simpler words listed above. I didn't make any binary destructive
set operations (like assoc-union!) because these didn't seem to be in
use anywhere in Factor's code base for sets.

There are a couple ways that this can cause a backwards
incompatibility, if this is put in the core sets vocabulary. First,
now the sets vocab will define a word set which potentially conflicts
with the set word in namespaces. However, most vocabs won't use either
of these vocabs, and many vocabs that use both of these won't ever
call the set word, so only a few things will have to be updated.
Additionally, once all code in Factor that uses hashtables as sets is
updated to use these sets, then it might make sense to remove the
conjoin word, potentially breaking code that's not included in the
repository.

Does anyone have any thoughts on this design? If you can see any
potential problems with this approach, I'd like to hear them.

Thanks,

Dan

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


Re: [Factor-talk] Factor @ Heilbronn University

2010-01-28 Thread Daniel Ehrenberg
That sounds great! It sounds like your course's Factor section is
focusing on the part that I think is the most important. Would you be
willing to release the tutorials for more general consumption? I'm
sure lots of people would be interested in reading them, auch wenn sie
auf Deutsch sind.

I regret to inform you, however, that you aren't the first person to
use Factor in a university course. Samuel Tardieu used Factor in his
course, "Paradigmes et langages non classiques" For Telecom ParisTech,
whose (French) website is here: http://www.rfc1149.net/inf355/

Dan

On Thu, Jan 28, 2010 at 7:02 AM, Dominikus Herzberg
 wrote:
> Some of you might be delighted to hear that Factor is used at Heilbronn
> University (Germany) in a course called "Software Engineering of Complex
> Systems". Read about it on my
> blog http://denkspuren.blogspot.com/2010/01/factor-heilbronn-university.html
> Cheers,
> Dominikus
>
> --
> 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
>
>

--
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] Playing with python-like iterators (and efficiency of continuations)

2009-10-31 Thread Daniel Ehrenberg
1. Exceptions would be a slow (in the current implementation) and
messy way to signal the end of an iteration. Exceptions should be used
for things that aren't likely to happen, and this is something likely.
You could base your design for next on the assoc protocol. at* looks
up the value corresponding to a key in an assoc. If the key is
present, it returns the value along with the flag t. If the key is
absent, it returns f for the value and f for the flag. Often, code
will call the word 'at' rather than 'at*', which is : at at* drop
;--just returning the value, or f if the value isn't there. But this
only works if you expect that at* shouldn't return f for the value, or
if you want to equate a value of f with a missing key, or you know the
key will be there, etc. So you could have next* and next.

Alternatively, you could have a function empty? which tests if the
iterator has been exhausted, together with a next-unsafe function that
increments the iterator and is allowed to create an invalid iterator
if it's already done. Out of these primitives, you could build next
(or next*) to safely increment the iterator, either throwing an
exception if it's done (if we don't think anyone's likely to call next
on purpose on an exhausted iterator) or return a flag about whether
it's done (if we think people are likely to call it on purpose in that
case).

If you go with a generic protocol for iterators (which I would
recommend for performance reasons; I wrote about this below), then you
should choose the base functions by what's easiest to implement, and
then expose a set of functions on top of that which turn out to be the
most useful. Probably, the situation where you call 'next' directly at
all is rare, compared to situations where you want to call 'each'.

2. Using coroutines for this is very costly and probably will always
be more expensive than writing code in a direct style. Saving and
restoring contexts has some overhead, and it's harder for the compiler
to reason about it. How would you be able to inline the computation,
even if the coroutine is known? There's probably a way, but I don't
know of any compiler that does this. It must have a cost in Python
too, but maybe the penalty isn't so great because your Python code
will already be slow for other reasons.

In general:
I like your idea of making a set of generic words for iterators. There
could be several classes that implement the iterator words: sequences,
coroutine-based generators, linked lists, deques, hashtables, etc.
This would be a bit of code to implement each of them, a little more
than if you went with coroutines because you need an explicit
representation of the cursor. But if a system like that existed, you
could write code that iterates over any type of object. You could
implement 'each', for example, in terms of iterators, and if 'like'
were part of the protocol, you could implement 'map'.

It would be great to replace the sequence protocol with this. Then,
many of the sequence words wouldn't be tied to operating on
random-access structures. Code duplication in the standard library
could be reduced.

The big challenge is doing this without performance regressions. The
code should be expressed in a way that the compiler can optimize out
the overhead of using iterator objects rather that doing the iteration
directly. This is impossible for coroutines (at least with the
compiler we have right now), but it could be possible for iterators
over sequences, if enough type information is known by the compiler.

Maybe you want to make these iterators functional. That is, maybe the
next operation should return a new iterator that stands for the new
location, without modifying the old iterator object. One advantage of
this is that the compiler understands how to do escape analysis on
immutable tuples. This is the only way I could see iterators being
implemented that wouldn't be a performance regression for sequence
operations. A disadvantage is that, if escape analysis can't be done,
it allocates more memory.

Dan

On Sat, Oct 31, 2009 at 4:46 PM, Paul Moore  wrote:
> I'm playing with the idea of iterators and generators from Python.
> Basically, an iterator is an object that supports a single operation,
> next, which produces the iterator's next value. Iterators can be
> created from sequences in the obvious way by iterating through the
> items.
>
> Python also supports generators, which are a limited form of coroutine:
>
> def gen():
>    yield 1
>    yield 2
>    yield 3
>
> defines a generator function which, when called, returns an iterator
> which produces the values from each yield statement in turn.
>
> There are two questions which come to mind while trying to design these:
>
> 1. What's the most idiomatic way in Factor to implement next? In
> Python, it returns a new value each time it's called, and signals that
> it has run out of values by raising a special StopIteration exception.
> This has the major advantage that iterators don't have to 

[Factor-talk] A small compiler change

2009-10-12 Thread Daniel Ehrenberg
Hi Factorers,

I modified the Factor compiler to be more aware of constants. For
example, now, "5 [ foo ] dip" is transformed to "foo 5" (avoiding an
unnecessary store and reload to the retain stack) and the low-level IR
is aware of constants defined in other basic blocks (even if there is
an intervening subroutine call) using data collected in high-level IR.
This allows value numbering and the constant folding it performs to be
more effective. The results are in the branch constant-propagation in
the main Factor repository. All together, it's maybe 30 extra lines of
code for this change. Slava, do you think this should be merged into
the main branch?

Dan

--
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] Bit fields in structs

2009-10-06 Thread Daniel Ehrenberg
I hacked bit fields onto Joe Groff's excellent new structs. This
wasn't hard to do, since Joe's code was so well-structured. My draft
code is in the main repository, in the bitfields branch. The current
implementation has really inefficient getters and setters, and I'll
have to change this before it gets merged.

With this change, a struct using bitfields can look like this:

STRUCT: foo
{ a uint bits: 12 }
{ b int bits: 2 }
{ c char } ;

The size of this struct is three bytes, because the a and b slots are
packed right next to each other. The a slot can store integers between
0 and 4095, and the b slot can store integers between -2 and 1. The
choice of 'int' and 'uint' as the types given was arbitrary, and based
on the syntax in C. I could have also gone with 'signed' and
'unsigned' or something like that; I'm not sure what's preferable.

>From what I've read about bitfields, they have an unspecified layout
in C. I wasn't sure where to find documentation for different
platforms, so I went for something arbitrary (they're packed in
textual order, little endian). If anyone can tell me what
convention(s) it should actually use, I'll update the code.

This is the second time I've implemented bitfields in Factor. I hope
this implementation is more useful than my last one.

Dan

--
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] Parsing data files with fixed-length field

2009-10-06 Thread Daniel Ehrenberg
The simple-flat-files vocab is more special-purpose; I wrote it to
parse a file format that seemed to come up in multiple applications,
but it's not for everything.

To parse a text file with fixed-length fields, your best bet is to use
the words in the sequences vocabulary. Once you have the line as a
string, you can call the word 'cut' on it to split it into two pieces,
dividing at a particular index. From here, you can do further
processing on the fields. If there are several fields, all of the same
length, the 'groups' word divides a sequence up into subsequences of a
given length. There are probably other sequences words that you will
find useful, and it's all pretty well-documented.

Dan

On Tue, Oct 6, 2009 at 12:14 PM, Jon Harper  wrote:
> the "parsing simple flat files" help article might help
>
> On Wed, Oct 7, 2009 at 12:48 AM, Stephen Veit  
> wrote:
>> I want to parse text data files with fixed-length fields. Is there a
>> vocabulary that I should look at? If not, I will start writing my own.
>> Thanks.
>>
>> --
>> Stephen Veit
>>
>>
>> --
>> 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
>>
>>
>
>
>
> --
> Jon Harper
>
> --
> 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
>

--
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] Proposed change to ##slot and ##set-slot instructions

2009-09-26 Thread Daniel Ehrenberg
Hi everyone,

It looks like, the way the compiler is right now, ##slot and
##set-slot are more complicated than they have to be. These
instructions do two things: first, subtract the tag from the index
given, then read or write memory from the sum of the index and the
base pointer. If ##slot and ##set-slot didn't have to do this
processing with the tag, they wouldn't need a temporary register.
Potentially, this could improve register allocation and value
numbering.

I made this change, by modifying the low level IR builder to insert
some arithmetic instructions before ##slot and ##set-slot, and the
results are in the 'slots' branch of the main repository. I've tested
the changes on both x86 and PPC. Slava, do these changes look good to
you? If so, I think they're ready to be merged in.

Dan

--
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] Fixing compiler.tree.propagation unit tests

2009-09-22 Thread Daniel Ehrenberg
Hi all,

I noticed some commented out unit tests in compiler.tree.propagation.
I made some small modifications to the constraints code (mostly
refactoring and uncommenting code), and now these all pass. The result
is in the 'constraints' branch of the main repository. I bootstrapped
and ran the compiler unit tests, and they pass. Slava, if these
changes look good to you, do you want to merge them in?

Dan

--
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] sequences.extra

2009-09-14 Thread Daniel Ehrenberg
Sam,

I noticed your sequences.extras vocab. It looks like it does some
useful things that aren't in the sequences vocab, but some things
duplicate existing code. For example, reduce* is like [ ] swap
map-reduce and find-all is very similar to  swap assoc-filter.
Also, reduce-r could be implemented more efficiently if you used
slices rather than subsequences of the input sequence; right now, it
takes quadratic time but it could be linear. It could use constant
stack space, rather than linear, if you implemented this by just
iterating over the sequence from back to front (this would remove the
need for slices). Are you interested in making these kinds of
cleanups?

It would be nice to not have a vocab called sequences.extras;
something with a name like this is a poorly-defined grab bag, and
things would be more clean if they were sorted into vocabularies that
had more meaningful names. There used to be a vocab called
sequences.lib but this was reorganized and deleted for that same
reason.

Dan

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

2009-08-28 Thread Daniel Ehrenberg
On Wed, Aug 26, 2009 at 3:30 AM, Tom Schouten wrote:
>> If the rewrite rules are monotonic, then there's an easy procedure
>> to optimize the program: list out all programs, calculate their
>> efficiency, and select one of the best ones
>
> I guess here `monitonic' means that there are no loops?  Something
> like `strictly decreasing'.
>
No, I meant more like there's a partially ordered set of programs,
where one program is "smaller" than another if it's more optimized,
and your rewrite rules always rewrite a bigger program to a smaller
one. Then, if there are no infinite descending chains, ie if there's
no infinite sequence of rewrites to smaller and smaller programs, the
(slow) algorithm for optimization that I described works.
>
>> Maybe the algorithm to find the optimal series of peephole
>> optimizations will be a confluent subset of the general rewriting
>> system of all valid peephole optimizations; is this what you mean?
>
> What I meant was that the algorithm in Staapl is formulated
> differently (each word is a macro: a _fuction_ which takes an object
> code stack to an object code stack).  I don't immediately see how this
> can be reformulated as a more general rewrite system on code _syntax_,
> but I've got this hunch it's not so difficult.
>
> I'm also not sure if they are really 100% equivalent, since I'm
> throwing in some extra specification of the order of evaluation.  This
> makes it possible to play tricks like using objects that only exist at
> compile time without requiring any special notation for it: the eager
> algorithm guarantees that such objects are fully reduced before code
> is compiled (or raise an error).  What would be neat is to be able to
> keep this semantics, but use a more elegant way of formulating it as a
> syntactic operation.  (If this doesn't make sense I'd be happy to
> elaborate.)

Yeah, that makes sense, like a kind of abstract interpretation, you're saying?
>
>> 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 8-bit PIC chips are weird.  The 16-bit cores are more or less
> standard register/risc but on the 8-bitters everything needs to pass
> through a single working register.  This makes it almost cry for a
> stack language approach :)
>
Oh, right, that does sound like it'd limit the benefits of a more
advanced compiler like Factor's.

Dan

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

2009-08-25 Thread Daniel Ehrenberg
Looks like I should have read more about Staapl before writing that
email. I guess you do the equivalent of DCN by your peephole
optimizations. The thing about Factor's compiler is, it does this in a
more general way. You should look at Slava's past blog posts, or read
the code, if you're interested in knowing more about it.

On Tue, Aug 25, 2009 at 12:49 PM, Daniel Ehrenberg wrote:
> Hey Tom,
>
> This is a good question. There's a lot of literature on peephole
> optimization, and I've read very little of it. I bet it'd be relevant
> here, though there are special complications for a stack language.
> Peephole optimization has limits, since you can't do much with control
> flow, and the linearization order of instructions has a big impact on
> what optimizations can be done. But it's not totally outdated; GCC
> uses a technique based on peephole optimization for its instruction
> selection pass, even though they could have gone with a more general
> tree/dag rewriting approach. It seems like a reasonable way to do
> things for a simple compiler like yours.
>
> Well, here's a way to view a system like the one you're talking about
> formally: consider your rewrite rules, and the program, and say all
> the rewrite rules are optional and can be applied in any order to any
> part of the program at any time. Now you have a set (hopefully finite,
> if your rewrite rules have a certain monotonicity property) of
> programs which implement the original code, and which the rewrite
> rules can give you. If the rewrite rules are monotonic, then there's
> an easy procedure to optimize the program: list out all programs,
> calculate their efficiency, and select one of the best ones. The task
> now is to construct an efficient algorithm to find an optimal program,
> by some metric.
>
> But I guess I'm not saying anything very helpful in that paragraph,
> since I didn't give you the algorithm. It depends on the structure of
> the rewrite rules. The phrase "rewrite rule" implies the most general
> thing possible, and you can't make an algorithm on something so
> general. With something like an optimizer, I don't understand why
> things have to be confluent. Maybe the algorithm to find the optimal
> series of peephole optimizations will be a confluent subset of the
> general rewriting system of all valid peephole optimizations; is this
> what you mean? If you have a confluent and always-terminating rewrite
> system, it's really easy to do the rewriting, so that'd be a reason to
> think about confluent rewriting systems, but they're not the only
> thing you should consider.
>
> On the topic of optimizing stack-based code: Factor's compiler might
> be the most advanced stack-based compiler ever constructed. It does
> not use peephole optimizations. The stack checker and compiler
> 'frontend' (high-level IR) form a stack code to stack code optimizer
> which is much more powerful than a peephole optimizer, taking control
> flow into account. The intermediate form is based on SSA, but at the
> same time the stack is always present; SSA values refer to stack
> locations. The most important pass is Sparse Conditional Constant
> Propagation, which can be done on a stack-based, tree-structured IR
> with no special difficulties. The last step, in the conversion to
> low-level IR, ignores the SSA values and lets things be passed around
> on the stack that was there the whole time.
>
> 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. A major goal of Factor's low-level
> optimizer (arguably the main goal) is to eliminate redundant peeks and
> replaces between subroutine calls, exposing a value structure that
> other optimizations and the register allocator can use. It seems like
> any advanced-enough compiler for a stack language should have some way
> of eliminating redundant peeks and replaces, and Factor's
> deconcatenatization algorithm is an elegant solution to this problem.
>
> Dan
>
> On Tue, Aug 25, 2009 at 1:21 AM, Tom Schouten wrote:
>> Hello list,
>>
>> I guess this is mostly for Daniel, but anyone else of course feel free
>> to chime in...
>>
>> I'm trying to get a better idea about rewriting systems for
>> concatenative languages, particularly in the area of specification of
>> peephole optimizations.  It's been on my mind for a while, but I've
>> always side-stepped any non-deterministic computations.  I.e. in
>> Staapl[1], the PIC18 code generator[2] is written using an eager
>> pattern matching approac

Re: [Factor-talk] Rewriting

2009-08-25 Thread Daniel Ehrenberg
Hey Tom,

This is a good question. There's a lot of literature on peephole
optimization, and I've read very little of it. I bet it'd be relevant
here, though there are special complications for a stack language.
Peephole optimization has limits, since you can't do much with control
flow, and the linearization order of instructions has a big impact on
what optimizations can be done. But it's not totally outdated; GCC
uses a technique based on peephole optimization for its instruction
selection pass, even though they could have gone with a more general
tree/dag rewriting approach. It seems like a reasonable way to do
things for a simple compiler like yours.

Well, here's a way to view a system like the one you're talking about
formally: consider your rewrite rules, and the program, and say all
the rewrite rules are optional and can be applied in any order to any
part of the program at any time. Now you have a set (hopefully finite,
if your rewrite rules have a certain monotonicity property) of
programs which implement the original code, and which the rewrite
rules can give you. If the rewrite rules are monotonic, then there's
an easy procedure to optimize the program: list out all programs,
calculate their efficiency, and select one of the best ones. The task
now is to construct an efficient algorithm to find an optimal program,
by some metric.

But I guess I'm not saying anything very helpful in that paragraph,
since I didn't give you the algorithm. It depends on the structure of
the rewrite rules. The phrase "rewrite rule" implies the most general
thing possible, and you can't make an algorithm on something so
general. With something like an optimizer, I don't understand why
things have to be confluent. Maybe the algorithm to find the optimal
series of peephole optimizations will be a confluent subset of the
general rewriting system of all valid peephole optimizations; is this
what you mean? If you have a confluent and always-terminating rewrite
system, it's really easy to do the rewriting, so that'd be a reason to
think about confluent rewriting systems, but they're not the only
thing you should consider.

On the topic of optimizing stack-based code: Factor's compiler might
be the most advanced stack-based compiler ever constructed. It does
not use peephole optimizations. The stack checker and compiler
'frontend' (high-level IR) form a stack code to stack code optimizer
which is much more powerful than a peephole optimizer, taking control
flow into account. The intermediate form is based on SSA, but at the
same time the stack is always present; SSA values refer to stack
locations. The most important pass is Sparse Conditional Constant
Propagation, which can be done on a stack-based, tree-structured IR
with no special difficulties. The last step, in the conversion to
low-level IR, ignores the SSA values and lets things be passed around
on the stack that was there the whole time.

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. A major goal of Factor's low-level
optimizer (arguably the main goal) is to eliminate redundant peeks and
replaces between subroutine calls, exposing a value structure that
other optimizations and the register allocator can use. It seems like
any advanced-enough compiler for a stack language should have some way
of eliminating redundant peeks and replaces, and Factor's
deconcatenatization algorithm is an elegant solution to this problem.

Dan

On Tue, Aug 25, 2009 at 1:21 AM, Tom Schouten wrote:
> Hello list,
>
> I guess this is mostly for Daniel, but anyone else of course feel free
> to chime in...
>
> I'm trying to get a better idea about rewriting systems for
> concatenative languages, particularly in the area of specification of
> peephole optimizations.  It's been on my mind for a while, but I've
> always side-stepped any non-deterministic computations.  I.e. in
> Staapl[1], the PIC18 code generator[2] is written using an eager
> pattern matching approach, essentiall re-interpreting already
> generated machine code as stack machine code that can then be
> partially evaluated together with the currently compiling primitive
> operation.  (Explained here[3] in some detail).
>
> I've always been suspicious that this formulation, while it works well
> in practice and has a certain elegance, is a special case of a more
> general, non-confluent rewriting system.
>
> It seems to me that if there are any interesting optimizations to
> make, they are not going to be unique and depend on which path through
> the reduction rules is used to get to a particular irreducible
> expression.
>
> And then it stops.
>
> I have some intuition about reduction machines, as long as they
> compute a unique solution (lambda calculus w. strict eval (CEK
> machine) and lazy eval using graph reduction, ...) but I'm not sure
> how to view the other cases where you have a bunch of rewrite ru

Re: [Factor-talk] SVG

2009-08-25 Thread Daniel Ehrenberg
There are Cairo bindings. To access them, just use the cairo
vocabulary. It's in the basis directory. Thanks, Slava and Doug! No
need to make them a second time.

I don't think generating SVG directly would be too tough. For this you
might find my xml.syntax module useful. If you use this for generating
XML, you don't have to worry about escaping things, and the syntax is
more convenient. For an example of code using xml.syntax, you can look
at the feed>xml word in the syndication vocabulary. Maybe the
interpolate module will be useful for constructing certain strings in
SVG tag attributes, also.

Dan

On Mon, Aug 24, 2009 at 6:20 PM, Matthew Willis wrote:
> Hugh,
>
> I'm pretty sure there is a Cairo binding for Factor in the Factor
> distribution somewhere.
>
> Matthew Willis
>
> On Aug 25, 2009, at 6:49 AM, Hugh Aguilar wrote:
>
>> 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
>
>
> --
> 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
>

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

Re: [Factor-talk] Berkeley DB

2009-05-08 Thread Daniel Ehrenberg
Sorry, I shut down factorforge.org because no one was using it. You
can use Github instead.

Dan

On Fri, May 8, 2009 at 8:57 PM, Glenn Tarcea  wrote:
> I'll work on putting something together. I have (had?) a git
> repository that Daniel Ehrenberg set up. I just haven't used it yet.
>
> I'll put together a few details on how I approached this. I found the
> BerkeleyDB interface unfriendly and have a C wrapper around it to make
> the FFI calls easier and to minimize stack shuffles, etc...
>
> Thanks,
>
> Glenn
>
> V. Glenn Tarcea
> gtar...@umich.edu
>
> On May 8, 2009, at 2:09 PM, Slava Pestov wrote:
>
>> Hi Glenn,
>>
>> I encourage you to whip up some docs and tests and release this
>> library. We can give you feedback for cleaning it up if necessary. A
>> lot of people would find use for a BerkleyDB binding, I think.
>>
>> Slava
>>
>> On Fri, May 8, 2009 at 6:39 AM, Glenn Tarcea 
>> wrote:
>>> I have a mostly complete wrapper to BerkeleyDB that I have used for
>>> some small projects. I've never released it (no documentation, few
>>> unit tests, first project in Factor so code is a little rough) but
>>> I'm
>>> happy to make it available.
>>>
>>> Glenn
>>>
>>> V. Glenn Tarcea
>>> gtar...@umich.edu
>>>
>>> On May 7, 2009, at 8:59 PM, Hugh Aguilar wrote:
>>>
>>>> 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
>>>>
>>>>
>>>
>>>
>>> --
>>> 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
>>>
>>
>> --
>> 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
>>
>>
>
>
> --
> 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
>

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


Re: [Factor-talk] assembly language

2009-05-07 Thread Daniel Ehrenberg
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.

Dan

On Thu, May 7, 2009 at 7:57 PM, Hugh Aguilar  wrote:
> 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
>

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


Re: [Factor-talk] symtab

2009-05-06 Thread Daniel Ehrenberg
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.

Dan

On Wed, May 6, 2009 at 10:12 PM, Hugh Aguilar  wrote:
> 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
>

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


Re: [Factor-talk] question about <=>

2009-04-30 Thread Daniel Ehrenberg
The idiom for <=> is that the result is eventually consumed by a case.
For example:

: do-something ( n m -- )
<=> {
{ +lt+ [ "Less" ] }
{ +gt+ [ "Greater" ] }
{ +eq+ [ "Equal" ] }
} case print ;

With locals, you can implement this ?sgn combinator in terms of case as this:

:: ?sgn ( cmp lt gt eq -- )
cmp {
{ +lt+ [ lt call ] }
{ +gt+ [ gt call ] }
{ +eq+ [ eq call ] }
} case ; inline

(You could just as well implement this in terms of if, and without
locals, as you did below, but this is a little cleaner-looking. The
implementation could look like this:

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

In both combinators, the value/cmp input is +gt+, +eq+ or +lt+)

<=> used to return 1, 0 or -1, but it was changed to this style to
make it more clear what the output means, and to make things more
strongly typed. If <=> returns a number, then it might accidentally be
used in an arithmetic calculation, where it wouldn't have a real
meaning. Using special symbols prevents that (with a runtime type
error).

If you want to make your code available, you can set up a git
repository (eg at github) and upload the code there. It's easiest for
others to get your code from you if you put a full copy of the Factor
repository, with your modifications, there, rather than just the code
that you've written.

Dan

On Thu, Apr 30, 2009 at 2:42 PM, Hugh Aguilar  wrote:
> 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
>

--
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] Why do we have to clone V{ } ?

2009-04-08 Thread Daniel Ehrenberg
clone is used to make a new vector. V{ } creates a vector at
parsetime, and when the code is run, a reference to that vector is
pushed onto the stack. If this vector is manipulated, it will
manipulate the original copy. Sometimes this is what you want to do,
but if you want a *new* empty vector, you have to clone it. Another
way to accomplish this is 0  . There's no particular reason to
use one or the other.

Dan

On Wed, Apr 8, 2009 at 10:14 AM, Ludovic Kuty  wrote:
> Hi,
>
> I read an article and saw various samples in the factor code base
> where the need for an empty vector materializes as: V{ } clone. I am
> wondering why is the clone word used.
>
> TIA,
>
> Ludovic Kuty
>
>
> --
> 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
>

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


Re: [Factor-talk] while usage and [let

2009-04-06 Thread Daniel Ehrenberg
dec decrements a dynamically scoped variable. You're trying to use it
for locals, which use a totally different mechanism for everything.
For locals, there's no way right now to factor out a decrement
function; you just have to read the local, subtract one and write the
local. With this technique, your code could look like this:

: test ( -- )
  [let | n! [ 10 ] | [ n zero? not ] [ n 1- n! n "%d\n" printf ] while ] ;

In creating a local, if you use a name ending in ! then it will be a
mutable local. The setter is called n! and the getter is called n

Dan

On Mon, Apr 6, 2009 at 1:05 PM, Ludovic Kuty  wrote:
> Hi,
>
> I am trying to make a little example with a while loop. I plan to use
> it in another context so I'd like to avoid using ranges (unless you
> show me how to represent infinite sequences like all integers). The
> code doesn't work because the n in "n dec" is not a symbol ? Nor a
> variable ? I still don't understand how to use symbols because I
> thought that I could avoid using SYMBOL: and still get the benefit of
> variables.
> I could do it with recursion (as with the test2 word) but instead I
> try to use the while word specifically.
>
> Could you please show me how to rewrite my example ? Or maybe I cannot
> alter the value of n inside [let.
>
> TIA
>
> Ludovic Kuty
>
> ! INFINITE LOOP ! BUG
> : test ( -- )
>   [let | n [ 10 ] | [ n zero? not ] [ n dec n "%d\n" printf ] while ]
> ;
>
> ! OK but I do not want this
> :: test2 ( n -- )
>   n zero? [ ] [ n "%d\n" printf n 1 - test2 ] if
> ;
>
>
> --
> 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
>

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


Re: [Factor-talk] trying to get my head around writing (good?) Factor code

2009-04-05 Thread Daniel Ehrenberg
Kyle,

Well, here's my attempt at solving the same problem. I use a different
algorithm from you; I think mine should be more efficient. I don't
think there's much shuffling in this version, though maybe the use of
/mod inside map isn't perfectly intention-revealing.

 : change ( amount -- coins )
{ 25 10 5 1 }
[ [ /mod swap ] map nip ] keep
[  ] 2map concat ;

Dan

On Sun, Apr 5, 2009 at 4:21 PM, Kyle Cordes  wrote:
> I'm trying to get my head around writing (good?) Factor code. Could
> someone point me in the right direction on the snippet below? Even after
> a few rounds of cleanup, I haven't been able to make it very
> intention-revealing, mostly (maybe?) because of juggling three values on
> the stack.
>
>
> USING: kernel sequences math ;
> IN: coins
>
> 
> : make-change-with-coin ( coins cents coin -- coins cents )
> [ 2dup >= ]
>   [ tuck - swap tuck [ prefix ] 2dip ] while
> drop ;
>
> PRIVATE>
>
> : change ( cents -- coins )
> { } swap
> { 25 10 5 1 } [ make-change-with-coin ] each
> drop ;
>
>
>
> ( scratchpad ) 99 change .
> { 1 1 1 1 10 10 25 25 25 }
>
> --
> Kyle Cordes
> http://kylecordes.com
>
> --
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

--
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Stack effects

2009-04-02 Thread Daniel Ehrenberg
In my opinion, the current convention of using the same name before
and after the -- is sufficient express what's read-only. An additional
syntax like this would be an extra thing to learn, and would need
special representation in stack effect objects in order to be
homoiconic. But, of course, you can define your own version of : and
friends which supports this syntax, desugaring down to the current
conventions. I'm not sure what problem this would solve.

Dan

On Thu, Apr 2, 2009 at 6:28 PM, Maxim Savtchenko  wrote:
> Copy/paste from IRC:
>
> 
>
>  random idea on factor core. why stack effects declare
> only ( inputs -- outputs ) ? looks like ( x y -- x z ) is pretty
> common situation. why not define deeper read-only part of stack
> separately? with compile-time checking of readonly-ness of it?
>
>  ( x y -- x z ) => something like ( x | y -- z )
>
>  Keyholder_: it's not common enough, and it's more complicated like that
>
>  Keyholder_: interesting factorization,though :)
>
>  not common? but every single slot setter have this type
> of stack effect
>
>  and many words that do complex changes on objects looks
> that way. like add-responder
>
>  my main point is not on shortening description, but on
> static checking
>
>  errors, when I by accident return other things in place
> of object that should stay in place are just too stupid to not being
> reported by compiler
>
> 
>
> What do you think, comrades?
>
> Maxim Savchenko
>
> --
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

--
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] [XML bug?

2009-03-27 Thread Daniel Ehrenberg
Yeah, right now, you can't interpolate into xmlns slots because those
values must be known at parsetime. This is basically an XML parsing
error which I didn't write a good error message for. I might change
this soon, to allow your kind of code (it would need reorganizing a
lot of code), but I'm not sure whether it is so useful. I'm not sure
if any code really needs to be generic over XML namespace URLs. I
think most code should be written in the second style.

I should say something else about [XML: it doesn't really respect
namespace URLs. What it prints out is the textual prefixes used in the
source, and the xmlns declarations used in the code, but if you
compose things poorly, the generated code could overlap and not do
what it looks like it should do. If this is an issue in practice, then
I could redo the XML printer to generate namespace names based off the
URLs, and be more high level in that way. But I think the current,
more ad-hoc system is adequate.

Dan

On Fri, Mar 27, 2009 at 11:58 AM, Philipp Winkler
 wrote:
> Hi all,
>
> I might have a bug report for the xml.syntax vocabulary. Assigning the
> name space attribute doesn't work the [XML syntax.
>
> So for example:
>
> "http://schemas.openxmlformats.org/package/2006/content-types";
> [XML > XML]
>
> yields the following error:
>
> Bad store to specialized slot
> value T{ interpolated f f }
> class nullable-string
>
> However:
> [XML
> http://schemas.openxmlformats.org/package/2006/content-types";>
>        
> XML]
> works just fine.
>
> I don't know if this is actually a bug or if I'm doing something wrong.
>
> Best,
> -phil
>
>
> --
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

--
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] Encodings finished?

2009-03-20 Thread Daniel Ehrenberg
Hi everyone,

I've implemented ISO 2022-JP-1, a Japanese text encoding used mostly
for email. It's pushed to Factor's main repository. As far as I know,
Factor now has an implementation for all of the useful encodings for
text, and some that aren't even completely needed, because no one
really uses them (eg UTF-32). So, except for better unit tests, I
think the project of implementing text encodings for Factor is done.
If anything is missing, please tell me.

Dan

--
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Bug in XML Parser?

2009-03-15 Thread Daniel Ehrenberg
OK, I need to change XML then. The string>xml word would serve your
purposes here, but there's no equivalent for each-element. The problem
is, UTF-8 is being decoded twice! So I'll make an string-each-element
word which'll suit this purpose.

Dan

On Sun, Mar 15, 2009 at 2:15 PM, Sascha Matzke  wrote:
> Hi,
>
>> Your code doesn't work because the XML parser auto-detects encodings,
>> and thus it needs a binary stream, not a character stream.
>
> the problem is, that in my original use-case (the file is just a
> workaround to reproduce the issue) I get the XML via HTTP GET
> (http-get word) - which exibits the same behavior. Should I re-encode
> the data returned by http-get into a byte-array to make the xml parser
> work?
>
> Sascha
> --
> Through the darkness of future past
> the magician longs to see
> One chants out between two worlds
> Fire walk with me.
>
> --
> Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
> powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
> easily build your RIAs with Flex Builder, the Eclipse(TM)based development
> software that enables intelligent coding and step-through debugging.
> Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

--
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Summer of code 2009 ideas for Factor

2009-03-14 Thread Daniel Ehrenberg
These are good ideas. You can add them to the wiki if you want. (It's
a wiki, after all.) Also, student applicants aren't limited to the
ideas that are already on the wiki, and can apply to do part of an
idea, or several ideas combined.

A change like native threading might be too big a project for the
summer, though; it would require several changes to the runtime (the
garbage collector would need somewhat of a re-design, even if
collection itself is single-threaded, for example) and to the
libraries (all data structures would have to be made thread-safe, and
we wouldn't accept a performance regression on single-threaded code).

Dan

On Sat, Mar 14, 2009 at 9:40 AM, zimbatm  wrote:
> Yet other ideas:
> * add a simple text editor to the UI for quickly changing words
> * add some symbolic manipulation tools, that help newbies prettying up
> their code
>
> --
> Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
> powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
> easily build your RIAs with Flex Builder, the Eclipse(TM)based development
> software that enables intelligent coding and step-through debugging.
> Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

--
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Summer of code 2009 ideas for Factor

2009-03-13 Thread Daniel Ehrenberg
That's the application deadline for mentors. If the Factor project
gets accepted, then we'll post information about how to apply as a
student here.

Dan

On Fri, Mar 13, 2009 at 7:11 PM, Slava Pestov  wrote:
> Hi all,
>
> Doug, Dan and I wrote up some project ideas for students here:
>
> http://concatenative.org/wiki/view/Factor/GSoC/2009
>
> Feedback is appreciated. There are only a few days before the
> application deadline.
>
> Slava
>
> --
> Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
> powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
> easily build your RIAs with Flex Builder, the Eclipse(TM)based development
> software that enables intelligent coding and step-through debugging.
> Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

--
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] new_ui, binaries, etc

2009-03-13 Thread Daniel Ehrenberg
Regexp is far from the only text processing library in Factor. There's
also PEGs EBNF, which uses a packrat parser to execute a parsing
expression grammar. It's not very efficient right now, though. You can
also do little ad-hoc things with manipulating strings directly (as
sequences); the Unicode library does this in parsing resource files.
The XML library builds its own terrible parsing abstraction, but it's
terrible and I plan to replace it soon.

Dan

On Fri, Mar 13, 2009 at 9:40 AM, Kobi Lurie  wrote:
> Great news, kudos to littledan :)
> Slava, is regexp the only or main way to get text processing on factor?
> I've created some utilities for text processing which are more low level
> and also less complete,
> but they might be faster, or simply more ready out of the box. (if
> anyone is less familiar with regexp's syntax)
> ofcourse they also need some cleanup and more logical placement/refactoring.
> and later on, some help to mature them from the more knowledgeable
> factorers would be great too.
>
> I also think documentation is important for newbies and an example goes
> a long way for quick reference.
> (more example code, gets devs faster :-))
> All in all, I'm quite sure everyone here loves factor, and the way it's
> developing,
> I personally see the meta features as ones having alot of (untapped)
> potential, if used as tools for helping with development and getting
> quick information about the code.
> Are there any big projects you plan in order to test and refine Factor
> further? tip us, and probably some will be glad to lend a hand for
> implementing the smaller stuff...
>
> Thanks, Kobi
>
>
> Slava Pestov wrote:
>> Hi all,
>>
>> A few people have asked questions so I thought I'd post a little status 
>> update.
>>
>> The new_ui branch is now merged into master and there is no further
>> development in the new_ui branch. I've updated a lot of code in basis
>> and extra (and moved other stuff to unmaintained that I didn't want to
>> update). I will do a blog post about the API changes and other new
>> features soon. Please do test, keeping in mind that the new gadgets
>> still need some cosmetic tweaks.
>>
>> There are still some things that don't load and pass tests, hence we
>> haven't had binaries for a while. This doesn't mean development has
>> slowed down or stopped, though; quite the opposite, a lot of work is
>> being done and we're going through a less stable phase. I expect
>> things to settle down in a week or so.
>>
>> In other news, Daniel Ehrenberg has been working on our regular
>> expression implementation, originally written by Doug Coleman. Dan has
>> added some features and also major performance improvements; regexes
>> now compile to machine code, and as a result the benchmark.regex-dna
>> benchmark now runs 60x faster than before. Dan will also add group
>> capture soon, giving us a full-featured regex engine.
>>
>> Slava
>>
>> --
>> Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
>> powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
>> easily build your RIAs with Flex Builder, the Eclipse(TM)based development
>> software that enables intelligent coding and step-through debugging.
>> Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
>> ___
>> Factor-talk mailing list
>> Factor-talk@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/factor-talk
>>
>
>
> --
> Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
> powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
> easily build your RIAs with Flex Builder, the Eclipse(TM)based development
> software that enables intelligent coding and step-through debugging.
> Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

--
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] peg for parsing words

2009-03-10 Thread Daniel Ehrenberg
Great. One last thing: write unit tests for the test parsers so we
have an automated way to see if they work, and just move the test
parsers to peg-lexer-tests.factor. (Once this is done, you can run
your unit tests with "peg-lexer" test; this is very convenient for
interactive development, I find.) Then I'll pull from you.

Dan

On Tue, Mar 10, 2009 at 6:36 PM, Sam Anklesaria  wrote:
> Documentation, summary, authors, and tags have all been updated.
>
> Daniel Ehrenberg wrote:
>> This looks great! Good work.
>>
>> To get stuff committed to the repository, you just have to ask one of
>> the core developers with commit access to pull from you. I could do
>> this. But, before that happens, there are a couple changes you should
>> make to your code. First, this code should be in extra rather than
>> basis. Second, it'd be nice if you documented the code and wrote unit
>> tests for it. Third, you should make summary.txt and authors.txt
>> files. Then, we can pull this into the Factor repository.
>>
>> Dan
>>
>> On Mon, Mar 9, 2009 at 8:52 PM, Sam Anklesaria  wrote:
>>> I recently made a library that allows a peg parser to temporarily take over 
>>> the
>>> lexer, which can be useful for implementing more complicated parsing words.
>>> It's on github at http://github.com/bogiebro/factor/tree/master (called 
>>> peg-lexer)
>>>
>>> How would I commit this to Factor's repository?
>>>
>>> --
>>> ___
>>> Factor-talk mailing list
>>> Factor-talk@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/factor-talk
>>>
>>
>> --
>> ___
>> Factor-talk mailing list
>> Factor-talk@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/factor-talk
>>
>
>
> --
> Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
> powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
> easily build your RIAs with Flex Builder, the Eclipse(TM)based development
> software that enables intelligent coding and step-through debugging.
> Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

--
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] peg for parsing words

2009-03-10 Thread Daniel Ehrenberg
This looks great! Good work.

To get stuff committed to the repository, you just have to ask one of
the core developers with commit access to pull from you. I could do
this. But, before that happens, there are a couple changes you should
make to your code. First, this code should be in extra rather than
basis. Second, it'd be nice if you documented the code and wrote unit
tests for it. Third, you should make summary.txt and authors.txt
files. Then, we can pull this into the Factor repository.

Dan

On Mon, Mar 9, 2009 at 8:52 PM, Sam Anklesaria  wrote:
> I recently made a library that allows a peg parser to temporarily take over 
> the
> lexer, which can be useful for implementing more complicated parsing words.
> It's on github at http://github.com/bogiebro/factor/tree/master (called 
> peg-lexer)
>
> How would I commit this to Factor's repository?
>
> --
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

--
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Question about convert *.h to *.ffi

2009-03-04 Thread Daniel Ehrenberg
No, there's no tool like that. Such a tool would be a lot of work,
since it would involve implementing a C header parser and preprocessor
in the general case. This has been done in the SWIG project, I think,
but no one has done this for Factor's FFI. It looks like it'd be
possible to bind to SWIG and use its header parser, actually.

Dan

On Wed, Mar 4, 2009 at 2:31 AM, Caesar Hu  wrote:
> Hi, all
>
> I'm study C library interface, viewing cairo/ffi.factor, then I have a
> question:
>
> Is there a tool to convert *.h to ffi.factor, like :
>
> cairo.h:
> typedef struct _cairo_matrix {
>     double xx; double yx;
>     double xy; double yy;
>     double x0; double y0;
> } cairo_matrix_t;
>
> cairo/ffi.factor:
> C-STRUCT: cairo_matrix_t
>     { "double" "xx" }
>     { "double" "yx" }
>     { "double" "xy" }
>     { "double" "yy" }
>     { "double" "x0" }
>     { "double" "y0" } ;
>
> If there is a  tool to convert *.h to ffi.factor, we can binding C library
> easily.
>
> --
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
> -Strategies to boost innovation and cut costs with open source participation
> -Receive a $600 discount off the registration fee with the source code: SFAD
> http://p.sf.net/sfu/XcvMzF8H
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
>

--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Taiwan Big5 encoding

2009-03-03 Thread Daniel Ehrenberg
I added Big5 support to Factor last night. I didn't end up using your
code since Big5 is just another EUC, and we have an implementation of
EUC-KR, so I abstracted out the code for EUC-KR and now it's also used
by Big5, Johab and EUC-JP. Maybe I should support EUC-CN (GB 2312)
also. Here's what the Big5 source code looks like now:

USING: io.encodings.iana io.encodings.euc ;
IN: io.encodings.big5

EUC: big5 "vocab:io/encodings/big5/CP950.txt"

big5 "Big5" register-encoding

The parsing word EUC: reads the resource file and defines the encoding
descriptor big5. I plan on reorganizing 8-bit encodings along these
lines.

Dan

On Sun, Mar 1, 2009 at 11:48 PM, 胡培舜  wrote:
> Hi, all
>
>   I have working on Taiwan Big5 encoding, It can work normally now,
> here is result
>
> http://paste.factorcode.org/paste?id=482
>
> Can I commit to io.encodings.Big5 ?
>
> --
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
> -Strategies to boost innovation and cut costs with open source participation
> -Receive a $600 discount off the registration fee with the source code: SFAD
> http://p.sf.net/sfu/XcvMzF8H
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
>

--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Taiwan Big5 encoding

2009-03-02 Thread Daniel Ehrenberg
That's great, Caesar. There's a bit of code duplication with the
earlier io.encodings.korean, and this also repeats with existing code,
so I'll figure out how to factor this out properly. Am I correct in
reading from your code that Big5 is an EUC? If so, it might be better
if we had common code for handling EUCs, and then used this for Big5.
One problem with this code is that it does not handle end of file
gracefully in the middle of a multibyte character. You might have
based the code off an earlier version of io.encodings.japanese, which
has the same problem. Jong-Hyouk Yun (ageld...@gmail.com), on this
mailing list, is working on other EUCs; you should talk to him about
his plans for this all.

Great to have another contributor!

Dan

On Sun, Mar 1, 2009 at 11:48 PM, 胡培舜  wrote:
> Hi, all
>
>   I have working on Taiwan Big5 encoding, It can work normally now,
> here is result
>
> http://paste.factorcode.org/paste?id=482
>
> Can I commit to io.encodings.Big5 ?
>
> --
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
> -Strategies to boost innovation and cut costs with open source participation
> -Receive a $600 discount off the registration fee with the source code: SFAD
> http://p.sf.net/sfu/XcvMzF8H
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
>

--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Bug List Dump

2009-03-01 Thread Daniel Ehrenberg
Wow, that's really awesome! Tell me if you have any issues with
inverse, or think it could easily be made more general in some way.

Dan

On Sat, Feb 28, 2009 at 3:08 PM, Jesse Rusak  wrote:
> I also made a new
> version of  which uses the inverse vocab to provide bi-
> directional editing of a model. (I will hopefully contribute some of
> this once it's ready.)
>
> Hope that helps!
> - Jesse

--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Beste way to move element to end of sequence?

2009-02-25 Thread Daniel Ehrenberg
Wow, I contradicted myself in my own email. I only really meant the
second part, where I said that you don't need to use map-permutation.

Dan

On Wed, Feb 25, 2009 at 1:56 PM, Daniel Ehrenberg  wrote:
> What you really want to do is calculate the permutation directly, and
> then use map-permutation. I suspect the permutation can be calculated
> in linear time. Here's a quick O(n log log n) solution, which is
> basically as good. (I've never written an algorithm before which came
> out with a log log complexity, so this is fun for me!)
>
> USE: lists
>
> : evens/odds ( seq -- even odd )
>     >alist [ first even? ] partition [ values ] bi@ ;
>
> : reorder>list ( seq -- seq-list )
>    dup length 2 <=
>    [ 1list ]
>    [ evens/odds reorder>list cons ]
>    if ;
>
> : reorder ( seq -- newseq )
>    reorder>list  list>array concat ;
>
> By the way, there's no particular reason why you need to use
> map-permutation for this (unless you're applying the same permutation
> several times to sequences of the same length); you can just apply it
> directly to your sequence.
>
> Dan
>
> On Wed, Feb 25, 2009 at 9:59 AM, Jon Kleiser  wrote:
>> Thanks, Jesse! Your solution looks fine. I'll study the words 'keep' and
>> 'reduce' so I can understand the magic involved. ;-)
>>
>> There may be a more direct way to do this. Maybe some recursive method?
>> As you may have seen, if the initial sequence is
>> { 0 1 2 3 4 5 6 7 8 9 }, then the result will be
>> { 0 2 4 6 8 1 5 9 7 3 }. As I'm going to apply the move-core-to-end on
>> that, over and over, I could use the first result as a permutation
>> sequence with Daniel Ehrenberg's map-permutation word.
>>
>> /Jon
>>
>> On 2/25/09 1:11 PM, Jesse Rusak wrote:
>>> How about this?
>>>
>>> : move-core-to-end ( seq -- seq )
>>>    [ length 2 - [1,b] ] keep [ swap move-to-end ] reduce ;
>>>
>>> Though I feel like there's probably a more direct way to do this than
>>> moving each element in turn.
>>>
>>> - Jesse
>>>
>>> On 25-Feb-09, at 4:30 AM, Jon Kleiser wrote:
>>>
>>>> Here's follow-up to my first question about how to move the nth
>>>> element
>>>> to the end, which Daniel and Slava had several solutions for.
>>>>
>>>> On 2/23/09 7:19 PM, Daniel Ehrenberg wrote:
>>>>> Well, here's an inefficient way to do it, but the code is pretty:
>>>>>
>>>>> : move-to-end ( n seq -- newseq )
>>>>>    [ remove-nth ] [ nth ] 2bi suffix ;
>>>> I now wanted to apply that operation for n=1 to n=length-2, i.e.
>>>> skipping the first (0) and last (length-1) index. I came up with the
>>>> following solution, but I suspect Daniel, Slava, or other Factor heads
>>>> on this list, may have a better (looking) way of doing it, maybe
>>>> without
>>>> the variable. Here's mine:
>>>>
>>>> : move-core-to-end ( seq -- seq )
>>>>     SYMBOL: target
>>>>     dup
>>>>     target set
>>>>     length 2 - [1,b] [ target get move-to-end target set ] each
>>>>     target get ;
>>>>
>>>> /Jon
>>
>> --
>> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
>> -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
>> -Strategies to boost innovation and cut costs with open source participation
>> -Receive a $600 discount off the registration fee with the source code: SFAD
>> http://p.sf.net/sfu/XcvMzF8H
>> ___
>> Factor-talk mailing list
>> Factor-talk@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/factor-talk
>>
>

--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Beste way to move element to end of sequence?

2009-02-25 Thread Daniel Ehrenberg
What you really want to do is calculate the permutation directly, and
then use map-permutation. I suspect the permutation can be calculated
in linear time. Here's a quick O(n log log n) solution, which is
basically as good. (I've never written an algorithm before which came
out with a log log complexity, so this is fun for me!)

USE: lists

: evens/odds ( seq -- even odd )
 >alist [ first even? ] partition [ values ] bi@ ;

: reorder>list ( seq -- seq-list )
dup length 2 <=
[ 1list ]
[ evens/odds reorder>list cons ]
if ;

: reorder ( seq -- newseq )
reorder>list  list>array concat ;

By the way, there's no particular reason why you need to use
map-permutation for this (unless you're applying the same permutation
several times to sequences of the same length); you can just apply it
directly to your sequence.

Dan

On Wed, Feb 25, 2009 at 9:59 AM, Jon Kleiser  wrote:
> Thanks, Jesse! Your solution looks fine. I'll study the words 'keep' and
> 'reduce' so I can understand the magic involved. ;-)
>
> There may be a more direct way to do this. Maybe some recursive method?
> As you may have seen, if the initial sequence is
> { 0 1 2 3 4 5 6 7 8 9 }, then the result will be
> { 0 2 4 6 8 1 5 9 7 3 }. As I'm going to apply the move-core-to-end on
> that, over and over, I could use the first result as a permutation
> sequence with Daniel Ehrenberg's map-permutation word.
>
> /Jon
>
> On 2/25/09 1:11 PM, Jesse Rusak wrote:
>> How about this?
>>
>> : move-core-to-end ( seq -- seq )
>>    [ length 2 - [1,b] ] keep [ swap move-to-end ] reduce ;
>>
>> Though I feel like there's probably a more direct way to do this than
>> moving each element in turn.
>>
>> - Jesse
>>
>> On 25-Feb-09, at 4:30 AM, Jon Kleiser wrote:
>>
>>> Here's follow-up to my first question about how to move the nth
>>> element
>>> to the end, which Daniel and Slava had several solutions for.
>>>
>>> On 2/23/09 7:19 PM, Daniel Ehrenberg wrote:
>>>> Well, here's an inefficient way to do it, but the code is pretty:
>>>>
>>>> : move-to-end ( n seq -- newseq )
>>>>    [ remove-nth ] [ nth ] 2bi suffix ;
>>> I now wanted to apply that operation for n=1 to n=length-2, i.e.
>>> skipping the first (0) and last (length-1) index. I came up with the
>>> following solution, but I suspect Daniel, Slava, or other Factor heads
>>> on this list, may have a better (looking) way of doing it, maybe
>>> without
>>> the variable. Here's mine:
>>>
>>> : move-core-to-end ( seq -- seq )
>>>     SYMBOL: target
>>>     dup
>>>     target set
>>>     length 2 - [1,b] [ target get move-to-end target set ] each
>>>     target get ;
>>>
>>> /Jon
>
> --
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
> -Strategies to boost innovation and cut costs with open source participation
> -Receive a $600 discount off the registration fee with the source code: SFAD
> http://p.sf.net/sfu/XcvMzF8H
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Beste way to move element to end of sequence?

2009-02-23 Thread Daniel Ehrenberg
Well, here's an inefficient way to do it, but the code is pretty:

: move-to-end ( n seq -- newseq )
[ remove-nth ] [ nth ] 2bi suffix ;

I guess you could make this all in place to be more efficient, but
asymptotically this wouldn't really be a win in terms of time (unless
the index you provide is usually near the end). If you want to do this
particular operation efficiently, I suggest you use dlists.  But if
your problem is really to apply a particular permutation to a
sequence, using a word like this might be the best way to go:

: map-permutation ( seq permutation -- newseq )
swap '[ _ nth ] map ;

I'd give you a code sample of how to calculate your permutation, but
I'm not sure exactly what you want to do here.

Dan

On Mon, Feb 23, 2009 at 10:05 AM, Jon Kleiser  wrote:
> Hi,
>
> Could somebody tell me the most efficient way to cut an element out of a
> sequence and put it at the end? I need to repeat this over and over, but
> each time with a new index. If the index e.g. runs from 1 to 3, the
> results should be like this:
>
> initial { a b c d e f }
> 1 ->{ a c d e f b }
> 2 ->{ a c e f b d }
> 3 ->{ a c e b d f }
>
> Sincerely,
>
> Jon Kleiser
>
> --
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
> -Strategies to boost innovation and cut costs with open source participation
> -Receive a $600 discount off the registration fee with the source code: SFAD
> http://p.sf.net/sfu/XcvMzF8H
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Deployment and define-operation

2009-02-13 Thread Daniel Ehrenberg
When you were deploying, did you strip out word properties? Those need
to be left in for define-operation to work, I think. In the deploy
tool, there's a checkbox for this. You might want to try deploying
including everything, which is much more likely to work, and then
seeing what you can safely take away.

Dan

On Fri, Feb 13, 2009 at 3:53 AM, Ben Schlingelhof  wrote:
> Hi there,
>
> I've managed to narrow down teh problems with deployment I've had.
> First thing was missing vocabs in USING: clauses. Apparantly the
> Factor Runtime doesn't give a warning if a vocab is used, that it
> already knows, but the deployer does object rather cryptically. So
> that worked, but now I'm stuck again: I can deploy, but the app ends
> in the low-level-debugger. This happens whenever I try to use
> define-operation for my UI. Everything else works fine, the UI deploys
> smoothly if I dont define any new operations, but if I do: bugger.
> Maybe I don't get the whole idea about operations. Sorry for not
> sharing any code, but I'm sort of under contract and would not feel
> good sharing it. Here's the error:
>
> .s
>  DATA STACK:
> T{ sequences:immutable f }
> READY
> .r
>  RETAIN STACK:
> #
> [ kernel:drop ]
> [ f # namespaces:set-global ]
> [ ]
> READY
> .c
>  CALL STACK:
> [ init:boot T{ vectors:vector { } 0 } kernel:clone
> compiler.units:definition-observers namespaces:set-global T{
> hashtables:hashtable 0 0 { T{ hashtables.private:tombstone f } T{
> hashtables.private:tombstone f } T{ hashtables.private:tombstone f }
> T{ hashtables.private:tombstone f } T{ hashtables.private:tombstone f
> } T{ hashtables.private:tombstone f } T{ hashtables.private:tombstone
> f } T{ hashtables.private:tombstone f } } } kernel:clone
> alien:callbacks namespaces:set-global io.backend:init-io... ]
> 69
> 1a0009b 5e29150
> [ T{ hashtables:hashtable 0 0 { T{ hashtables.private:tombstone f } T{
> hashtables.private:tombstone f } T{ hashtables.private:tombstone f }
> T{ hashtables.private:tombstone f } T{ hashtables.private:tombstone f
> } T{ hashtables.private:tombstone f } T{ hashtables.private:tombstone
> f } T{ hashtables.private:tombstone f } } } kernel:clone
> namespaces.private:>n kernel:call namespaces.private:ndrop ]
> 3
> 20bcc9b 58e42e0
> [ cocoa.classes:NSAutoreleasePool "new" cocoa.messages:send
> kernel:slip "release" cocoa.messages:send ]
> 3
> 1fcda8b 5c05780
> [ [ kernel:call ] kernel:dip ]
> 1
> 1b5a52b 58df4a0
> [ [ kernel:compose [ kernel:dip continuations:rethrow ] kernel:curry
> continuations:recover ] [ kernel:drop ] kernel:2bi kernel:call ]
> 2
> 1f16c7b 588b650
> [ [ kernel:2keep ] kernel:dip kernel:call ]
> 1
> 20adf53 58dd050
> [ [ kernel:call ] kernel:2dip ]
> 1
> 1b5a623 58e0c80
> continuations:rethrow
> f
> 1b8004b 58bf050
> [ threads:self threads:error-in-thread threads:stop ]
> 1
> 1a0414b 5e29730
> error-in-thread/tuple-dispatch-engine
> f
> 1b9ba83 5ca9a00
> READY
>
> Thanks for reading, any ideas?
>
> Ben
>
> --
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
> -Strategies to boost innovation and cut costs with open source participation
> -Receive a $600 discount off the registration fee with the source code: SFAD
> http://p.sf.net/sfu/XcvMzF8H
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Help needed, io.encodings.korean decode-char

2009-02-12 Thread Daniel Ehrenberg
That's great. Get a repository with someone like Github, tell me where
it is and I'll commit it for you. Only a few people directly have
commit access to the main repository.

Dan

On Thu, Feb 12, 2009 at 6:16 AM, Jong-Hyouk Yun  wrote:
> Hi, SOLVED.
>
> my tests passed, it seems works fine. (but still tests have to load
> before "test").
>
> how can I commit i.e.korean?
>
> Thanks.
>
> 2009/2/11 Jong-Hyouk Yun :
>> Hi,
>>
>> I've been working on Korean cp949 encoding for awhile, here is result:
>>
>> http://paste.factorcode.org/paste?id=423 -- io.encodings.korean vocab
>> http://paste.factorcode.org/paste?id=424 -- io.encodings.korean tests
>>
>> but, I couldn't make it work decode-char. (encode-char is seems ok)
>>
>> my questions are...
>>
>> 1) is there any problem on my 'decode-char'?
>>
>> 2) ' "io.encodings.korean" test ' does not working when I'm didn't
>> load that vocab or i.e.korean vocab.
>>
>>
>> Thanks.
>>
>
> --
> Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
> software. With Adobe AIR, Ajax developers can use existing skills and code to
> build responsive, highly engaging applications that combine the power of local
> resources and data with the reach of the web. Download the Adobe AIR SDK and
> Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

--
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] Another XML API change

2009-02-10 Thread Daniel Ehrenberg
Hi all,

I forgot to say, I reorganized the XML vocabularies a week or so ago.
Now, words like tag-named and children>string are in xml.traversal,
and all XML-related parsing words are in xml.syntax (http://p.sf.net/sfu/adobe-com
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] ms949 for IANA?

2009-02-09 Thread Daniel Ehrenberg
That's great! For this, I don't think a special method for 
or  is necessary; the default one should do fine. I can't
believe I forgot about using MEMO: to load resource files; that's a
much cleaner technique than VALUE:.

About CP949 vs the proper EUC-KR: is the Microsoft version a strict
superset of the official version, or does it have some changes in the
ASCII range the way the equivalent Japanese encodings do? If there are
changes, it seems like we should support both. I want the Factor
encodings library to be completely correct with respect to the
standards, as well as practical.

As far as register-encoding, that word is used to set up a mapping of
IANA encoding names to Factor encoding descriptors, so if CP949 isn't
IANA-registered, it wouldn't make sense to use that name with
register-encoding. On the other hand, if that encoding name is used
unofficially on the internet a lot, I could extend io.encodings.iana
to let you register a list of synonyms that are unofficial.

Dan

On Mon, Feb 9, 2009 at 8:27 AM, Jong-Hyouk Yun  wrote:
> here is unfinished code...
>
> http://paste.factorcode.org/paste?id=419
>
> anybody help me to complete , ?
>
> I got to go to bed for tomorrow working T.T...
>
>
> Cheers.
>
> 2009/2/9 Jong-Hyouk Yun :
>> Hi,
>>
>> After coming home from office, I've worked awhile for cp949(aka cp949,
>> uhc -- unified hanguel code, and extended euc-kr) encoding for Korean.
>>
>> Anyway, I found IANA registry has no entry for "cp949".
>> "cp949" is de facto Korean encoding, but there's not found. (I thinks
>> ksc codes are quite similar but I knew it's not same things)
>>
>> So, can I use below?
>>
>> 
>> cp949 "cp949" register-encoding
>> 
>>
>> I think most Korean hackers prefer 'cp949' or 'ms949'than
>> ksc-blah-blah-blah-blup-blahs.
>>
>> It was easy to implement encoding in Factor than I expected, so I
>> expect I could release it's shamelessly "japanese.factor" resemblance
>> encoding, soon. :-)
>>
>>
>> Thanks.
>>
>
> --
> Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
> software. With Adobe AIR, Ajax developers can use existing skills and code to
> build responsive, highly engaging applications that combine the power of local
> resources and data with the reach of the web. Download the Adobe AIR SDK and
> Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

--
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] call( -- )

2009-02-08 Thread Daniel Ehrenberg
Hi everyone,

Slava told me today that with-datastack compiles, so I implemented a
feature that I've wanted for a while: the ability of code compiled
with the optimizing compiler to call arbitrary quotations. All you
have to do to make this infer is declare the stack effect of the
quotation that you're calling, at the call site. Using this, I made
lazy lists compile with the optimizing compiler, when they didn't
infer before. So, where persistent.deques used to implement its own
lists, and I was about to make my own lists for an algorithm in the
wrap vocabulary, I now use the existing list vocab. You could, for
example, implement a restricted version of case like this:

: case ( object alist -- )
at call( -- ) ;

And this compiles with the optimizing compiler! [ case ] infer => ((
object object -- )).

You can put an arbitrary stack effect in call( -- ), and it'll be
checked at runtime that the quotation actually takes and leaves the
right number of things. For example, call( x y z -- foo bar ) asserts
that the quotation takes three values and returns two. The
implementation of all this is totally trivial using with-datastack.
It's in the call vocabulary. (I'm not sure if that's the best name for
it.) This takes the place of assert-depth, as it's equivalent to call(
-- ). It also replaces most usages of with-datastack, if you were
using it with a fixed number of inputs and outputs. Enjoy!

Dan

--
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] circular

2009-02-05 Thread Daniel Ehrenberg
Alex Chapman wrote the first version of circular, for vertex buffers I
think. I, unaware of this, wrote another implementation of the same
thing for the XML parser, and then I realized they were the same and
merged the two libraries. The idea of a circular buffer is kinda
trivial and I'm sure it's not really a Factor innovation. I remember
seeing an implementation of something similar in a C book I was
reading years ago. Maybe it's an innovation to make it a virtual
sequence. I doubt that, but haven't seen it anywhere else following
the same protocol that arrays do. It'd be easy to implement circular
in, say, Python following the equivalent of the sequence protocol.

Dan

On Thu, Feb 5, 2009 at 11:54 AM, Eduardo Cavazos  wrote:
> Hello,
>
> The 'circular' vocabulary is pretty neat. I actually use it in the
> 'trails' demo. To try it do:
>
> "trails" run
>
> So I'm curious, what was the precedent for 'circular'? Was it borrowed
> from another language? Or is it a Factor innovation?
>
> Ed
>
> --
> Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
> software. With Adobe AIR, Ajax developers can use existing skills and code to
> build responsive, highly engaging applications that combine the power of local
> resources and data with the reach of the web. Download the Adobe AIR SDK and
> Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

--
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] deploy error tracking

2009-02-05 Thread Daniel Ehrenberg
Could you say what you're deploying so I can try to reproduce the error?

Dan

On Thu, Feb 5, 2009 at 9:10 AM, Ben Schlingelhof  wrote:
> Hi,
>
> while deploy I get this:
> T{ generic.standard:no-method f sequences:set-length }
> Something problematic with my code no doubt, but how do I track this
> down? I can't reproduce the error in the listener, everything works
> fine there. Any ideas?
>
> Ben
>
> --
> Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
> software. With Adobe AIR, Ajax developers can use existing skills and code to
> build responsive, highly engaging applications that combine the power of local
> resources and data with the reach of the web. Download the Adobe AIR SDK and
> Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

--
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] difference between "#'reduce" and "reduce"?

2009-02-05 Thread Daniel Ehrenberg
Your order of arguments is wrong. The initial value is taken as the
middle parameter for reduce. Here's the code you want:

{ { 1 2 } { 3 4 } } { } [ append ] reduce

But what you really want is the word concat, for this particular case.
It's linear rather than quadratic time overhead.

Dan

On Thu, Feb 5, 2009 at 1:47 AM, Jong-Hyouk Yun  wrote:
> Hi,
>
>
> I'm very confused with 'reduce' word.
>
> in CommonLisp I could flatten depth-2 list '((1 2) (3 4) ..) into '(1
> 2 3 4 ...) with #'reduce...
>
> 
> (reduce #'append '((1 2) (3 4)) :initial-value '())
> 
>
> but, Factor give me unexpected results
>
> 
> ( scratchpad ) { 1 2 } { 3 4 } append .
> { 1 2 3 4 }
> ( scratchpad ) { } { 1 2 } append .
> { 1 2 }
> ( scratchpad ) { } { { 1 2 } { 3 4 } } [ append ] reduce .
> { { 1 2 } { 3 4 } }
> 
>
> I expected those snippets give me "{ 1 2 3 4 }" but isn't.
> Am I misunderstood concepts?
>
>
> Thanks.
>
>
>
> ps. recently (really!) I'm falling love with Factor language, awesome
> language and ultimate Emacs+FUEL environment gave me new programming
> life. Thanks to every guys on Factor and their wonderful works!
>
> --
> Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
> software. With Adobe AIR, Ajax developers can use existing skills and code to
> build responsive, highly engaging applications that combine the power of local
> resources and data with the reach of the web. Download the Adobe AIR SDK and
> Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

--
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Some Japanese encoding support

2009-02-02 Thread Daniel Ehrenberg
I also implemented GB 18030.

On Mon, Feb 2, 2009 at 12:19 AM, Daniel Ehrenberg  wrote:
> Hi all,
>
> I just implemented Shift JIS for Factor, and it's in the main
> repository. There's also UTF-32. I still have to do ISO 2022 and
> EUC-JP to get complete coverage of Japanese encodings, as well as GB
> 18030 for Chinese, and then Factor's support for encodings will be
> more or less complete.
>
> Dan
>

--
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] Some Japanese encoding support

2009-02-01 Thread Daniel Ehrenberg
Hi all,

I just implemented Shift JIS for Factor, and it's in the main
repository. There's also UTF-32. I still have to do ISO 2022 and
EUC-JP to get complete coverage of Japanese encodings, as well as GB
18030 for Chinese, and then Factor's support for encodings will be
more or less complete.

Dan

--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Vocabularies moved to unmaintained

2009-01-30 Thread Daniel Ehrenberg
Oops. I did that. It's fixed now.

On Thu, Jan 29, 2009 at 8:26 PM, Slava Pestov  wrote:
> Dan,
>
> Slate is used by a bunch of things so it should be moved back and have
> its help fixed. The others can wait until someone gets around to it.
>
> Slava
>
> On Thu, Jan 29, 2009 at 8:16 PM, Eduardo Cavazos  
> wrote:
>> Daniel Ehrenberg wrote:
>>
>>> Unfortunately, I had to move some vocabularies to unmaintained because
>>> help-lint has been broken on them for some time. Just make the files
>>> pass help-lint to get the moved back. The vocabularies are, 4DNav (and
>>> child vocabularies), asoda (ditto), ui.gadgets.plot, ui.gadgets.slate
>>> and ui.gadgets.tiling.
>>
>> Did you bother to check the vocabularies which are dependent on
>> 'ui.gadgets.slate'?
>>
>> Ed
>>
>> --
>> This SF.net email is sponsored by:
>> SourcForge Community
>> SourceForge wants to tell your story.
>> http://p.sf.net/sfu/sf-spreadtheword
>> ___
>> Factor-talk mailing list
>> Factor-talk@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/factor-talk
>>
>
> --
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] Vocabularies moved to unmaintained

2009-01-29 Thread Daniel Ehrenberg
Hi,

Unfortunately, I had to move some vocabularies to unmaintained because
help-lint has been broken on them for some time. Just make the files
pass help-lint to get the moved back. The vocabularies are, 4DNav (and
child vocabularies), asoda (ditto), ui.gadgets.plot, ui.gadgets.slate
and ui.gadgets.tiling.

Dan

--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] XML API change

2009-01-29 Thread Daniel Ehrenberg
Now, write-xml-chunk and xml-chunk>string have been removed, in favor
of write-xml and xml>string, which is now generic. write-prolog is
also now replaced by write-xml.

Dan

On Wed, Jan 28, 2009 at 6:37 PM, Daniel Ehrenberg  wrote:
> Hi all,
>
> I made some changes to the XML API that I want everyone to be aware
> of. First, XML chunks are now first-class: they are still sequences,
> but they're their own tuple type, defined in xml.data. This only
> affects the output of string>xml-chunk and similar words; the
> acceptable inputs to xml-chunk>string hasn't decreased. Second, tags
> are no longer assocs of their attributes. They are only sequences of
> their children. To get an attribute with a specific name, use attr (
> tag name -- string ) and to set an attribute, use set-attr ( tag value
> name -- ). You can also manipulate the assoc of attributes, which is
> stored in the attr slot, directly. This will all be documented very
> soon.
>
> Dan
>

--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] XML API change

2009-01-28 Thread Daniel Ehrenberg
Hi all,

I made some changes to the XML API that I want everyone to be aware
of. First, XML chunks are now first-class: they are still sequences,
but they're their own tuple type, defined in xml.data. This only
affects the output of string>xml-chunk and similar words; the
acceptable inputs to xml-chunk>string hasn't decreased. Second, tags
are no longer assocs of their attributes. They are only sequences of
their children. To get an attribute with a specific name, use attr (
tag name -- string ) and to set an attribute, use set-attr ( tag value
name -- ). You can also manipulate the assoc of attributes, which is
stored in the attr slot, directly. This will all be documented very
soon.

Dan

--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Factor development having transparent persistence

2009-01-24 Thread Daniel Ehrenberg
None of the things under exotic data structures have been implemented
in Factor, or at least the guy who wrote the page hasn't publicly
released them. There is a high-level, backend-independent database
library for Factor which is included in the distribution, but I guess
that doesn't meet your requirements, since the programmer still
maintains a database. The documentation is on the Factor website at
http://docs.factorcode.org/content/vocab-db.html . If you have some
other library that you want to write bindings for, the documentation
for Factor's FFI is at
http://docs.factorcode.org/content/vocab-alien.html . Of course it's
possible to write a "transparent object database" in pure Factor to
the same degree as it is in any language which supports enough
reflective capability. You'll have no problems with Factor not being
good enough for metaprogramming. I don't think anyone's planned to
write such a database library yet, though.

Dan

On Fri, Jan 23, 2009 at 2:22 PM, Mark Koenig  wrote:
>
>
> Ive been following Factor development for about a year now.  The language
> has many qualities that I find intriguing.
> Im a database developer by profession and have been seeking a radically
> simplified development environment for years.
> Ive dug into the corners of your site and find snips that allude to my
> interest, but its a big subject with lots of technical detail to confuse the
> issues.
>
> Im looking for an extensible typed language closely integrated with an
> object database that provides transparent persistence.  The database must
> have all the normal ACID qualities required to support realworld transaction
> capability.  But I am not interested in maintaining an RDBMS or OR mapping
> or memory based db.
>
> To me "transparent" means schema management is derived from source code.   I
> want to name the object I need and the low level system finds it in
> memory/disk/where ever and MAGIC its there and usable.  Actions for Adds,
> Updates and Deletes are inferred from source code.  To the greatest extent
> possible the fact that the developer is retaining persistent objects is
> implicit needing little to no explicit code.  There seems to be two concepts
> in the literature - SAVING OBJECTS and OBJECT VERSIONING. I am most
> interested in the former, but see value in both.
> Under an item called Exotic data structures I found a few research topics
> related but it gave no idea whether its implimentation in Factor is
> doable but needs God-like powers, doable but lacking human resources, or
> "Dont hold your breath waiting for this one".
>
> Ive actually found a commercial product called Jade that proports to be a
> pascal-like language with transparent object database.
> http://www.jadeworld.com/jade/index.htm
> but the language is a let-down compared to Factor and its has expensive
> runtime costs.  Ive also found a open source object database products called
> odb4 and mcobject that might be candidates for Factor FFI.
>
> If you're still with me, I want to know if Factor could offer industrial
> strength database transactions transparently to the developer?
>
> Would it be FFI around an odb or could the capabilities be native Factor?
> What are the trade-offs?
>
> How likely is it to happen in my lifetime?
>
> Are there any other related resources that you know of?
>
> Thanks a lot
>
> Mark
>
> --
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
>

--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Locals Usage

2009-01-22 Thread Daniel Ehrenberg
This is my philosophy too. I do use locals sometimes, but typically
only one or two locals words per vocabulary. The version without
locals is usually cleaner, I find.

Dan

On Thu, Jan 22, 2009 at 2:06 PM, V. Glenn Tarcea  wrote:
> Sam,
>
> Interesting in sites :-)
>
> I find I only use Locals when I end up in a word where I have to do a lot of
> stack shuffling, and breaking the word down further doesn't really work. I
> find Locals interesting because they give you the best of both worlds and
> allow you to switch between the two on an as needed basis.
>
> Glenn
>
> V. Glenn Tarcea
> gtar...@umich.edu
>
>
> -Original Message-
> From: Samuel Tardieu [mailto:s...@rfc1149.net]
> Sent: Thursday, January 22, 2009 2:35 PM
> To: factor-talk@lists.sourceforge.net
> Subject: Re: [Factor-talk] Locals Usage
>
>> "Glenn" == V Glenn Tarcea  writes:
>
> Glenn> I really like how Factor allows either usage, even though it
> Glenn> creates a tension between the two styles.
>
> I personally dislike Eduardo's style, as it leads to code which looks
> too complicated to me and I think that it encourages longer
> words. What I like a lot about concatenative languages is the ability
> to easily refactor parts of existing words into new, shorted words,
> without any rewriting, and I have the feeling that this is often lost
> when locals are in the game.
>
> But heck, Eduardo shares much more Factor code than I do, so I let the
> code talk and wouldn't allow myself to criticize his (very useful IMO)
> experiments, even if I would prefer the Factor standard library to be
> more in a stack-oriented style.
>
>  Sam
> --
> Samuel Tardieu -- s...@rfc1149.net -- http://www.rfc1149.net/
>
>
> 
> --
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
>
>
>
> --
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Problem with regexp

2009-01-17 Thread Daniel Ehrenberg
Or you might have more luck with parser-combinators.regexp. I'm pretty
sure that implements group caputure correctly.

On Sat, Jan 17, 2009 at 11:09 AM, Daniel Ehrenberg  wrote:
> Regexp group caputure hasn't been fully debugged yet. You should try
> using some other parsing mechanism, like pegs. Hopefully this will be
> fixed soon.
>
> Dan
>
> On Fri, Jan 16, 2009 at 8:17 PM, W.Ch Lin  wrote:
>> I run into a problem when getting numbers from some html with regexp.
>> Why
>> "123" "(\\d+)"  match*
>> doesn't match 123 but 1 ?
>>
>>
>> Thanks
>>
>> --
>> This SF.net email is sponsored by:
>> SourcForge Community
>> SourceForge wants to tell your story.
>> http://p.sf.net/sfu/sf-spreadtheword
>> ___
>> Factor-talk mailing list
>> Factor-talk@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/factor-talk
>>
>>
>

--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Problem with regexp

2009-01-17 Thread Daniel Ehrenberg
Regexp group caputure hasn't been fully debugged yet. You should try
using some other parsing mechanism, like pegs. Hopefully this will be
fixed soon.

Dan

On Fri, Jan 16, 2009 at 8:17 PM, W.Ch Lin  wrote:
> I run into a problem when getting numbers from some html with regexp.
> Why
> "123" "(\\d+)"  match*
> doesn't match 123 but 1 ?
>
>
> Thanks
>
> --
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
>

--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Generators?

2009-01-15 Thread Daniel Ehrenberg
It was a design decision to not allow readln for binary, because it
doesn't make sense. On streams with a string encoding, line breaks are
interpreted to be \n, \r or \r\n. If the text isn't meant to be
understood as a string of text, I don't know what a line break would
be. An octet that's \n or \r isn't universally a line break, for
example in UTF-16BE, the possible ways to break lines are \0\n, \0\r
and \0\r\0\n. If your input is something that's base64-encoded, for
example, then it should be treated as ascii, but if it's arbitrary
binary stuff, ascii shouldn't be used. What are you trying to do here?

Dan

On Thu, Jan 15, 2009 at 1:34 PM, Adam  wrote:
> Hmmm, I was working with:
>
>
> "/path/to/bigfile" ascii [ [ ... ] each-line ] with-file-reader
>
> But I want to work with a binary data... is ascii 'safe' enough for
> that?  Binary encoding doesn't work with readln.
>
> On Thu, Jan 15, 2009 at 11:14 AM, Samuel Tardieu  wrote:
>>> "Adam" == Adam   writes:
>>
>> Adam> Is there a feature in Factor that acts like Generators in
>> Adam> Python?  I.E. adding an iteration protocol where a result is
>> Adam> computed, returned, and then yeilds to the caller?
>>
>> You can also use lazy lists (in "lists.lazy"). For an example, you can
>> look at "math.primes.lists", where "lprimes" is an infinite stream
>> containing all the prime numbers:
>>
>>  USE: math.primes.lists
>>  10 lprimes lnth
>>  ===> 1299721
>>
>> "lprimes" is defined as its first element and a word to get from the
>> current element to the next one:
>>
>>  : lprimes ( -- list ) 2 [ next-prime ] lfrom-by ;
>>
>>  Sam
>> --
>> Samuel Tardieu -- s...@rfc1149.net -- http://www.rfc1149.net/
>>
>>
>> --
>> This SF.net email is sponsored by:
>> SourcForge Community
>> SourceForge wants to tell your story.
>> http://p.sf.net/sfu/sf-spreadtheword
>> ___
>> Factor-talk mailing list
>> Factor-talk@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/factor-talk
>>
>
> --
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Accessing multiple slots without using dup and swap

2009-01-12 Thread Daniel Ehrenberg
SYMBOL: can be used anywhere, but you'll notice that if you define it
within the M:, it's still available on the outside. It's generally
considered contrary to coding conventions to put SYMBOL: within a word
body, since it means the same thing as if it's outside of the word
body.

Dan

On Mon, Jan 12, 2009 at 9:11 AM, Ludovic Kuty  wrote:
> It looks like SYMBOL: can be used anywhere. Thus my example becomes:
>
> M: rectangle area
>SYMBOL: temp
>temp [ temp get width>> temp get height>> * ] with-variable ;
>
> And in fact "\ temp" has no meaning if temp is not defined somewhere.
> That's why "\ +" works but not "\ not_defined". The documentation for
> DEFER: states that "Due to the way the parser works, words cannot be
> referenced before they are defined".
>
> That answers my second question. However I'm not sure this is the
> correct way to express access to multiple slots.
>
> On 12 Jan 2009, at 15:55, Ludovic Kuty wrote:
>
>> I thought of doing like this:
>> SYMBOL: temp
>> M: rectangle area
>>temp [ temp get width>> temp get height>> * ] with-variable ;
>>
>> But now I have an implementation detail (the fact that temp is a
>> symbol) that is leaking out of the method body. It doesn't feel right.
>> I should be able to avoid SYMBOL and use "\ temp" but Factor curiously
>> complains: "Word not found in current vocabulary search path". The \
>> parsing word should avoid trying to execute the word. Any idea are
>> welcome.
>
>
> --
> Check out the new SourceForge.net Marketplace.
> It is the best place to buy or sell services for
> just about anything Open Source.
> http://p.sf.net/sfu/Xq1LFB
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Launch from custom image file

2009-01-10 Thread Daniel Ehrenberg
When you drag the image onto the Factor.app, it does something like
./factor file.image. So the image is treated like a Factor source
file. We want dragging to work for Factor source files, so to support
both would require some automatic way of differentiating source files
from images. It's not implemented now, because there's no easy way to
do it that always works. But we could just use the extension...

Dan

On Sat, Jan 10, 2009 at 5:59 AM, Jon Kleiser  wrote:
> Hi,
>
> I've just tried something that doesn't seem to be supported. ;-) I tried
> to launch the Factor UI by dropping an image file onto Factor.app. When I
> first tried this on my PPC Mac, I quite soon got a "Word not found..."
> message. When I tried it on my Intel Mac, however, it resulted in a huge
> amount of disk activity, both reads and writes, before I got some "Word
> not found...".
> I know about the -i=image command line switch, but I think it could be
> handy to launch the Factor UI by dropping an image file on the app.
> What could all the disk activity be?
>
> /Jon
>
>
> --
> Check out the new SourceForge.net Marketplace.
> It is the best place to buy or sell services for
> just about anything Open Source.
> http://p.sf.net/sfu/Xq1LFB
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

--
Check out the new SourceForge.net Marketplace.
It is the best place to buy or sell services for
just about anything Open Source.
http://p.sf.net/sfu/Xq1LFB
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] FAQ fixed

2009-01-05 Thread Daniel Ehrenberg
The FAQ is now on the wiki at
https://concatenative.org/wiki/view/Factor/FAQ. It looks like there
are some bugs in Farkup, that the syntax isn't recursive enough,
though.

On Sun, Jan 4, 2009 at 3:28 PM, Daniel Ehrenberg  wrote:
> Hi all,
>
> Sorry about the huge delay, but I think I've fixed the issues with the
> FAQ. If there are any outstanding problems, or if you have suggestions
> for questions, please contact me again. I'm looking into putting the
> FAQ on the concatenative.org wiki somehow, so that I'm not the only
> maintainer.
>
> Dan
>

--
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] FAQ fixed

2009-01-04 Thread Daniel Ehrenberg
Hi all,

Sorry about the huge delay, but I think I've fixed the issues with the
FAQ. If there are any outstanding problems, or if you have suggestions
for questions, please contact me again. I'm looking into putting the
FAQ on the concatenative.org wiki somehow, so that I'm not the only
maintainer.

Dan

--
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Unique object system, more info wanted

2008-12-09 Thread Daniel Ehrenberg
Oops, this is an artifact of the fact that the FAQ was originally a
blog post. I'll remove this comment soon. There is a blog post, but
it's outdated, and you should look at the docs.

On Mon, Dec 8, 2008 at 9:52 PM, Jon Kleiser <[EMAIL PROTECTED]> wrote:
> Hi,
>
> In the Factor FAQ, under Q#36, I read this: "Another cool feature is
> Factor's unique object system, which deserves a separate blog post to
> explain." Is there such a blog post somewhere?
>
> /Jon
>
>
> --
> SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
> The future of the web can't happen without you.  Join us at MIX09 to help
> pave the way to the Next Web now. Learn more and register at
> http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

--
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Classic temperature conversion constraint system

2008-12-04 Thread Daniel Ehrenberg
By the way, you could implement c->f as follows:

USE: inverse
: c->f ( c -- f ) [ f->c ] undo ;

I know it's trivial, but it's fun.

Dan

On Thu, Dec 4, 2008 at 8:53 PM, Eduardo Cavazos <[EMAIL PROTECTED]> wrote:
> Hello,
>
> Anybody who's looked into constraint based programming has run into the
> classic Fahrenheit to Celsius example.
>
> Here it is in Factor:
>
>http://paste.factorcode.org/paste?id=237
>
> That's not a vocabulary. You can just paste that into a listener. (You'll need
> the latest version from git as it uses the 'sto' vocabulary.) A window with
> the demo will appear.
>
> It demonstrates a few Factor techniques:
>
>* Programming with models
>* Gadgets which act as controls and views over models (the VC in MVC)
>* Mutually dependent models
>
> Ed
>
> -
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

--
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Bad link from FAQ to docs

2008-11-17 Thread Daniel Ehrenberg
Oops, I'll fix this.

On Mon, Nov 17, 2008 at 9:43 PM, Jon Kleiser <[EMAIL PROTECTED]> wrote:
> Hi,
>
> >From Q#65 here  there's a link to
>  that gives me a
> "404 not found".
>
> /Jon
>
>
> -
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Killer regexp

2008-10-05 Thread Daniel Ehrenberg
Easy way to implement this within an NFA->DFA framework:
When doing split on a regex, just 'and' the regular expression
together with .+ . For example, [0-9]* becomes ([0-9]*)&(.+) . DFA
minimization makes this just as efficient as [0-9]+ would have been,
which is what you really want.

Dan

On Sat, Oct 4, 2008 at 11:23 PM, Stefan Scholl <[EMAIL PROTECTED]> wrote:
> Hi Slava & Co.,
>
> Ruby and Perl do it this way:
>
>>> "sdfh923oweop23dfosdhf0sdofo".split(/[0-9]*/)
> => ["s", "d", "f", "h", "o", "w", "e", "o", "p", "d", "f", "o", "s", "d", 
> "h", "f", "s", "d", "o", "f", "o"]
>
>
> Python goes another way:
>
 re.split(r"[0-9]*", "sdfh923oweop23dfosdhf0sdofo")
> ['sdfh', 'oweop', 'dfosdhf', 'sdofo']
>
>
> Ruby and Perl split a string into the single characters when you
> just supply an empty string as pattern. Python ignores it.
>
>>> "Ruby".split("")
> => ["R", "u", "b", "y"]
>
>
 re.split("", "Python")
> ['Python']
>
>
> I guess this feature is useful in Perl, because now you can
> easily iterate over the single characters of a string. This isn't
> needed for Ruby and Python.
>
> And Factor doesn't need to split strings into single characters,
> too.
>
> I'd say the Python way would be appropriate.
>
>
> Slava Pestov <[EMAIL PROTECTED]> wrote:
>> Hi Stefan,
>>
>> The problem is that [0-9]* matches an empty string. The fact that it
>> hangs is a bug, but what should be the appropriate behavior in this
>> case?
>>
>> Slava
>>
>> On Tue, Sep 30, 2008 at 4:08 AM, Stefan Scholl <[EMAIL PROTECTED]> wrote:
>>> Just testing re-split (vocab "regexp):
>>>
>>> USE: regexp
>>> "sdfh923oweop23dfosdhf0sdofo" "[0-9]*"  re-split
>>>
>>>
>>> And now Factor hangs. Process at full 50 % (dual cores are funny).
>>>
>>>
>>> Factor build 492, Windows XP.
>>>
>>>
>>> --
>>> Web (en): http://www.no-spoon.de/ -*- Web (de): http://www.frell.de/
>>>
>>>
>>> -
>>> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
>>> Build the coolest Linux based applications with Moblin SDK & win great 
>>> prizes
>>> Grand prize is a trip for two to an Open Source event anywhere in the world
>>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>>> ___
>>> Factor-talk mailing list
>>> Factor-talk@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/factor-talk
>>>
>>
>> -
>> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
>> Build the coolest Linux based applications with Moblin SDK & win great prizes
>> Grand prize is a trip for two to an Open Source event anywhere in the world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>
>
> --
> Web (en): http://www.no-spoon.de/ -*- Web (de): http://www.frell.de/
>
>
> -
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] fry and curry

2008-08-31 Thread Daniel Ehrenberg
Well, personally, I never got used to fry. I feel comfortable using
curry and compose for most things. I don't see why it is a problem to
use them except in exceptionally complicated cases. For me, it feels
like fry is doing more than is needed. Are you suggesting that we use

{ 1 2 3 } 4 '[ , + ] map

in place of

{ 1 2 3 } 4 [ + ] curry map

? I don't understand how that is much of an improvement. I'm not sure
how to do what "with" does in terms of fry. For building complicated
quotations, it's another story. It seems like both are useful.

Dan

On Sun, Aug 31, 2008 at 4:36 AM, Slava Pestov <[EMAIL PROTECTED]> wrote:
> Hi all,
>
>
> Now that the 'fry' abstraction has been around for a while, how do people
> feel about using it? Should we generally try to phase out direct usages of
> 'curry' as much as possible, except for in the core, and use 'fry'
> everywhere else in basis and extra?
>
> Slava
>
> -
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
>

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] help for help

2008-08-20 Thread Daniel Ehrenberg
Kobi,

Would you like web space on a server running Factor to set this up? If
so, I could give that to you. Factorcode.org tends to run a somewhat
old version of Factor for stability reasons, but I'd be fine with
other kinds of arrangements. There are many, many possible statistics
to show, and I'm not sure if Slava has enough time to put them all up
there.

Dan

On Wed, Aug 20, 2008 at 1:32 PM, Kobi Lurie <[EMAIL PROTECTED]> wrote:
> hi slava and all,
> I think it would be neat to have such statistics generated dynamically
> on the website. (263/700 documented examples, click here to see the list..)
>
> Then, factor programmers would know what is needed and where to fill in,
> (aiming for clear & clean code).
> like a todo list for thoroughness.
> the same could be done whenever something becomes obsolete, or a good
> abstraction is born.
>
> (like ERROR: 's in exceptions and the "new" slot accessors, or a word
> that got a low score for idiomatic implementation, etc.)
> what are your thoughts about this?
>
> kobi
>
> Slava Pestov wrote:
>
>> Hi James,
>>
>> You're right: there are too few words with examples:
>>
>> ( scratchpad ) all-words [ word-help { $examples } collect-elements
>> empty? not ] count .
>> 263
>>
>> Adding more examples is an on-going project of mine; I'd appreciate
>> help from others too. You don't need to be an expert in Factor to
>> contribute a few examples here and there. "help" help will cover
>> enough of the help markup language to get you started.
>>
>> Slava
>>
>> On Tue, Aug 19, 2008 at 3:00 PM, James K Smith <[EMAIL PROTECTED]
>> > wrote:
>>
>> It would be great if all the documented words included corresponding
>> examples that could be run in the repl. No? I don't know Factor
>> well enough
>> to even begin to make a contribution in this regard.
>>
>> James
>>
>>
>>
>>
>> -
>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>> challenge
>> Build the coolest Linux based applications with Moblin SDK & win
>> great prizes
>> Grand prize is a trip for two to an Open Source event anywhere in
>> the world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> 
>> ___
>> Factor-talk mailing list
>> Factor-talk@lists.sourceforge.net
>> 
>> https://lists.sourceforge.net/lists/listinfo/factor-talk
>>
>>
>> 
>>
>> -
>> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
>> Build the coolest Linux based applications with Moblin SDK & win great prizes
>> Grand prize is a trip for two to an Open Source event anywhere in the world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> 
>>
>> ___
>> Factor-talk mailing list
>> Factor-talk@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/factor-talk
>>
>
>
> -
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] How should be displayed the multibyte character in factor?

2008-08-10 Thread Daniel Ehrenberg
Which input encoding are you using? Are you doing this at the command
line or in the UI? I think things only work for non-Latin alphabets
(this should change soon) if you use the terminal (./factor
-run=listener) with the UTF-8 encoding in your terminal. It might be
labeled "Unicode" rather than UTF-8.  If this doesn't work, there's
probably a bug.

Support for various Japanese encodings (ISO 2022, Shift JIS, EUC-JP)
hasn't yet been implemented, unfortunately. However, internally Factor
uses Unicode for everything. All source code read from a file is
assumed to be in UTF-8. All strings can contain any code point and the
I/O library supports several file encodings.

Dan

2008/8/10 [EMAIL PROTECTED] <[EMAIL PROTECTED]>:
> How should be displayed the multi-byte string in factor?
>
> I was not able to do though I tried.
>
> code:
> ( scratchpad ) "日本語ですよ" write
> 1: "・ス・ス・ス{・ス・ス・ス・ス・ス・スwrite
> ^
> Unterminated string
>
> Type :help for debugging help.
>
> -
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Quotations which return themselves (Quines)

2008-08-01 Thread Daniel Ehrenberg
To insert a break into a quotation, press i as you're passing over it.

On Tue, Jul 29, 2008 at 5:33 PM, Adam <[EMAIL PROTECTED]> wrote:
> Is walking a call through supposed to insert breaks into quotations?
>

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] CSV library

2008-07-30 Thread Daniel Ehrenberg
Well, threads have their own namestack, but they share the global
namespace. You can write code using only set-global and get-global
where threads wouldn't interact well, but if you use with-scope around
code that modifies variables, there should be no need to worry about
interaction between threads. There's no way to absolutely prevent
other code from using set-global on your variable, but you can make
the delimiter variable private to indicate that it shouldn't be messed
with.

Dan

On Wed, Jul 30, 2008 at 3:18 AM, Phil Dawes <[EMAIL PROTECTED]> wrote:
> Cool thanks. Just so I'm sure, does each thread have it's own complete
> namestack? E.g. so thread 'b' can't override thread 'a's delimiter at
> the root namespace halfway through a csv import?
>
> Cheers,
>
> Phil

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Naming convention for destructive operations

2008-07-25 Thread Daniel Ehrenberg
On Fri, Jul 25, 2008 at 7:02 AM, William Tanksley, Jr
<[EMAIL PROTECTED]> wrote:
> Slava Pestov <[EMAIL PROTECTED]> wrote:
>> I don't like the ! suffix because it overlaps with comments. What
>> about past tense to denote mutation?
>> suffix suffixed
>> append appended
>> reverse reversed
>> remove removed (or pluck, plucked)?
>> remove-nth removed-nth (or snip, snipped)?
>
> That won't work at all -- or rather, it's the opposite of what you
> want. That's not the simple past tense -- it's the past participle. It
> doesn't mean that the action has been performed; rather, it's an
> adjective that usually indicates a _distinct object_.
>
> For example, if you have a list and you write [list sorted] you're
> implying that there are two possible lists -- one sorted and one
> unsorted. Thus, past participle indicates duplication (i.e.
> immutability), not mutation. This is why people are getting confused
> about this proposal.
>
> One example of my usage appears in Python, where the normal list.sort
> method applies in-place, while the sorted() function produces a sorted
> copy.
>
> Now, if you want to be fancy with your grammar, using the past
> participle would be excellent for non-mutating functions.
>
> One warning: be consistent, please. Most languages fail at this (eg.
> Ruby's "!" suffix).
>
>> Slava
>
> -Wm

I second all of this, and what everyone else has been saying. If we're
going to make a language change here (which it's reasonable to delay),
it shouldn't be to something like this, and out of the things proposed
so far, I like the ! suffix the best. (The stack effect issue is
orthogonal.)

Dan

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Fry is a lubricant

2008-07-25 Thread Daniel Ehrenberg
I have the same feeling about locals and now-considered-evil stack
shufflers. All of these have some value as language features,
especially to make development easier, but it seems like
well-factored, well-written code doesn't use them all that much.

Dan

On Thu, Jul 24, 2008 at 8:58 PM, Slava Pestov <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I like fry very much, but I've noticed that most of my usages of 'fry'
> are pretty trivial, stuff like
>
> '[ , foo ]
> '[ , , foo ]
>
> Or sometimes the slightly more elaborate
>
> '[ swap , foo ]
> '[ drop , foo ]
>
> I've been trying to reconcile these two facts, and I think I've figured it 
> out.
>
> In theory, fry is sort of redundant, because most usages do not really
> take advantage of its full power.
>
> However, often when I'm writing some code, the first iteration is more
> complex than it needs to be, and in these cases, I will end up with
> more complex fry forms, stuff like
>
> '[ [ , blah ] bi@ ] 2each
>
> It seems that a lot of the time, the natural progression of the code
> simplifies it down to something with a trivial use of fry; I'll change
> a stack effect here, tweak a tuple there, and suddenly my complex
> logic evaporates and the complex fry usage along with it.
>
> But having fry there makes it easy to get the first iteration going,
> and to gradually refactor it later, rather than spending time up-front
> writing complex stack shuffling that I know I won't need anyway. So
> very often fry acts as a 'programming lubricant' without actually
> impacting the final code. This is pretty interesting, I think.
>
> Just wanted to share this thought...
>
> Slava
>
> -
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Speeding up loads?

2008-07-20 Thread Daniel Ehrenberg
If you don't want this to take a long time when starting Factor up,
you can also save your image once you've loaded the libraries you
want. You can do this with the "save" word.

Dan

On Sun, Jul 20, 2008 at 3:55 PM, Eduardo Cavazos <[EMAIL PROTECTED]> wrote:
> Glenn Tarcea wrote:
>
>> When I load libraries out of extra it takes forever for the load to
>> complete. Is there a way to precompile the files and speed up the
>> load times on these?
>
> Hello,
>
> You can add a line like this:
>
>USING: vocab-a vocab-b vocab-c ... ;
>
> to your "~/.factor-boot-rc" where each vocab is one which you'd like to have
> saved as part of your image after bootstrap. So if you notice some
> vocabularies which take a particularly long time to load, you can put them in
> there. To take this to the extreme and load everything, put this
> in "~/.factor-boot-rc":
>
>load-everything
>
> Ed
>
> -
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] fry in inverse

2008-07-06 Thread Daniel Ehrenberg
Feel free to change this if you care about it. I don't mind the old
version of this enough to change it myself.

Dan

On Sun, Jul 6, 2008 at 10:37 AM, Eduardo Cavazos <[EMAIL PROTECTED]> wrote:
> Dan,
>
> I spotted a place in 'inverse' where fry can be used nicely:
>
> : recover-chain ( seq -- quot )
>[ no-match ] [ swap \ recover-fail 3array >quotation ] reduce ;
>
> : recover-chain ( seq -- quot )
>[ no-match ] [ swap '[ , , recover-fail ] ] reduce ;
>
> Ed
>
> -
> Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
> Studies have shown that voting for your favorite open source project,
> along with a healthy diet, reduces your potential for chronic lameness
> and boredom. Vote Now at http://www.sourceforge.net/community/cca08
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

-
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Modifying the current namespace from change monitor code

2008-06-26 Thread Daniel Ehrenberg
I don't understand this example. What does C[ ] do? Does it package up
the quotation with the dynamic scope or something?

Dan

On Thu, Jun 26, 2008 at 8:33 AM, Eduardo Cavazos <[EMAIL PROTECTED]> wrote:
> Hello,
>
> This example is a notable use of fry; it would be awkward without it.
>
> I wanted to monitor a directory and update some variables in the current
> namespace upon changes made to the directory or it's contents.
>
> The help for 'with-monitors' mentions that the quot is run inside a new scope.
> This signals to me that I need to turn my quot into a namespace closure
> (vocab: rewrite-closures).
>
> In this example, I'll increment the value of a variable 'a' when changes to a
> directory "/tmp/test-dir-105" are made.
>
> Here's some setup:
>
> --
> USING: threads io.monitors rewrite-closures fry ;
>
> SYMBOL: a
>
> 0 a set
>
> : action ( monitor -- monitor )
>  [ next-change 2drop a get 1 + a set ] [ action ] bi ;
> --
>
> The code to start monitoring often resembles something like this:
>
>[
>  [ "/tmp/test-dir-105" t  action ] with-monitors
>]
>  in-thread
>
> The problem there is that 'action' is run in the scope provided
> by 'with-monitors'.
>
> Here's an attempt:
>
>C[ "/tmp/test-dir-105" t  action ]
>
>[ with-monitors ] curry in-thread
>
> Now the 'action' is inside a quot closed over the current namespace, but this
> still doesn't work. The problem is that '' needs to be run in the
> namespace provided by 'with-monitors'.
>
> So finally, we have this:
>
>C[ action ]
>  '[
> [ "/tmp/test-dir-105" t  , call ] with-monitors
>   ]
>in-thread
>
> This does the job and depends on fry's ability to embed items into nested
> quotations.
>
> Ed
>
> -
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] microsecond precision timer

2008-06-24 Thread Daniel Ehrenberg
I'm wondering, is it possible to do this without adding a primitive,
just using the FFI as in your example? You could use hooks for proper
cross-platform behavior.

Dan

On Tue, Jun 24, 2008 at 1:59 AM, Phil Dawes <[EMAIL PROTECTED]> wrote:
> Hi Factor List,
>
> I've been doing some code profiling that requires a microsecond timer
> (measuring the accumulated time spent in words that take less than a
> millisecond for each invocation). To handle this on my 32bit linux box I
> used the following:
>
> FUNCTION: int gettimeofday ( void* TP, void* TZP ) ;
>
> : micros ( -- n )
>   8  dup f gettimeofday drop 2 c-ulong-array> first2
>   [ 100 * ] dip + ;
>
> ...which obviously isn't portable. Looking at the source in os_unix.c
> and os_windows*.c it looks like the timers on all the platforms are of
> microsecond precision so I was wondering whether there was any objection
> to me putting a 'micros' primitive in the vm?
>
> (Actually I'm guessing that probably I don't know what I'm talking about
> and that there's a good reason why only 'millis' exists in factor)
>
> Cheers,
>
> Phil
>
>
>
> -
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] help help

2008-06-10 Thread Daniel Ehrenberg
For up-to-date docs, you're best off looking at the Factor
distribution itself, which has a documentation browser. There's no way
to output this as something printable right now (though it might be a
fun project to try to fix this!). At this point I'm not sure if it'd
be a good idea to print out the docs, as the library is not guaranteed
to be stable across versions until we get to version 1.0.

Dan

On Tue, Jun 10, 2008 at 3:10 PM, James Smith <[EMAIL PROTECTED]> wrote:
> I suspect the web docs aren't too up to date. Additionally, a docs or
> cookbook pdf would really be helpful. Will I have to crawl the pages, or is
> there something more printable already extant?
>
> Thanks,
> James
>
>
>
>
> -
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] stack reshape notation

2008-06-10 Thread Daniel Ehrenberg
William, for another way of doing shuffles, look at extra/shufflers.
If Ed's proposal were implemented, it could just be another "skin" on
top of the same framework.

Dan

On Tue, Jun 10, 2008 at 11:11 AM, William Tanksley, Jr
<[EMAIL PROTECTED]> wrote:
> Eduardo Cavazos <[EMAIL PROTECTED]> wrote:
>> I messed around with a stack reshaping notation a few days ago. There are 
>> four
>> forms:
>>v[...]  drop
>><[...]  rotate left
>>>[...]  rotate right
>>^[...]  pick
>
> I have very little credible neutrality on this issue, since I've
> designed a few shuffles myself, but a couple of points:
>
> 1. Nice! I'm glad to see that Factor can do shuffles. I had thought it
> was impossible.
> 2. Huh? I don't get this notation at all. Why 4 distinct dialects?
> 3. Why all the different punctuation marks?
>
> -Wm
>
> -
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] onigirihouse users

2008-05-31 Thread Daniel Ehrenberg
If you're still using Onigirihouse, ask me for a Factorforge account.

On Sat, May 31, 2008 at 4:09 PM, Matthew Willis <[EMAIL PROTECTED]> wrote:
> Are any of you still using your homes and factor repositories on
> onigirihouse.com?
>
> I think most people have moved on to other setups, so I'd like to
> reclaim the box for my own use.
>
> Please let me know if you need any files from there.
>
> Thanks!
> Matt
>
>
> -
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] Library audit: A proposal

2008-05-31 Thread Daniel Ehrenberg
Hi all,

So, hopefully, we can get Factor 1.0 done this year. This was my goal
in an unofficial (but no one objected to it yet) roadmap, to have
Factor done by December 31. If this still seems reasonable, we need to
make sure that the standard library is as good as we want it to be.
Regardless of the possible inclusion of new vocab roots, it seems to
me that just about every vocabulary should have (1) Documentation (2)
Unit tests (3) Metadata. Maybe (4) Clean code should be added to that
list, but it's less essential. Assembling this isn't a fun task, but I
think we need an audit of extra/.

Proposal: Give every vocabulary in extra the tag "unaudited". The
person who wrote that vocab will have the responsibility of adding
appropriate documentation, unit tests and metadata within 2 months. If
that person doesn't provide those things, then we'll divide up the
remaining vocabs among people who volunteer to audit the remaining
ones within a month or so. Good Samaritans can start auditing others'
libraries earlier, though. If we start now on a schedule that's
something like this, then everything can be audited by September.

I call this an "audit" because I think there are lots of vocabs that
people (or at least me) have written, failed to write appropriate
tests and docs, and then just forgotten about. I think the audit just
has to be of extra/ because core/ seems to be mostly appropriately
documented, tested and tagged at this point. I think it's appropriate
to do something like now, even though not all of the language features
are done, because the process of updating code for the language
features should go smoothly and orthogonally to this, and users
haven't been expected to update their own code for most language
features. (Incidentally, the audit might also include changing code to
use new-slots and no delegation, if those aren't already done by that
time.)

What do you think of this idea?

Dan

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Interesting use of 'fry'

2008-04-22 Thread Daniel Ehrenberg

Well, you could do this minor factoring, if you find it hard to
imagine how to improve your code further...

: render-plain-list ( seq component quot -- )
'[ , component>> renderer>> @ ] each ; inline

: render-li-list ( seq quot component -- )
'[  @  ] render-plain-list ; inline

: render-ordered-list ( seq quot component -- )
 render-li-list  ; inline

: render-unordered-list ( seq quot component -- )
 render-li-list  ; inline

(OK, I guess I'm out of excuses to procrastinate on homework now. Bye)

Dan


On Tue, Apr 22, 2008 at 6:59 PM, Slava Pestov <[EMAIL PROTECTED]> wrote:
> Hi all,
>
>  I'm working on the web framework and came up with this:
>
>  : render-plain-list ( seq component quot -- )
>  '[ , component>> renderer>> @ ] each ; inline
>
>  : render-ordered-list ( seq quot component -- )
>   '[  @  ] render-plain-list  ; inline
>
>  : render-unordered-list ( seq quot component -- )
>   '[  @  ] render-plain-list  ; inline
>
>  : render-list ( value renderer quot -- )
>  over type>> {
>  { +plain+ [ render-plain-list ] }
>  { +ordered+   [ render-ordered-list ] }
>  { +unordered+ [ render-unordered-list ] }
>  } case ; inline
>
>  M: list-renderer render-view*
>  [ render-view* ] render-list ;
>
>  M: list-renderer render-summary*
>  [ render-summary* ] render-list ;
>
>  I think this is a pretty nice use-case for 'fry' and its hard to
>  imagine how this code could be improved further.
>
>  Slava
>
>  -
>  This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
>  Don't miss this year's exciting event. There's still time to save $100.
>  Use priority code J8TL2D2.
>  
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
>  ___
>  Factor-talk mailing list
>  Factor-talk@lists.sourceforge.net
>  https://lists.sourceforge.net/lists/listinfo/factor-talk
>

-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Assorted Questions

2008-04-15 Thread Daniel Ehrenberg
Mine is factorforge.org. I made it not because there was anything
wrong with onigirihouse but just because I can't hand out accounts
there. So just tell me when you're ready to get started.

Dan

On Tue, Apr 15, 2008 at 2:53 AM, Nikhil Marathe <[EMAIL PROTECTED]> wrote:
>
>
> On Tue, Apr 15, 2008 at 2:18 AM, Daniel Ehrenberg <[EMAIL PROTECTED]>
> wrote:
> > Kikhil,
> >
> > If you want, I can set up an account for you on a server I have. Using
> > a real version control system like git instead of throwing around
> > patch files is better because (1) it highlights conflicts from
> > concurrent changes (2) it's easier for people to pull your patches.
> > Interested? If so, I'll help you get set up.
> >
> > Dan
> >
>
> First I'll just get comfortable on a local server and pull the master
> branch.
> But I'll let you know if I need an account. BTW is onigirihouse.com yours?
>
> Thanks a lot!
>
> Nikhil
>
> -
>  This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
>  Don't miss this year's exciting event. There's still time to save $100.
>  Use priority code J8TL2D2.
>
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
> ___
>  Factor-talk mailing list
>  Factor-talk@lists.sourceforge.net
>  https://lists.sourceforge.net/lists/listinfo/factor-talk
>
>

-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Assorted Questions

2008-04-14 Thread Daniel Ehrenberg
err, oops, Nikhil

On Mon, Apr 14, 2008 at 3:48 PM, Daniel Ehrenberg <[EMAIL PROTECTED]> wrote:
> Kikhil,
>
>  If you want, I can set up an account for you on a server I have. Using
>  a real version control system like git instead of throwing around
>  patch files is better because (1) it highlights conflicts from
>  concurrent changes (2) it's easier for people to pull your patches.
>  Interested? If so, I'll help you get set up.
>
>  Dan
>
>
>
>  On Mon, Apr 14, 2008 at 2:56 AM, Nikhil Marathe <[EMAIL PROTECTED]> wrote:
>  > Hi,
>  > Here are my questions
>  >
>  > 1. What is the size of Factor's git master? Because pulling a large one
>  > isn't possible for me
>  >
>  > 2. Is a full master copy needed to make changes to certain files and merge
>  > them.
>  >
>  > 3. If I'm not so comfortable with git, can I send patches to some developer
>  > who can merge them ( if they are accepted of course )
>  >
>  > Thanks,
>  > Nikhil
>  >
>  > --
>  > 
>  >  http://22bits.exofire.net/
>  > 
>
>
> > -
>  >  This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
>  >  Don't miss this year's exciting event. There's still time to save $100.
>  >  Use priority code J8TL2D2.
>  >
>  > 
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
>  > ___
>  >  Factor-talk mailing list
>  >  Factor-talk@lists.sourceforge.net
>  >  https://lists.sourceforge.net/lists/listinfo/factor-talk
>  >
>  >
>

-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Assorted Questions

2008-04-14 Thread Daniel Ehrenberg
Kikhil,

If you want, I can set up an account for you on a server I have. Using
a real version control system like git instead of throwing around
patch files is better because (1) it highlights conflicts from
concurrent changes (2) it's easier for people to pull your patches.
Interested? If so, I'll help you get set up.

Dan

On Mon, Apr 14, 2008 at 2:56 AM, Nikhil Marathe <[EMAIL PROTECTED]> wrote:
> Hi,
> Here are my questions
>
> 1. What is the size of Factor's git master? Because pulling a large one
> isn't possible for me
>
> 2. Is a full master copy needed to make changes to certain files and merge
> them.
>
> 3. If I'm not so comfortable with git, can I send patches to some developer
> who can merge them ( if they are accepted of course )
>
> Thanks,
> Nikhil
>
> --
> 
>  http://22bits.exofire.net/
> 
> -
>  This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
>  Don't miss this year's exciting event. There's still time to save $100.
>  Use priority code J8TL2D2.
>
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
> ___
>  Factor-talk mailing list
>  Factor-talk@lists.sourceforge.net
>  https://lists.sourceforge.net/lists/listinfo/factor-talk
>
>

-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Bye Bye Tiger, Tiger Bye Bye

2008-04-13 Thread Daniel Ehrenberg
John,

A decision to keep backwards compatibility is not as simple as keeping
the current code existing. What's there now is actually subtly broken.
Most significantly, it doesn't work with categories at all. The design
works like this: a class is queried to provide a list of methods, and
those methods have their signatures read (method signatures determine
not just the arity but also the types of arguments, which might not
all be id) and method stubs are made. I'm redesigning it to not load
classes in that way, rather to look up the methods based on their
usage in Factor code, but I have to use different introspective
techniques. For that, I can either use the ObjC 1.0 or 2.0 API;
they're mutually incompatible. It makes sense to use ObjC 2.0 just
because it's the only one Apple has implemented on 64-bit processors.
The ObjC 2.0 API is just plain better in a bunch of ways. It means,
for one, that we won't have to rely on undocumented implementation
details to read the return type of a method. Maintaining backwards
compatibility will take a little work, but if it'll get used then I'll
make it an eventual goal of mine. I originally said it wouldn't be
backwards compatible because, among all Mac developers I know, the
consensus was that it wasn't necessary.

Of course, I don't know when I'll have much free time to do all
this... it's not extremely high on my priority list, since the main
problems with the current system surface infrequently (we can't do
macosx-x86-64 with the UI, and categories are broken). Hopefully
within a year, though.

Dan

On Sun, Apr 13, 2008 at 6:30 PM, John Pallister <[EMAIL PROTECTED]> wrote:
>  Yes, but an application developer choosing to limit her
>  market by relying on a particular new API for a specific
>  product is one thing; if Factor only runs on Leopard, that
>  would seem to limit the developer's options before she even
>  starts.
>
>  But you're right, I was thinking of Vista when I wrote my
>  message; I shouldn't tar Leopard with that particular brush.
>
>  Anyway, I don't want to belabour the point any further.
>
>  Although it did occur to me that this concern for the
>  adequacy of aging hardware could be related to the fact that
>  I turn 37 next month. ;)
>
>
>  > For now there's no reason not to support Tiger, so let's fix the bug.
>  > :)  For the long term, it looks like you can get about $200 for the
>  > Pismo on ebay, and put it toward a shiny new MacBook!
>
>  Oh, my next laptop will definitely be a MacBook Pro...
>
>  Cheers,
>
>  John :^P
>
> --
>  John Pallister
>  [EMAIL PROTECTED]
>
>
>  -
>
>
> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
>  Don't miss this year's exciting event. There's still time to save $100.
>  Use priority code J8TL2D2.
>  
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
>  ___
>  Factor-talk mailing list
>  Factor-talk@lists.sourceforge.net
>  https://lists.sourceforge.net/lists/listinfo/factor-talk
>

-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] collect-until

2008-04-08 Thread Daniel Ehrenberg
Nikhil,

Want to host a git repository yourself? If you do, you could add this
into sequences.lib immediately, and then others can pull from you. I
can provide hosting for you, through factorforge.org, if you'd like.

Dan

On Tue, Apr 8, 2008 at 12:19 PM, Nikhil Marathe <[EMAIL PROTECTED]> wrote:
> This is a wrapper over find, to do something like this
>
> for elem in seq:
>   if(   ! fn ( elem ) ) break
>   else newseq.append(elem)
>
> : collect-until ( seq quot -- seq )
> ! calls quot on each element, if it returns false, stops
>  ! and returns sequence from beginning to that point ( exclusive )
>
> [ not ] compose ! this is because find is weird ( according to me )
> dupd find drop dup [ head ] [ 2drop f ] if ;
>
> I'm using 0.91 stable so something like this might already be in the git
> repository.
>  If its not, and if everyone is satisfied with it, maybe it could be put
> in...
>
> Cheers,
> Nikhil
>
> --
> 
> http://22bits.exofire.net/
>  
> -
>  This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
>  Register now and save $200. Hurry, offer ends at 11:59 p.m.,
>  Monday, April 7! Use priority code J8TLD2.
>
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
> ___
>  Factor-talk mailing list
>  Factor-talk@lists.sourceforge.net
>  https://lists.sourceforge.net/lists/listinfo/factor-talk
>
>

-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Register now and save $200. Hurry, offer ends at 11:59 p.m., 
Monday, April 7! Use priority code J8TLD2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Factor-way locals

2008-04-07 Thread Daniel Ehrenberg
Well, for *zero* runtime overhead it's not possible without hacking
the compiler, but in less than 20 lines I think it's possible to make
a large-enough fixed-size stack with memory protection for overflow
which doesn't depend on dynamically scoped variable lookup. (Well,
what I'm thinking of wouldn't work well with continuations, but they
can be redefined.) However, this is not all that useful in general.
For one, if it's used for locals, then they're effectively dynamically
scoped, causing the funarg problem all over again. Additionally, if
they're going to have the same optimizations as >r and r>, then all
use of them must be balanced, so it would do nothing more than >r and
r> already do. In writing code in Factor, I've never encountered a
problem where >r and r> were too awkward to express what I wanted to
express, and I'm not sure what kinds of idioms would effectively take
advantage of this ability.

It's definitely an upside of locals that they have no runtime cost at
all, but the more important (and broader, easier) goal was that they
can be used with the optimizing compiler. Mutable locals do have a
runtime cost, though they can still be used with the optimizing
compiler.

Dan

On Mon, Apr 7, 2008 at 12:40 PM, Maxim Savtchenko <[EMAIL PROTECTED]> wrote:
> I thought, one of main ideas behind extra/locals is zero overhead in
>  run-time. Additional retain stacks in general form will be useful only
>  with optimizing compiler support. ">mystack" and "mystack>" should be
>  just as effective as ">r" and "r>". Is it possible with six lines of
>  code without special language features?

-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Register now and save $200. Hurry, offer ends at 11:59 p.m., 
Monday, April 7! Use priority code J8TLD2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Factor-way locals

2008-04-07 Thread Daniel Ehrenberg
On Mon, Apr 7, 2008 at 3:23 AM, janko metelko <[EMAIL PROTECTED]> wrote:
> I was proposing this on irc too... multiple retain stacks that you can
> create and name on your own. And then also important is that stacks would
> have not just push, pop functionality but also peek (so that value stays on
> stack)
>
> but I don't like your syntax that much, why would you have to define them
> and use some structure (block) where there I don't see the need for it.
>
> >people (could silently create and PUSH on them if they aren't yet created,
> or a special syntax could be made for this to be)
>
> people> (POP)
>
> people|> or people (or something else for PEEK)
>
> best regards,
> janko

In the XML parser I wrote, I use an explicit stack, but it doesn't
require any special language features. In a dynamically scoped
variable, I hold a vector that can be pushed to, and I have words
defined (push-xml and pop-xml) that manipulate this stack. The whole
thing is either three or six lines of code, depending how you count.
It could be abstracted into some kind of declaration STACK:, but
doesn't require any special language features.

Dan

-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Register now and save $200. Hurry, offer ends at 11:59 p.m., 
Monday, April 7! Use priority code J8TLD2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Factor-way locals

2008-04-07 Thread Daniel Ehrenberg
In Factor right now, :bind is :: and it works exactly the same way.
bind doesn't exist, as it's unclear how it'd work parsing-wise (how do
you parse [ a b c d ] unless they're declared beforehand somewhere?),
but a similar construction exists: 1 2 3 4 [| a b c d | a b + c d + +
] call

Dan

On Mon, Apr 7, 2008 at 4:10 AM, Victor M. <[EMAIL PROTECTED]> wrote:
> I think that a function like bind could be more intersting. Something like:
>
> 1 2 3 4 [ a b c d ] [ a b + c d + + ] bind
>
> The function will automatically create local variables (local only on the
> second seq) using the values from the stack.
>
> And in a more advanced version it can be used to create functions with
> parameters:
>
> :bind sum-of-4-numbers ( a b c d -- x ) a b + c d + + ;
>
>
> On Mon, Apr 7, 2008 at 10:23 AM, janko metelko <[EMAIL PROTECTED]> wrote:
>
> > I was proposing this on irc too... multiple retain stacks that you can
> create and name on your own. And then also important is that stacks would
> have not just push, pop functionality but also peek (so that value stays on
> stack)
> >
> > but I don't like your syntax that much, why would you have to define them
> and use some structure (block) where there I don't see the need for it.
> >
> > >people (could silently create and PUSH on them if they aren't yet
> created, or a special syntax could be made for this to be)
> >
> > people> (POP)
> >
> > people|> or people (or something else for PEEK)
> >
> > best regards,
> > janko
> >
> >
> >
> >
> >
> > On Sun, Apr 6, 2008 at 11:41 PM, Maxim Savtchenko <[EMAIL PROTECTED]>
> wrote:
> >
> > > I have mixed feelings about extra/locals library. It is good to have
> > > local named storage, but current design of extra/locals looks very
> > > "lispish" (FP-style immutable variables). I think, there is a way to
> > > make it closer to Factor stack-shuffling paradigm. So I have a
> > > suggestion. What if we can use not local variables, but local
> > > additional retain stacks, just like ">r" and "r>"? Let me show you
> > > this concept on example from recent Slava's blog-post:
> > >
> > > :: julian-day-number>date ( n -- year month day )
> > >#! Inverse of julian-day-number
> > >[let* | a [ n 32044 + ]
> > >b [ 4 a * 3 + 146097 /i ]
> > >c [ a 146097 b * 4 /i - ]
> > >d [ 4 c * 3 + 1461 /i ]
> > >e [ c 1461 d * 4 /i - ]
> > >m [ 5 e * 2 + 153 /i ] |
> > >100 b * d + 4800 -
> > >m 10 /i + m 3 +
> > >12 m 10 /i * -
> > >e 153 m * 2 + 5 /i - 1+
> > >] ;
> > >
> > > This is how it looks with lisp-style locals. And here is my suggestion:
> > >
> > > : julian-day-number>date ( n -- year month day )
> > >#! Inverse of julian-day-number
> > >[rest n a b c d e f | >n
> > >n 32044 + >a
> > >4 a * 3 + 146097 /i >b
> > >a 146097 b * 4 /i - >c
> > >4 c * 3 + 1461 /i >d
> > >c 1461 d * 4 /i - >e
> > >5 e * 2 + 153 /i >m
> > >100 b * d + 4800 -
> > >m 10 /i + m 3 +
> > >12 m 10 /i * -
> > >e 153 m * 2 + 5 /i - 1+
> > >] ;
> > >
> > > "[rest" - is fo REtain STacks. It creates additional local stacks with
> > > accessors to them. Each stack ("x" for example) have three accessors.
> > > Traditional ">x" and "x>" with semantics of ">r" and "r>". And
> > > abbreviation "x" with semantics of "x> dup >x". At the end of "[rest
> > > ... ]" block remaining values on additional stacks are simply
> > > dismissed. Looks good for me.
> > >
> > > This raises major question. Is it possible to compile efficient code
> > > with more than one retain stack?
> > >
> > > Maxim Savchenko.
> > >
> > >
> -
> > > This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
> > > Register now and save $200. Hurry, offer ends at 11:59 p.m.,
> > > Monday, April 7! Use priority code J8TLD2.
> > >
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
> > > ___
> > > Factor-talk mailing list
> > > Factor-talk@lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/factor-talk
> > >
> >
> >
> > -
> > This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
> > Register now and save $200. Hurry, offer ends at 11:59 p.m.,
> > Monday, April 7! Use priority code J8TLD2.
> >
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
> > ___
> > Factor-talk mailing list
> > Factor-talk@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/factor-talk
> >
> >
>
>
>
> --
> float e,a,b,c,d;int i;main(){for(b=0;b<4;b
> +=.091){for(a=0;a<4;a+=.051){c=0;d=0;for(i
> =99;--i&&c*c+d*d<4;)e=c*c-d*d+a-2,d=2*c*d+
> b-2,c=e;putchar(". ·*%#"[i&5]);}puts("");}}
>
> ---

  1   2   3   >