3 ms·
I've written parsers in C, you get used to it. It would probably take you as long to write an integer parser in C as it would take me in Haskell.
by swiley 5y ago
I've written parsers in C, you get used to it. It would probably take you as long to write an integer parser in C as it would take me in Haskell.
- retrac 5y agoIt's literally two lines, yet it handles hexadecimal and octal too. :) Of course, if you set up some parser combinators with a nice library in C, it could be a one liner in C too. I figure it's not the language, so much as the libraries and tooling around the language. Back in the day, one couldn't stick a term in the project definition, have the compiler automatically download and assemble a library, then invoke it with one line in the program code, all within 10 seconds. You'd have to start with "is this a digit?" and build up from there, like I did back in my CS courses with Pascal, once upon a time.