Simple Transform
The minimal pipeline pattern: one input, one module call, one output.
Use Case
You need to transform a string to uppercase.
The Pipeline
# simple-test.cst
# Demonstrates basic module usage with a single transformation
@example("Hello, World!")
in message: String
# Transform the message to uppercase
result = Uppercase(message)
out result
Explanation
| Step | Expression | Purpose |
|---|---|---|
| 1 | @example("Hello, World!") | Provides a default test value |
| 2 | in message: String | Declares the input |
| 3 | Uppercase(message) | Calls the Uppercase module (PascalCase = module call) |
| 4 | out result | Declares the output |
Module names use PascalCase (Uppercase, WordCount, Trim). The name must exactly match the module registered in the Scala runtime.
warning
Module names are case-sensitive. Uppercase works, but uppercase or UPPERCASE will fail with a "module not found" error.
Running the Example
Input
{
"message": "Hello, World!"
}
Expected Output
{
"result": "HELLO, WORLD!"
}
Variations
Chain two transforms
@example(" Hello, World! ")
in message: String
trimmed = Trim(message)
upper = Uppercase(trimmed)
out upper
Multiple outputs from one input
@example("Hello, World!")
in message: String
upper = Uppercase(message)
lower = Lowercase(message)
length = TextLength(message)
out upper
out lower
out length
tip
Stdlib functions (like trim, concat) use lowercase. Custom modules (like Uppercase, WordCount) use PascalCase. The convention helps distinguish built-in functions from user-defined modules.
Best Practices
- One responsibility per step — each variable assignment should do one thing
- Use
@examplefor every input — enables quick testing from the dashboard - Module names are case-sensitive —
Uppercaseworks,uppercasedoes not (unless it's a stdlib function)
Related Examples
- Hello World — string concatenation
- Text Analysis — multi-step text processing