Arc Forumnew | comments | leaders | submitlogin
2 points by sacado 6121 days ago | link | parent

Well, maybe I didn't fully understand how to use it, but it is really too hard for me to write a code that looks like "dup rot- . * + dup dup < . if", even for low-level functions.

I find myself taking too much time thinking "let's see, the value I want is at the third position on the stack, I want to get it duplicated on the top, but without changing the order of the other elements, so I should do..." instead of really solving the problem I'm working on.

But maybe I'll give it another try later ?



3 points by ryantmulligan 6121 days ago | link

Either you can make a word that takes the 3rd element from the stack while maintaining order, or there already is one.

-----

1 point by sacado 6121 days ago | link

But in other languages you don't even have to bother with that. Accessing the third element of the stack is easily feasible and you can even guess how to do it.

And the fact that my variables have no name (they're all called "first element on the stack", "second element", etc.) reminds me assembly code, but without the efficiency : I can understand that in a low-level language as Forth, but it doesn't look like Factor is one.

But I can be wrong, and anyway Factor is on my "try it again later" list.

-----

1 point by mst 6119 days ago | link

On the one hand, factor -does- have named variables.

On the other hand, once you start experimenting with stack stuff there's a moment where you go "aha" and it actually starts to make a lot of sense for temporary variables.

There are probably other aha moments further in that I haven't got to yet; I've not spent as much time with factor as I want to.

I dunno if I'll ever use it for "real stuff", but I think it's worth fighting your way through to the aha moments just like lisp and haskell are even if you never expect to use -them- for "real stuff".

-----