Author Topic: xdata and the "{"  (Read 2771 times)

0 Members and 1 Guest are viewing this topic.

curmudgeon

  • Newt
  • Posts: 192
xdata and the "{"
« on: July 20, 2009, 04:23:24 PM »
I am wanting to attach a little xdata to some objects. I have read the tutorial on Afralisp, and several posts here.
my needs are quite simple, really.

I think I am understanding that the (1002 . "{") and  (1002 . "}")  codes are used to nest a list. but why you would want to escapes me.
unless it is to fit a schema?

I am wanting to attach one piece of text and one integer to electrical devices to represent the circuit number and number of watts associated with each entity. then I can select each device by circuit number, and sum the wattages in the panel. pretty simple, really helpful.

just don't see why I would need to group two or three items in a nested list.

???
Never express yourself more clearly than you are able to think.

gile

  • Water Moccasin
  • Posts: 2224
  • Marseille, France
Re: xdata and the "{"
« Reply #1 on: July 20, 2009, 04:35:03 PM »
Quote
ust don't see why I would need to group two or three items in a nested list.

I think you don't need to, you just can do it if you want
Speaking English as a French Frog

MP

  • Seagull
  • Posts: 17399
Re: xdata and the "{"
« Reply #2 on: July 20, 2009, 04:47:28 PM »
Like Gile said, the facility is there is you need it. For simple data structure it's overkill IMO. Unless something I write is intended to be publicly consumable or it would benefit from the stratification I don't bother. However, it's good to get used to using them, particularly parsing data that uses it, as it's very common in the industry, typically pairing descriptor keys with values within a "{" "}" sentinel pair.

Some typical Autoplant xdata to illuminate:

(-3
    (   "AT_GRP"

        (1002 . "{")
        (1000 . "MT")
        (1000 . "MS")
        (1002 . "}")

        (1002 . "{")
        (1000 . "GN")
        (1000 . "AT_FRJ70QGI_9RI")
        (1002 . "}")
    )

    (   "AT_COMP"

        (1002 . "{")
        (1000 . "MDL")
        (1000 . "Base")
        (1002 . "}")

        (1002 . "{")
        (1000 . "CLS")
        (1000 . "AT_PIPE_BEND")
        (1002 . "}")

        (1002 . "{")
        (1000 . "SPC")
        (1000 . "BRZ")
        (1002 . "}")

        (1002 . "{")
        (1000 . "STB")
        (1000 . "PIPE")
        (1002 . "}")
        ...
    )
    ...
)
   
\|// Set goal. Experiment tirelessly until
|Oo| practice has become expertise.  Loop.
|- | LinkedIn | Dropbox

curmudgeon

  • Newt
  • Posts: 192
Re: xdata and the "{"
« Reply #3 on: July 20, 2009, 05:27:21 PM »
many thanks.
Never express yourself more clearly than you are able to think.