class Upl::Functor
Just an idea, not used yet.
Attributes
atom[R]
Public Class Methods
new( atom, args_or_arity )
click to toggle source
# File lib/upl/functor.rb, line 4 def initialize( atom, args_or_arity ) @atom = atom case args_or_arity when Array @args = args_or_arity @arity = args.size when Integer @arity = args_or_arity else "dunno bout #{args_or_arity.inspect}" end end
Public Instance Methods
args()
click to toggle source
# File lib/upl/functor.rb, line 19 def args; @args || [] end
arity()
click to toggle source
# File lib/upl/functor.rb, line 20 def arity; @arity || args.size end
functor_t()
click to toggle source
create a functor_t
pointer
# File lib/upl/functor.rb, line 23 def functor_t raise NotImplementedError end
predicate_t()
click to toggle source
create a predicate_t
# File lib/upl/functor.rb, line 28 def predicate_t raise NotImplementedError end
pretty_print(pp)
click to toggle source
# File lib/upl/functor.rb, line 32 def pretty_print(pp) unless atom.to_sym == :',' pp.text atom.to_s if arity > 0 pp.text ?/ pp.text arity.to_s end end if arity > 0 pp.group 1, ?(, ?) do args.each_with_index do |ruby_term,i| ruby_term.pretty_print pp pp.text ?, if i < arity - 1 end end end end