Created
February 5, 2024 03:46
-
-
Save okayurisotto/89da435576c9841cf5043a50a333ce51 to your computer and use it in GitHub Desktop.
π€
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Software { | |
| local Semver = (str: String) -> | |
| str.matches(Regex(#"^\#(IntStr)\.\#(IntStr)\.\#(IntStr)$"#)) | |
| local IntStr = #"(0|[1-9]\d*)"# | |
| local function greet(name: String): String = "Hello, \(name) world!" | |
| name: String(length > 0) | |
| version: String(Semver) | |
| message: String = greet(name) | |
| } | |
| solutions: Listing<Software> = new { | |
| new { | |
| name = "Pkl" | |
| version = "0.25.1" | |
| } | |
| } | |
| /* | |
| * { | |
| * "solutions": [ | |
| * { | |
| * "name": "Pkl", | |
| * "version": "0.25.1", | |
| * "message": "Hello, Pkl world!" | |
| * } | |
| * ] | |
| * } | |
| */ |
okayurisotto
commented
Feb 5, 2024
Author
- https://pkl-lang.org/main/current/language-reference/index.html
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment