Skip to main content
Became Hot Network Question
Tweeted twitter.com/StackMma/status/1557924835786989571
edited title
Link
Lukas Lang
  • 34.4k
  • 1
  • 56
  • 99

What does the operation Map[({...}=#;{...})&, ] do?

Source Link
seeker
  • 577
  • 2
  • 7

What does the operation Map[({}=#;{})&, ] do?

With reference to the answer by @Bill to the question posted here, I am trying to understand the following three lines

  u = RandomReal[{0, 1}, {20, 5}]
  v = Map[({x, y, z, a, b} = #; {x, y, z, a, b, 1 - a - b}) &, u]
  w = Take[Select[v, ({x, y, z, a, b, c} = #;  x^2 + y^2 + z^2 <= 1 && x + y - 1 <= z <= -x + y + 1 && z >= -x - y - 1) &], 3]

Clearly u generates $20 \times 5$ array of random (real) numbers between 0 and 1. But I do not understand how Map[({x, y, z, a, b} = #; {x, y, z, a, b, 1 - a - b}) &, u] is working. Both v and w involve something like ({}=#;{})&. What does this operation do?