func (l *LinkedList) Update(n *Node, val GenericVal) {
	n.val = val
}
Update will update the value for a given node
package linkedlist
import "github.com/cheekybits/genny/generic"
var (
	zeroVal GenericVal
	zeroSum GenericSum
)
type GenericVal generic.Type
type GenericSum generic.Type
type LinkedList struct {
	head *Node
	tail *Node
	reporter bool
	len      int32
}
func (l *LinkedList) prepend(val GenericVal) (n *Node) {
	n = newNode(nil, l.head, val)
	if l.head != nil {
		l.head.prev = n
	}
	if l.tail == nil {
		l.tail = n
	}
	l.head = n
	l.len++
	return
}
func (l *LinkedList) append(val GenericVal) (n *Node) {
	n = newNode(l.tail, nil, val)
	if l.tail != nil {
		l.tail.next = n
	}
	if l.head == nil {
		l.head = n
	}
	l.tail = n
	l.len++
	return
}
func (l *LinkedList) mapCopy(fn MapFn) (nl *LinkedList) {
	nl = &LinkedList{reporter: true}
	l.ForEach(nil, func(n *Node, val GenericVal) bool {
		nl.append(fn(val))
		return false
	})
	return
}
func (l *LinkedList) mapModify(fn MapFn) (nl *LinkedList) {
	nl = l
	l.ForEach(nil, func(n *Node, val GenericVal) bool {
		n.val = fn(val)
		return false
	})
	return
}
func (l *LinkedList) filterCopy(fn FilterFn) (nl *LinkedList) {
	nl = &LinkedList{reporter: true}
	l.ForEach(nil, func(_ *Node, val GenericVal) bool {
		if fn(val) {
			nl.append(val)
		}
		return false
	})
	return
}
func (l *LinkedList) filterModify(fn FilterFn) (nl *LinkedList) {
	nl = l
	l.ForEach(nil, func(n *Node, val GenericVal) bool {
		if !fn(val) {
			l.Remove(n)
		}
		return false
	})
	return
}
func (l *LinkedList) Prepend(vals ...GenericVal) {
	for _, val := range vals {
		l.prepend(val)
	}
	return
}
func (l *LinkedList) Append(vals ...GenericVal) {
	for _, val := range vals {
		l.append(val)
	}
	return
}
func (l *LinkedList) Remove(n *Node) {
	if n.prev != nil {
		n.prev.next = n.next
	} else {
		if l.head = n.next; l.head != nil {
			l.head.prev = nil
		}
	}
	if n.next != nil {
		n.next.prev = n.prev
	} else {
		if l.tail = n.prev; l.tail != nil {
			l.tail.next = nil
		}
	}
	n.prev = nil
	n.next = nil
	n.val = zeroVal
	l.len--
}
func (l *LinkedList) ForEach(n *Node, fn ForEachFn) (ended bool) {
	if n == nil {
		n = l.head
	}
	var nn *Node
	for n != nil {
		nn = n.next
		if fn(n, n.val) {
			return true
		}
		n = nn
	}
	return false
}
func (l *LinkedList) ForEachRev(n *Node, fn ForEachFn) (ended bool) {
	if n == nil {
		n = l.tail
	}
	var pn *Node
	for n != nil {
		pn = n.prev
		if fn(n, n.val) {
			return true
		}
		n = pn
	}
	return false
}
func (l *LinkedList) Map(fn MapFn) (nl *LinkedList) {
	if l.reporter {
		return l.mapModify(fn)
	}
	return l.mapCopy(fn)
}
func (l *LinkedList) Filter(fn FilterFn) (nl *LinkedList) {
	if l.reporter {
		return l.filterModify(fn)
	}
	return l.filterCopy(fn)
}
func (l *LinkedList) Reduce(fn ReduceFn) (sum GenericSum) {
	l.ForEach(nil, func(_ *Node, val GenericVal) bool {
		sum = fn(sum, val)
		return false
	})
	return
}
func (l *LinkedList) Slice() (s []GenericVal) {
	s = make([]GenericVal, 0, l.len)
	l.ForEach(nil, func(_ *Node, val GenericVal) bool {
		s = append(s, val)
		return false
	})
	return
}
func (l *LinkedList) Val(n *Node) (val GenericVal) {
	return n.val
}