Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/fun/mod.ts>combinable.intercalcate

A collection of algebraic data types, lenses, and schemables based on a light weight higher kinded type implementation. Written for deno.
Latest
function combinable.intercalcate
import { combinable } from "https://deno.land/x/fun@v2.0.0/mod.ts";
const { intercalcate } = combinable;

Create a combinable that works like Array.join, inserting middle between every two values that are combineenated. This can have some interesting results.

Examples

Example 1

import * as SG from "./combinable.ts";
import * as S from "./string.ts";
import { pipe } from "./fn.ts";

const { combine: toList } = pipe(
  S.InitializableString,
  SG.intercalcate(", "),
);

const list = pipe(
  "apples",
  toList("oranges"),
  toList("and bananas"),
); // list === "apples, oranges, and bananas"

Parameters

middle: A