Re: Sbcl-help Digest, Vol 209, Issue 12; ftype
steve gonedes <[email protected]>
| Newsgroups | gmane.lisp.steel-bank.general |
|---|---|
| Message-ID | <[email protected]> |
On 6/18/24 17:03, [email protected] wrote: > Send Sbcl-help mailing list submissions to > [email protected] > > To subscribe or unsubscribe via the World Wide Web, visit > https://lists.sourceforge.net/lists/listinfo/sbcl-help > or, via email, send a message with subject or body 'help' to > [email protected] > > You can reach the person managing the list at > [email protected] > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Sbcl-help digest..." > > > Today's Topics: > > 1. Question of the day N1: DECLAIM and SETF (Marco Antoniotti) > 2. Question of the day N2: ~\Return (Marco Antoniotti) > 3. Re: Question of the day N1: DECLAIM and SETF (Richard M Kreuter) > 4. Re: Question of the day N1: DECLAIM and SETF (Marco Antoniotti) > > > > _______________________________________________ > Sbcl-help mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/sbcl-help why not do this.. (defun this (x &optional y) (declare (ignorable y)) (+ x (or y 0))) CL-USER> (describe #'this) #<FUNCTION THIS> [compiled function] Lambda-list: (X &OPTIONAL Y) Derived type: (FUNCTION (T &OPTIONAL T) (VALUES NUMBER &OPTIONAL)) Source form: (LAMBDA (X &OPTIONAL Y) (DECLARE (IGNORABLE Y)) (BLOCK THIS (+ X (OR Y 0)))) ; No value CL-USER> or (defun this (x &optional (y 0)) (declare (ignorable y)) (the fixnum (ldb (byte 48 0) (+ x (or y 0))))) either or the generic + is used. I see the need to declare functions; but this seems futile with sbcl; best to redefine the function (this) (defun $!this () (this)) if you want to inline code and get the type parser to work as best as possible keep the code in order. it would be nice to (defun this (x) (push x *lst*)) (defvar *this* nil) but it is not so easy...