Subversion Repositories programming

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
115 ira 1
# Copyright: Ira W. Snyder
2
# Start Date: 07-12-2005
3
# End Date: 
4
# License: BSD License (http://www.opensource.org/licenses/bsd-license.php)
5
#
6
# Changelog Follows:
7
#
8
# 07-12-2005: adding car(), cdr(), null(), oddp(), evenp()
9
#
10
 
11
def null (LIST):
12
	if len (LIST) <= 0:
13
		return []
14
 
15
def car (LIST):
16
	if null (LIST):
17
		return []
18
 
19
	return LIST[0]
20
 
21
def cdr (LIST):
22
	if null (LIST):
23
		return []
24
 
25
	return LIST[1:]
26
 
27
def evenp (X):
28
	return not X % 2
29
 
30
def oddp (X):
31
	return not evenp (X)
32