Opportunistic Mutation in Roc
roc-lang.org·14w·
Discuss: Hacker News

Roc is designed to have a small number of simple language primitives. This goal leads Roc to be a single-paradigm functional language, while its performance goals lead to some design choices that are uncommon in functional languages.

Opportunistic mutation

All Roc values are semantically immutable, but may be opportunistically mutated behind the scenes when it would improve performance (without affecting the program’s behavior). For example:

colors
|> Set.insert "Purple"
|> Set.insert "Orange"
|> Set.insert "Blue"

The Set.insert function takes a Set and returns a Set with the given value inserted. It m…

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help