Class: Dhall::BuiltinFunction

Inherits:
Builtin show all
Defined in:
lib/dhall/builtins.rb

Instance Method Summary collapse

Methods inherited from Expression

#&, #*, #+, #annotate, #as_dhall, #cache_key, #concat, decode, #deep_merge, #deep_merge_type, #dhall_eq, #digest, #fetch, #fusion, #merge, #normalize, #resolve, #shift, #slice, #substitute, #to_binary, #to_cbor, #to_proc, #to_s, #|

Instance Method Details

#as_jsonObject



34
35
36
37
38
39
40
# File 'lib/dhall/builtins.rb', line 34

def as_json
	if (unfilled = unfill) != self
		unfilled.as_json
	else
		super
	end
end

#call(*new_args) ⇒ Object



25
26
27
28
29
30
31
32
# File 'lib/dhall/builtins.rb', line 25

def call(*new_args)
	args = partial_application + new_args
	if args.length == method(:uncurried_call).arity
		uncurried_call(*args)
	else
		with(partial_application: args)
	end
end

#unfill(*args) ⇒ Object



19
20
21
22
23
# File 'lib/dhall/builtins.rb', line 19

def unfill(*args)
	(args.empty? ? partial_application : args).reduce(self.class.new) do |f, arg|
		Application.new(function: f, argument: arg)
	end
end