Skip to content

Functional programming toolkit for Go

License

Notifications You must be signed in to change notification settings

mdwhatcott/funcy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

github.com/mdwhatcott/funcy [DEPRECATED]

NOTE: the funcy package described first below has been deprecated, in effect having been replaced by the funcy/ranger package (describe farther below).


GoDoc

What is this?

A library providing functional-style operations like Map/Reduce/Filter (to name a few) implemented in Go w/ generics.

But Rob Pike says we should just write for loops instead...

Sorry, I guess I just couldn't resist. I extend apologies to all the Go purists who are annoyed by this.

Are you aware that this approach lacks lazy evaluation, generates a ton of garbage, and won't scale for increasingly large inputs?

Yup. I extend apologies to all the functional purists who are annoyed by this.

How would one install it? (Asking for a friend...)

go get github.com/mdwhatcott/funcy

Enjoy!


github.com/mdwhatcott/funcy/ranger

GoDoc

Despite what I thought was a very cleverly written disclaimer (above), Go went and released version 1.23 with iterators, which means we can have our cake and eat it too, a phrase which here means that lazy evaluation is now possible and so we no longer need upset functional purists!

I'm not sure how Rob feels about all this, but I sincerely hope you do enjoy the funcy/ranger package, with many accompanying examples.