[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: functional languages ill-suited for large programs?



Pascal Costanza <costanza@web.de> responds:
> 
> On 1. Nov 2003, at 00:56, Jan-Willem Maessen wrote:
> 
> > peculier Car _ = Car
> > peculier _ Truck = Truck
> > peculier _ _      = error "Ack!"
> >
> > How would you write the above in CLOS?  How would you explain it?
> 
> What's wrong with:
> 
> (defmethod peculier ((car car) par2)
>    (declare (ignore par2))
>    car)
> 
> (defmethod peculier (par1 (truck truck))
>    (declare (ignore par1))
>    truck)
> 
> (defmethod peculier (par1 par2)
>    (declare (ignore par1 par2))
>    (error "Ack!"))

What is (peculier Car Truck)?  In my code it's Car.  Can you explain
in simple terms what I'd need to do to get the same answer in CLOS?
Can you justify any redundancy you might introduce?

-Jan-Willem Maessen
jmaessen@alum.mit.edu