Assignment 3: Linda in ErlangThe objective of this assignment is to design and implement an Erlang module which implements a Linda-style tuple space and provides some of the standard tuple-space primitives. The InterfaceThe interface to the module must consist of the following collection of functions:
Representing Tuples and PatternsIn the interface functions, tuples are naturally represented by Erlang tuples. The representation of patterns – in the definition of the in function - should use a single "wild card" pattern any. The following Erlang function match defines when a pattern (the first argument) matches a given tuple (the second argument): match(any,_) -> true; match(P,Q) when is_tuple(P), is_tuple(Q) -> match(tuple_to_list(P),tuple_to_list(Q)); match([P|PS],[L|LS]) -> case match(P,L) of true -> match(PS,LS); false -> false end; match(P,P) -> true; match(_,_) -> false. For simplicity the function works at all types, not just tuple types. Implementation and Submission NotesThe implementation of the tuplespace does not have to use an efficient data structure – although ideally your code should be written is such a way that it should be easy to replace your internal representation of the tuplespace with a more efficient one. Requirements
On-line ResourcesThe following Erlang resources may be useful:
Last modified:
Sunday, 25-Sep-2011 18:15:01 CEST
|