Type of extend function?

75 views
Skip to first unread message

Alex Cruise

unread,
Jul 23, 2009, 1:51:07 PM7/23/09
to frp-d...@googlegroups.com
The Tar Pit paper says:
> In FRP all essential state takes the form of relations, and the essential
> logic is expressed using relational algebra **extended** with (pure)
> user defined
> functions.
...but gives no formal definition of the extend function that's used in
the examples. Is it fair to say that the extend function takes a
relation (which can be base or derived) and one or more extended
attribute functions which are *strictly* functions from the row-type of
the relation given in the first argument?

Thanks!

-0xe1a

Alex Cruise

unread,
Jul 23, 2009, 2:01:48 PM7/23/09
to frp-d...@googlegroups.com
Alex Cruise wrote:
> ...but gives no formal definition of the extend function that's used
> in the examples. Is it fair to say that the extend function takes a
> relation (which can be base or derived) and one or more extended
> attribute functions which are *strictly* functions from the row-type
> of the relation given in the first argument?
OK, never mind, I see this now:
> PropertyInfo = extend(Property,
> (priceBand = priceBandForPrice(price)),
> (areaCode = areaCodeForAddress(address)),
> (numberOfRooms = count(restrict(RoomInfo | address == address))),
> (squareFeet = sum(roomSize, restrict(RoomInfo | address == address))))
So the extended attribute functions must:
- return a single value (as opposed to a relation), and;
- have as their domain either:
- global (e.g. an aggregation over relations), or;
- the row-type of the first argument

Anything else? :)

Thanks,

-0xe1a

Ben Moseley

unread,
Aug 8, 2009, 3:39:35 AM8/8/09
to frp-d...@googlegroups.com

Yes, that's the intention.

--Ben

Ben Moseley

unread,
Aug 8, 2009, 3:39:57 AM8/8/09
to frp-d...@googlegroups.com

On 23 Jul 2009, at 19:01, Alex Cruise wrote:
> Alex Cruise wrote:
>> ...but gives no formal definition of the extend function that's used
>> in the examples. Is it fair to say that the extend function takes a
>> relation (which can be base or derived) and one or more extended
>> attribute functions which are *strictly* functions from the row-type
>> of the relation given in the first argument?
> OK, never mind, I see this now:
>> PropertyInfo = extend(Property,
>> (priceBand = priceBandForPrice(price)),
>> (areaCode = areaCodeForAddress(address)),
>> (numberOfRooms = count(restrict(RoomInfo | address == address))),
>> (squareFeet = sum(roomSize, restrict(RoomInfo | address ==
>> address))))
> So the extended attribute functions must:
> - return a single value (as opposed to a relation), and;

Yes.

> - have as their domain either:
> - global (e.g. an aggregation over relations), or;

Not sure what you mean here. If you're just asking about identifiers
which are deemed in-scope, then, yes the intention is that the
universe of defined relations would be in scope.

> - the row-type of the first argument
>

Yes (assuming I've understood you correctly).

> Anything else? :)

Not that I can think of immediately ;-)

--Ben

Reply all
Reply to author
Forward
0 new messages