ble val) {
  a[index] = val;
}
int *new_int(int size) {
  return (int *) malloc(size*sizeof(int));
}
void delete_int(int *a) {
  free(a);
}
int get_int(int *a, int index) {
  return a[index];
}
int set_int(int *a, int index, int val) {
  a[index] = val;
}
%}

</pre></div>

<p>
While these could be called directly, we could also write a Tcl script
like this :
</p>

<div class="code"><pre>
proc Array {type size} {
    set ptr [new_$type $size]
    set code {
        set method [lindex $args 0]
        set par