From: peng
Subject: help me understand some codes
Date: 
Message-ID: <1102448485.1fd311f70054b1589865c582e6a579ea@tng>
hi there,
I need your help to understand the syntax of each row in below lisp
codes written in ACL. especially the use of " -> ","->*" and
declaration here.

;---
(defun well-sorted-p (x &optional subst (sort top-sort))
;; determines if expression is well sorted
;; it does this by doing well-sorting on the expression
;; with the restriction that no instantiation be done
(prog->
(quote t -> *%checking-well-sorted-p%*)
(well-sort x subst sort ->* subst)
(declare (ignore subst))
(return-from prog-> t)))
;---

Thank in advance for your kindly help.



--
peng
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------
 
From: Pascal Bourguignon
Subject: Re: help me understand some codes
Date: 
Message-ID: <87fz2hzqqd.fsf@thalassa.informatimago.com>
peng <···········@mail.codecomments.com> writes:

> hi there,
> I need your help to understand the syntax of each row in below lisp
> codes written in ACL. especially the use of " -> ","->*" and
> declaration here.
> 
> ;---
> (defun well-sorted-p (x &optional subst (sort top-sort))
> ;; determines if expression is well sorted
> ;; it does this by doing well-sorting on the expression
> ;; with the restriction that no instantiation be done
> (prog->
> (quote t -> *%checking-well-sorted-p%*)
> (well-sort x subst sort ->* subst)
> (declare (ignore subst))
> (return-from prog-> t)))
> ;---
> 
> Thank in advance for your kindly help.

prog-> is not in CLHS, not in the package COMMON-LISP.

So it must be either an implementation provided symbol (check the
documentation of your implementation), or a function (or I'd bet a
macro in this case) of the software you're looking at.  Search its
definition in the sources and read the documentation.


Dynamically, you can ask the lisp system what it knows about it:

(describe      'prog->)
(documentation 'prog-> nil)
(documentation 'prog-> 'function)

and if it's a macro, you can see what it does with:

(macroexpand-1 '(prog->
                  (quote t -> *%checking-well-sorted-p%*)
                  (well-sort x subst sort ->* subst)
                  (declare (ignore subst))
                  (return-from prog-> t)))


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
The world will now reboot; don't bother saving your artefacts.