Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • binary
  • boolean
  • byte
  • char
  • datetime
  • decimal
  • double
  • float
  • int
  • json
  • long int
  • string

C3 Also supports certain composites of primitive types. For example, the C3 Type Mapp  is a map between values and keys. We can create a map directly in python in two ways:

  1. Let C3 Figure out the type for us: c3.MappObj(value=python_obj) The new Mapp object can be accessed through the .value  property of the MappObj
  2. Tell C3 exactly which types are supported with c3.Mapp(c3.MappType.fromString("map<string,any>"), {'a': 5, 'b': [1,2,3]})

Similarly, C3 has the Arry  type which supports plain arrays. We can specify them in the same ways.

  1. Let C3 Figure out the type for us: c3.ArryObj(value=python_list)  The new Arry  object can be accessed through the .value  property of the ArryObj
  2. Tell C3 exactly which types are supported with c3.Arry(c3.ArryType.fromString('[int]'), [1,2,3,4]) 

In both cases, these primitive types aren't persisted. They can be used anywhere a C3 Type specifies it must have an Obj  type. (Especially useful for DynBatchJobs  or DynMapReduce jobs for contexts).

Additional Resources

...

The C3 AI Suite also supports abstract types. To define an Abstract Type, add the keyword 'abstract' before the Type definition. Abstract Types cannot be instantiated and must mix-in to another concrete Type. This provides a great way to standardize interfaces. Here's an example:

Code Block
abstract type InteraceInterface {
	field1: int
    method1: function(double): int
}

...