Live data from Hacker News

Factor 0.96 now available – over 1,100 commits

re-factor.blogspot.com

31–40 of 67 posts

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

#31

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.

Concatenative language syntax is actually pretty easy at the basic level. I don't know Factor, but I used to dabble a lot in Forth. The single syntactical rule with Forth is that a symbol (called a "word") is one or more non-space characters, delimited by spaces. So the following three things are all words: SWAP ." -1

Next, there's the idea of the stack. Every word is executed, one after the other, and the words operate on the stack. So the four-word sequence 3 4 + . puts a 3 on the stack, then puts a 4 on the stack, then pops the top two numbers from the stack and puts their sum on the stack, then prints the top number on the stack. So the result, naturally, is 11. (Well, it is if you're operating in base 6 at the time. Didn't want to make it TOO easy for you!)

Oh, and there's also the concept of interpreting vs compiling. The colon word, which is spelled :, reads the very next word from the input and begins the definition of that word. Every word it encounters up to the next semi-colon is compiled, not executed. So if I did this

    3 4 + : FOO SWAP DROP ; .
... it would still print out the sum of 3 and 4, but in between it would also define a new word called FOO. Which would be a silly way to program, but it demonstrates the point.

So the short form is: begin reading at the top left, continue rightward and downward until you reach the bottom. There's no syntax as such, like Perl's die "Can't open file" unless $fileopen; because Forth-like languages don't read ahead to the end of the line.

[Edited: HN doesn't do Markdown. WTF? Also, I don't know my left and right.]

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

#32
post #27

As cool as an approach that Factor has, I cannot fathom why it is being developed for x86 for the life of me. (Besides claims of cross-platform native executable compilation.) On ARM it would be interesting- or if it had a highly modular structure that would allow it to be "easily" ported to other microprocessors. But on x86? What niche is it trying to serve? Is it a language-lover's-language? I guess what I'm asking…

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 for your reply, it already made me more interested in Factor from an implementation standpoint, even if I wouldn't use it on x86.

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

#33
post #24

It takes a few hours to get used to, but once you get the hang of it it becomes an amazing language. For most things postfix notation that Factor uses reads better than applicative (prefix) notation other languages uses. It's like jQuery's or linq's method chaining, only better :) and with less syntax. For example here is the solution to problem 22 in Project Euler ( http://projecteuler.net/problem=22 ): : names ( --…

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.

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

#34
post #24

It takes a few hours to get used to, but once you get the hang of it it becomes an amazing language. For most things postfix notation that Factor uses reads better than applicative (prefix) notation other languages uses. It's like jQuery's or linq's method chaining, only better :) and with less syntax. For example here is the solution to problem 22 in Project Euler ( http://projecteuler.net/problem=22 ): : names ( --…

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.

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

#36
post #23

What is it? Why should I learn it? What are its "killer" features? Ain't nobody got time to learn about every new prog. language.. :)

My suggestion is that learning to write programs in a concatenative language will teach you to think in combinatorial logic, a fundamental basis for computation. I outlined this idea a while back and mentioned Factor in "Finding Joy in Combinators:"

https://github.com/raganwald/homoiconic/blob/master/2008-11-...

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

#37

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.

>> I guess, a damn good tutorial is in order.

Firing up the Factor GUI environment you can access help via F1 where two options are the cookbook and the "Your First Program" tutorial.

This same documentation available in the environment is also available online[1].

[1] http://docs.factorcode.org/content/article-first-program.htm...

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

#38
post #24

It takes a few hours to get used to, but once you get the hang of it it becomes an amazing language. For most things postfix notation that Factor uses reads better than applicative (prefix) notation other languages uses. It's like jQuery's or linq's method chaining, only better :) and with less syntax. For example here is the solution to problem 22 in Project Euler ( http://projecteuler.net/problem=22 ): : names ( --…

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.

And yet that's very much how object-oriented languages are typically structured.

  object.method()

  "hello world".print()
If you're used to speaking a language like English where the word order is subject-verb-object, you'd probably consider a subject-object-verb language to be "backwards" too. But native speakers of that language certainly wouldn't have a problem.

I'm sure it's just a matter of what you're used to.

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

#39
post #28
post #23

What is it? Why should I learn it? What are its "killer" features? Ain't nobody got time to learn about every new prog. language.. :)

You don't have to learn it. It is probably mostly interesting to users of concatenative languages, or those who just want to broaden their horizons.. Personally, I've fallen in love with it a few years ago. Even though I don't use Factor for anything practical, the language itself (as well as Forth) has taught me a completely new way of thinking about problem solving. Something that I benefit from in other languages…

Ok, but that is not true for any new programming language. So why downvote my question?

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

#40
post #24

It takes a few hours to get used to, but once you get the hang of it it becomes an amazing language. For most things postfix notation that Factor uses reads better than applicative (prefix) notation other languages uses. It's like jQuery's or linq's method chaining, only better :) and with less syntax. For example here is the solution to problem 22 in Project Euler ( http://projecteuler.net/problem=22 ): : names ( --…

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.

But you can read left to right to get the order in which operations/transformations are performed:

    "hello world" uppercase print
While in languages where function application is prefix, you have to go inside to outside, right to left:

    print(uppercase("hello world"))
Additionally, if there are infix operators, the direction is switched mid statement:

    print(uppercase("hello" + "world"))
hello -> world <- uppercase <- print
Post reply on HN