kedarbellare commented on a change in pull request #14195: [Clojure] Add 
methods based on NDArrayAPI/SymbolAPI
URL: https://github.com/apache/incubator-mxnet/pull/14195#discussion_r275120017
 
 

 ##########
 File path: contrib/clojure-package/src/dev/generator.clj
 ##########
 @@ -56,37 +60,138 @@
 
 (defn increment-param-name [pname]
   (if-let [num-str (re-find #"-\d" pname)]
-    (str (first (clojure.string/split pname #"-")) "-" (inc (Integer/parseInt 
(last (clojure.string/split num-str #"-")))))
+    (str 
+     (first (clojure.string/split pname #"-"))
+     "-"
+     (inc (Integer/parseInt (last (clojure.string/split num-str #"-")))))
     (str pname "-" 1)))
 
-(defn rename-duplicate-params [params]
-  (reduce (fn [known-names n] (conj known-names (if (contains? (set 
known-names) n)
-                                                  (increment-param-name n)
-                                                  n)))
-          []
-          params))
+(defn rename-duplicate-params [pnames]
+  (->> (reduce
+        (fn [pname-counts n]
+          (let [rn (if (pname-counts n) (str n "-" (pname-counts n)) n)
+                inc-pname-counts (update-in pname-counts [n] (fnil inc 0))]
+            (update-in inc-pname-counts [:params] conj rn)))
+        {:params []}
+        pnames)
+       :params))
+
+(defn get-public-no-default-methods [obj]
+  (->> (r/reflect obj)
+       :members
+       (map #(into {} %))
+       (filter #(-> % :flags :public))
+       (filter #(not (re-find #"org\$apache\$mxnet" (str (:name %)))))
+       (filter #(not (re-find #"\$default" (str (:name %)))))))
+
+(defn get-public-to-gen-methods [public-to-hand-gen public-no-default]
+  (remove #(contains? (->> public-to-hand-gen
 
 Review comment:
   done! agree that it looks much nicer :)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to