Hi On Thursday, January 15, 2015 at 3:51:08 PM UTC+1, 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. > > This is just the way it works, I suppose. Sometimes you want to capture all results in a tuple, sometimes not... The callee can't really guess what you want (as in Octave's nargout). In a similar way, I sometimes wish there would be something like
first, rest = foo_returning_many_objects() which I usually solve with an assignment to `rest` followed by a `shift!()`. ---david 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 >