Vyxal S
, 124120 bitsv1, 15.5 bytes
s:¯0J⁽ṅḋ•ꜝƛ₍htU\¯Ǐ⁽ṅḋ•ꜝƛ₍htU\-j
Try it Online!Try it Online!
Explained
s:¯0J⁽ṅḋ•ꜝƛ₍htU\¯Ǐ⁽ṅḋ•ꜝƛ₍htU\-j
s: # Push two copies of the input list but sorted
¯0J¯Ǐ # Forward differences of items with 0the first item appended
- this is for making sure the length of the deltas matches the length of the input
⁽ṅḋ # Grouped by whether they are <= 1
• # Reshape the sorted input to that shape
ꜝ # and remove the 0
# the top of the stack will be a list of lists of numbers that are ranges
ƛ # to each range
₍htU # either get the first and last item or just the first
\-j # join on "-"
# S flag joins the result on spaces