Ben Nadel
On User Experience (UX) Design, JavaScript, ColdFusion, Node.js, Life, and Love.
Ben Nadel at Scotch On The Rocks (SOTR) 2011 (Edinburgh) with: Cyril Hanquez and Hugo Sombreireiro and Reto Aeberli and Steven Peeters and Guust Nieuwenhuis and Aurélien Deleusière and Damien Bruyndonckx
Ben Nadel at Scotch On The Rocks (SOTR) 2011 (Edinburgh) with: Cyril Hanquez@Fitzchev ) , Hugo Sombreireiro@hsombreireiro ) , Reto Aeberli@aeberli ) , Steven Peeters@aikisteve ) , Guust Nieuwenhuis@Lagaffe ) , Aurélien Deleusière@adeleusiere ) , and Damien Bruyndonckx ( @damienbkx )

Over-Complicating Getting the Rest of List

By Ben Nadel on
Tags: ColdFusion

Sometimes, I have a tendency to overcomplicate things. Such was a case with the idea of ListRest(). So many times, I have wanted to get the first item in a list, and then get the "rest" of the list. I never built it, but I always thought it would be great to have a ruction ListRest( intIndex ) that would return everything after the given index (in the list).

Then suddenly today, it hit me. D'uh!! That basically already exists. Its called ListDeleteAt(). Granted, in spirit it does not do the same exact thing I was thinking about, but in practicality, it does. I just wanted to get everything after the first item in a list. Hello ListDeleteAt( 1 ).

In this case, my inability to find a good solution was clearly determined by my inability to see the abstract problem beyond my choice of words. I thought to myself, I need to get the "rest." But bringing to an abstract level, all I needed to do was get everything but the first element.

I do that a lot, get caught up in the detail and fail to see the larger picture. I am trying.

Reader Comments

I almost don't want to post this, but it's a bit simpler than even that... :)

It'd work great for your initial problem, but you can't specify the index.

JHill, thanks for the link to the Live Docs. I think you make a good point, never hesitate to post up some good information. Not just for me, but for everyone else who stumbles across this post.