Skip to content

Example on how to use swap! with multi-arg fns.#1

Merged
burinc merged 3 commits intoburinc:mainfrom
slipset:push-swap-upwards
Nov 9, 2025
Merged

Example on how to use swap! with multi-arg fns.#1
burinc merged 3 commits intoburinc:mainfrom
slipset:push-swap-upwards

Conversation

@slipset
Copy link
Copy Markdown

@slipset slipset commented Nov 9, 2025

This lets you avoid anonymous fns (which are really where the meat of the program is done, and it lets you push the swap! s to the edges of your system, and as you see from just this example, you now (again) have multiple swaps following each others.

I can imagine that you can end up with very few swap!s, composing changing the game state more or less purely.

@slipset slipset changed the title Extract anon-fn out to pure fn Example on how to use swap! with multi-arg fns. Nov 9, 2025
@burinc
Copy link
Copy Markdown
Owner

burinc commented Nov 9, 2025

This is awesome @slipset. I will update the article later with your changes. 💯

@burinc burinc merged commit c75168c into burinc:main Nov 9, 2025
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

Successfully merging this pull request may close these issues.

2 participants