Hacker News new | past | comments | ask | show | jobs | submit login

my fave snippet is from line 206:

            }
          }
        }
      }
    }
  }
To be fair I've seen that pattern in just about every codebase I've touched, sadly.



What do you mean? Is that considered too deep nesting? (I'm not trying to be sarcastic.)


It means nikatwork is not going to like the aesthetics of lisp.


I like Lisp.

My problem with this code is not aesthetics. This logic is too deeply nested, by the time you hit the last conditional there is way too much going on[1].

Perl makes it especially nice to flatten logic due to RHS conditionals, eg "x++ if y;". Here is my two minute flattening job[2], it prob has syntactic errors but you get the gist.

[1] http://en.wikipedia.org/wiki/The_Magical_Number_Seven,_Plus_...

[2] http://pastebin.com/4TDVftpJ


Needs more maps and greps. :)

Seriously though, I use maps and greps a lot now, often chained to transform a data structure from one type to another. I'm annoyed when I have to drop to a for(each) loop.


Yeah maps are awesome! I only changed the conditionals and nothing else, to show how easy it is to flatten deeply-nested logic.




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

Search: