// Generated by bynkc — do not edit by hand.
// commons shop

import { Ok, Err, Some, None, type Result, type Option, type ValidationError } from "../runtime.js";

import { all, any, filter, find, map } from "../bynk/list.js";

export function doubled(xs: readonly number[]): readonly number[] {
  return map(xs, (x) => x * 2);
}

export function bigOnly(xs: readonly number[]): readonly number[] {
  return filter(xs, (x) => x > 10);
}

export function firstBig(xs: readonly number[]): Option<number> {
  return find(xs, (x) => x > 10);
}

export function anyBig(xs: readonly number[]): boolean {
  return any(xs, (x) => x > 10);
}

export function allBig(xs: readonly number[]): boolean {
  return all(xs, (x) => x > 10);
}

export function sumBy<A>(xs: readonly A[], f: (a0: A) => number): number {
  return ((__xs: readonly A[], __acc: number, __f: (acc: number, x: A) => number) => { for (const __x of __xs) __acc = __f(__acc, __x); return __acc; })(xs, 0, (acc, x) => acc + f(x));
}

export function total(xs: readonly number[]): number {
  return sumBy(doubled(xs), (x) => x);
}

