Skip to content

Instantly share code, notes, and snippets.

@CHatmaker
Last active March 29, 2024 15:40
Show Gist options
  • Save CHatmaker/3e6cba6414fadfabfa3725255da2ba74 to your computer and use it in GitHub Desktop.
Save CHatmaker/3e6cba6414fadfabfa3725255da2ba74 to your computer and use it in GitHub Desktop.
5g Modeling Templates
// Base Template
/* FUNCTION NAME: <enter name here>λ
DESCRIPTION:*//**<this comment displays in name manager>*/
/* REVISIONS: Date Developer Description
<changed> <your name> <what changed>
*/
FunctionNameλ = LAMBDA(
// Parameter Declarations
[Argument1], // All arguments must have [ ]
[Argument2], // Add as many arguments as needed.
[Argument3],
// Help
LET(Help, TRIM(TEXTSPLIT(
"FUNCTION: →FunctionNameλ( Argument1, Argument2, [Argument3])¶" &
"DESCRIPTION: →Copy description from comment block at top.¶" &
"WEBPAGE: →URL¶" &
"VERSION: →copy date from last revision in REVISIONS¶" &
"PARAMETERS: →¶" &
"Argument1 →(Required) Description of required argument1¶" &
"Argument2 →(Required) Description of required argument2¶" &
"Argument3 →(Optional) Description of optional argument3 with what default is¶" &
"EXAMPLES: →Formula (ID is assumed to be the module's name)¶" &
"→=ID.FunctionNameλ( 123, 456)",
"→", "¶" )
),
// Check inputs - Omitted required arguments (do not include optional arguments)
Help?, OR( ISOMITTED( Argument1),
ISOMITTED( Argument2 )
),
// Set internal named constants if needed
// Set defaults for optional arguments if needed
Argument3, IF( ISOMITTED( Argument3), 0, Argument3),
// Procedure starts here
Result, Argument1 + Argument2 - Argument3, // Last Formula line goes here
// Return Result
CHOOSE(Help? + 1, Result, Help)
)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment