How do you write this in lisp



I have a simplifying function called between() which is pretty slow.  Could anyone be kind enough to show me how to 
write the same function in Lisp so it is faster and still works in Maxima.  Compiling this does not produce significant 
improvement.

load("simplifying.lisp");

simpbetween(__x,__a,__b, [__option]):=
block(
 [prederror:false],
 if emptyp(__option) or first(__option) = 'fourier then
  if is(__x > __a) = true and is(__x < __b)=true then
   1
  elseif is(__x < __a)=true or is(__x > __b)=true then
   0
  elseif is(equal(__x,__a))=true or is(equal(__x,__b))=true then
   1/2
  elseif __b = 'inf then
  (
   (1 + signum(__x - __a))/2
  )
  elseif __a = 'minf then
  (
   (1 - signum(__x - __b))/2
  )
  elseif __a = 'minf and __b = 'inf then
   1
  elseif __a = 'minf and __b = 'minf then
   0
  elseif __a = 'inf and __b = 'inf then
   0
  else
   if emptyp(__option) then
    simpfuncall('between, __x, __a, __b)
   else
    simpfuncall('between, __x, __a, __b, first(__option))
 elseif first(__option) = 'closed then
  if is(__x >= __a) = true and is(__x <= __b)=true then
   1
  elseif is(__x < __a)=true or is(__x > __b)=true then
   0
  elseif __a = 'minf and __b = 'inf then
   1
  elseif __a = 'minf and __b = 'minf then
   0
  elseif __a = 'inf and __b = 'inf then
   0
  else
   simpfuncall('between, __x, __a, __b, first(__option))
 elseif first(__option) = 'open then
  if is(__x > __a) = true and is(__x < __b)=true then
   1
  elseif is(__x <= __a)=true or is(__x >= __b)=true then
   0
  elseif __a = 'minf and __b = 'inf then
   1
  elseif __a = 'minf and __b = 'minf then
   0
  elseif __a = 'inf and __b = 'inf then
   0
  else
   simpfuncall('between, __x, __a, __b, first(__option))
 elseif first(__option) = 'rclosed then
  if is(__x > __a) = true and is(__x <= __b)=true then
   1
  elseif is(__x <= __a)=true or is(__x > __b)=true then
   0
  elseif __a = 'minf and __b = 'inf then
   1
  elseif __a = 'minf and __b = 'minf then
   0
  elseif __a = 'inf and __b = 'inf then
   0
  else
   simpfuncall('between, __x, __a, __b, first(__option))
 elseif first(__option) = 'lclosed then
  if is(__x >= __a) = true and is(__x < __b)=true then
   1
  elseif is(__x < __a)=true or is(__x >= __b)=true then
   0
  elseif __a = 'minf and __b = 'inf then
   1
  elseif __a = 'minf and __b = 'minf then
   0
  elseif __a = 'inf and __b = 'inf then
   0
  else
   simpfuncall('between, __x, __a, __b, first(__option))
 else
  simpfuncall('between, __x, __a, __b, first(__option))
)$

simplifying(between, simpbetween)$