type trie_p
type(trie), pointer :: p => NULL()
end type trie_p
type trie
class(*), allocatable :: value
type(trie_p), dimension(:), allocatable :: nodes
end type trie
data Trie v
= Branch Char (Map Char (Trie v))
| Leaf Char v
local function New(base,new)
return setmetatable(new,{__index=base})
end
local Trie={}
function Trie.New()
return New(Trie,{
children={},
value=nil
})
end
type trie_p
type(trie), pointer :: p => NULL()
end type trie_p
type trie
class(*), allocatable :: value
type(trie_p), dimension(:), allocatable :: nodes
end type trie
local function New(base,new)
return setmetatable(new,{__index=base})
end
local Trie={}
function Trie.New()
return New(Trie,{
children={},
value=nil
})
end