Re: A simple notation, again
From: mAsterdam <mAsterdam_at_vrijdag.org>
Date: Sun, 22 Jul 2007 22:27:53 +0200
Message-ID: <46a3bd80$1$336$e4fe514c_at_news.xs4all.nl>
>>> Using the notation [A B C] for <NOT> (A <AND> B <AND> C), etc.
>>>
>>> The following [ A [B]] means "A implies B" for Boolean algebra.
>>> What is
>>> the corresponding thing for Relational Algebra?
>>>
>>> Also, I'm trying to come up with a bracket notation for a "literal
>>> relation", like literals for simple datatypes like numbers and
>>> character strings.
>>>
>>> I'm toying with this:
>>>
>>> [["David" "Cressey" 1]
>>> ["Marshall" "Spight" 2]
>>> ["Bob" "Badour" 3]
>>> ["Jan" Hidders" 4]]
>>>
>>>
>>> This would represent a relation of order 3 and cardinality 4.
>>>
>>> What I don't like about this is that the binding between attribute
>>> values and attribute names is by position
>>> rather than by name, and in fact the attribute names don't even
>>> appear here. That's unacceptably bad. The symmetry is appealing, but
>>> it clearly needs improvement.
>>>
>>> Does tutorial D have a way of laying out a relation as an explicit
>>> literal character string?
] Received on Sun Jul 22 2007 - 22:27:53 CEST
Date: Sun, 22 Jul 2007 22:27:53 +0200
Message-ID: <46a3bd80$1$336$e4fe514c_at_news.xs4all.nl>
David Cressey wrote:
> Brian Selzer wrote: >> David Cressey wrote:
>>> Using the notation [A B C] for <NOT> (A <AND> B <AND> C), etc.
>>>
>>> The following [ A [B]] means "A implies B" for Boolean algebra.
>>> What is
>>> the corresponding thing for Relational Algebra?
>>>
>>> Also, I'm trying to come up with a bracket notation for a "literal
>>> relation", like literals for simple datatypes like numbers and
>>> character strings.
>>>
>>> I'm toying with this:
>>>
>>> [["David" "Cressey" 1]
>>> ["Marshall" "Spight" 2]
>>> ["Bob" "Badour" 3]
>>> ["Jan" Hidders" 4]]
>>>
>>>
>> How about something like this >> {(Last, First, Num) : >> ("David", "Cressey", 1), >> ("Marshall", "Spight", 2), >> ("Bob", "Badour", 3), >> ("Jan", "Hidders", 4)} >>
>>> This would represent a relation of order 3 and cardinality 4.
>>>
>>> What I don't like about this is that the binding between attribute
>>> values and attribute names is by position
>>> rather than by name, and in fact the attribute names don't even
>>> appear here. That's unacceptably bad. The symmetry is appealing, but
>>> it clearly needs improvement.
>>>
>>> Does tutorial D have a way of laying out a relation as an explicit
>>> literal character string?
> > I like the colon. I'd like to stay within the square > bracket notation, if possible.
</lurk>
Your call. Hey! It is your notation.
What about the relation name in the literal?
[Person[ ... ?[[ ... would be an anonymous relation ?
colons are also used to denote types.
Combining an relationname and both colons would make the literal look like:
[Person[Last:doublequotedstring First:doublequotedstring Num:decimalnumber]:
["David" "Cressey" 1] ["Marshall" "Spight" 2] ["Bob" "Badour" 3] ["Jan" Hidders" 4]]
... though I would prefer commmas like in Brian's version, avoiding the need for CamelCasing or lots of underscores.
[Person [
Last:doublequoted string,
First:doublequoted string,
Num:decimal number
]
:
["David", "Cressey", 1] ["Marshall", "Spight", 2] ["Bob", "Badour", 3] ["Jan", Hidders", 4]
] Received on Sun Jul 22 2007 - 22:27:53 CEST