Skip to content

beginner question about st #554

Answered by TimWhiting
MangoIV asked this question in Q&A
Jun 14, 2024 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

Ah yes this confused me at first too. The return value of modify is the return value of the lambda you pass it, the return value of modify is not used to set the ref. Inside the lambda i refers to a local variable (you can use i := i + x to get what you want). It's closer in behavior and semantics to Haskell's modifyMVar without the need to return a tuple.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@MangoIV
Comment options

@MangoIV
Comment options

Answer selected by MangoIV
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants