Preferences

If your function changes it's behaviour based on the type, then it's not generic.

Your list_contains function should be able to just do a == comparison regardless of whether it's an int or a string.

This is effectively no different than adding a parameter to one of your non-"generic" functions and just swapping behaviour based on that?


This item has no comments currently.

Keyboard Shortcuts

Story Lists

j
Next story
k
Previous story
Shift+j
Last story
Shift+k
First story
o Enter
Go to story URL
c
Go to comments
u
Go to author

Navigation

Shift+t
Go to top stories
Shift+n
Go to new stories
Shift+b
Go to best stories
Shift+a
Go to Ask HN
Shift+s
Go to Show HN

Miscellaneous

?
Show this modal