Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

S-expression idioms

I am interested in S-expressions, but I still don't have the right idioms in mind.

Imagine a VLSI component, characterized by a name and a list of typed ports. What is preferable :

(component name (p1 float) (p2 float))

or

(component name ((p1 float) (p2 float)))

?

like image 232
JCLL Avatar asked Dec 04 '25 19:12

JCLL


2 Answers

The first says,

I am absolutely sure, for all time, that the component item consists of a name and 0-n ports, and nothing else.

The second states:

The component item consists of a name and a list of ports, and I might decide to add some other things later.

like image 161
bmargulies Avatar answered Dec 06 '25 12:12

bmargulies


I'd personally prefer the first because it's more readable/editable, but either is possible. It depends on how complicated your sexprs are going to be and how you're going to process them.

like image 39
Fred Foo Avatar answered Dec 06 '25 13:12

Fred Foo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!