2024-07-08 15:39:26 +00:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
Perform *arithmetic* multiplication. It's kind of like repeated **addition**, very neat.
|
|
|
|
|
|
|
|
```nix
|
|
|
|
multiply 2 3
|
|
|
|
=> 6
|
|
|
|
```
|
|
|
|
*/
|
|
|
|
multiply = x: y: x * y;
|
|
|
|
|
|
|
|
/**👈 precisely this wide 👉*/
|
|
|
|
measurement = x: x;
|
|
|
|
|
|
|
|
floatedIn = /** This also works. */
|
|
|
|
x: y: x;
|
|
|
|
|
|
|
|
compact=/**boom*/x: x;
|
|
|
|
|
2024-07-15 12:27:09 +00:00
|
|
|
# https://github.com/NixOS/rfcs/blob/master/rfcs/0145-doc-strings.md#ambiguous-placement
|
2024-07-08 15:39:26 +00:00
|
|
|
/** Ignore!!! */
|
|
|
|
unambiguous =
|
|
|
|
/** Very close */
|
|
|
|
x: x;
|
|
|
|
|
|
|
|
/** Firmly rigid. */
|
|
|
|
constant = true;
|
|
|
|
|
|
|
|
/** Immovably fixed. */
|
|
|
|
lib.version = "9000";
|
|
|
|
|
|
|
|
/** Unchangeably constant. */
|
|
|
|
lib.attr.empty = { };
|
|
|
|
|
|
|
|
lib.attr.undocumented = { };
|
|
|
|
|
|
|
|
nonStrict = /** My syntax is not strict, but I'm strict anyway. */ x: x;
|
|
|
|
strict = /** I don't have to be strict, but I am anyway. */ { ... }: null;
|
|
|
|
# Note that pre and post are the same here. I just had to name them somehow.
|
|
|
|
strictPre = /** Here's one way to do this */ a@{ ... }: a;
|
|
|
|
strictPost = /** Here's another way to do this */ { ... }@a: a;
|
|
|
|
|
|
|
|
# TODO
|
|
|
|
|
2024-07-15 12:27:09 +00:00
|
|
|
/** You won't see this. */
|
|
|
|
curriedArgs =
|
|
|
|
/** A documented function. */
|
|
|
|
x:
|
|
|
|
/** The function returned by applying once */
|
|
|
|
y:
|
|
|
|
/** A function body performing summation of two items */
|
|
|
|
x + y;
|
|
|
|
|
|
|
|
/** Documented formals (but you won't see this comment) */
|
|
|
|
documentedFormals =
|
|
|
|
/** Finds x */
|
|
|
|
{ /** The x attribute */
|
|
|
|
x
|
|
|
|
}: x;
|
2024-07-08 15:39:26 +00:00
|
|
|
}
|