# \#varargs

**URL:** https://discourse.julialang.org/tag/varargs/1292.md

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

---

## [Typed varargs](https://discourse.julialang.org/t/typed-varargs/118291)

<div class="topic-metadata">

**Author:** [@Nichola](https://discourse.julialang.org/u/Nichola)\
**Replies:** 4\
**Last updated:** [August 16, 2024, 9:52pm UTC](https://discourse.julialang.org/t/typed-varargs/118291 "2024-08-16T21:52:17Z")

</div>

I would like to define a function with a variable number of typed arguments. In particular I would like to overload the + operator in this way function Base.:+(a::MyType, (c, args...)) where c is a Number and args is …

---

## [Using Vararg for mixed types](https://discourse.julialang.org/t/using-vararg-for-mixed-types/108973)

<div class="topic-metadata">

**Author:** [@Larbino1](https://discourse.julialang.org/u/Larbino1)\
**Replies:** 5\
**Last updated:** [January 19, 2024, 4:17pm UTC](https://discourse.julialang.org/t/using-vararg-for-mixed-types/108973 "2024-01-19T16:17:40Z")

</div>

Recently I have started getting the error message: WARNING: Wrapping Vararg directly in UnionAll is deprecated (wrap the tuple instead). │ You may need to write f(x::Vararg{T}) rather than f(x::Vararg{\<:T}) or f(x::Va…

---

## [Understanding Varargs partial specialization](https://discourse.julialang.org/t/understanding-varargs-partial-specialization/102141)

<div class="topic-metadata">

**Author:** [@Benny](https://discourse.julialang.org/u/Benny)\
**Replies:** 1\
**Last updated:** [July 27, 2023, 5:41am UTC](https://discourse.julialang.org/t/understanding-varargs-partial-specialization/102141 "2023-07-27T05:41:34Z")

</div>

In the “Be aware of when Julia avoids specializing”, section, the following is stated: As a heuristic, Julia avoids automatically specializing on argument type parameters in three specific cases: Type , Function , and V…

---

## [Variable number of arguments with different types](https://discourse.julialang.org/t/variable-number-of-arguments-with-different-types/102035)

<div class="topic-metadata">

**Author:** [@linwaytin](https://discourse.julialang.org/u/linwaytin)\
**Replies:** 8\
**Last updated:** [July 25, 2023, 9:36pm UTC](https://discourse.julialang.org/t/variable-number-of-arguments-with-different-types/102035 "2023-07-25T21:36:10Z")

</div>

This might be a strange question, but I really want to know if there is a way to construct a function where the first few variables are Int, while the rest are Float64, so that I can call it using like fn(1, 2, 3.2, 3.4,…

---

## [Define multiple methods or one method with union types?](https://discourse.julialang.org/t/define-multiple-methods-or-one-method-with-union-types/101674)

<div class="topic-metadata">

**Author:** [@kunzaatko](https://discourse.julialang.org/u/kunzaatko)\
**Replies:** 4\
**Last updated:** [July 17, 2023, 2:03pm UTC](https://discourse.julialang.org/t/define-multiple-methods-or-one-method-with-union-types/101674 "2023-07-17T14:03:17Z")

</div>

What is the preferred way to implement methods that allow multiple types? Option A: function method(a::Union{Tuple{Integer,Integer}, Integer}, b::Union{Tuple{Integer,Integer}, Integer}) a = a isa Integer ? (a,a) : …

---

## [Add varargs methods of \`any\`, \`all\`, and \`count\`](https://discourse.julialang.org/t/add-varargs-methods-of-any-all-and-count/95072)

<div class="topic-metadata">

**Author:** [@uniment](https://discourse.julialang.org/u/uniment)\
**Replies:** 26\
**Last updated:** [February 26, 2023, 7:10am UTC](https://discourse.julialang.org/t/add-varargs-methods-of-any-all-and-count/95072 "2023-02-26T07:10:26Z")

</div>

It would be helpful to have variable-length methods of any, all, and count for comparing collections, so that e.g. you could write this: all(≡, \[1,2,3\], \[1,2,3\]) # true count(≥, (3,2,1), 1:3) # 2 Proof of concept: Bas…
