Start to rework some of our kcl docs (#3222)

* Start to rework some of our kcl docs

Signed-off-by: Paul R. Tagliamonte <paul@zoo.dev>
This commit is contained in:
Paul Tagliamonte
2024-08-06 20:27:26 -04:00
committed by GitHub
parent 5cb5dbd689
commit e1c45bdb33
81 changed files with 423 additions and 343 deletions

View File

@ -10,7 +10,7 @@ use crate::{
std::Args,
};
/// Computes the cosine of a number (in radians).
/// Compute the cosine of a number (in radians).
pub async fn cos(args: Args) -> Result<MemoryItem, KclError> {
let num = args.get_number()?;
let result = inner_cos(num)?;
@ -18,7 +18,7 @@ pub async fn cos(args: Args) -> Result<MemoryItem, KclError> {
args.make_user_val_from_f64(result)
}
/// Computes the cosine of a number (in radians).
/// Compute the cosine of a number (in radians).
///
/// ```no_run
/// const exampleSketch = startSketchOn("XZ")
@ -40,7 +40,7 @@ fn inner_cos(num: f64) -> Result<f64, KclError> {
Ok(num.cos())
}
/// Computes the sine of a number (in radians).
/// Compute the sine of a number (in radians).
pub async fn sin(args: Args) -> Result<MemoryItem, KclError> {
let num = args.get_number()?;
let result = inner_sin(num)?;
@ -48,7 +48,7 @@ pub async fn sin(args: Args) -> Result<MemoryItem, KclError> {
args.make_user_val_from_f64(result)
}
/// Computes the sine of a number (in radians).
/// Compute the sine of a number (in radians).
///
/// ```no_run
/// const exampleSketch = startSketchOn("XZ")
@ -70,7 +70,7 @@ fn inner_sin(num: f64) -> Result<f64, KclError> {
Ok(num.sin())
}
/// Computes the tangent of a number (in radians).
/// Compute the tangent of a number (in radians).
pub async fn tan(args: Args) -> Result<MemoryItem, KclError> {
let num = args.get_number()?;
let result = inner_tan(num)?;
@ -78,7 +78,7 @@ pub async fn tan(args: Args) -> Result<MemoryItem, KclError> {
args.make_user_val_from_f64(result)
}
/// Computes the tangent of a number (in radians).
/// Compute the tangent of a number (in radians).
///
/// ```no_run
/// const exampleSketch = startSketchOn("XZ")
@ -125,7 +125,7 @@ fn inner_pi() -> Result<f64, KclError> {
Ok(std::f64::consts::PI)
}
/// Computes the square root of a number.
/// Compute the square root of a number.
pub async fn sqrt(args: Args) -> Result<MemoryItem, KclError> {
let num = args.get_number()?;
let result = inner_sqrt(num)?;
@ -133,7 +133,7 @@ pub async fn sqrt(args: Args) -> Result<MemoryItem, KclError> {
args.make_user_val_from_f64(result)
}
/// Computes the square root of a number.
/// Compute the square root of a number.
///
/// ```no_run
/// const exampleSketch = startSketchOn("XZ")
@ -155,7 +155,7 @@ fn inner_sqrt(num: f64) -> Result<f64, KclError> {
Ok(num.sqrt())
}
/// Computes the absolute value of a number.
/// Compute the absolute value of a number.
pub async fn abs(args: Args) -> Result<MemoryItem, KclError> {
let num = args.get_number()?;
let result = inner_abs(num)?;
@ -163,7 +163,7 @@ pub async fn abs(args: Args) -> Result<MemoryItem, KclError> {
args.make_user_val_from_f64(result)
}
/// Computes the absolute value of a number.
/// Compute the absolute value of a number.
///
/// ```no_run
/// const myAngle = -120
@ -192,7 +192,7 @@ fn inner_abs(num: f64) -> Result<f64, KclError> {
Ok(num.abs())
}
/// Computes the largest integer less than or equal to a number.
/// Compute the largest integer less than or equal to a number.
pub async fn floor(args: Args) -> Result<MemoryItem, KclError> {
let num = args.get_number()?;
let result = inner_floor(num)?;
@ -200,7 +200,7 @@ pub async fn floor(args: Args) -> Result<MemoryItem, KclError> {
args.make_user_val_from_f64(result)
}
/// Computes the largest integer less than or equal to a number.
/// Compute the largest integer less than or equal to a number.
///
/// ```no_run
/// const sketch001 = startSketchOn('XZ')
@ -220,7 +220,7 @@ fn inner_floor(num: f64) -> Result<f64, KclError> {
Ok(num.floor())
}
/// Computes the smallest integer greater than or equal to a number.
/// Compute the smallest integer greater than or equal to a number.
pub async fn ceil(args: Args) -> Result<MemoryItem, KclError> {
let num = args.get_number()?;
let result = inner_ceil(num)?;
@ -228,7 +228,7 @@ pub async fn ceil(args: Args) -> Result<MemoryItem, KclError> {
args.make_user_val_from_f64(result)
}
/// Computes the smallest integer greater than or equal to a number.
/// Compute the smallest integer greater than or equal to a number.
///
/// ```no_run
/// const sketch001 = startSketchOn('XZ')
@ -248,7 +248,7 @@ fn inner_ceil(num: f64) -> Result<f64, KclError> {
Ok(num.ceil())
}
/// Computes the minimum of the given arguments.
/// Compute the minimum of the given arguments.
pub async fn min(args: Args) -> Result<MemoryItem, KclError> {
let nums = args.get_number_array()?;
let result = inner_min(nums);
@ -256,7 +256,7 @@ pub async fn min(args: Args) -> Result<MemoryItem, KclError> {
args.make_user_val_from_f64(result)
}
/// Computes the minimum of the given arguments.
/// Compute the minimum of the given arguments.
///
/// ```no_run
/// const exampleSketch = startSketchOn("XZ")
@ -285,7 +285,7 @@ fn inner_min(args: Vec<f64>) -> f64 {
min
}
/// Computes the maximum of the given arguments.
/// Compute the maximum of the given arguments.
pub async fn max(args: Args) -> Result<MemoryItem, KclError> {
let nums = args.get_number_array()?;
let result = inner_max(nums);
@ -293,7 +293,7 @@ pub async fn max(args: Args) -> Result<MemoryItem, KclError> {
args.make_user_val_from_f64(result)
}
/// Computes the maximum of the given arguments.
/// Compute the maximum of the given arguments.
///
/// ```no_run
/// const exampleSketch = startSketchOn("XZ")
@ -322,7 +322,7 @@ fn inner_max(args: Vec<f64>) -> f64 {
max
}
/// Computes the number to a power.
/// Compute the number to a power.
pub async fn pow(args: Args) -> Result<MemoryItem, KclError> {
let nums = args.get_number_array()?;
if nums.len() > 2 {
@ -344,7 +344,7 @@ pub async fn pow(args: Args) -> Result<MemoryItem, KclError> {
args.make_user_val_from_f64(result)
}
/// Computes the number to a power.
/// Compute the number to a power.
///
/// ```no_run
/// const exampleSketch = startSketchOn("XZ")
@ -366,7 +366,7 @@ fn inner_pow(num: f64, pow: f64) -> Result<f64, KclError> {
Ok(num.powf(pow))
}
/// Computes the arccosine of a number (in radians).
/// Compute the arccosine of a number (in radians).
pub async fn acos(args: Args) -> Result<MemoryItem, KclError> {
let num = args.get_number()?;
let result = inner_acos(num)?;
@ -374,7 +374,7 @@ pub async fn acos(args: Args) -> Result<MemoryItem, KclError> {
args.make_user_val_from_f64(result)
}
/// Computes the arccosine of a number (in radians).
/// Compute the arccosine of a number (in radians).
///
/// ```no_run
/// const sketch001 = startSketchOn('XZ')
@ -397,7 +397,7 @@ fn inner_acos(num: f64) -> Result<f64, KclError> {
Ok(num.acos())
}
/// Computes the arcsine of a number (in radians).
/// Compute the arcsine of a number (in radians).
pub async fn asin(args: Args) -> Result<MemoryItem, KclError> {
let num = args.get_number()?;
let result = inner_asin(num)?;
@ -405,7 +405,7 @@ pub async fn asin(args: Args) -> Result<MemoryItem, KclError> {
args.make_user_val_from_f64(result)
}
/// Computes the arcsine of a number (in radians).
/// Compute the arcsine of a number (in radians).
///
/// ```no_run
/// const sketch001 = startSketchOn('XZ')
@ -427,7 +427,7 @@ fn inner_asin(num: f64) -> Result<f64, KclError> {
Ok(num.asin())
}
/// Computes the arctangent of a number (in radians).
/// Compute the arctangent of a number (in radians).
pub async fn atan(args: Args) -> Result<MemoryItem, KclError> {
let num = args.get_number()?;
let result = inner_atan(num)?;
@ -435,7 +435,7 @@ pub async fn atan(args: Args) -> Result<MemoryItem, KclError> {
args.make_user_val_from_f64(result)
}
/// Computes the arctangent of a number (in radians).
/// Compute the arctangent of a number (in radians).
///
/// ```no_run
/// const sketch001 = startSketchOn('XZ')
@ -457,7 +457,7 @@ fn inner_atan(num: f64) -> Result<f64, KclError> {
Ok(num.atan())
}
/// Computes the logarithm of the number with respect to an arbitrary base.
/// Compute the logarithm of the number with respect to an arbitrary base.
///
/// The result might not be correctly rounded owing to implementation
/// details; `log2()` can produce more accurate results for base 2,
@ -482,7 +482,7 @@ pub async fn log(args: Args) -> Result<MemoryItem, KclError> {
args.make_user_val_from_f64(result)
}
/// Computes the logarithm of the number with respect to an arbitrary base.
/// Compute the logarithm of the number with respect to an arbitrary base.
///
/// The result might not be correctly rounded owing to implementation
/// details; `log2()` can produce more accurate results for base 2,
@ -506,7 +506,7 @@ fn inner_log(num: f64, base: f64) -> Result<f64, KclError> {
Ok(num.log(base))
}
/// Computes the base 2 logarithm of the number.
/// Compute the base 2 logarithm of the number.
pub async fn log2(args: Args) -> Result<MemoryItem, KclError> {
let num = args.get_number()?;
let result = inner_log2(num)?;
@ -514,7 +514,7 @@ pub async fn log2(args: Args) -> Result<MemoryItem, KclError> {
args.make_user_val_from_f64(result)
}
/// Computes the base 2 logarithm of the number.
/// Compute the base 2 logarithm of the number.
///
/// ```no_run
/// const exampleSketch = startSketchOn("XZ")
@ -534,7 +534,7 @@ fn inner_log2(num: f64) -> Result<f64, KclError> {
Ok(num.log2())
}
/// Computes the base 10 logarithm of the number.
/// Compute the base 10 logarithm of the number.
pub async fn log10(args: Args) -> Result<MemoryItem, KclError> {
let num = args.get_number()?;
let result = inner_log10(num)?;
@ -542,7 +542,7 @@ pub async fn log10(args: Args) -> Result<MemoryItem, KclError> {
args.make_user_val_from_f64(result)
}
/// Computes the base 10 logarithm of the number.
/// Compute the base 10 logarithm of the number.
///
/// ```no_run
/// const exampleSketch = startSketchOn("XZ")
@ -562,7 +562,7 @@ fn inner_log10(num: f64) -> Result<f64, KclError> {
Ok(num.log10())
}
/// Computes the natural logarithm of the number.
/// Compute the natural logarithm of the number.
pub async fn ln(args: Args) -> Result<MemoryItem, KclError> {
let num = args.get_number()?;
let result = inner_ln(num)?;
@ -570,7 +570,7 @@ pub async fn ln(args: Args) -> Result<MemoryItem, KclError> {
args.make_user_val_from_f64(result)
}
/// Computes the natural logarithm of the number.
/// Compute the natural logarithm of the number.
///
/// ```no_run
/// const exampleSketch = startSketchOn("XZ")