
A Recursive List Pattern
(without using map)
lad-hoc map-like
operations, build list outside-in, using recursion:
unwrap
wrap
static OpenList scale(long factor,
OpenList L)
{
if( L.isEmpty() )
return OpenList.nil;
long first = ((Long)L.first()).longValue();
Long result = new Long(factor*first);
return cons(result, scale(factor, L.rest());
}
recurse