Fix other read-string uses in PSB2 problems

Since removing 'read-string' and 'str' from middle-character and twitter seemed to help diversify the outputs, we chose to replace all other occurrences of this pattern from the other PSB2 problems. Additionally, this conversion with 'read-string' and 'str' was completely unnecessary since the program was already taking from the top of the string stack.
This commit is contained in:
RichardLussier 2022-03-03 14:44:09 -06:00
parent 404e640cfb
commit c6f08d4ca3
5 changed files with 13 additions and 38 deletions

View File

@ -78,19 +78,14 @@
(:step-limit argmap))
:string))
inputs)
parsed-outputs (map (fn [output]
(try (read-string output)
#?(:clj (catch Exception e 1000.0)
:cljs (catch js/Error. e 1000.0))))
outputs)
errors (map (fn [correct-output output]
(if (= output :no-stack-item)
10000
(metrics/levenshtein-distance correct-output output)))
correct-outputs
parsed-outputs)]
outputs)]
(assoc individual
:behaviors parsed-outputs
:behaviors outputs
:errors errors
:total-error #?(:clj (apply +' errors)
:cljs (apply + errors)))))

View File

@ -46,19 +46,14 @@
(:step-limit argmap))
:string))
inputs)
parsed-outputs (map (fn [output]
(try (read-string output)
#?(:clj (catch Exception e 1000.0)
:cljs (catch js/Error. e 1000.0))))
outputs)
errors (map (fn [correct-output output]
(if (= output :no-stack-item)
10000
(metrics/levenshtein-distance (str correct-output) (str output))))
(metrics/levenshtein-distance correct-output output)))
correct-outputs
parsed-outputs)]
outputs)]
(assoc individual
:behaviors parsed-outputs
:behaviors outputs
:errors errors
:total-error #?(:clj (apply +' errors)
:cljs (apply + errors)))))

View File

@ -74,19 +74,14 @@
(:step-limit argmap))
:string))
inputs)
parsed-outputs (map (fn [output]
(try (read-string output)
#?(:clj (catch Exception e 1000.0)
:cljs (catch js/Error. e 1000.0))))
outputs)
errors (map (fn [correct-output output]
(if (= output :no-stack-item)
10000
(metrics/levenshtein-distance correct-output output)))
correct-outputs
parsed-outputs)]
outputs)]
(assoc individual
:behaviors parsed-outputs
:behaviors outputs
:errors errors
:total-error #?(:clj (apply +' errors)
:cljs (apply + errors)))))

View File

@ -46,19 +46,14 @@
(:step-limit argmap))
:string))
inputs)
parsed-outputs (map (fn [output]
(try (read-string output)
#?(:clj (catch Exception e 1000.0)
:cljs (catch js/Error. e 1000.0))))
outputs)
errors (map (fn [correct-output output]
(if (= output :no-stack-item)
10000
(metrics/levenshtein-distance (str correct-output) (str output))))
(metrics/levenshtein-distance correct-output output)))
correct-outputs
parsed-outputs)]
outputs)]
(assoc individual
:behaviors parsed-outputs
:behaviors outputs
:errors errors
:total-error #?(:clj (apply +' errors)
:cljs (apply + errors)))))

View File

@ -59,19 +59,14 @@
(:step-limit argmap))
:string))
inputs)
parsed-outputs (map (fn [output]
(try (read-string output)
#?(:clj (catch Exception e 1000.0)
:cljs (catch js/Error. e 1000.0))))
outputs)
errors (map (fn [correct-output output]
(if (= output :no-stack-item)
10000
(metrics/levenshtein-distance (str correct-output) (str output))))
(metrics/levenshtein-distance correct-output output)))
correct-outputs
parsed-outputs)]
outputs)]
(assoc individual
:behaviors parsed-outputs
:behaviors outputs
:errors errors
:total-error #?(:clj (apply +' errors)
:cljs (apply + errors)))))