Sha256: 704d373e14f98673fb7188a29d6eec15c2301dd91731f25a41bc0047bc295978
Contents?: true
Size: 1.15 KB
Versions: 14
Compression:
Stored size: 1.15 KB
Contents
# frozen_string_literal: true module MiniKraken module Core # Freshness: fresh, bound, ground # fresh: no association at all # bound: associated to something that is itself not ground. # ground: associated to something that is either an atomic, a composite with ground members, # a variable reference to something that is itself ground. # RS fresh == fresh or bound # RS not fresh == ground # RS result == fresh => any or bound => expr(any) Freshness = Struct.new(:degree, :associated) do def initialize(aDegree, anAssociated) super(aDegree, valid_associated(anAssociated)) end def fresh? degree == :fresh end def bound? degree == :bound end def ground? degree == :ground end # Does this instance represent something fresh according to # "Reasoned Schemer" book ? def rs_fresh? degree != ground end private def valid_associated(anAssociated) raise StandardError, 'Wrong argument' if anAssociated.kind_of?(self.class) anAssociated end end # struct end # module end # module
Version data entries
14 entries across 14 versions & 1 rubygems