[SOLVED] DSRN (dog slow roman numerals)
|
06-16-2014, 09:13 PM
Post: #51
|
|||
|
|||
RE: DSRN (dog slow roman numerals)
Now you may call me a traitor of my own position, but I wondered whether it was useful to overload * to multiply a string by a number: like "M" * 3 = "MMM".
What if we use Forth's /MOD (n1 n2 - rem quot) instead of IDIV2 (n1 n2 - quot rem)? Code: \<< But then I noticed: MAP can't access the stack below the list. Furthermore if more than one element is created they are enclosed within a list. Example: { 1 2 3 } \<< DUP \>> MAP returns: {{ 1 1 } { 2 2 } { 3 3 }} So that won't work. I'd prefer that MAP just pushes an element of the list on the stack, applies the program and then pops the top of the stack back to the list. Thus the result would be: 1 2 3 { 1 2 3 } You can still create a list if you want to. But now it happens under the hood and you can't avoid it. Cheers Thomas |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)