jaym / nim-pipeline

Pipline operator for Nim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pipeline

An example Nim macro that creates a pipeline operator (ie, Elixir, FSharp). For example, a function call foo(bar(1), "baz") can be written as bar(1) |> foo("baz")

Example

import pipeline

proc times(a, b: int) : int =
  result = a * b

proc plus(a, b: int) : int =
  result = a + b

echo plus(10,2) |> 
     times(2)   |>
     plus(1)

About

Pipline operator for Nim

License:MIT License


Languages

Language:Nim 100.0%