Stream: beginners

Topic: Function with no arguments


view this post on Zulip Shawn (Feb 01 2024 at 05:49):

This feels like a really silly question, but how do you define a function with no arguments?

view this post on Zulip Brendan Hansknecht (Feb 01 2024 at 06:04):

So in roc, there is no such thing. That would just be a constants. That said, if you want lazy evaluation, the standard is to make a function that takes an empty record as the argument:

lazySlowCompute = \{} -> ...

Last updated: Jul 06 2025 at 12:14 UTC