Lisp question

Discussion in 'AutoCAD' started by Rakesh Rao, Jan 3, 2004.

  1. Rakesh Rao

    Rakesh Rao Guest

    I am stumped on this. How do I find the value and type of a symbol name
    which will be passed from a VBA routine as a lisp function argument?

    For example,

    (setq Name "Rakesh")

    (setq Age 35)

    I need to write a function:

    (ValueOf "Name")

    should return "Rakesh"

    (ValueOf "Age")

    should return 35


    Any help is appreciated and thanks in advance.

    Regards
    Rakesh


    --

    AutoCAD customization for Engineering/Mapping/GIS
    Get GeoTools @ http://www.4d-technologies.com/geotools
    Build MyGeoTools @ http://www.4d-technologies.com/geotools/my_geotools.htm
    FREE downloads : http://www.4d-technologies.com/techcenter
    </PRE>
     
    Rakesh Rao, Jan 3, 2004
    #1
  2. Rakesh Rao

    morrisde Guest

    (eval Name)

    Is that what you mean?
     
    morrisde, Jan 3, 2004
    #2
  3. Rakesh Rao

    Rakesh Rao Guest

    Rakesh Rao, Jan 3, 2004
    #3
  4. There is no need for a function to determine the value of a symbol. The
    symbol is bound to its value and may be used wherever the value would be
    used, just like in VBA:

    (setq newValue (1+ Age))

    You can verify this by simply evaluating the symbol at the command line:

    Command: !Age
    35

    Command: !Name
    "Rakesh"

    As for determining the type of a symbol, use the TYPE function.

    --
    There are 10 kinds of people. Those who understand binary and those who
    don't.

    http://code.acadx.com
    (Pull the pin to reply)
     
    Frank Oquendo, Jan 3, 2004
    #4
  5. Rakesh Rao

    Tom Smith Guest

    Frank, he may not know that ! is shorthand for eval, to force the evaluation
    of a symbol.
     
    Tom Smith, Jan 5, 2004
    #5
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.