Write a function
```python
alternate_sort(l)
```
that combines the elements of an array by sorting the elements ascending by their **absolute value** and outputs negative and non-negative integers alternatingly (starting with the negative value, if any).

E.g.
```python
alternate_sort([5, -42, 2, -3, -4, 8, -9,]) == [-3, 2, -4, 5, -9, 8, -42]
alternate_sort([5, -42, 2, -3, -4, 8, 9]) == [-3, 2, -4, 5, -42, 8, 9]
alternate_sort([5, 2, -3, -4, 8, -9]) == [-3, 2, -4, 5, -9, 8]
alternate_sort([5, 2, 9, 3, 8, 4]) == [2, 3, 4, 5, 8, 9]
```

Source: codewars | Difficulty: EASY
Tags: Sorting

Data structures

Starter code: def alternate_sort(l):
	

Solutions:
from itertools import chain, zip_longest

def alternate_sort(l):
	l = sorted(l, key=abs)
	(p, n) = ([n for n in l if n >= 0], [n for n in l if n < 0])
	return [n for n in chain(*zip_longest(n, p)) if n is not None]


def alternate_sort(l):
	a = sorted([i for i in l if i >= 0])[::-1]
	b = sorted([i for i in l if i not in a])
	res = []
	while len(a) or len(b):
		if len(b):
			res.append(b.pop())
		if len(a):
			res.append(a.pop())
	return res


from itertools import chain, zip_longest

def alternate_sort(l):
	return list(filter(lambda x: x is not None, chain(*zip_longest(sorted(filter(lambda x: x < 0, l))[::-1], sorted(filter(lambda x: x > -1, l))))))


from itertools import chain, zip_longest
sentinel = object()

def alternate_sort(l):
	positive = sorted(filter(0 .__le__, l))
	negative = sorted(filter(0 .__gt__, l), reverse=True)
	return list(filter(lambda x: x is not sentinel, chain.from_iterable(zip_longest(negative, positive, fillvalue=sentinel))))


def alternate_sort(l):
	res = sorted(l, key=lambda x: abs(x))
	n = 1
	new_l = []
	while res:
		for x in res:
			if (x >= 0, x < 0)[n % 2]:
				new_l.append(x)
				res.remove(x)
				break
		n += 1
	return new_l


def alternate_sort(list):
	positive_list = []
	negative_list = []
	for number in list:
		if number >= 0:
			positive_list.append(number)
		else:
			negative_list.append(number)
	positive_list.sort()
	negative_list.sort(reverse=True)
	i = 0
	for negative in negative_list:
		positive_list.insert(i * 2, negative)
		i += 1
	return positive_list


def alternate_sort(l):
	xs = sorted(l)
	(pos, neg, result) = ([], [], [])
	for x in xs:
		[pos, neg][x < 0].append(x)
	while pos and neg:
		result.extend([neg.pop(), pos.pop(0)])
	return result + neg[::-1] + pos


def alternate_sort(l):
	negatives = sorted((n for n in l if n < 0), key=abs)
	positives = sorted((n for n in l if n > -1))
	return [lst[i] for i in range(max(len(negatives), len(positives))) for lst in (negatives, positives) if i < len(lst)]


def alternate_sort(l):
	new = []
	neg = [x for x in l if x < 0]
	neg.sort()
	neg = neg[::-1]
	pos = [x for x in l if x >= 0]
	pos.sort()
	while neg or pos:
		if neg:
			new.append(neg.pop(0))
		if pos:
			new.append(pos.pop(0))
	return new


def alternate_sort(l):
	l = sorted(l, key=abs)
	positives = [n for n in l if n >= 0]
	negatives = [n for n in l if n < 0]
	result = []
	while positives and negatives:
		result.append(negatives.pop(0))
		result.append(positives.pop(0))
	return result + positives + negatives