Stream: helpdesk (published)

Topic: ✔ Create destructuring expression from variable names


view this post on Zulip DrChainsaw (Jul 31 2023 at 11:31):

Given a tuple of variable names, what is the simplest/best way to create an expression which assigns them through destructuring?

For example, given names = (:a, :b, :c), create the expression a,b,c, = mytuple using the variable names.

view this post on Zulip DrChainsaw (Jul 31 2023 at 11:43):

Ok, I think I found it:

:(($(names...),) = mytuple)

view this post on Zulip Notification Bot (Jul 31 2023 at 11:43):

DrChainsaw has marked this topic as resolved.


Last updated: Dec 28 2024 at 04:38 UTC