Re: Help with Templates, cannot find missing implementation somewhere...

2022-01-01 Thread d4v3y_5c0n3s
That seems to have fixed my issue, thanks.  :)

On Thursday, December 30, 2021 at 9:28:57 PM UTC-5 gmhwxi wrote:

> Or you could supply a template parameter (bucket(a) in this case) to
> arrayptr_freelin:
>
> implmnt{a} dict_delete_lin ( d ) = let
>   implmnt array_uninitize$clear (i, x) = 
> bucket_delete_recursive(x)
> in
>   arrayptr_freelin(d.buckets, size_of_int(d.size))
> end
> On Thursday, December 30, 2021 at 9:00:48 PM UTC-5 gmhwxi wrote:
>
>> Just need to replace bucket(a) with BUCKET(a) as is shown below:
>>
>>   implmnt array_uninitize$clear (i, x) = 
>> bucket_delete_recursive(x)
>>
>> On Thursday, December 30, 2021 at 6:07:31 PM UTC-5 d4v3y_5c0n3s wrote:
>>
>>> Here are the files, with some of the functions that are never used in 
>>> the example removed.
>>> The code was compiled with:  *patscc -c -DATS_MEMALLOC_LIBC dict.dats*
>>> | | |
>>> (*
>>> ###  dict.sats  ###
>>>
>>>
>>> *)
>>>
>>> #include "share/atspre_staload.hats"
>>>
>>> (*  buckets (aka linked lists)  *)
>>> absvtype bucket (a:vt@ype) = ptr
>>>
>>> fn{a:vt@ype} bucket_new ( string, a ) : bucket(a)
>>>
>>> fn{a:vt@ype} bucket_map ( !bucket(a) ) : void
>>> fn{a:vt@ype} bucket_filter_map ( b: !bucket(a) ) : void
>>>
>>>
>>> fn{a:vt@ype} bucket_item$delete ( x: a ): void
>>> fn{a:vt@ype} bucket_item$map ( x: &a ): void
>>> fn{a:vt@ype} bucket_item$filter ( x: !a ): bool
>>> fn{a:vt@ype} bucket_item$to_string ( x: !a ): string
>>>
>>>
>>> fun{a:vt@ype} bucket_delete_recursive ( b: bucket(a) ) : void
>>>
>>> fn{a:vt@ype} bucket_print ( b: !bucket(a) ) : void
>>>
>>> (*  dictionaries  *)
>>>
>>> sortdef dsz = {s:int | s > 0}
>>> absvt@ype dict (a:vt@ype, n:int) = @{size=int,buckets=ptr}
>>>
>>>
>>> fn{a:vt@ype} dict_new {s:dsz} ( int s ) : dict(a, s)
>>> fn{a:t@ype} dict_delete {s:dsz} ( d: dict(a, s) ) : void
>>> fn{a:vt@ype} dict_delete_lin {s:dsz} ( d: dict(a, s) ) : void
>>> fn{a:vt@ype} dict_delete_fun {s:dsz} ( d: dict(a, s), (a) -> void ) : 
>>> void
>>> | | |
>>> (*
>>> ###  dict.dats  ###
>>>
>>>
>>> *)
>>>
>>> #include "share/atspre_staload.hats"
>>>
>>> staload "./dict.sats"
>>>
>>> fn hash {n:int | n>0}{s:int | s>0}
>>> ( s: string(s), size: int(n) ) : [o:int | o >= 0; o < n] int o = let
>>> fun hash_num {i:nat | i <= s}
>>> ( i: int i, h: int, str_sz: int(s) ) : int =
>>> if i < str_sz then let
>>> val c_at_i = string_get_at_gint(s, i)
>>> in
>>> hash_num(i+1, h * 101 + g0int_of_char(c_at_i), 
>>> str_sz)
>>> end else h
>>> in
>>> g1int_nmod(abs(g1ofg0(hash_num(0, 0, sz2i(strlen(s), size)
>>> end
>>>
>>> local
>>>
>>> datavtype BUCKET (a:vt@ype) =
>>> | bucket_empty of ()
>>> | bucket_filled of (Strptr1, a, BUCKET(a))
>>>
>>> assume bucket(a:vt@ype) = BUCKET(a)
>>> assume dict(a:vt@ype, n:int) = @{
>>>   size=int n,
>>>   buckets=arrayptr(bucket(a), n)
>>> }
>>>
>>> extern fn{a:vt@ype} bucket_operate ( !bucket(a) ) : void
>>>
>>>
>>> in
>>>
>>> implement{a} dict_new {s} ( size ) = let
>>> val size_st = size_of_int(size)
>>> val bucket_arr = arrayptr_make_uninitized(size_st)
>>> implmnt array_initize$init (i, x) = x := bucket_empty()
>>> val () = arrayptr_initize(bucket_arr, size_st)
>>> in
>>> @{size=size, buckets=bucket_arr}:dict(a, s)
>>> end
>>>
>>> implmnt{a} dict_delete ( d ) = let
>>>   implmnt(a2:t@ype) bucket_item$delete ( x ) = ()
>>> in
>>>   dict_delete_lin(d)
>>> end
>>>
>>> implmnt{a} bucket_delete_recursive ( b ) =
>>> case+ b of
>>> | ~bucket_empty() => ()
>>> | ~bucket_filled(str, x, next_bucket) => let
>>> val () = strptr_free(str)
>>> val () = bucket_item$delete(x)
>>> in
>>> bucket_delete_recursive(next_bucket)
>>> end
>>>
>>> implmnt{a} dict_delete_lin ( d ) = let
>>>   implmnt array_uninitize$clear (i, x) = 
>>> bucket_delete_recursive(x)
>>> in
>>>   arrayptr_freelin(d.buckets, size_of_int(d.size))
>>> end
>>>
>>> implmnt{a} dict_delete_fun ( d, dltr ) = let
>>>   implmnt bucket_item$delete ( x ) = dltr(x)
>>> in
>>>   dict_delete_lin(d)
>>> end
>>>
>>>
>>> implmnt{a} bucket_new ( key, item ) = 
>>> bucket_filled($UNSAFE.castvwtp0{Strptr1}(key), item, bucket_empty())
>>>
>>> implmnt{a} bucket_map ( b ) =
>>>   case+ b of
>>>   | bucket_empty() => ()
>>>   | @bucket_filled(_, x, next_bucket) => {
>>> val () = bucket_item$map(x)
>>> val () = bucket_map(next_bucket)
>>> prval () = fold@(b)
>>>   }
>>>
>>> implmnt{a} bucket_filter_map ( b ) =
>>>   case+ b of
>>>   | bucket_empty() => ()
>>>   | @bucket_filled(_, x, next_bucket) =>
>>>   if bucket_item$filter(x) then {
>>>   val () = bucket_item$map(x)
>>>   val () = bucket_filter_map(next_bucket)
>>>   prval () = fold@(b)
>>>   }
>>>   else {
>>> val () = bucket_filter_map(next_bucket)
>>> prval () = fold@(b)
>>>   }
>>>
>>> implmnt{a} bucket_print ( b ) =
>>> case+ b of
>>> | bucket_empty() => ()
>>>
>>> | bucket_filled(str

Re: Help with Templates, cannot find missing implementation somewhere...

2021-12-30 Thread gmhwxi
Or you could supply a template parameter (bucket(a) in this case) to
arrayptr_freelin:

implmnt{a} dict_delete_lin ( d ) = let
  implmnt array_uninitize$clear (i, x) = 
bucket_delete_recursive(x)
in
  arrayptr_freelin(d.buckets, size_of_int(d.size))
end
On Thursday, December 30, 2021 at 9:00:48 PM UTC-5 gmhwxi wrote:

> Just need to replace bucket(a) with BUCKET(a) as is shown below:
>
>   implmnt array_uninitize$clear (i, x) = 
> bucket_delete_recursive(x)
>
> On Thursday, December 30, 2021 at 6:07:31 PM UTC-5 d4v3y_5c0n3s wrote:
>
>> Here are the files, with some of the functions that are never used in the 
>> example removed.
>> The code was compiled with:  *patscc -c -DATS_MEMALLOC_LIBC dict.dats*
>> | | |
>> (*
>> ###  dict.sats  ###
>>
>>
>> *)
>>
>> #include "share/atspre_staload.hats"
>>
>> (*  buckets (aka linked lists)  *)
>> absvtype bucket (a:vt@ype) = ptr
>>
>> fn{a:vt@ype} bucket_new ( string, a ) : bucket(a)
>>
>> fn{a:vt@ype} bucket_map ( !bucket(a) ) : void
>> fn{a:vt@ype} bucket_filter_map ( b: !bucket(a) ) : void
>>
>>
>> fn{a:vt@ype} bucket_item$delete ( x: a ): void
>> fn{a:vt@ype} bucket_item$map ( x: &a ): void
>> fn{a:vt@ype} bucket_item$filter ( x: !a ): bool
>> fn{a:vt@ype} bucket_item$to_string ( x: !a ): string
>>
>>
>> fun{a:vt@ype} bucket_delete_recursive ( b: bucket(a) ) : void
>>
>> fn{a:vt@ype} bucket_print ( b: !bucket(a) ) : void
>>
>> (*  dictionaries  *)
>>
>> sortdef dsz = {s:int | s > 0}
>> absvt@ype dict (a:vt@ype, n:int) = @{size=int,buckets=ptr}
>>
>>
>> fn{a:vt@ype} dict_new {s:dsz} ( int s ) : dict(a, s)
>> fn{a:t@ype} dict_delete {s:dsz} ( d: dict(a, s) ) : void
>> fn{a:vt@ype} dict_delete_lin {s:dsz} ( d: dict(a, s) ) : void
>> fn{a:vt@ype} dict_delete_fun {s:dsz} ( d: dict(a, s), (a) -> void ) : void
>> | | |
>> (*
>> ###  dict.dats  ###
>>
>>
>> *)
>>
>> #include "share/atspre_staload.hats"
>>
>> staload "./dict.sats"
>>
>> fn hash {n:int | n>0}{s:int | s>0}
>> ( s: string(s), size: int(n) ) : [o:int | o >= 0; o < n] int o = let
>> fun hash_num {i:nat | i <= s}
>> ( i: int i, h: int, str_sz: int(s) ) : int =
>> if i < str_sz then let
>> val c_at_i = string_get_at_gint(s, i)
>> in
>> hash_num(i+1, h * 101 + g0int_of_char(c_at_i), 
>> str_sz)
>> end else h
>> in
>> g1int_nmod(abs(g1ofg0(hash_num(0, 0, sz2i(strlen(s), size)
>> end
>>
>> local
>>
>> datavtype BUCKET (a:vt@ype) =
>> | bucket_empty of ()
>> | bucket_filled of (Strptr1, a, BUCKET(a))
>>
>> assume bucket(a:vt@ype) = BUCKET(a)
>> assume dict(a:vt@ype, n:int) = @{
>>   size=int n,
>>   buckets=arrayptr(bucket(a), n)
>> }
>>
>> extern fn{a:vt@ype} bucket_operate ( !bucket(a) ) : void
>>
>>
>> in
>>
>> implement{a} dict_new {s} ( size ) = let
>> val size_st = size_of_int(size)
>> val bucket_arr = arrayptr_make_uninitized(size_st)
>> implmnt array_initize$init (i, x) = x := bucket_empty()
>> val () = arrayptr_initize(bucket_arr, size_st)
>> in
>> @{size=size, buckets=bucket_arr}:dict(a, s)
>> end
>>
>> implmnt{a} dict_delete ( d ) = let
>>   implmnt(a2:t@ype) bucket_item$delete ( x ) = ()
>> in
>>   dict_delete_lin(d)
>> end
>>
>> implmnt{a} bucket_delete_recursive ( b ) =
>> case+ b of
>> | ~bucket_empty() => ()
>> | ~bucket_filled(str, x, next_bucket) => let
>> val () = strptr_free(str)
>> val () = bucket_item$delete(x)
>> in
>> bucket_delete_recursive(next_bucket)
>> end
>>
>> implmnt{a} dict_delete_lin ( d ) = let
>>   implmnt array_uninitize$clear (i, x) = 
>> bucket_delete_recursive(x)
>> in
>>   arrayptr_freelin(d.buckets, size_of_int(d.size))
>> end
>>
>> implmnt{a} dict_delete_fun ( d, dltr ) = let
>>   implmnt bucket_item$delete ( x ) = dltr(x)
>> in
>>   dict_delete_lin(d)
>> end
>>
>>
>> implmnt{a} bucket_new ( key, item ) = 
>> bucket_filled($UNSAFE.castvwtp0{Strptr1}(key), item, bucket_empty())
>>
>> implmnt{a} bucket_map ( b ) =
>>   case+ b of
>>   | bucket_empty() => ()
>>   | @bucket_filled(_, x, next_bucket) => {
>> val () = bucket_item$map(x)
>> val () = bucket_map(next_bucket)
>> prval () = fold@(b)
>>   }
>>
>> implmnt{a} bucket_filter_map ( b ) =
>>   case+ b of
>>   | bucket_empty() => ()
>>   | @bucket_filled(_, x, next_bucket) =>
>>   if bucket_item$filter(x) then {
>>   val () = bucket_item$map(x)
>>   val () = bucket_filter_map(next_bucket)
>>   prval () = fold@(b)
>>   }
>>   else {
>> val () = bucket_filter_map(next_bucket)
>> prval () = fold@(b)
>>   }
>>
>> implmnt{a} bucket_print ( b ) =
>> case+ b of
>> | bucket_empty() => ()
>>
>> | bucket_filled(str, x, next_bucket) => let
>> val () = print("\(")
>> val () = print(str)
>> val () = print(" : ")
>> val () = print( bucket_item$to_string(x) )
>> val () = print(")")
>> in
>> bucket_print(next_bucket)
>> end
>>
>> end
>>
>> var d = dict_new(7)

Re: Help with Templates, cannot find missing implementation somewhere...

2021-12-30 Thread gmhwxi
Just need to replace bucket(a) with BUCKET(a) as is shown below:

  implmnt array_uninitize$clear (i, x) = 
bucket_delete_recursive(x)

On Thursday, December 30, 2021 at 6:07:31 PM UTC-5 d4v3y_5c0n3s wrote:

> Here are the files, with some of the functions that are never used in the 
> example removed.
> The code was compiled with:  *patscc -c -DATS_MEMALLOC_LIBC dict.dats*
> | | |
> (*
> ###  dict.sats  ###
>
>
> *)
>
> #include "share/atspre_staload.hats"
>
> (*  buckets (aka linked lists)  *)
> absvtype bucket (a:vt@ype) = ptr
>
> fn{a:vt@ype} bucket_new ( string, a ) : bucket(a)
>
> fn{a:vt@ype} bucket_map ( !bucket(a) ) : void
> fn{a:vt@ype} bucket_filter_map ( b: !bucket(a) ) : void
>
>
> fn{a:vt@ype} bucket_item$delete ( x: a ): void
> fn{a:vt@ype} bucket_item$map ( x: &a ): void
> fn{a:vt@ype} bucket_item$filter ( x: !a ): bool
> fn{a:vt@ype} bucket_item$to_string ( x: !a ): string
>
>
> fun{a:vt@ype} bucket_delete_recursive ( b: bucket(a) ) : void
>
> fn{a:vt@ype} bucket_print ( b: !bucket(a) ) : void
>
> (*  dictionaries  *)
>
> sortdef dsz = {s:int | s > 0}
> absvt@ype dict (a:vt@ype, n:int) = @{size=int,buckets=ptr}
>
>
> fn{a:vt@ype} dict_new {s:dsz} ( int s ) : dict(a, s)
> fn{a:t@ype} dict_delete {s:dsz} ( d: dict(a, s) ) : void
> fn{a:vt@ype} dict_delete_lin {s:dsz} ( d: dict(a, s) ) : void
> fn{a:vt@ype} dict_delete_fun {s:dsz} ( d: dict(a, s), (a) -> void ) : void
> | | |
> (*
> ###  dict.dats  ###
>
>
> *)
>
> #include "share/atspre_staload.hats"
>
> staload "./dict.sats"
>
> fn hash {n:int | n>0}{s:int | s>0}
> ( s: string(s), size: int(n) ) : [o:int | o >= 0; o < n] int o = let
> fun hash_num {i:nat | i <= s}
> ( i: int i, h: int, str_sz: int(s) ) : int =
> if i < str_sz then let
> val c_at_i = string_get_at_gint(s, i)
> in
> hash_num(i+1, h * 101 + g0int_of_char(c_at_i), 
> str_sz)
> end else h
> in
> g1int_nmod(abs(g1ofg0(hash_num(0, 0, sz2i(strlen(s), size)
> end
>
> local
>
> datavtype BUCKET (a:vt@ype) =
> | bucket_empty of ()
> | bucket_filled of (Strptr1, a, BUCKET(a))
>
> assume bucket(a:vt@ype) = BUCKET(a)
> assume dict(a:vt@ype, n:int) = @{
>   size=int n,
>   buckets=arrayptr(bucket(a), n)
> }
>
> extern fn{a:vt@ype} bucket_operate ( !bucket(a) ) : void
>
>
> in
>
> implement{a} dict_new {s} ( size ) = let
> val size_st = size_of_int(size)
> val bucket_arr = arrayptr_make_uninitized(size_st)
> implmnt array_initize$init (i, x) = x := bucket_empty()
> val () = arrayptr_initize(bucket_arr, size_st)
> in
> @{size=size, buckets=bucket_arr}:dict(a, s)
> end
>
> implmnt{a} dict_delete ( d ) = let
>   implmnt(a2:t@ype) bucket_item$delete ( x ) = ()
> in
>   dict_delete_lin(d)
> end
>
> implmnt{a} bucket_delete_recursive ( b ) =
> case+ b of
> | ~bucket_empty() => ()
> | ~bucket_filled(str, x, next_bucket) => let
> val () = strptr_free(str)
> val () = bucket_item$delete(x)
> in
> bucket_delete_recursive(next_bucket)
> end
>
> implmnt{a} dict_delete_lin ( d ) = let
>   implmnt array_uninitize$clear (i, x) = 
> bucket_delete_recursive(x)
> in
>   arrayptr_freelin(d.buckets, size_of_int(d.size))
> end
>
> implmnt{a} dict_delete_fun ( d, dltr ) = let
>   implmnt bucket_item$delete ( x ) = dltr(x)
> in
>   dict_delete_lin(d)
> end
>
>
> implmnt{a} bucket_new ( key, item ) = 
> bucket_filled($UNSAFE.castvwtp0{Strptr1}(key), item, bucket_empty())
>
> implmnt{a} bucket_map ( b ) =
>   case+ b of
>   | bucket_empty() => ()
>   | @bucket_filled(_, x, next_bucket) => {
> val () = bucket_item$map(x)
> val () = bucket_map(next_bucket)
> prval () = fold@(b)
>   }
>
> implmnt{a} bucket_filter_map ( b ) =
>   case+ b of
>   | bucket_empty() => ()
>   | @bucket_filled(_, x, next_bucket) =>
>   if bucket_item$filter(x) then {
>   val () = bucket_item$map(x)
>   val () = bucket_filter_map(next_bucket)
>   prval () = fold@(b)
>   }
>   else {
> val () = bucket_filter_map(next_bucket)
> prval () = fold@(b)
>   }
>
> implmnt{a} bucket_print ( b ) =
> case+ b of
> | bucket_empty() => ()
>
> | bucket_filled(str, x, next_bucket) => let
> val () = print("\(")
> val () = print(str)
> val () = print(" : ")
> val () = print( bucket_item$to_string(x) )
> val () = print(")")
> in
> bucket_print(next_bucket)
> end
>
> end
>
> var d = dict_new(7)
> val () = dict_delete(d)
> | | |
> On Thursday, December 30, 2021 at 2:48:29 PM UTC-5 gmhwxi wrote:
>
>> Where can I find your source code so that I can produce the error you are 
>> referring to?
>>
>> --Hongwei
>>
>>
>> On Thu, Dec 30, 2021 at 12:47 PM d4v3y_5c0n3s  wrote:
>>
>>> Ok, so I've been able to get the "dict" type to be abstract, but I can't 
>>> seem to get "bucket" to be abstract.  I tried adding the "= ptr" part you 
>>> suggested, but I'm not having any luck.  Using your so

Re: Help with Templates, cannot find missing implementation somewhere...

2021-12-30 Thread d4v3y_5c0n3s
Here are the files, with some of the functions that are never used in the 
example removed.
The code was compiled with:  *patscc -c -DATS_MEMALLOC_LIBC dict.dats*
| | |
(*
###  dict.sats  ###


*)

#include "share/atspre_staload.hats"

(*  buckets (aka linked lists)  *)
absvtype bucket (a:vt@ype) = ptr

fn{a:vt@ype} bucket_new ( string, a ) : bucket(a)

fn{a:vt@ype} bucket_map ( !bucket(a) ) : void
fn{a:vt@ype} bucket_filter_map ( b: !bucket(a) ) : void

fn{a:vt@ype} bucket_item$delete ( x: a ): void
fn{a:vt@ype} bucket_item$map ( x: &a ): void
fn{a:vt@ype} bucket_item$filter ( x: !a ): bool
fn{a:vt@ype} bucket_item$to_string ( x: !a ): string

fun{a:vt@ype} bucket_delete_recursive ( b: bucket(a) ) : void

fn{a:vt@ype} bucket_print ( b: !bucket(a) ) : void

(*  dictionaries  *)
sortdef dsz = {s:int | s > 0}
absvt@ype dict (a:vt@ype, n:int) = @{size=int,buckets=ptr}

fn{a:vt@ype} dict_new {s:dsz} ( int s ) : dict(a, s)
fn{a:t@ype} dict_delete {s:dsz} ( d: dict(a, s) ) : void
fn{a:vt@ype} dict_delete_lin {s:dsz} ( d: dict(a, s) ) : void
fn{a:vt@ype} dict_delete_fun {s:dsz} ( d: dict(a, s), (a) -> void ) : void
| | |
(*
###  dict.dats  ###


*)

#include "share/atspre_staload.hats"

staload "./dict.sats"

fn hash {n:int | n>0}{s:int | s>0}
( s: string(s), size: int(n) ) : [o:int | o >= 0; o < n] int o = let
fun hash_num {i:nat | i <= s}
( i: int i, h: int, str_sz: int(s) ) : int =
if i < str_sz then let
val c_at_i = string_get_at_gint(s, i)
in
hash_num(i+1, h * 101 + g0int_of_char(c_at_i), 
str_sz)
end else h
in
g1int_nmod(abs(g1ofg0(hash_num(0, 0, sz2i(strlen(s), size)
end

local
datavtype BUCKET (a:vt@ype) =
| bucket_empty of ()
| bucket_filled of (Strptr1, a, BUCKET(a))

assume bucket(a:vt@ype) = BUCKET(a)
assume dict(a:vt@ype, n:int) = @{
  size=int n,
  buckets=arrayptr(bucket(a), n)
}

extern fn{a:vt@ype} bucket_operate ( !bucket(a) ) : void

in

implement{a} dict_new {s} ( size ) = let
val size_st = size_of_int(size)
val bucket_arr = arrayptr_make_uninitized(size_st)
implmnt array_initize$init (i, x) = x := bucket_empty()
val () = arrayptr_initize(bucket_arr, size_st)
in
@{size=size, buckets=bucket_arr}:dict(a, s)
end

implmnt{a} dict_delete ( d ) = let
  implmnt(a2:t@ype) bucket_item$delete ( x ) = ()
in
  dict_delete_lin(d)
end

implmnt{a} bucket_delete_recursive ( b ) =
case+ b of
| ~bucket_empty() => ()
| ~bucket_filled(str, x, next_bucket) => let
val () = strptr_free(str)
val () = bucket_item$delete(x)
in
bucket_delete_recursive(next_bucket)
end

implmnt{a} dict_delete_lin ( d ) = let
  implmnt array_uninitize$clear (i, x) = 
bucket_delete_recursive(x)
in
  arrayptr_freelin(d.buckets, size_of_int(d.size))
end

implmnt{a} dict_delete_fun ( d, dltr ) = let
  implmnt bucket_item$delete ( x ) = dltr(x)
in
  dict_delete_lin(d)
end


implmnt{a} bucket_new ( key, item ) = 
bucket_filled($UNSAFE.castvwtp0{Strptr1}(key), item, bucket_empty())

implmnt{a} bucket_map ( b ) =
  case+ b of
  | bucket_empty() => ()
  | @bucket_filled(_, x, next_bucket) => {
val () = bucket_item$map(x)
val () = bucket_map(next_bucket)
prval () = fold@(b)
  }

implmnt{a} bucket_filter_map ( b ) =
  case+ b of
  | bucket_empty() => ()
  | @bucket_filled(_, x, next_bucket) =>
  if bucket_item$filter(x) then {
  val () = bucket_item$map(x)
  val () = bucket_filter_map(next_bucket)
  prval () = fold@(b)
  }
  else {
val () = bucket_filter_map(next_bucket)
prval () = fold@(b)
  }

implmnt{a} bucket_print ( b ) =
case+ b of
| bucket_empty() => ()
| bucket_filled(str, x, next_bucket) => let
val () = print("\(")
val () = print(str)
val () = print(" : ")
val () = print( bucket_item$to_string(x) )
val () = print(")")
in
bucket_print(next_bucket)
end

end

var d = dict_new(7)
val () = dict_delete(d)
| | |
On Thursday, December 30, 2021 at 2:48:29 PM UTC-5 gmhwxi wrote:

> Where can I find your source code so that I can produce the error you are 
> referring to?
>
> --Hongwei
>
>
> On Thu, Dec 30, 2021 at 12:47 PM d4v3y_5c0n3s  wrote:
>
>> Ok, so I've been able to get the "dict" type to be abstract, but I can't 
>> seem to get "bucket" to be abstract.  I tried adding the "= ptr" part you 
>> suggested, but I'm not having any luck.  Using your solution, the code will 
>> compile, unless I test the "dict" type by calling "dict_new" & 
>> "dict_delete."  Looking at the error messages, the problem appears to be 
>> related to the "dict_delete" call, and I've provided the error below so you 
>> can see for yourself.  I know that there are a lot of details missing, so 
>> let me know if you'd like me to provide any more details.
>>
>> Error message:
>> In file included from dict_dats.c:15:
>> dict_dats.c: In function ‘loop_95__95__1’:
>> dict_dats.c:6190:28: error:

Re: Help with Templates, cannot find missing implementation somewhere...

2021-12-30 Thread Hongwei Xi
Where can I find your source code so that I can produce the error you are
referring to?

--Hongwei


On Thu, Dec 30, 2021 at 12:47 PM d4v3y_5c0n3s  wrote:

> Ok, so I've been able to get the "dict" type to be abstract, but I can't
> seem to get "bucket" to be abstract.  I tried adding the "= ptr" part you
> suggested, but I'm not having any luck.  Using your solution, the code will
> compile, unless I test the "dict" type by calling "dict_new" &
> "dict_delete."  Looking at the error messages, the problem appears to be
> related to the "dict_delete" call, and I've provided the error below so you
> can see for yourself.  I know that there are a lot of details missing, so
> let me know if you'd like me to provide any more details.
>
> Error message:
> In file included from dict_dats.c:15:
> dict_dats.c: In function ‘loop_95__95__1’:
> dict_dats.c:6190:28: error: ‘PMVtmpltcstmat’ undeclared (first use in this
> function)
>  6190 | ATSINSmove_void(tmp195__1,
> PMVtmpltcstmat[0](array_uninitize$clear S2Eapp(S2Ecst(g0int_t0ype); S2Eextkind(atstype_int)))>)(arg2,
> ATSPMVrefarg1(arg0))) ;
>   |^~
> /usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:284:39:
> note: in definition of macro ‘ATSINSmove_void’
>   284 | #define ATSINSmove_void(tmp, command) command
>   |   ^~~
> dict_dats.c:6190:28: note: each undeclared identifier is reported only
> once for each function it appears in
>  6190 | ATSINSmove_void(tmp195__1,
> PMVtmpltcstmat[0](array_uninitize$clear S2Eapp(S2Ecst(g0int_t0ype); S2Eextkind(atstype_int)))>)(arg2,
> ATSPMVrefarg1(arg0))) ;
>   |^~
> /usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:284:39:
> note: in definition of macro ‘ATSINSmove_void’
>   284 | #define ATSINSmove_void(tmp, command) command
>   |   ^~~
> dict_dats.c:6190:46: error: ‘array_uninitize$clear’ undeclared (first use
> in this function)
>  6190 | ATSINSmove_void(tmp195__1,
> PMVtmpltcstmat[0](array_uninitize$clear S2Eapp(S2Ecst(g0int_t0ype); S2Eextkind(atstype_int)))>)(arg2,
> ATSPMVrefarg1(arg0))) ;
>   |  ^
> /usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:284:39:
> note: in definition of macro ‘ATSINSmove_void’
>   284 | #define ATSINSmove_void(tmp, command) command
>   |   ^~~
> dict_dats.c:6190:68: warning: implicit declaration of function ‘S2Eapp’
> [-Wimplicit-function-declaration]
>  6190 | ATSINSmove_void(tmp195__1,
> PMVtmpltcstmat[0](array_uninitize$clear S2Eapp(S2Ecst(g0int_t0ype); S2Eextkind(atstype_int)))>)(arg2,
> ATSPMVrefarg1(arg0))) ;
>   |
>  ^~
> /usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:284:39:
> note: in definition of macro ‘ATSINSmove_void’
>   284 | #define ATSINSmove_void(tmp, command) command
>   |   ^~~
> dict_dats.c:6190:75: warning: implicit declaration of function ‘S2Ecst’
> [-Wimplicit-function-declaration]
>  6190 | ATSINSmove_void(tmp195__1,
> PMVtmpltcstmat[0](array_uninitize$clear S2Eapp(S2Ecst(g0int_t0ype); S2Eextkind(atstype_int)))>)(arg2,
> ATSPMVrefarg1(arg0))) ;
>   |
> ^~
> /usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:284:39:
> note: in definition of macro ‘ATSINSmove_void’
>   284 | #define ATSINSmove_void(tmp, command) command
>   |   ^~~
> dict_dats.c:6190:82: error: ‘BUCKET’ undeclared (first use in this
> function)
>  6190 | ATSINSmove_void(tmp195__1,
> PMVtmpltcstmat[0](array_uninitize$clear S2Eapp(S2Ecst(g0int_t0ype); S2Eextkind(atstype_int)))>)(arg2,
> ATSPMVrefarg1(arg0))) ;
>   |
>^~
> /usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:284:39:
> note: in definition of macro ‘ATSINSmove_void’
>   284 | #define ATSINSmove_void(tmp, command) command
>   |   ^~~
> dict_dats.c:6190:89: error: expected ‘)’ before ‘;’ token
>  6190 | move_void(tmp195__1,
> PMVtmpltcstmat[0](array_uninitize$clear S2Eapp(S2Ecst(g0int_t0ype); S2Eextkind(atstype_int)))>)(arg2,
> ATSPMVrefarg1(arg0))) ;
>   |
>  ~  ^
>
> /usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:284:39:
> note: in definition of macro ‘ATSINSmove_void’
>   284 | #define ATSINSmove_void(tmp, command) command
>   |   ^~~
> dict_dats.c:6190:145: error: expected expression before ‘)’ token
>  6190 | lear S2Eextkind(atstype_int)))>)(arg2, ATSPMVrefarg1(arg0))) ;
>   |
> ^
>
> /usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:284:39:
> note: in definition of macro ‘ATSINSmove_void’
>   284 | #define ATSINSmove_void(tmp, comma

Re: Help with Templates, cannot find missing implementation somewhere...

2021-12-30 Thread d4v3y_5c0n3s
Ok, so I've been able to get the "dict" type to be abstract, but I can't 
seem to get "bucket" to be abstract.  I tried adding the "= ptr" part you 
suggested, but I'm not having any luck.  Using your solution, the code will 
compile, unless I test the "dict" type by calling "dict_new" & 
"dict_delete."  Looking at the error messages, the problem appears to be 
related to the "dict_delete" call, and I've provided the error below so you 
can see for yourself.  I know that there are a lot of details missing, so 
let me know if you'd like me to provide any more details.

Error message:
In file included from dict_dats.c:15:
dict_dats.c: In function ‘loop_95__95__1’:
dict_dats.c:6190:28: error: ‘PMVtmpltcstmat’ undeclared (first use in this 
function)
 6190 | ATSINSmove_void(tmp195__1, 
PMVtmpltcstmat[0](array_uninitize$clear)(arg2, 
ATSPMVrefarg1(arg0))) ;
  |^~
/usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:284:39: 
note: in definition of macro ‘ATSINSmove_void’
  284 | #define ATSINSmove_void(tmp, command) command
  |   ^~~
dict_dats.c:6190:28: note: each undeclared identifier is reported only once 
for each function it appears in
 6190 | ATSINSmove_void(tmp195__1, 
PMVtmpltcstmat[0](array_uninitize$clear)(arg2, 
ATSPMVrefarg1(arg0))) ;
  |^~
/usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:284:39: 
note: in definition of macro ‘ATSINSmove_void’
  284 | #define ATSINSmove_void(tmp, command) command
  |   ^~~
dict_dats.c:6190:46: error: ‘array_uninitize$clear’ undeclared (first use 
in this function)
 6190 | ATSINSmove_void(tmp195__1, 
PMVtmpltcstmat[0](array_uninitize$clear)(arg2, 
ATSPMVrefarg1(arg0))) ;
  |  ^
/usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:284:39: 
note: in definition of macro ‘ATSINSmove_void’
  284 | #define ATSINSmove_void(tmp, command) command
  |   ^~~
dict_dats.c:6190:68: warning: implicit declaration of function ‘S2Eapp’ 
[-Wimplicit-function-declaration]
 6190 | ATSINSmove_void(tmp195__1, 
PMVtmpltcstmat[0](array_uninitize$clear)(arg2, 
ATSPMVrefarg1(arg0))) ;
  |   
 ^~
/usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:284:39: 
note: in definition of macro ‘ATSINSmove_void’
  284 | #define ATSINSmove_void(tmp, command) command
  |   ^~~
dict_dats.c:6190:75: warning: implicit declaration of function ‘S2Ecst’ 
[-Wimplicit-function-declaration]
 6190 | ATSINSmove_void(tmp195__1, 
PMVtmpltcstmat[0](array_uninitize$clear)(arg2, 
ATSPMVrefarg1(arg0))) ;
  | 
  ^~
/usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:284:39: 
note: in definition of macro ‘ATSINSmove_void’
  284 | #define ATSINSmove_void(tmp, command) command
  |   ^~~
dict_dats.c:6190:82: error: ‘BUCKET’ undeclared (first use in this function)
 6190 | ATSINSmove_void(tmp195__1, 
PMVtmpltcstmat[0](array_uninitize$clear)(arg2, 
ATSPMVrefarg1(arg0))) ;
  | 
 ^~
/usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:284:39: 
note: in definition of macro ‘ATSINSmove_void’
  284 | #define ATSINSmove_void(tmp, command) command
  |   ^~~
dict_dats.c:6190:89: error: expected ‘)’ before ‘;’ token
 6190 | move_void(tmp195__1, 
PMVtmpltcstmat[0](array_uninitize$clear)(arg2, 
ATSPMVrefarg1(arg0))) ;
  |   
 ~  ^

/usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:284:39: 
note: in definition of macro ‘ATSINSmove_void’
  284 | #define ATSINSmove_void(tmp, command) command
  |   ^~~
dict_dats.c:6190:145: error: expected expression before ‘)’ token
 6190 | lear)(arg2, ATSPMVrefarg1(arg0))) ;
  | 
  ^

/usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:284:39: 
note: in definition of macro ‘ATSINSmove_void’
  284 | #define ATSINSmove_void(tmp, command) command
  |   ^~~

On Tuesday, December 7, 2021 at 8:08:48 AM UTC-5 d4v3y_5c0n3s wrote:

> Thanks, I tried something similar with the "dict" type, but completely 
> overlooked the "bucket" type.  I'll test this to see if it resolves the 
> issue.
>
> On Wednesday, December 1, 2021 at 12:28:15 AM UTC-5 gmhwxi wrote:
>
>> After taking a

Re: Help with Templates, cannot find missing implementation somewhere...

2021-12-07 Thread d4v3y_5c0n3s
Thanks, I tried something similar with the "dict" type, but completely 
overlooked the "bucket" type.  I'll test this to see if it resolves the 
issue.

On Wednesday, December 1, 2021 at 12:28:15 AM UTC-5 gmhwxi wrote:

> After taking a quick look at dict.sats, I spotted the following line:
>
> absvtype bucket(a:vt@ype)
>
> which should be change to the following one:
>
> absvtype bucket(a:vt@ype) = ptr // ptr takes the compiler the size of 
> bucket
>
> The simple reason is that the compiler needs to know the size of an 
> abstract type in order to compile it to a type in C.
>
>
> On Wednesday, December 1, 2021 at 12:16:34 AM UTC-5 gmhwxi wrote:
>
>> I don't quite understand.
>> Templates in ATS2 are supposed to be working with abstract types.
>>
>> If I could try precisely what you did on your machine, then I may be able 
>> to suggest something.
>>
>>
>>
>> On Tue, Nov 30, 2021 at 8:27 PM d4v3y_5c0n3s  wrote:
>>
>>> Update 2:
>>> After investigating the prelude, I've determined that templates in ATS2 
>>> just conflict with abstract types in some instances.  For this reason, it 
>>> seems that in many parts of the prelude avoided the use of the "assume" 
>>> keyword with template-heavy code.
>>>
>>> On Tuesday, November 30, 2021 at 7:08:48 PM UTC-5 d4v3y_5c0n3s wrote:
>>>
 Update:
 I was able to get the code I provided above running by staloading the 
 dict.dats file from the dict_test.dats file using " staload _ = 
 "./dict.dats" ".  Now, my only problem is that if I make the "dict" & 
 bucket types abstract, the templates stop working.

 On Tuesday, November 30, 2021 at 1:39:39 PM UTC-5 d4v3y_5c0n3s wrote:

> You are right, including " share/atspre_staload.hats" causes the code 
> to compile.  However, I'm still having issues.  You see, the code I 
> provided I had taken from a static (.sats) and dynamic (.dats) file in 
> order to make it more presentable when asking for help.  Your fix only 
> fixes the issue in the single-file version, and when including the 
> external 
> static file it doesn't work.  Do you know what might be going wrong?  
> I'll 
> provide the (simplified) contents of each of these files below.
>
> *dict.sats*:
> #include "share/atspre_staload.hats"
>
>
> datavtype BUCKET (a:vt@ype) =
> | bucket_empty of ()
> | bucket_filled of (Strptr1, a, BUCKET(a))
>
> vtypedef bucket(a:vt@ype) = BUCKET(a)
>
> fn{a:vt@ype} bucket_item$delete ( x: a ): void
>
> fun{a:vt@ype} bucket_delete_recursive ( b: bucket(a) ) : void
>
> sortdef dsz = {s:int | s > 0}
>
> vtypedef dict(a:vt@ype, n:int) =
> @{
> size=int n,
> buckets=arrayptr(bucket(a), n)
> }
>
> fn{a:vt@ype} dict_new {s:dsz} ( int s ) : dict(a, s)
> fn{a:t@ype} dict_delete {s:dsz} ( d: dict(a, s) ) : void
> fn{a:vt@ype} dict_delete_lin {s:dsz} ( d: dict(a, s) ) : void
>
>
> *dict.dats*:
> #include "share/atspre_staload.hats"
>
> staload "./dict.sats"
>
> local
> in
>
>
> implement{a} dict_new {s} ( size ) = let
> val size_st = size_of_int(size)
> val bucket_arr = arrayptr_make_uninitized(size_st)
> implmnt array_initize$init (i, x) = x := bucket_empty()
> val () = arrayptr_initize(bucket_arr, size_st)
> in
> @{size=size, buckets=bucket_arr}:dict(a, s)
> end
>
> implmnt{a} dict_delete ( d ) = let
>   implmnt(a2:t@ype) bucket_item$delete ( x ) = ()
> in
>   dict_delete_lin(d)
> end
>
> implmnt{a} bucket_delete_recursive ( b ) =
> case+ b of
> | ~bucket_empty() => ()
> | ~bucket_filled(str, x, next_bucket) => let
> val () = strptr_free(str)
> val () = bucket_item$delete(x)
> in
> bucket_delete_recursive(next_bucket)
> end
>
> implmnt{a} dict_delete_lin ( d ) = let
>   implmnt array_uninitize$clear (i, x) = 
> bucket_delete_recursive(x)
> in
>   arrayptr_freelin(d.buckets, size_of_int(d.size))
> end
> end
>
> *dict_test.dats*, where main is:
> #include "share/atspre_staload.hats"
>
> staload "./dict.sats"
>
>
> implmnt main0 () = let
>   var d = dict_new(13)
> in
>   dict_delete(d)
> end
>
> *My output*:
> $ patscc --gline -DATS_MEMALLOC_LIBC dict_test.dats
>
> In file included from dict_test_dats.c:15:
> /home/tmj90/Goldelish-Engine/source/data/dict_test.dats: In function 
> ‘mainats_0_void’:
> /home/tmj90/Goldelish-Engine/source/data/dict_test.dats:58:21: error: 
> ‘PMVtmpltcstmat’ undeclared (first use in this function)
>58 |   var d = dict_new(13)
>   | ^~~   
>
> /usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:276:37:
>  
> note: in definition of macro ‘ATSINSmove’

Re: Help with Templates, cannot find missing implementation somewhere...

2021-11-30 Thread gmhwxi
After taking a quick look at dict.sats, I spotted the following line:

absvtype bucket(a:vt@ype)

which should be change to the following one:

absvtype bucket(a:vt@ype) = ptr // ptr takes the compiler the size of bucket

The simple reason is that the compiler needs to know the size of an 
abstract type in order to compile it to a type in C.


On Wednesday, December 1, 2021 at 12:16:34 AM UTC-5 gmhwxi wrote:

> I don't quite understand.
> Templates in ATS2 are supposed to be working with abstract types.
>
> If I could try precisely what you did on your machine, then I may be able 
> to suggest something.
>
>
>
> On Tue, Nov 30, 2021 at 8:27 PM d4v3y_5c0n3s  wrote:
>
>> Update 2:
>> After investigating the prelude, I've determined that templates in ATS2 
>> just conflict with abstract types in some instances.  For this reason, it 
>> seems that in many parts of the prelude avoided the use of the "assume" 
>> keyword with template-heavy code.
>>
>> On Tuesday, November 30, 2021 at 7:08:48 PM UTC-5 d4v3y_5c0n3s wrote:
>>
>>> Update:
>>> I was able to get the code I provided above running by staloading the 
>>> dict.dats file from the dict_test.dats file using " staload _ = 
>>> "./dict.dats" ".  Now, my only problem is that if I make the "dict" & 
>>> bucket types abstract, the templates stop working.
>>>
>>> On Tuesday, November 30, 2021 at 1:39:39 PM UTC-5 d4v3y_5c0n3s wrote:
>>>
 You are right, including " share/atspre_staload.hats" causes the code 
 to compile.  However, I'm still having issues.  You see, the code I 
 provided I had taken from a static (.sats) and dynamic (.dats) file in 
 order to make it more presentable when asking for help.  Your fix only 
 fixes the issue in the single-file version, and when including the 
 external 
 static file it doesn't work.  Do you know what might be going wrong?  I'll 
 provide the (simplified) contents of each of these files below.

 *dict.sats*:
 #include "share/atspre_staload.hats"


 datavtype BUCKET (a:vt@ype) =
 | bucket_empty of ()
 | bucket_filled of (Strptr1, a, BUCKET(a))

 vtypedef bucket(a:vt@ype) = BUCKET(a)

 fn{a:vt@ype} bucket_item$delete ( x: a ): void

 fun{a:vt@ype} bucket_delete_recursive ( b: bucket(a) ) : void

 sortdef dsz = {s:int | s > 0}

 vtypedef dict(a:vt@ype, n:int) =
 @{
 size=int n,
 buckets=arrayptr(bucket(a), n)
 }

 fn{a:vt@ype} dict_new {s:dsz} ( int s ) : dict(a, s)
 fn{a:t@ype} dict_delete {s:dsz} ( d: dict(a, s) ) : void
 fn{a:vt@ype} dict_delete_lin {s:dsz} ( d: dict(a, s) ) : void


 *dict.dats*:
 #include "share/atspre_staload.hats"

 staload "./dict.sats"

 local
 in


 implement{a} dict_new {s} ( size ) = let
 val size_st = size_of_int(size)
 val bucket_arr = arrayptr_make_uninitized(size_st)
 implmnt array_initize$init (i, x) = x := bucket_empty()
 val () = arrayptr_initize(bucket_arr, size_st)
 in
 @{size=size, buckets=bucket_arr}:dict(a, s)
 end

 implmnt{a} dict_delete ( d ) = let
   implmnt(a2:t@ype) bucket_item$delete ( x ) = ()
 in
   dict_delete_lin(d)
 end

 implmnt{a} bucket_delete_recursive ( b ) =
 case+ b of
 | ~bucket_empty() => ()
 | ~bucket_filled(str, x, next_bucket) => let
 val () = strptr_free(str)
 val () = bucket_item$delete(x)
 in
 bucket_delete_recursive(next_bucket)
 end

 implmnt{a} dict_delete_lin ( d ) = let
   implmnt array_uninitize$clear (i, x) = 
 bucket_delete_recursive(x)
 in
   arrayptr_freelin(d.buckets, size_of_int(d.size))
 end
 end

 *dict_test.dats*, where main is:
 #include "share/atspre_staload.hats"

 staload "./dict.sats"


 implmnt main0 () = let
   var d = dict_new(13)
 in
   dict_delete(d)
 end

 *My output*:
 $ patscc --gline -DATS_MEMALLOC_LIBC dict_test.dats

 In file included from dict_test_dats.c:15:
 /home/tmj90/Goldelish-Engine/source/data/dict_test.dats: In function 
 ‘mainats_0_void’:
 /home/tmj90/Goldelish-Engine/source/data/dict_test.dats:58:21: error: 
 ‘PMVtmpltcstmat’ undeclared (first use in this function)
58 |   var d = dict_new(13)
   | ^~~   

 /usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:276:37:
  
 note: in definition of macro ‘ATSINSmove’
   276 | #define ATSINSmove(tmp, val) (tmp = val)
   | ^~~
 /home/tmj90/Goldelish-Engine/source/data/dict_test.dats:58:21: note: 
 each undeclared identifier is reported only once for each function it 
 appears in
58 |   var d = dict_new(13)
   | ^~~   

 /usr/local/l

Re: Help with Templates, cannot find missing implementation somewhere...

2021-11-30 Thread Hongwei Xi
I don't quite understand.
Templates in ATS2 are supposed to be working with abstract types.

If I could try precisely what you did on your machine, then I may be able
to suggest something.



On Tue, Nov 30, 2021 at 8:27 PM d4v3y_5c0n3s  wrote:

> Update 2:
> After investigating the prelude, I've determined that templates in ATS2
> just conflict with abstract types in some instances.  For this reason, it
> seems that in many parts of the prelude avoided the use of the "assume"
> keyword with template-heavy code.
>
> On Tuesday, November 30, 2021 at 7:08:48 PM UTC-5 d4v3y_5c0n3s wrote:
>
>> Update:
>> I was able to get the code I provided above running by staloading the
>> dict.dats file from the dict_test.dats file using " staload _ =
>> "./dict.dats" ".  Now, my only problem is that if I make the "dict" &
>> bucket types abstract, the templates stop working.
>>
>> On Tuesday, November 30, 2021 at 1:39:39 PM UTC-5 d4v3y_5c0n3s wrote:
>>
>>> You are right, including " share/atspre_staload.hats" causes the code to
>>> compile.  However, I'm still having issues.  You see, the code I provided I
>>> had taken from a static (.sats) and dynamic (.dats) file in order to make
>>> it more presentable when asking for help.  Your fix only fixes the issue in
>>> the single-file version, and when including the external static file it
>>> doesn't work.  Do you know what might be going wrong?  I'll provide the
>>> (simplified) contents of each of these files below.
>>>
>>> *dict.sats*:
>>> #include "share/atspre_staload.hats"
>>>
>>>
>>> datavtype BUCKET (a:vt@ype) =
>>> | bucket_empty of ()
>>> | bucket_filled of (Strptr1, a, BUCKET(a))
>>>
>>> vtypedef bucket(a:vt@ype) = BUCKET(a)
>>>
>>> fn{a:vt@ype} bucket_item$delete ( x: a ): void
>>>
>>> fun{a:vt@ype} bucket_delete_recursive ( b: bucket(a) ) : void
>>>
>>> sortdef dsz = {s:int | s > 0}
>>>
>>> vtypedef dict(a:vt@ype, n:int) =
>>> @{
>>> size=int n,
>>> buckets=arrayptr(bucket(a), n)
>>> }
>>>
>>> fn{a:vt@ype} dict_new {s:dsz} ( int s ) : dict(a, s)
>>> fn{a:t@ype} dict_delete {s:dsz} ( d: dict(a, s) ) : void
>>> fn{a:vt@ype} dict_delete_lin {s:dsz} ( d: dict(a, s) ) : void
>>>
>>>
>>> *dict.dats*:
>>> #include "share/atspre_staload.hats"
>>>
>>> staload "./dict.sats"
>>>
>>> local
>>> in
>>>
>>>
>>> implement{a} dict_new {s} ( size ) = let
>>> val size_st = size_of_int(size)
>>> val bucket_arr = arrayptr_make_uninitized(size_st)
>>> implmnt array_initize$init (i, x) = x := bucket_empty()
>>> val () = arrayptr_initize(bucket_arr, size_st)
>>> in
>>> @{size=size, buckets=bucket_arr}:dict(a, s)
>>> end
>>>
>>> implmnt{a} dict_delete ( d ) = let
>>>   implmnt(a2:t@ype) bucket_item$delete ( x ) = ()
>>> in
>>>   dict_delete_lin(d)
>>> end
>>>
>>> implmnt{a} bucket_delete_recursive ( b ) =
>>> case+ b of
>>> | ~bucket_empty() => ()
>>> | ~bucket_filled(str, x, next_bucket) => let
>>> val () = strptr_free(str)
>>> val () = bucket_item$delete(x)
>>> in
>>> bucket_delete_recursive(next_bucket)
>>> end
>>>
>>> implmnt{a} dict_delete_lin ( d ) = let
>>>   implmnt array_uninitize$clear (i, x) =
>>> bucket_delete_recursive(x)
>>> in
>>>   arrayptr_freelin(d.buckets, size_of_int(d.size))
>>> end
>>> end
>>>
>>> *dict_test.dats*, where main is:
>>> #include "share/atspre_staload.hats"
>>>
>>> staload "./dict.sats"
>>>
>>>
>>> implmnt main0 () = let
>>>   var d = dict_new(13)
>>> in
>>>   dict_delete(d)
>>> end
>>>
>>> *My output*:
>>> $ patscc --gline -DATS_MEMALLOC_LIBC dict_test.dats
>>>
>>> In file included from dict_test_dats.c:15:
>>> /home/tmj90/Goldelish-Engine/source/data/dict_test.dats: In function
>>> ‘mainats_0_void’:
>>> /home/tmj90/Goldelish-Engine/source/data/dict_test.dats:58:21: error:
>>> ‘PMVtmpltcstmat’ undeclared (first use in this function)
>>>58 |   var d = dict_new(13)
>>>   | ^~~
>>>
>>> /usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:276:37:
>>> note: in definition of macro ‘ATSINSmove’
>>>   276 | #define ATSINSmove(tmp, val) (tmp = val)
>>>   | ^~~
>>> /home/tmj90/Goldelish-Engine/source/data/dict_test.dats:58:21: note:
>>> each undeclared identifier is reported only once for each function it
>>> appears in
>>>58 |   var d = dict_new(13)
>>>   | ^~~
>>>
>>> /usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:276:37:
>>> note: in definition of macro ‘ATSINSmove’
>>>   276 | #define ATSINSmove(tmp, val) (tmp = val)
>>>   | ^~~
>>> /home/tmj90/Goldelish-Engine/source/data/dict_test.dats:58:39: error:
>>> ‘dict_new’ undeclared (first use in this function)
>>>58 |   var d = dict_new(13)
>>>
>>>   |   ^
>>> /usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:276:37:
>>> note: in definition of macro ‘ATSINSmove’
>>>   276 | #define ATSINSmove(tm

Re: Help with Templates, cannot find missing implementation somewhere...

2021-11-30 Thread d4v3y_5c0n3s
Update 2:
After investigating the prelude, I've determined that templates in ATS2 
just conflict with abstract types in some instances.  For this reason, it 
seems that in many parts of the prelude avoided the use of the "assume" 
keyword with template-heavy code.

On Tuesday, November 30, 2021 at 7:08:48 PM UTC-5 d4v3y_5c0n3s wrote:

> Update:
> I was able to get the code I provided above running by staloading the 
> dict.dats file from the dict_test.dats file using " staload _ = 
> "./dict.dats" ".  Now, my only problem is that if I make the "dict" & 
> bucket types abstract, the templates stop working.
>
> On Tuesday, November 30, 2021 at 1:39:39 PM UTC-5 d4v3y_5c0n3s wrote:
>
>> You are right, including " share/atspre_staload.hats" causes the code to 
>> compile.  However, I'm still having issues.  You see, the code I provided I 
>> had taken from a static (.sats) and dynamic (.dats) file in order to make 
>> it more presentable when asking for help.  Your fix only fixes the issue in 
>> the single-file version, and when including the external static file it 
>> doesn't work.  Do you know what might be going wrong?  I'll provide the 
>> (simplified) contents of each of these files below.
>>
>> *dict.sats*:
>> #include "share/atspre_staload.hats"
>>
>>
>> datavtype BUCKET (a:vt@ype) =
>> | bucket_empty of ()
>> | bucket_filled of (Strptr1, a, BUCKET(a))
>>
>> vtypedef bucket(a:vt@ype) = BUCKET(a)
>>
>> fn{a:vt@ype} bucket_item$delete ( x: a ): void
>>
>> fun{a:vt@ype} bucket_delete_recursive ( b: bucket(a) ) : void
>>
>> sortdef dsz = {s:int | s > 0}
>>
>> vtypedef dict(a:vt@ype, n:int) =
>> @{
>> size=int n,
>> buckets=arrayptr(bucket(a), n)
>> }
>>
>> fn{a:vt@ype} dict_new {s:dsz} ( int s ) : dict(a, s)
>> fn{a:t@ype} dict_delete {s:dsz} ( d: dict(a, s) ) : void
>> fn{a:vt@ype} dict_delete_lin {s:dsz} ( d: dict(a, s) ) : void
>>
>>
>> *dict.dats*:
>> #include "share/atspre_staload.hats"
>>
>> staload "./dict.sats"
>>
>> local
>> in
>>
>>
>> implement{a} dict_new {s} ( size ) = let
>> val size_st = size_of_int(size)
>> val bucket_arr = arrayptr_make_uninitized(size_st)
>> implmnt array_initize$init (i, x) = x := bucket_empty()
>> val () = arrayptr_initize(bucket_arr, size_st)
>> in
>> @{size=size, buckets=bucket_arr}:dict(a, s)
>> end
>>
>> implmnt{a} dict_delete ( d ) = let
>>   implmnt(a2:t@ype) bucket_item$delete ( x ) = ()
>> in
>>   dict_delete_lin(d)
>> end
>>
>> implmnt{a} bucket_delete_recursive ( b ) =
>> case+ b of
>> | ~bucket_empty() => ()
>> | ~bucket_filled(str, x, next_bucket) => let
>> val () = strptr_free(str)
>> val () = bucket_item$delete(x)
>> in
>> bucket_delete_recursive(next_bucket)
>> end
>>
>> implmnt{a} dict_delete_lin ( d ) = let
>>   implmnt array_uninitize$clear (i, x) = 
>> bucket_delete_recursive(x)
>> in
>>   arrayptr_freelin(d.buckets, size_of_int(d.size))
>> end
>> end
>>
>> *dict_test.dats*, where main is:
>> #include "share/atspre_staload.hats"
>>
>> staload "./dict.sats"
>>
>>
>> implmnt main0 () = let
>>   var d = dict_new(13)
>> in
>>   dict_delete(d)
>> end
>>
>> *My output*:
>> $ patscc --gline -DATS_MEMALLOC_LIBC dict_test.dats
>>
>> In file included from dict_test_dats.c:15:
>> /home/tmj90/Goldelish-Engine/source/data/dict_test.dats: In function 
>> ‘mainats_0_void’:
>> /home/tmj90/Goldelish-Engine/source/data/dict_test.dats:58:21: error: 
>> ‘PMVtmpltcstmat’ undeclared (first use in this function)
>>58 |   var d = dict_new(13)
>>   | ^~~   
>>
>> /usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:276:37:
>>  
>> note: in definition of macro ‘ATSINSmove’
>>   276 | #define ATSINSmove(tmp, val) (tmp = val)
>>   | ^~~
>> /home/tmj90/Goldelish-Engine/source/data/dict_test.dats:58:21: note: each 
>> undeclared identifier is reported only once for each function it appears in
>>58 |   var d = dict_new(13)
>>   | ^~~   
>>
>> /usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:276:37:
>>  
>> note: in definition of macro ‘ATSINSmove’
>>   276 | #define ATSINSmove(tmp, val) (tmp = val)
>>   | ^~~
>> /home/tmj90/Goldelish-Engine/source/data/dict_test.dats:58:39: error: 
>> ‘dict_new’ undeclared (first use in this function)
>>58 |   var d = dict_new(13)
>>
>>   |   ^   
>> /usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:276:37:
>>  
>> note: in definition of macro ‘ATSINSmove’
>>   276 | #define ATSINSmove(tmp, val) (tmp = val)
>>   | ^~~
>> /home/tmj90/Goldelish-Engine/source/data/dict_test.dats:58:48: warning: 
>> implicit declaration of function ‘S2Eapp’ [-Wimplicit-function-declaration]
>>58 |   var d = dict_new(13)
>>
>>   |^ 
>> /usr/loca

Re: Help with Templates, cannot find missing implementation somewhere...

2021-11-30 Thread d4v3y_5c0n3s
Update:
I was able to get the code I provided above running by staloading the 
dict.dats file from the dict_test.dats file using " staload _ = 
"./dict.dats" ".  Now, my only problem is that if I make the "dict" & 
bucket types abstract, the templates stop working.

On Tuesday, November 30, 2021 at 1:39:39 PM UTC-5 d4v3y_5c0n3s wrote:

> You are right, including " share/atspre_staload.hats" causes the code to 
> compile.  However, I'm still having issues.  You see, the code I provided I 
> had taken from a static (.sats) and dynamic (.dats) file in order to make 
> it more presentable when asking for help.  Your fix only fixes the issue in 
> the single-file version, and when including the external static file it 
> doesn't work.  Do you know what might be going wrong?  I'll provide the 
> (simplified) contents of each of these files below.
>
> *dict.sats*:
> #include "share/atspre_staload.hats"
>
>
> datavtype BUCKET (a:vt@ype) =
> | bucket_empty of ()
> | bucket_filled of (Strptr1, a, BUCKET(a))
>
> vtypedef bucket(a:vt@ype) = BUCKET(a)
>
> fn{a:vt@ype} bucket_item$delete ( x: a ): void
>
> fun{a:vt@ype} bucket_delete_recursive ( b: bucket(a) ) : void
>
> sortdef dsz = {s:int | s > 0}
>
> vtypedef dict(a:vt@ype, n:int) =
> @{
> size=int n,
> buckets=arrayptr(bucket(a), n)
> }
>
> fn{a:vt@ype} dict_new {s:dsz} ( int s ) : dict(a, s)
> fn{a:t@ype} dict_delete {s:dsz} ( d: dict(a, s) ) : void
> fn{a:vt@ype} dict_delete_lin {s:dsz} ( d: dict(a, s) ) : void
>
>
> *dict.dats*:
> #include "share/atspre_staload.hats"
>
> staload "./dict.sats"
>
> local
> in
>
>
> implement{a} dict_new {s} ( size ) = let
> val size_st = size_of_int(size)
> val bucket_arr = arrayptr_make_uninitized(size_st)
> implmnt array_initize$init (i, x) = x := bucket_empty()
> val () = arrayptr_initize(bucket_arr, size_st)
> in
> @{size=size, buckets=bucket_arr}:dict(a, s)
> end
>
> implmnt{a} dict_delete ( d ) = let
>   implmnt(a2:t@ype) bucket_item$delete ( x ) = ()
> in
>   dict_delete_lin(d)
> end
>
> implmnt{a} bucket_delete_recursive ( b ) =
> case+ b of
> | ~bucket_empty() => ()
> | ~bucket_filled(str, x, next_bucket) => let
> val () = strptr_free(str)
> val () = bucket_item$delete(x)
> in
> bucket_delete_recursive(next_bucket)
> end
>
> implmnt{a} dict_delete_lin ( d ) = let
>   implmnt array_uninitize$clear (i, x) = 
> bucket_delete_recursive(x)
> in
>   arrayptr_freelin(d.buckets, size_of_int(d.size))
> end
> end
>
> *dict_test.dats*, where main is:
> #include "share/atspre_staload.hats"
>
> staload "./dict.sats"
>
>
> implmnt main0 () = let
>   var d = dict_new(13)
> in
>   dict_delete(d)
> end
>
> *My output*:
> $ patscc --gline -DATS_MEMALLOC_LIBC dict_test.dats
>
> In file included from dict_test_dats.c:15:
> /home/tmj90/Goldelish-Engine/source/data/dict_test.dats: In function 
> ‘mainats_0_void’:
> /home/tmj90/Goldelish-Engine/source/data/dict_test.dats:58:21: error: 
> ‘PMVtmpltcstmat’ undeclared (first use in this function)
>58 |   var d = dict_new(13)
>   | ^~~   
>
> /usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:276:37:
>  
> note: in definition of macro ‘ATSINSmove’
>   276 | #define ATSINSmove(tmp, val) (tmp = val)
>   | ^~~
> /home/tmj90/Goldelish-Engine/source/data/dict_test.dats:58:21: note: each 
> undeclared identifier is reported only once for each function it appears in
>58 |   var d = dict_new(13)
>   | ^~~   
>
> /usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:276:37:
>  
> note: in definition of macro ‘ATSINSmove’
>   276 | #define ATSINSmove(tmp, val) (tmp = val)
>   | ^~~
> /home/tmj90/Goldelish-Engine/source/data/dict_test.dats:58:39: error: 
> ‘dict_new’ undeclared (first use in this function)
>58 |   var d = dict_new(13)
>
>   |   ^   
> /usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:276:37:
>  
> note: in definition of macro ‘ATSINSmove’
>   276 | #define ATSINSmove(tmp, val) (tmp = val)
>   | ^~~
> /home/tmj90/Goldelish-Engine/source/data/dict_test.dats:58:48: warning: 
> implicit declaration of function ‘S2Eapp’ [-Wimplicit-function-declaration]
>58 |   var d = dict_new(13)
>
>   |^ 
> /usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:276:37:
>  
> note: in definition of macro ‘ATSINSmove’
>   276 | #define ATSINSmove(tmp, val) (tmp = val)
>   | ^~~
> /home/tmj90/Goldelish-Engine/source/data/dict_test.dats:58:55: warning: 
> implicit declaration of function ‘S2Ecst’ [-Wimplicit-function-declaration]
>58 |   var d = dict_new(13)
>
>   |   ^ 
> /u

Re: Help with Templates, cannot find missing implementation somewhere...

2021-11-30 Thread d4v3y_5c0n3s
You are right, including " share/atspre_staload.hats" causes the code to 
compile.  However, I'm still having issues.  You see, the code I provided I 
had taken from a static (.sats) and dynamic (.dats) file in order to make 
it more presentable when asking for help.  Your fix only fixes the issue in 
the single-file version, and when including the external static file it 
doesn't work.  Do you know what might be going wrong?  I'll provide the 
(simplified) contents of each of these files below.

*dict.sats*:
#include "share/atspre_staload.hats"

datavtype BUCKET (a:vt@ype) =
| bucket_empty of ()
| bucket_filled of (Strptr1, a, BUCKET(a))

vtypedef bucket(a:vt@ype) = BUCKET(a)

fn{a:vt@ype} bucket_item$delete ( x: a ): void

fun{a:vt@ype} bucket_delete_recursive ( b: bucket(a) ) : void

sortdef dsz = {s:int | s > 0}

vtypedef dict(a:vt@ype, n:int) =
@{
size=int n,
buckets=arrayptr(bucket(a), n)
}

fn{a:vt@ype} dict_new {s:dsz} ( int s ) : dict(a, s)
fn{a:t@ype} dict_delete {s:dsz} ( d: dict(a, s) ) : void
fn{a:vt@ype} dict_delete_lin {s:dsz} ( d: dict(a, s) ) : void


*dict.dats*:
#include "share/atspre_staload.hats"

staload "./dict.sats"

local
in

implement{a} dict_new {s} ( size ) = let
val size_st = size_of_int(size)
val bucket_arr = arrayptr_make_uninitized(size_st)
implmnt array_initize$init (i, x) = x := bucket_empty()
val () = arrayptr_initize(bucket_arr, size_st)
in
@{size=size, buckets=bucket_arr}:dict(a, s)
end

implmnt{a} dict_delete ( d ) = let
  implmnt(a2:t@ype) bucket_item$delete ( x ) = ()
in
  dict_delete_lin(d)
end

implmnt{a} bucket_delete_recursive ( b ) =
case+ b of
| ~bucket_empty() => ()
| ~bucket_filled(str, x, next_bucket) => let
val () = strptr_free(str)
val () = bucket_item$delete(x)
in
bucket_delete_recursive(next_bucket)
end

implmnt{a} dict_delete_lin ( d ) = let
  implmnt array_uninitize$clear (i, x) = 
bucket_delete_recursive(x)
in
  arrayptr_freelin(d.buckets, size_of_int(d.size))
end
end

*dict_test.dats*, where main is:
#include "share/atspre_staload.hats"

staload "./dict.sats"

implmnt main0 () = let
  var d = dict_new(13)
in
  dict_delete(d)
end

*My output*:
$ patscc --gline -DATS_MEMALLOC_LIBC dict_test.dats
In file included from dict_test_dats.c:15:
/home/tmj90/Goldelish-Engine/source/data/dict_test.dats: In function 
‘mainats_0_void’:
/home/tmj90/Goldelish-Engine/source/data/dict_test.dats:58:21: error: 
‘PMVtmpltcstmat’ undeclared (first use in this function)
   58 |   var d = dict_new(13)
  | ^~~   
/usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:276:37: 
note: in definition of macro ‘ATSINSmove’
  276 | #define ATSINSmove(tmp, val) (tmp = val)
  | ^~~
/home/tmj90/Goldelish-Engine/source/data/dict_test.dats:58:21: note: each 
undeclared identifier is reported only once for each function it appears in
   58 |   var d = dict_new(13)
  | ^~~   
/usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:276:37: 
note: in definition of macro ‘ATSINSmove’
  276 | #define ATSINSmove(tmp, val) (tmp = val)
  | ^~~
/home/tmj90/Goldelish-Engine/source/data/dict_test.dats:58:39: error: 
‘dict_new’ undeclared (first use in this function)
   58 |   var d = dict_new(13)
  |   ^   
/usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:276:37: 
note: in definition of macro ‘ATSINSmove’
  276 | #define ATSINSmove(tmp, val) (tmp = val)
  | ^~~
/home/tmj90/Goldelish-Engine/source/data/dict_test.dats:58:48: warning: 
implicit declaration of function ‘S2Eapp’ [-Wimplicit-function-declaration]
   58 |   var d = dict_new(13)
  |^ 
/usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:276:37: 
note: in definition of macro ‘ATSINSmove’
  276 | #define ATSINSmove(tmp, val) (tmp = val)
  | ^~~
/home/tmj90/Goldelish-Engine/source/data/dict_test.dats:58:55: warning: 
implicit declaration of function ‘S2Ecst’ [-Wimplicit-function-declaration]
   58 |   var d = dict_new(13)
  |   ^ 
/usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:276:37: 
note: in definition of macro ‘ATSINSmove’
  276 | #define ATSINSmove(tmp, val) (tmp = val)
  | ^~~
/home/tmj90/Goldelish-Engine/source/data/dict_test.dats:58:62: error: 
‘g0int_t0ype’ undeclared (first use in this function)
   58 |   var d = dict_new(13)
  |  
^  
/usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:276:37: 
note: in definition of macro ‘ATSINSmove’
  276 | #define ATSINSmove(

Re: Help with Templates, cannot find missing implementation somewhere...

2021-11-30 Thread Hongwei Xi
I tried your code and it compiled without any issue.

Did you have the following line at the top:

#include "share/atspre_staload.hats"

The error messages you showed indicate that many template implementations
were not
available to the compiler (patsopt).

--Hongwei


On Tue, Nov 30, 2021 at 10:52 AM d4v3y_5c0n3s  wrote:

> Okay, so I've been struggling with my use of templates for a while
> now, and I'm making this post to get some more eyes on the issue.  I've
> been getting really frustrated, because nothing I've tried seems to work,
> and I have no way to understand what is going wrong whatsoever besides
> becoming familiar with compiler internals (which could take who knows how
> long to learn.)
>
> Here's my code:
> datavtype BUCKET (a:vt@ype) =
> | bucket_empty of ()
> | bucket_filled of (Strptr1, a, BUCKET(a))
>
> vtypedef bucket(a:vt@ype) = BUCKET(a)
>
> sortdef dsz = {s:int | s > 0}
>
> vtypedef dict(a:vt@ype, n:int) =
> @{
> size=int n,
> buckets=arrayptr(bucket(a), n)
> }
>
> extern fn{a:vt@ype} dict_new {s:dsz} ( int s ) : dict(a, s)
> extern fn{a:t@ype} dict_delete {s:dsz} ( d: dict(a, s) ) : void
> extern fn{a:vt@ype} dict_delete_lin {s:dsz} ( d: dict(a, s) ) : void
>
> extern fun{a:vt@ype} bucket_delete_recursive ( b: bucket(a) ) : void
> extern fn{a:vt@ype} bucket_item$delete ( x: a ): void
>
> implement{a} dict_new {s} ( size ) = let
> val size_st = size_of_int(size)
> val bucket_arr = arrayptr_make_uninitized(size_st)
> implmnt array_initize$init (i, x) = x := bucket_empty()
> val () = arrayptr_initize(bucket_arr, size_st)
> in
> @{size=size, buckets=bucket_arr}:dict(a, s)
> end
>
> implmnt{a} dict_delete ( d ) = let
>   implmnt(a2:t@ype) bucket_item$delete ( x ) = ()
> in
>   dict_delete_lin(d)
> end
>
> implmnt{a} bucket_delete_recursive ( b ) =
> case+ b of
> | ~bucket_empty() => ()
> | ~bucket_filled(str, x, next_bucket) => let
> val () = strptr_free(str)
> val () = bucket_item$delete(x)
> in
> bucket_delete_recursive(next_bucket)
> end
>
> implmnt{a} dict_delete_lin ( d ) = let
>   implmnt array_uninitize$clear (i, x) =
> bucket_delete_recursive(x)
> in
>   arrayptr_freelin(d.buckets, size_of_int(d.size))
> end
>
> implmnt main0 () = let
>   var d = dict_new(13)
> in
>   dict_delete(d)
> end
>
>
> Here's the output:
> $ patscc --gline dict_test.dats
> In file included from dict_test_dats.c:15:
> /home/tmj90/Goldelish-Engine/source/data/dict_test.dats: In function
> ‘_057_home_057_tmj90_057_Goldelish_055_Engine_057_source_057_data_057_dict_test_056_dats__dict_new__0__1’:
> /home/tmj90/Goldelish-Engine/source/data/dict_test.dats:24:21: error:
> ‘PMVtmpltcstmat’ undeclared (first use in this function)
>24 | val bucket_arr = arrayptr_make_uninitized(size_st)
>   | ^~
> /usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:276:37:
> note: in definition of macro ‘ATSINSmove’
>   276 | #define ATSINSmove(tmp, val) (tmp = val)
>   | ^~~
> /home/tmj90/Goldelish-Engine/source/data/dict_test.dats:24:21: note: each
> undeclared identifier is reported only once for each function it appears in
>24 | val bucket_arr = arrayptr_make_uninitized(size_st)
>   | ^~
> /usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:276:37:
> note: in definition of macro ‘ATSINSmove’
>   276 | #define ATSINSmove(tmp, val) (tmp = val)
>   | ^~~
> /home/tmj90/Goldelish-Engine/source/data/dict_test.dats:24:39: error:
> ‘arrayptr_make_uninitized’ undeclared (first use in this function)
>24 | val bucket_arr = arrayptr_make_uninitized(size_st)
>   |   ^~~~
> /usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:276:37:
> note: in definition of macro ‘ATSINSmove’
>   276 | #define ATSINSmove(tmp, val) (tmp = val)
>   | ^~~
> /home/tmj90/Goldelish-Engine/source/data/dict_test.dats:24:64: warning:
> implicit declaration of function ‘S2Eapp’ [-Wimplicit-function-declaration]
>24 | val bucket_arr = arrayptr_make_uninitized(size_st)
>   |
> ^~
> /usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:276:37:
> note: in definition of macro ‘ATSINSmove’
>   276 | #define ATSINSmove(tmp, val) (tmp = val)
>   | ^~~
> /home/tmj90/Goldelish-Engine/source/data/dict_test.dats:24:71: warning:
> implicit declaration of function ‘S2Ecst’ [-Wimplicit-function-declaration]
>24 | val bucket_arr = arrayptr_make_uninitized(size_st)
>
> |
> ^
> /usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:276:37:
> note: in definition of macro ‘ATSINSmove’
>   276 | #define ATSINSmove(tmp, val) (tmp = val)
>   | ^~~
> /home/tm