unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Built-in Functions and Special Forms
@ 2003-02-26 20:50 Artist
  2003-02-26 21:08 ` Barry Margolin
  2003-02-27  1:38 ` Pascal Bourguignon
  0 siblings, 2 replies; 8+ messages in thread
From: Artist @ 2003-02-26 20:50 UTC (permalink / raw)


Hi,
 I have been using emacs now for over an year.
 and now I like to know how I can do some work with lisp.
 
 How I can find the built-in functions for lisp:

 command-index for emacs or C-h f TAB won't work here cause it will
also give me the function defined in .el or .elc files.

 I am looking more like  more or less like:

(nth N LIST)
(eq OBJ1 OBJ2)
(> NUM1 NUM2)
(% X Y)

Similary for Special Forms:

 I am seeking the list like:

(defun NAME ARGLIST [DOCSTRING] BODY...)
(let VARLIST BODY...)
(if COND THEN ELSE...)
(setq SYM VAL SYM VAL ...)
(while TEST BODY...)
(function ARG)
(quote ARG)
(progn BODY ...)

Thanks for help in advance.

Artist.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Built-in Functions and Special Forms
  2003-02-26 20:50 Built-in Functions and Special Forms Artist
@ 2003-02-26 21:08 ` Barry Margolin
  2003-02-27  0:02   ` Unknown
  2003-02-27  1:38 ` Pascal Bourguignon
  1 sibling, 1 reply; 8+ messages in thread
From: Barry Margolin @ 2003-02-26 21:08 UTC (permalink / raw)


In article <de3ad953.0302261250.5fbca113@posting.google.com>,
Artist <googleartist@yahoo.com> wrote:
>Hi,
> I have been using emacs now for over an year.
> and now I like to know how I can do some work with lisp.
> 
> How I can find the built-in functions for lisp:

Read the Emacs Lisp Reference Manual.

-- 
Barry Margolin, barry.margolin@level3.com
Genuity Managed Services, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Built-in Functions and Special Forms
  2003-02-26 21:08 ` Barry Margolin
@ 2003-02-27  0:02   ` Unknown
  0 siblings, 0 replies; 8+ messages in thread
From: Unknown @ 2003-02-27  0:02 UTC (permalink / raw)


Barry Margolin wrote:

> In article <de3ad953.0302261250.5fbca113@posting.google.com>,
> Artist <googleartist@yahoo.com> wrote:
>>Hi,
>> I have been using emacs now for over an year.
>> and now I like to know how I can do some work with lisp.
>> 
>> How I can find the built-in functions for lisp:
> 
> Read the Emacs Lisp Reference Manual.

I concur.  It's very well written.  Very useful.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Built-in Functions and Special Forms
  2003-02-26 20:50 Built-in Functions and Special Forms Artist
  2003-02-26 21:08 ` Barry Margolin
@ 2003-02-27  1:38 ` Pascal Bourguignon
  2003-02-27  3:42   ` Greg Hill
  2003-02-27  7:31   ` Miles Bader
  1 sibling, 2 replies; 8+ messages in thread
From: Pascal Bourguignon @ 2003-02-27  1:38 UTC (permalink / raw)


googleartist@yahoo.com (Artist) writes:

> Hi,
>  I have been using emacs now for over an year.
>  and now I like to know how I can do some work with lisp.
>  
>  How I can find the built-in functions for lisp:

(let ((internals ()))
  (mapatoms (lambda (sym)
              (when (and (functionp sym) (subrp (symbol-function sym)))
                (push sym internals))))
  (insert (format "%S\n" internals)))

I've not found any predicate to distinguish between built-in functions
and special forms.


-- 
__Pascal_Bourguignon__                   http://www.informatimago.com/
----------------------------------------------------------------------
There is a fault in reality. Do not adjust your minds. -- Salman Rushdie

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Built-in Functions and Special Forms
  2003-02-27  1:38 ` Pascal Bourguignon
@ 2003-02-27  3:42   ` Greg Hill
  2003-02-27  7:31   ` Miles Bader
  1 sibling, 0 replies; 8+ messages in thread
From: Greg Hill @ 2003-02-27  3:42 UTC (permalink / raw)


At 2:38 AM +0100 2/27/03, Pascal Bourguignon wrote:
>I've not found any predicate to distinguish between built-in functions
>and special forms.

In Emacs-21, the documentation is consistent enough that this seems 
to always work.

(defun special-form-p (symbol)
     (string-match "\\.\\.\\.\\|&rest" (documentation symbol)))

--Greg

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Built-in Functions and Special Forms
@ 2003-02-27  4:02 Greg Hill
  0 siblings, 0 replies; 8+ messages in thread
From: Greg Hill @ 2003-02-27  4:02 UTC (permalink / raw)



[-- Attachment #1.1: Type: text/plain, Size: 521 bytes --]

>At 2:38 AM +0100 2/27/03, Pascal Bourguignon wrote:
>>I've not found any predicate to distinguish between built-in functions
>>and special forms.
>
>In Emacs-21, the documentation is consistent enough that this seems 
>to always work.
>
>(defun special-form-p (symbol)
>     (string-match "\\.\\.\\.\\|&rest" (documentation symbol)))

Of course that should really be:

(defun special-form-p (symbol)
     (and (subrp (symbol-function symbol))
          (string-match "\\.\\.\\.\\|&rest" (documentation symbol))))

--Greg

[-- Attachment #1.2: Type: text/html, Size: 1399 bytes --]

[-- Attachment #2: Type: text/plain, Size: 151 bytes --]

_______________________________________________
Help-gnu-emacs mailing list
Help-gnu-emacs@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnu-emacs

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Built-in Functions and Special Forms
  2003-02-27  1:38 ` Pascal Bourguignon
  2003-02-27  3:42   ` Greg Hill
@ 2003-02-27  7:31   ` Miles Bader
  1 sibling, 0 replies; 8+ messages in thread
From: Miles Bader @ 2003-02-27  7:31 UTC (permalink / raw)
  Cc: help-gnu-emacs

Pascal Bourguignon <pjb@informatimago.com> writes:
> I've not found any predicate to distinguish between built-in functions
> and special forms.

See `subr-arity'.

-Miles
-- 
o The existentialist, not having a pillow, goes everywhere with the book by
  Sullivan, _I am going to spit on your graves_.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Built-in Functions and Special Forms
       [not found] <mailman.2511.1046318512.21513.help-gnu-emacs@gnu.org>
@ 2003-02-28 18:51 ` Artist
  0 siblings, 0 replies; 8+ messages in thread
From: Artist @ 2003-02-28 18:51 UTC (permalink / raw)


Greg Hill <ghill@synergymicro.com> wrote in message news:<mailman.2511.1046318512.21513.help-gnu-emacs@gnu.org>...
> >At 2:38 AM +0100 2/27/03, Pascal Bourguignon wrote:
> >>I've not found any predicate to distinguish between built-in functions
> >>and special forms.
> >
> >In Emacs-21, the documentation is consistent enough that this seems 
> >to always work.
> >
> >(defun special-form-p (symbol)
> >     (string-match "\\.\\.\\.\\|&rest" (documentation symbol)))
> 
> Of course that should really be:
> 
> (defun special-form-p (symbol)
>      (and (subrp (symbol-function symbol))
>           (string-match "\\.\\.\\.\\|&rest" (documentation symbol))))
> 
> --Greg
> --
Code below works fine.
(defun my-special-forms ()
(let
    ((internals () ))
  (mapatoms (lambda (sym)
	      (when
		  (and 
		   (functionp sym)
		   (subrp (symbol-function sym))
		   (eq 'unevalled (cdr (subr-arity (symbol-function sym))))
		   )
		(push sym internals)
		)

	      )
	    )
  internals
;  (insert (format "%S\n" internals))
)
)

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2003-02-28 18:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-02-26 20:50 Built-in Functions and Special Forms Artist
2003-02-26 21:08 ` Barry Margolin
2003-02-27  0:02   ` Unknown
2003-02-27  1:38 ` Pascal Bourguignon
2003-02-27  3:42   ` Greg Hill
2003-02-27  7:31   ` Miles Bader
  -- strict thread matches above, loose matches on Subject: below --
2003-02-27  4:02 Greg Hill
     [not found] <mailman.2511.1046318512.21513.help-gnu-emacs@gnu.org>
2003-02-28 18:51 ` Artist

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).