/Cello

Primary LanguageCMIT LicenseMIT

Cello

CI Status Version License Platform

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

Cello is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'Cello'

Example

#include "Cello.h"

int main(int argc, char** argv) {

  /* Stack objects are created using "$" */
  var i0 = $(Int, 5);
  var i1 = $(Int, 3);
  var i2 = $(Int, 4);

  /* Heap objects are created using "new" */
  var items = new(Array, Int, i0, i1, i2);
  
  /* Collections can be looped over */
  foreach (item in items) {
    print("Object %$ is of type %$\n",
      item, type_of(item));
  }
  
  /* Heap objects destructed via Garbage Collection */
  return 0;
}
#include "Cello.h"

int main(int argc, char** argv) {
  
  /* Shorthand $ can be used for basic types */
  var prices = new(Table, String, Int);
  set(prices, $S("Apple"),  $I(12)); 
  set(prices, $S("Banana"), $I( 6)); 
  set(prices, $S("Pear"),   $I(55)); 

  /* Tables also support iteration */
  foreach (key in prices) {
    var val = get(prices, key);
    print("Price of %$ is %$\n", key, val);
  }
  
  return 0;
}

Author

lilo, luolee.me@gmail.com

Thanks

orangeduck/Cello

License

Cello is available under the MIT license. See the LICENSE file for more info.