Skip to content

Instantly share code, notes, and snippets.

@rocketnia
Created July 12, 2011 15:58
Show Gist options
  • Save rocketnia/1078269 to your computer and use it in GitHub Desktop.
Save rocketnia/1078269 to your computer and use it in GitHub Desktop.
; colon-pipes.arc
;
; Copyright 2011 Ross Angle. However, you can use this for whatever
; you want. Don't bother giving me credit.
;
;
; This was made based on an idea expressed at
; <http://arclanguage.org/item?id=13450> and again at
; <http://arclanguage.org/item?id=14870>. Instead of writing this:
;
; (accum acc
; (each x args
; (acc (* 2 x))))
;
; You can write this:
;
; (// accum acc :
; each x args :
; acc : * 2 x)
(mac // body
(aif (pos ': body)
(let (before (nil . after)) (split body it)
`(,@before (// ,@after)))
body))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment