🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.lang.lisp.x
1 messages
1 total messages Started by Strong datatypes for weak minds. Wed, 02 Sep 1992 13:57
n! for xlisp
#92
Author: Strong datatypes for weak minds.
Date: Wed, 02 Sep 1992 13:57
23 lines
1204 bytes
	kan@dg-rtp.dg.com was nice enough to mail me this, which
	works in XLISP V1.1..2.1 and also traps the negative number 
	case:

		(defun factorial (x)
		  (cond ((> x 1) (* x (factorial (- x 1))))
			((> x -1) 1)
			(t nil)))

	I think the error in my ways is that I was using my CP/M
	laptop where XLISP 1.1 only has integers in the range of
	-32768 to +37767 and it was too late for me to notice
	why (factorial 9) didn't work.

	(Please don't tell me the error in my ways was using CP/M
	in 1992.  I've had my NEC 8400 laptop for ~7 years and can't
	afford anything that small and more powerful on my income...
	otherwise I'd be using Scheme or a Forth-variant like UNTIL.
	Besides, the NEC does words and plays ANSI terminal just fine.)

	Regards,
	rcs
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads