mirror of
https://github.com/janet-lang/janet
synced 2025-10-21 10:47:40 +00:00
Change syntax for namespaces.
Add quasiquote, unquote, and unquote-splicing as specials rather than a macro.
This commit is contained in:
@@ -143,65 +143,65 @@ static const JanetReg cfuns[] = {
|
||||
{"real", janet_real,
|
||||
"(real x)\n\nCast a number x to a real number."
|
||||
},
|
||||
{"math.random", janet_rand,
|
||||
"(math.random)\n\n"
|
||||
{"math/random", janet_rand,
|
||||
"(math/random)\n\n"
|
||||
"Returns a uniformly distrbuted random real number between 0 and 1."
|
||||
},
|
||||
{"math.seedrandom", janet_srand,
|
||||
"(math.seedrandom seed)\n\n"
|
||||
{"math/seedrandom", janet_srand,
|
||||
"(math/seedrandom seed)\n\n"
|
||||
"Set the seed for the random number generator. 'seed' should be an "
|
||||
"an integer."
|
||||
},
|
||||
{"math.cos", janet_cos,
|
||||
"(math.cos x)\n\n"
|
||||
{"math/cos", janet_cos,
|
||||
"(math/cos x)\n\n"
|
||||
"Returns the cosine of x."
|
||||
},
|
||||
{"math.sin", janet_sin,
|
||||
"(math.sin x)\n\n"
|
||||
{"math/sin", janet_sin,
|
||||
"(math/sin x)\n\n"
|
||||
"Returns the sine of x."
|
||||
},
|
||||
{"math.tan", janet_tan,
|
||||
"(math.tan x)\n\n"
|
||||
{"math/tan", janet_tan,
|
||||
"(math/tan x)\n\n"
|
||||
"Returns the tangent of x."
|
||||
},
|
||||
{"math.acos", janet_acos,
|
||||
"(math.acos x)\n\n"
|
||||
{"math/acos", janet_acos,
|
||||
"(math/acos x)\n\n"
|
||||
"Returns the arccosine of x."
|
||||
},
|
||||
{"math.asin", janet_asin,
|
||||
"(math.asin x)\n\n"
|
||||
{"math/asin", janet_asin,
|
||||
"(math/asin x)\n\n"
|
||||
"Returns the arcsine of x."
|
||||
},
|
||||
{"math.atan", janet_atan,
|
||||
"(math.atan x)\n\n"
|
||||
{"math/atan", janet_atan,
|
||||
"(math/atan x)\n\n"
|
||||
"Returns the arctangent of x."
|
||||
},
|
||||
{"math.exp", janet_exp,
|
||||
"(math.exp x)\n\n"
|
||||
{"math/exp", janet_exp,
|
||||
"(math/exp x)\n\n"
|
||||
"Returns e to the power of x."
|
||||
},
|
||||
{"math.log", janet_log,
|
||||
"(math.log x)\n\n"
|
||||
{"math/log", janet_log,
|
||||
"(math/log x)\n\n"
|
||||
"Returns log base 2 of x."
|
||||
},
|
||||
{"math.log10", janet_log10,
|
||||
"(math.log10 x)\n\n"
|
||||
{"math/log10", janet_log10,
|
||||
"(math/log10 x)\n\n"
|
||||
"Returns log base 10 of x."
|
||||
},
|
||||
{"math.sqrt", janet_sqrt,
|
||||
"(math.sqrt x)\n\n"
|
||||
{"math/sqrt", janet_sqrt,
|
||||
"(math/sqrt x)\n\n"
|
||||
"Returns the square root of x."
|
||||
},
|
||||
{"math.floor", janet_floor,
|
||||
"(math.floor x)\n\n"
|
||||
{"math/floor", janet_floor,
|
||||
"(math/floor x)\n\n"
|
||||
"Returns the largest integer value real number that is not greater than x."
|
||||
},
|
||||
{"math.ceil", janet_ceil,
|
||||
"(math.ceil x)\n\n"
|
||||
{"math/ceil", janet_ceil,
|
||||
"(math/ceil x)\n\n"
|
||||
"Returns the smallest integer value real number that is not less than x."
|
||||
},
|
||||
{"math.pow", janet_pow,
|
||||
"(math.pow a x)\n\n"
|
||||
{"math/pow", janet_pow,
|
||||
"(math/pow a x)\n\n"
|
||||
"Return a to the power of x."
|
||||
},
|
||||
{NULL, NULL, NULL}
|
||||
@@ -212,11 +212,11 @@ int janet_lib_math(JanetArgs args) {
|
||||
JanetTable *env = janet_env(args);
|
||||
janet_cfuns(env, NULL, cfuns);
|
||||
|
||||
janet_def(env, "math.pi", janet_wrap_real(3.1415926535897931),
|
||||
janet_def(env, "math/pi", janet_wrap_real(3.1415926535897931),
|
||||
"The value pi.");
|
||||
janet_def(env, "math.e", janet_wrap_real(2.7182818284590451),
|
||||
janet_def(env, "math/e", janet_wrap_real(2.7182818284590451),
|
||||
"The base of the natural log.");
|
||||
janet_def(env, "math.inf", janet_wrap_real(INFINITY),
|
||||
janet_def(env, "math/inf", janet_wrap_real(INFINITY),
|
||||
"The real number representing positive infinity");
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user