Subversion Repositories programming

Rev

Blame | Last modification | View Log | RSS feed

# Copyright: Ira W. Snyder
# Start Date: 07-12-2005
# End Date: 
# License: BSD License (http://www.opensource.org/licenses/bsd-license.php)
#
# Changelog Follows:
#
# 07-12-2005: adding car(), cdr(), null(), oddp(), evenp()
#

def null (LIST):
        if len (LIST) <= 0:
                return []

def car (LIST):
        if null (LIST):
                return []
        
        return LIST[0]

def cdr (LIST):
        if null (LIST):
                return []
        
        return LIST[1:]

def evenp (X):
        return not X % 2

def oddp (X):
        return not evenp (X)