Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using procedures in functions #613

Open
Goju-Ryu opened this issue Oct 10, 2024 · 0 comments
Open

Using procedures in functions #613

Goju-Ryu opened this issue Oct 10, 2024 · 0 comments

Comments

@Goju-Ryu
Copy link
Contributor

I found myself wishing to be able to call procedures inside a function today. My use case was to set up the arguments of an assert I planned to run in many different variations. I wanted to test mys implementation of human against the existing one and thought I'd write something like the following:

fn test_human(time: Time) = assert_eq(time -> human, time -> human_new)

fn test_human_range(times: List<Time>) = times |> map(test_human)

I think it would be very beneficial for testing if something like the first line at least was possible. The second line is probably a lot more involved, so I won't focus too much on it.

I imagine it might be difficult or undesirable to mix functions and procedures, in which case I would instead propose to introduce custom procedures, a function-like construct that can only call other procedures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant