AnalogClock






Friday, September 26, 2014

J and Python Tips

J
$: self reference for recursion etc.
Have to experiment with it

Python
Use seq[:1] and seq[-1:] first and last instead of seq[0] and seq[-1] to avoid index out of range exception for empty sequences
Generally, for all index n use seq[n:n+1] instead of seq[n] to avoid exceptions without having to add extra logic checks
>>> [][3:4]
[]