Skip to main content

Timeline for The vanilla factorial challenge

Current License: CC BY-SA 4.0

8 events
when toggle format what by license comment
Aug 26, 2020 at 12:06 history edited Technohacker CC BY-SA 4.0
Add credit
Aug 26, 2020 at 11:07 history edited Technohacker CC BY-SA 4.0
Add closure-based solution
Aug 26, 2020 at 6:39 comment added madlaina Yes, you can just take the inputs as closure arguments, and you don't have to print the result, returning it is fine in most cases.
Aug 26, 2020 at 3:39 comment added Technohacker @madlaina Thank you! So that means I can use the function argument as input without taking it from program arguments I presume? Also I can't remember why I didn't use nth(), I guess I had issues with stdin, I'll change that too :)
Aug 25, 2020 at 19:10 comment added madlaina Sorry, I didn't see your answer before posting my own. You don't have to write a full program, a closure is fine for these sorts of challenges. You can use .nth(1) instead of .skip(1).next(). It is possible to return a Result from main, but unfortunately there's no standard type unifying NoneError from the Option and ParseIntError (Box<dyn std::error::Error> doesn't work because it's not implemented by NoneError (and probably shouldn't be)). In any case, the signature overhead is larger than the few bytes saved in most cases.
Aug 25, 2020 at 11:12 comment added Razetime codegolf.stackexchange.com/questions/74096/…
Aug 25, 2020 at 10:48 review First posts
Aug 25, 2020 at 11:01
Aug 25, 2020 at 10:47 history answered Technohacker CC BY-SA 4.0