Working-With-an-Association-List

Working With an Association List

Working With an Association List

You can pass the association list in the gp_PathData variable to the gp:drawOutline function by invoking the function as follows:

(gp:drawOutline gp_PathData)

Simple enough, but you also need to figure out how to process the information stored
in the association list. The Visual LISP Inspect feature can help you determine what
to do.

To use the Visual LISP Inspect feature to analyze your association list

  1. Load the code that is in the text editor window.
  2. Enter the following expression at the Console prompt:
    (setq BoundaryData (gp:getPointInput))

    Visual LISP will store the information you provide in a variable named BoundaryData.

  3. Respond to the prompts for start point, endpoint, and half-width.
  4. Select the BoundaryData variable name in the Console window by double-clicking it.
  5. Click View Inspect from the Visual LISP menu.

    Visual LISP displays a window like the following:

    The Inspect window shows you each sublist within the BoundaryData variable.

  6. Enter the following at the Visual LISP Console prompt:
    (assoc 50 BoundaryData)

    The assoc function returns the entry in the association list that is identified by the specified
    key. In this example, the specified key is 50; this is associated with the angle of
    the garden path (see Putting Association Lists to Use for a list of the key-value
    pairs defined for this application).

  7. Enter the following at the Visual LISP Console prompt:
    (cdr (assoc 50 BoundaryData))

    The cdr function returns the second element, and any remaining elements after that, from
    a list. In this example, cdr retrieves the angle value, which is the second and last element in the entry returned
    by the assoc function.

    By this point, you should have no trouble understanding the following code fragment:

    (setq PathAngle  (cdr (assoc 50 BoundaryData))
            Width      (cdr (assoc 40 BoundaryData))
            HalfWidth  (/ Width 2.00)
            StartPt    (cdr (assoc 10 BoundaryData))
            PathLength (cdr (assoc 41 BoundaryData))

Learning AutoCad

u can pass the association list in the gp_PathData variable to the gp: drawOutline function by invoking the function as follows: (gp:drawOutline gp_PathData) …Association Lists. An association list, or a-list, is a data structure used very frequently in Lisp. An a-list is a list of pairs (conses); each pair is an association.association list , or alist for short, records a mapping from keys to values. It is a list of cons cells called associations : the car of each cons cell is the key , and …associations can be found just about everywhere. An internet search of the words “association” plus the name of your city may turn up a surprisingly large list  …association list, often referred to as an alist, is a linked list in which each list element (or node) comprises a …list p q)) ;; <—- (display ( zip x y)) ;; ((1 4) (2 5) (3 6)). Result: http://www.ideone.com/ …… Elisp: Association List … Associative List (aka “alist”) is a datatype in Emacs Lisp. … There are functions that's designed for working with alist.… Deep integration into the language – many old commands work on …. The language support for Association s is approaching that for List -s.list of associations, which is also used in the case of ….. It seems to work but I do get interpretation warnings and the Objects are …lists, associations are fundamental constructs in the Wolfram Language. They associate keys with values, allowing highly efficient lookup and  …

نظرات کاربران



درباره نویسنده



بنده سیامک دوستداری فارغ التحصیل رشته مکانیک سنگ از دانشگاه صنعتی اصفهان هستم، و در این وبسایت آموزش های مربوط به نحوه برنامه نویسی در اتوکد و هچنین آموزش تصویری دستورات اتوکد را قرار خواهم داد.

تلفن همراه: ۰۹۰۰۱۲۳۴۴۴۴

ایمیل: s.doostdari@gmail.com

ترفند های اتوکد



دسته بندی مطالب​