Author Topic: [CHALLENGE] Rosetta Code - "Tasks not implemented in torquescript"  (Read 3576 times)

"Real constants and functions"

  • E: $e = 2.71828
  • Pi: $pi = 3.14159 (not always defined)
  • Natural Logarithm: mLow(x) / mLog($e)
  • Base 10 Logarithm: mLog(x)
  • Exponential: mPow($e, x)
  • Exponentiation: mPow(x, y)
  • Exponentiation Modulo: mPow(x, y) % z
"Assertion":

Code: [Select]
if ( !expression )
{
    // possibly display an error
    // error( x );
   
    return;
    // instead, possibly return a value to parent function to abort as well
    // return x;
}
This doesn't meet the definition of the assertion on the page.

This doesn't meet the definition of the assertion on the page.

Replace expresion with %x == 42 and it does.

Quote
Assertions are a way of breaking out of code when there is an error or an unexpected input. Some languages throw exceptions and some treat it as a break point.
It has to manually break out of code when there is an unexpected error. It's an assertion in English semantics, but not in the traditional way that page is describing.

E: $e = 2.71828
Natural Logarithm: mLow(x) / mLog($e)
Exponential: mPow($e, x)
Exponentiation Modulo: mPow(x, y) % z

These aren't natural.
« Last Edit: June 18, 2012, 06:01:47 AM by Port »

Guys, the default mLog() is the natural log, not the base 10 log. You still have to do change of bases though.

Guys, the default mLog() is the natural log, not the base 10 log. You still have to do change of bases though.
function mLog10(%num)
{
    return mLog(%num)/mLog(10);
}


Or even better:
function mLogN(%num, %base)
{
    return mLog(%num)/mLog(%base);
}

function mLog10(%num)
{
    return mLog(%num)/mLog(10);
}


Or even better:
function mLogN(%num, %base)
{
    return mLog(%num)/mLog(%base);
}

The "Real constants and functions" task is to demonstrate native language content, not user-made functions.

The "Real constants and functions" task is to demonstrate native language content, not user-made functions.
Really? I thought it meant real numbers LOL.

Is someone adding these? I know I didn't add my code

Is someone adding these? I know I didn't add my code

I will, when I can.

FileCopy and FileDelete are functions added by Badspot. You should probably remove that.
Well fileCopy i can make easily enough, but how does fileDelete work ?.?

Well fileCopy i can make easily enough, but how does fileDelete work ?.?

I don't think you can delete a file in blockland any other way.

I don't think you can delete a file in blockland any other way.
Well i mean in torque in general. It must be possible, otherwise you couldn't do it in blockland :/

Well i mean in torque in general. It must be possible, otherwise you couldn't do it in blockland :/

Grab a T3D demo and go look.

Grab a T3D demo and go look.
I actually just looked at the full torque 3d torquescript reference, fileDelete is a default function.