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
type Trie struct {
c rune
children map[rune]*Trie
isEntry bool
value V
}
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