lib/lisp/interpreter/core/functional.rb in lisp-interpreter-0.5.4 vs lib/lisp/interpreter/core/functional.rb in lisp-interpreter-0.5.5
- old
+ new
@@ -1,7 +1,10 @@
+require_relative 'stl_constants'
+
# Optimization module
module Optimize
+ include SchemeStl
def fold_values_helper(other)
other = other.map { |t| find_list_function_value [t] }
(equalize_lists other).transpose
end
@@ -39,13 +42,13 @@
end
def filter_helper(func, values)
result =
if func.is_a? Proc
- values.select { |t| func.call(*t) == '#t' }
+ values.select { |t| func.call(*t) == TRUE }
else
- values.select { |t| (send func, [t]) == '#t' }
+ values.select { |t| (send func, [t]) == FALSE }
end
build_list result
end
def apply_helper(func, values)
@@ -121,10 +124,10 @@
min = other.map(&:size).min
other.map { |t| t[0..min - 1] }
end
def member_helper(to_check, values)
- return '#f' unless values.include? to_check
+ return FALSE unless values.include? to_check
idx = values.index(to_check)
build_list values[idx..-1]
end
def find_params_lambda(other)