Live data from Hacker News

Factor 0.96 now available – over 1,100 commits

re-factor.blogspot.com

41–50 of 67 posts

Re: Factor 0.96 now available – over 1,100 commits

#41
post #8

Is there a HelloWorld example I can try?

"hello world" print ...although, more realistically, you're probably interested in something like the gettings started section of the docs [1]. There are also some great short example posts on the planet feed [2] from various blogs. EDIT: I'll plug my own blog for this too, as I started writing a Beginning Factor series of posts a long time ago [3], but never got beyond a couple entries. [1] http://docs.factorcode.or…

Hey Aaron,

From your second article[1] introducing Factor

"Next time we’ll stick with a theme of “flow” and discuss control flow for your words and after that, the typical work flow when developing code with Factor. Hope you enjoyed this installment!"

I am still waiting for that article. Your introductions to Factor are awesome and more would be delightful.

[1] http://elasticdog.com/2008/12/beginning-factor-shufflers-and...

Re: Factor 0.96 now available – over 1,100 commits

#42

I must say, that the syntax and semantics are not intuitive at all. I've spent half an hour trying to learn how does this thing work, and have not been able to. I guess, a damn good tutorial is in order. I think one of the primary reasons Python took off really well, was because of very good tutorials available. The language of Factor's documentation is still only tuned for language designers, not language users.

It has nothing to do with python being particularly intuitive and everything to do with it being very similar to every other imperative language you already know. If your first language was forth or PS you'd find factor intuitive too.

Re: Factor 0.96 now available – over 1,100 commits

#43
post #29

For those looking for "Why Factor" material you might like to look at some of Manfred von Thun's writings on the Joy programming language [1]. Joy is similar to Factor and Manfred wrote a lot of theory on the "why" of concatenative programming languages. [1] http://www.latrobe.edu.au/humanities/research/research-proje...

Or "Why Factor?": http://concatenative.org/wiki/view/Factor/FAQ/Why%3F

Re: Factor 0.96 now available – over 1,100 commits

#44
Having been a long-time user of HP series of calculators (HP48g, HP50g), postfix notation is not foreign to me. So I tried Factor, and gave up on it for several reasons.

First, there were obligatory stack effect declarations on each word. Want to refactor your program? Sure, rewrite your words, together with stack effect declarations. That part was extremely annoying when it came to exploratory programming. For the uninitiated: stack effect declarations are akin to function prototypes in C, only lacking type information. IMO, once you have them, and they're obligatory, you get all the drawbacks of postfix languages, and no benefits.

Second, the language and standard library rely heavily on stack combinators. Reading the standard library code requires intimate familiarity of what words like bi, bi@ and bi* do (among a whole lot of others).

Third, I find Factor's documentation extremely confusing. For example, there are "Vocabulary index" and "Libraries" sections, with little or no overlap between them. But vocabulary is a library (or package, whatever, same thing), so WTF?!

Then there are important and powerful features like generic words, but if you click on the "Language reference" link on the docs homepage, you get a menu with no mention of generics, and you have little clue in which section to look for them. (It's under objects.) Then you eventually find out (sorry, I was unable to dig up reference to the docs) that generics support only single dispatch, and only "math" generics (plus, minus, etc.) support double dispatch.

In short, the manual is a maze of cross-references with no head or tail.

Fourth, I dislike writing control structures in postfix. This is the part that, IMO, RPL on HP's calculators got right. Instead of forcing you to write something like

    10
    "Less than 10"
    "Greater than 10"
    [ 
you could write

    IF 10 
(Postfix conditionals were available for the rare cases where they were the most convenient form.)

Last but not least, it supports only cooperative threads.

Re: Factor 0.96 now available – over 1,100 commits

#45
post #44

Having been a long-time user of HP series of calculators (HP48g, HP50g), postfix notation is not foreign to me. So I tried Factor, and gave up on it for several reasons. First, there were obligatory stack effect declarations on each word. Want to refactor your program? Sure, rewrite your words, together with stack effect declarations. That part was extremely annoying when it came to exploratory programming. For the u…

You wouldn't write a conditional like that, you'd do:

    10 
This is pretty easy to read. If the boolean condition is true, run the first quotation, if it is false, run the second.

The unusual names lke 'dip', 'bi', etc are just common names that once learned make code easier to read. 'dip' is from Joy IIRC.

I do agree that combinator heaviness can make things difficult for a beginner. Especially if code uses a combinator that isn't common it requires time to look up and see what it does. You really need to immerse in Factor development for a while to get familiar with them.

Stack effect declarations exist to make refactoring safer. Prior to having them enforced by the compiler it was common to change a words stack effect only to find it broke random code using it elsewhere. Making the check enforced provided a safety check that you hadn't forgotten to change word usage elsewhere.

Re: Factor 0.96 now available – over 1,100 commits

#46
post #45
post #44

Having been a long-time user of HP series of calculators (HP48g, HP50g), postfix notation is not foreign to me. So I tried Factor, and gave up on it for several reasons. First, there were obligatory stack effect declarations on each word. Want to refactor your program? Sure, rewrite your words, together with stack effect declarations. That part was extremely annoying when it came to exploratory programming. For the u…

You wouldn't write a conditional like that, you'd do: 10 This is pretty easy to read. If the boolean condition is true, run the first quotation, if it is false, run the second. The unusual names lke 'dip', 'bi', etc are just common names that once learned make code easier to read. 'dip' is from Joy IIRC. I do agree that combinator heaviness can make things difficult for a beginner. Especially if code uses a combinato…

Oh, I've mixed up order of arguments to if.

The refactoring problem could have been solved in a more practical way (though more difficult implementation-wise) by implicit versioning of symbol definitions. Plus, I find that stack effect declarations read like line noise (see for example the declaration for if; IIRC from browsing the docs it's one of the moderately bad ones.)

Re: Factor 0.96 now available – over 1,100 commits

#47
post #42

I must say, that the syntax and semantics are not intuitive at all. I've spent half an hour trying to learn how does this thing work, and have not been able to. I guess, a damn good tutorial is in order. I think one of the primary reasons Python took off really well, was because of very good tutorials available. The language of Factor's documentation is still only tuned for language designers, not language users.

It has nothing to do with python being particularly intuitive and everything to do with it being very similar to every other imperative language you already know. If your first language was forth or PS you'd find factor intuitive too.

Postscript was around my 9th language[1] and I find Factor pretty easy to read. I might be a special case as I hate reading Python and every time I try an S-expr language I really never get the hang of it.

Thinking about Python, looks wise it is kind of the opposite of any of the stack languages. I get the feeling that you can like one or the other.

1) various 8-bit BASICs, 6502 ASM, Modula-2, 370 ASM, C, Ada, foxbase, SQL, Postscript, Forth, Objective-C (weird listing it out)

Re: Factor 0.96 now available – over 1,100 commits

#48
post #42

Earlier quoted context omitted.

It has nothing to do with python being particularly intuitive and everything to do with it being very similar to every other imperative language you already know. If your first language was forth or PS you'd find factor intuitive too.

Postscript was around my 9th language[1] and I find Factor pretty easy to read. I might be a special case as I hate reading Python and every time I try an S-expr language I really never get the hang of it. Thinking about Python, looks wise it is kind of the opposite of any of the stack languages. I get the feeling that you can like one or the other. 1) various 8-bit BASICs, 6502 ASM, Modula-2, 370 ASM, C, Ada, foxbas…

I started with C++ and thought I was just good at picking up languages because I picked up Java and Python in a day or two. Then I realized it was because they were so similar. When I learned Common Lisp I had to do some real work even though ny then I had been programming for 7-8 years.

Re: Factor 0.96 now available – over 1,100 commits

#49
post #34

Earlier quoted context omitted.

Reverse polish notation means you have to start reading from the end of the expression: "hello world" print This is also why ternary expressions in C like languages is hard to read.

I find the ternary expressions very easy to read and understand and never understood why others find it difficult at all. I see no semantical difference between if(expr1) expr2 else expr3; and expr1 ? expr2 : expr3; Okay you need to learn the syntax, but it should be second nature after a few times. I also think the question mark is very intuitive.

If it was that simple, people wouldn't have any issue with the conditional operator. The problem is there actually is a semantic difference between the two lines you wrote in most languages.

If-Then-Else is a statement. It doesn't return a value. It's just a branching operation between the two blocks.

The conditional operator is an expression. It returns a value hence it has a type. And that's where things start to be messy. Typing rules for the conditional operator are, well, not trivial and varie from language to language. Let's use an exemple from Java Puzzlers (Joshua Bloch and Neal Gafter) :

char x = 'X'; int i = 0; System.out.print(true ? x : 0); System.out.print(false ? i : x);

will print X88 but the same thing in C++

        char x = 'X';
        int i = 0;
        cout 
will print 8888.

And I am not even talking about the priority mess when you try to use a conditional operator in a conditional operator.

Re: Factor 0.96 now available – over 1,100 commits

#50
post #27

Earlier quoted context omitted.

Factor used to run on ARM [1]. Back then Windows Mobile only had 64MB of ram and it wasn't quite enough to do anything useful in Factor. I used to run a video sharing website written in Factor [2], sadly the server crashed a few weeks ago and I haven't recovered the data from the disk yet. Factor feels more like a Scheme than a Forth to me when programming. [1] http://web.archive.org/web/20111117015025/http://www.blu…

Woah thanks for that link, there could be some assembly worth salvaging there. Currently working on an ARM forth-idea with some scheme-ideas. There's this nagging intuition I have that there's a symbiosis between Lisp atom/Forth word and S-expression/Forth dictionary. I have to get something going pretty quickly so I can't get too pure about the idea, as I don't want to get bogged down in the necessary GC yet. Thanks…

Isn't Factor (at some level of abstraction) basically Lisp/Scheme with more minimal syntax? It replaces prefix notation and parentheses with postfix notation and a stack. All the benefits Lisps get from minimal syntax, Factor gets too.
Post reply on HN