klapaucius icon indicating copy to clipboard operation
klapaucius copied to clipboard

pseudo-composition of instructions

Open Vaguery opened this issue 7 years ago • 1 comments

take their :transaction steps and concatenate them, producing a new consolidated function on the fly.

For example,

(:scalar-add 9 :boolean-or :scalar-≤)

(consume-top-of :scalar :as :arg2)
(consume-top-of :scalar :as :arg1)
(calculate [:arg1 :arg2] +' :as :prelim)
(calculate [:prelim] #(if %1 (Double/isNaN %1) false) :as :nan)
(calculate [:nan :prelim] #(when-not %1 %2) :as :sum)
(return-item :sum)
(calculate [:nan] #(when %1 ":scalar-add produced NaN") :as :warning)
(record-an-error :from :warning)

(push-onto :scalar 9) ; <- the literal

(consume-top-of :bool :as :arg2)
(consume-top-of :bool :as :arg1)
(calculate [:arg1 :arg2] #(~operation %1 %2) :as :result)
(return-item :result)

(consume-top-of :scalar :as :arg2)
(consume-top-of :scalar :as :arg1)
(calculate [:arg1 :arg2] #(< (compare %1 %2) 1) :as :check)
(return-item :check)
  • take 2 :scalar
  • push to :exec
  • push to :scalar
  • take 2 :boolean
  • push to :exec
  • take 2 :scalar
  • return to :exec

Vaguery avatar Dec 18 '17 02:12 Vaguery

Affected by #175

Vaguery avatar Mar 06 '18 17:03 Vaguery