Sha256: 42a721bb1fc84de058ab094c1410b0b9cd8885b40a8e200a8cf68f0976a7abb7
Contents?: true
Size: 573 Bytes
Versions: 1
Compression:
Stored size: 573 Bytes
Contents
# frozen_string_literal: true module PrologMQI class Term def initialize(term) @term = term end def functor? @term.is_a?(Hash) && @term.key?('functor') && @term.key?('args') end def array? @term.is_a?(Array) end def variable? @term.is_a?(String) && (@term[0].upcase == @term[0] || @term.start_with?('_')) end def atom? @term.is_a?(String) && !variable? end def name return @term if atom? || variable? @term['functor'] end def args @term['args'] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
prolog_mqi-0.1.0 | lib/prolog_mqi/term.rb |