IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New Re: Algorithm question: RPN/stack processing.
May be a dumb idea, but isn't Icon an interpreted language? Couldn't you just have an Icon expression there and compute it using your interpreter?
New It's not a dumb idea.
But Icon is not an interpreted language. It's a translated language (it has it's own runtime p-code interpreter). If it were an interpreted language, I probably would have done what you suggested, yes.

Actually, I sorta began to head down that way. It's straightforward to get a function pointer to any builtin operator at runtime and call it with whatever you like. I was going to do something like that for most of the operators. Among other things, it gives me access to functions like repl() which repeats a string a given number of times. My original extension of this idea would have had the code build a list of operations at parse time so when it got to expanding all the tokens, if it found a list where it expected a string, then it would do a simple loop through the list, calling function pointers and moving values around in a mechanical and conditional free way. Unfortunately, this approach requires some very creative algorithms at a few points to solve some data-hiding and edge-condition problems.

Wade.

"All around me are nothing but fakes
Come with me on the biggest fake of all!"

     Algorithm question: RPN/stack processing. - (static) - (3)
         Re: Algorithm question: RPN/stack processing. - (Arkadiy) - (1)
             It's not a dumb idea. - (static)
         Progress report. And a request. - (static)

It's a trick. Get an axe.
39 ms