File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99; ;
1010
1111(ns ^:no-doc editscript.patch
12- (:require [clojure.set :as set]
13- [editscript.edit :as e]
12+ (:require [editscript.edit :as e]
1413 [editscript.util.common :as c]
1514 [clojure.string :as s]))
1615
3130 ; ;if p is ##NaN, then p cannot be found in x, for (= ##NaN ##NaN) is false!
3231 :map (dissoc x p)
3332 :vec (into (subvec x 0 p) (subvec x (inc ^long p)))
34- :set (set/difference x #{p} )
33+ :set (disj x p )
3534 :lst (->> (split-at p x)
3635 (#(concat (nth % 0 ) (next (nth % 1 ))))
3736 (apply list))))
4039 [x p v]
4140 (case (e/get-type x)
4241 :map (assoc x p v)
43- :vec (into (conj (subvec x 0 p) v) (subvec x p))
42+ :vec (if (= p (count x))
43+ (conj x v)
44+ (into (conj (subvec x 0 p) v) (subvec x p)))
4445 :set (conj x v)
4546 :lst (->> (split-at p x)
4647 (#(concat (nth % 0 ) (conj (nth % 1 ) v)))
7475 [x p v]
7576 (case (e/get-type x)
7677 :map (assoc x p v)
77- :vec (into ( conj ( subvec x 0 p) v) ( subvec x ( inc ^long p)) )
78- :set (-> x (set/difference #{p} ) (conj v))
78+ :vec (assoc x p v )
79+ :set (-> x (disj p ) (conj v))
7980 :lst (->> (split-at p x)
8081 (#(concat (nth % 0 ) (conj (rest (nth % 1 )) v)))
8182 (apply list))))
You can’t perform that action at this time.
0 commit comments