Replies: 2 comments
-
|
Hey! I totally get what you're trying to do. So, you're looking to properly type-hint that fn in KCL (Kotlin-like language) for better clarity, especially since right now you're using any as a placeholder, which isn't quite what you want. As of the last updates I know of, KCL doesn't provide a direct way to define function types like (a: int, b: int) -> int the way you'd expect in, say, TypeScript or Python with type hints. However, there's a workaround you could use to ensure you're more explicit about the function signature. but better check resources like https://golden-crown.casinologin.mobi/ it will help you |
Beta Was this translation helpful? Give feedback.
-
|
You can actually have nested type hint hello = lambda fn: (int, int) -> int, c: int, d: int -> int {
fn(c, d)
}
# same as
hello: ((int, int) -> int, int, int) -> int = lambda fn: (int, int) -> int, c: int, d: int -> int {
fn(c, d)
}
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Does KCL have a way to type-hint first-class functions? i.e. this works with
kcl run:But obviously
fn: anyis a lie. I really needfnto be of the form (pseudocode incoming)(a: int, b: int) -> int, but I can't find anything like this in the documentation / other discussions (based on searching for "first-class" and "currying")Beta Was this translation helpful? Give feedback.
All reactions