Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Recursive Character Search and Destroy

Name: Anonymous 2007-05-11 16:50 ID:tCgeez6Q

I receive a string, and I want to remove any 'a', 'b' and 'c' characters, in a recursive way.

How do I do this in C and Java?

Thanks

Name: Anonymous 2007-05-11 17:03 ID:ze7o20Cd

>>1

@tail_call
def f(i, o=''):
  if not i: return o
  if i[0] in ['a', 'b', 'c']: return f(i[1:], o)
  return f(i[1:], o + i[0])

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List