Ask user to provide points coordinates as two vectors or as a single vector of tuples?

K5Julien
Thu, 01 Aug 2024 06:41:22 +0000
Optimization (Mathematical)

When asking the user to provide coordinates of plan points for my package RingStarProblems.jl I initially thought the following was best:

xycoordinates = tuple.(1:10, rand(1:10, 10))
somefunction(xycoordinates)

However, looking at Concorde.jl, they do the following instead:

x = 1:10
y = rand(1:10, 10)
somefunction(x,y)

The major con I see in their choice is that the user could provide different sizes for x and y that’d lead to errors.

What is the best programming practice? Note that perhaps this is not entirely related to Julia but programming in general.

11 posts - 6 participants