public T Peek() => forward.Peek();
/// <summary> /// Peek and match /// </summary> /// <param name="Some">Handler if there is a value on the top of the stack</param> /// <param name="None">Handler if the stack is empty</param> /// <returns>Untouched stack</returns> public static Stck <T> peek <T>(Stck <T> stack, Action <T> Some, Action None) => stack.Peek(Some, None);
/// <summary> /// Peek and match /// </summary> /// <typeparam name="R">Return type</typeparam> /// <param name="Some">Handler if there is a value on the top of the stack</param> /// <param name="None">Handler if the stack is empty</param> /// <returns>Return value from Some or None</returns> public static R peek <T, R>(Stck <T> stack, Func <T, R> Some, Func <R> None) => stack.Peek(Some, None);
/// <summary> /// Return the item on the top of the stack without affecting the stack itself /// NOTE: Will throw an InvalidOperationException if the stack is empty /// </summary> /// <exception cref="InvalidOperationException">Stack is empty</exception> /// <returns>Top item value</returns> public static T peek <T>(Stck <T> stack) => stack.Peek();