Skip to content

Instantly share code, notes, and snippets.

@fbanados
Created May 23, 2017 01:18
Show Gist options
  • Save fbanados/d6e0134ff226abe71984a2221bbc7234 to your computer and use it in GitHub Desktop.
Save fbanados/d6e0134ff226abe71984a2221bbc7234 to your computer and use it in GitHub Desktop.
F#'s pipe operator for racket.
(define pipe
; Inspired on F#'s Forward pipe operator (|>)
(lambda args
(let ((v (car args))
(functions (cdr args)))
(foldl (λ (f v) (f v)) v functions))))
(test (pipe 1
add1
number->string
println)
(println
(number->string
(add1 1))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment