This question already has an answer here:
- Can I write a golfing library? 4 answers
My read on the current state of meta.CG opinion is that the use of libraries is acceptable and that the library call should count in the character count:
And from this discussion I conclude that there isn't really a consensus around whether or not languages specifically built for golfing should be allowed (but GolfScript is used to answer questions all the time, so perhaps that's as definitive an answer as one can get):
Would the use of a code golfing library therefore be acceptable? I'm thinking of a library that:
- Has a one-letter name (so calling it would require something like
library(g)-- 10 characters)
- Shortens commonly used function names (
- Curries a few functions so that defaults agree with their common usage in golfing
- Loads a few commonly used libraries (so commonly used that they are pretty much part of the canon in answering questions on SO)
- Would be a general-purpose library (e.g. it wouldn't be updated just to solve a particular problem)
It seems to me that:
- You incur a fairly major upfront cost (10 or so characters) and get a benefit down the road. Not unlike the common golfing trick of shortening functions that you use twice (e.g.
- For short problems this would be at best a slight advantage and for long ones it would be a huge advantage.
- This may help to even out the cross-language differences in function lengths
Sounds like a reasonable compromise to me, but curious what others think.