Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Sure, there's other ways to write it, the point of the post was Lisp's syntax, not the algorithm I used to demonstrate some features of it. You could write examples like yours in Lisp or Python, too. As well, your examples both slurp the whole file into memory, which mine avoided.

edit: And your C# version is only 24 non-whitespace characters shorter than the Python version, and 20 of those are because you called your variables 'f' instead of 'filespec' and 'w' instead of 'word'. A 4 non-whitespace character difference makes it exceedingly long and verbose? Or are you just advocating 1-letter variable names and avoiding newlines?



The c# version is calling only 4 methods and in C# you obviously have to declare the types. It’s the difference between declarative style versus imperative that I wanted to highlight, obviously Python is more compact than C#, but written in that way it becomes more verbose and more difficult to read and write. Write something like that in Lisp and let’s see how it compares.


Isn't "kv => kv.Key" a lambda function that is called?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: