JsonTuple

io.github.cakelier.tuples.space.JsonTuple
See theJsonTuple companion object
sealed trait JsonTuple

A tuple, an object representing an immutable and ordered sequence of values of different types.

This implementation of a tuple is a "JSON" tuple, meaning that it is built on the fundamental concepts of the JSON format, enabling an easier exchange of data over the wire. This is because JSON is now the de-facto format for the data exchange on the web, which in turn is the standard for building distributed architectures, namely webservices. This means that a JSON tuple is the same concept as a JSON array, so an indexed sequence of values allowed in JSON, minus the "JSON object". Objects are not allowed since this would violate the rigid structure of a tuple: this would allow to objects to nest tuples inside them, which could nest other objects, which in turn could nest other tuples and so on and so forth. This would not correctly represent what in most programming languages is a sequence or list of elements. However, tuples can be nested into other tuples, enabling the equivalent of a matrix or of a jagged array. Their usefulness is in representing simple, not deeply nested data structures, such as messages or events exchanged in a distributed system.

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class #:
object JsonNil.type

Members list

Value members

Abstract methods

infix def #:(h: JsonElement): JsonTuple

The constructor method for a JSON tuple, creating a new tuple from this tuple prepending a new head element to it. Being an operator ending with ":", this method is right associative, allowing a syntax such as

The constructor method for a JSON tuple, creating a new tuple from this tuple prepending a new head element to it. Being an operator ending with ":", this method is right associative, allowing a syntax such as

val tuple = 0 #: true #: "hello" #: JsonNil

Value parameters

h

The new element to be prepended to this tuple, for creating a new tuple

Attributes

Returns

a new tuple with the new element prepended to this tuple