You can use `foo()[1]`. I asked the same question a little while ago and 
there
was some discussion of the efficiency of this vs. x, = foo() in this 
message in the thread:

https://groups.google.com/d/msg/julia-users/fZx2onl2Cz0/GvbX0GthkPYJ

On Thursday, January 15, 2015 at 8:51:08 AM UTC-6, Tamas Papp wrote:
>
> Hi, 
>
> Is there an idiom for ignoring possible multiple values? For example, if 
> I have a function foo() that may or may not return multiple values where 
> values after the first one provide some extra information (eg a 
> condition number on an operation, etc), but I am not necessarily 
> interested in it -- however, if I do 
>
> x = foo() 
>
> the whole tuple is retained in x. I find I can do 
>
> x, = foo() 
>
> which works, but I will need to remember the comma. 
>
> I am looking for something similar to Common Lisp's default behavior, eg 
>
> (defun foo () 
>   (values 1 2)) 
>
> (let ((x (foo)))                ; don't care if foo return multiple values 
>   x)                            ; => 1 
>
> but I could not find anything similar in Julia. 
>
> best, 
>
> Tamas 
>

Reply via email to