Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
LISP - simple novice request
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  9 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
ilias  
View profile  
 More options Sep 28 2002, 12:02 pm
Newsgroups: comp.lang.lisp
From: ilias <at_n...@pontos.net>
Date: Sat, 28 Sep 2002 19:11:00 +0300
Subject: LISP - simple novice request
;;;(trace (get-macro-character #\`) ) ; i could'nt get this work

;;;(get-macro-character #\`)          ; use this, to obtain the
                                       ; function name for your lisp

(trace SYSTEM::READ-BACKQUOTE)

works, but is implementation-dependent (here: lispworks)

CL-USER 7 : 1 > (get-macro-character #\`)
SYSTEM::READ-BACKQUOTE
NIL

2 return values.

(trace (get-macro-character #\`))

but it throws an error. why?

Error: The call
(#<function COMPILER::TRACE-FUNCTION 20AA1DE2> NIL (#\`))
does not match definition
(#<function COMPILER::TRACE-FUNCTION 20AA1DE2> DSPEC:DSPEC &REST
COMPILER::TRACE-INFO &KEY COMPILER::BEFORE COMPILER::AFTER
COMPILER::EVAL-BEFORE COMPILER::EVAL-AFTER BREAK COMPILER::BREAK-ON-EXIT
STEP WHEN COMPILER::ENTRYCOND COMPILER::EXITCOND COMPILER::TRACE-OUTPUT
COMPILER::PROCESS COMPILER::ALLOCATION COMPILER::INSIDE
COMPILER::BACKTRACE).

shoudn't simply the first return value (SYSTEM::READ-BACKQUOTE) be used?

i've tried:

(trace #'(get-macro-character #\`) )

but still an error.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Richard Krush  
View profile  
 More options Sep 28 2002, 1:06 pm
Newsgroups: comp.lang.lisp
From: Richard Krush <rkr...@gmx.net>
Date: 28 Sep 2002 10:06:18 -0700
Local: Sat, Sep 28 2002 1:06 pm
Subject: Re: LISP - simple novice request

ilias <at_n...@pontos.net> writes:
> (trace (get-macro-character #\`))
> ...
> (trace #'(get-macro-character #\`) )

ilias,

I'm sure somebody already told you this, but HyperSpec really is your
friend. If you would look TRACE up, you would see that the syntax is as
follows [*]:

        trace function-name*

Notice that TRACE does not accept a form or a s-expression, only a
function name. So instead of your (trace (get-macro-character #\`)) all
you needed to do was what you did with (trace SYSTEM::READ-BACKQUOTE),
simply pass a function name to it, resulting in (trace
get-macro-character).

  [*] http://www.lispworks.com/reference/HyperSpec/Body/m_tracec.htm

Good luck!

--
 Richard Krushelnitskiy   "I know not with what weapons World War III will
 rkrush (at) gmx.net       be fought, but World War IV will be fought with
 http://rkrush.cjb.net     sticks and stones." -- Albert Einstein


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ilias  
View profile  
 More options Sep 28 2002, 2:25 pm
Newsgroups: comp.lang.lisp
From: ilias <at_n...@pontos.net>
Date: Sat, 28 Sep 2002 21:34:13 +0300
Local: Sat, Sep 28 2002 2:34 pm
Subject: Re: LISP - simple novice request

i've maybe expressed things complicated.

how can i pass the function-name which returns as first value from the
function (get-macro-character #\`) to the function trace ?

(trace (get-macro-character #\`) ) ; does not work


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Richard Krush  
View profile  
 More options Sep 28 2002, 2:45 pm
Newsgroups: comp.lang.lisp
From: Richard Krush <rkr...@gmx.net>
Date: 28 Sep 2002 11:45:20 -0700
Local: Sat, Sep 28 2002 2:45 pm
Subject: Re: LISP - simple novice request

ilias <at_n...@pontos.net> writes:

> i've maybe expressed things complicated.

> how can i pass the function-name which returns as first value from the
> function (get-macro-character #\`) to the function trace ?

> (trace (get-macro-character #\`) ) ; does not work

My apologies, I think what would work is something like this:

   (trace #.(get-macro-character #\`))

The #. reader macro evaluates the expression which follows after it, but
during the read phase. For more information, check out the HyperSpec [*].

   [*] http://www.lispworks.com/reference/HyperSpec/Body/02_dhf.htm

Here's what I get in CMUCL:

* (trace #.(get-macro-character #\`))
(#<Function COMMON-LISP::BACKQUOTE-MACRO {1012E791}>)

Hopefully that's what you need, if other more experienced Lispers believe
this is a wrong way of doing this, please correct me.

--
 Richard Krushelnitskiy   "I know not with what weapons World War III will
 rkrush (at) gmx.net       be fought, but World War IV will be fought with
 http://rkrush.cjb.net     sticks and stones." -- Albert Einstein


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ilias  
View profile  
 More options Sep 28 2002, 2:57 pm
Newsgroups: comp.lang.lisp
From: ilias <at_n...@pontos.net>
Date: Sat, 28 Sep 2002 22:06:20 +0300
Local: Sat, Sep 28 2002 3:06 pm
Subject: Re: LISP - simple novice request

yes, this works.

although i'd like to know, if this is the only way.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Joseph Dale  
View profile  
 More options Sep 28 2002, 3:09 pm
Newsgroups: comp.lang.lisp
From: Joseph Dale <jdale1...@sbcglobal.net>
Date: Sat, 28 Sep 2002 19:08:14 GMT
Local: Sat, Sep 28 2002 3:08 pm
Subject: Re: LISP - simple novice request

ilias wrote:

> i've maybe expressed things complicated.

> how can i pass the function-name which returns as first value from the
> function (get-macro-character #\`) to the function trace ?

get-macro-character does not return a function name as its first value,
it returns a function.

http://www.lisp.org/HyperSpec/Body/fun_set-macro_ro-character.html

> (trace (get-macro-character #\`) ) ; does not work

That is because trace requires a function name as argument, and it is
being passed a function.

http://www.lisp.org/HyperSpec/Body/mac_tracecm_untrace.html

Joe


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ilias  
View profile  
 More options Sep 28 2002, 3:24 pm
Newsgroups: comp.lang.lisp
From: ilias <at_n...@pontos.net>
Date: Sat, 28 Sep 2002 22:33:36 +0300
Local: Sat, Sep 28 2002 3:33 pm
Subject: Re: LISP - simple novice request

if it is as you say:
how can i convert a function to a funtion-name?

btw:
this version of the CLHS is 'vendor-independent'.
this version of the CLHS has a serch-function for symbols
http://www.lisp.org/HyperSpec/FrontMatter/Symbol-Index.html


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Raffael Cavallaro  
View profile  
 More options Sep 29 2002, 11:42 am
Newsgroups: comp.lang.lisp
From: Raffael Cavallaro <raffaelcavall...@junk.mail.me.not.mac.com>
Date: Sun, 29 Sep 2002 15:31:27 GMT
Local: Sun, Sep 29 2002 11:31 am
Subject: Re: LISP - simple novice request
In article <an4vlq$31...@usenet.otenet.gr>, ilias <at_n...@pontos.net>
wrote:

> if it is as you say:
> how can i convert a function to a funtion-name?

If you define this function:

(defun name-of-function ( a-function)
        (nth-value 2 (function-lambda-expression a-function)))

Then you can do things like:

? (name-of-function #'car)
CAR

? (name-of-function (symbol-function 'car))
CAR

Unfortunately, function-lambda-expression is not required to return a
usable name, so it may not return a name of (get-macro-character #\`)
that is usable by trace (it doesn't in OpenMCL, for example).

from the spec:

"The tertiary value, name, is the ``name'' of function. The name is
intended for debugging only and is not necessarily one that would be
valid for use as a name in defun or function, for example. By
convention, nil is used to mean that function has no name. Any
implementation may legitimately return nil as the name of any function."

As a broader issue, you should be aware that whatever the name of
(get-macro-character #\`) is in your implimentation - it happens to be
CCL::|` reader| in OpenMCL - may be inlined, and so not produce any
usable results from trace.

again, from the spec:

"If a function to be traced has been open-coded (e.g., because it was
declared inline), a call to that function might not produce trace
output."

So you might want to reconsider your broader goal here.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ilias  
View profile  
 More options Sep 29 2002, 3:50 pm
Newsgroups: comp.lang.lisp
From: ilias <at_n...@pontos.net>
Date: Sun, 29 Sep 2002 22:59:58 +0300
Local: Sun, Sep 29 2002 3:59 pm
Subject: Re: LISP - simple novice request
Raffael Cavallaro wrote:

[...]

> "If a function to be traced has been open-coded (e.g., because it was
> declared inline), a call to that function might not produce trace
> output."

> So you might want to reconsider your broader goal here.

i see.

basically i'd like to trace the expansion of `.

i could hook the macrofunction, too.

<store the function that returns> (get-macro-character #\`)

(set-macro-character #\` #'(lambda (stream char)
                     (format T "~% BACKQUOTE EXPANSION ~% ")
                     (<functioncall> <stored function> stream char))

something like that.

but maybe this runs into the same problems.

i don't know.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »