Re: What is the minimal Emacs config for practical Clojure development?
Yesterday, I followed the excellent "Clojurescript Quick Start Guide" (https://clojurescript.org/guides/quick-start). Everything worked as expected. They did a great job of making it as minimal as possible. After that, I followed the "Emacs and Inferior Clojure Interaction Mode" guide (https://clojurescript.org/tools/emacs-inf). That's a nice guide, too. I had one issue: the instructions are out of date because inf-clojure removed the run-clojure alias for the inf-clojure function. I submitted a patch: https://github.com/clojure/clojurescript-site/pull/246 Currently, I'm running with Emacs, inf-clojure, and lein-cljsbuild. It seems to be working well. I don't have live code reloading, like Figwheel. This is the function I'm using in my .emacs to launch the repl: (defun cljs-browser-repl () (interactive) (inf-clojure "lein trampoline run -m clojure.main repl.clj")) And the contents of repl.clj: (require '[cljs.repl :as repl]) (require '[cljs.repl.browser :as browser]) ;; require the browser implementation of IJavaScriptEnv (def env (browser/repl-env :static-dir ["." "out/" "resources/public/"])) ;; create a new environment (repl/repl env) ;; start the REPL Today, for unknown reasons, I'm no longer getting the "def: (:arglists^[[0m..." messages in my minibuffer, but instead I'm seeing two different errors when I put the cursor in an expression: WARNING: Use of undeclared Var cljs.user/Throwable at line 6 clojure.lang.ExceptionInfo: Assert failed: Argument to resolve must be a quoted symbol (core/and (seq? quoted-sym) (= (quote quote) (first quoted-sym))) at line 4 {:file "", :line 4, :column 2, :root-source-info {:source-type :fragment, :source-form (try (:arglists (clojure.core/meta (clojure.core/resolve (clojure.core/read-string "ClojureScript" (catch Throwable t nil))}, :tag :cljs/analysis-error} This usually pops up in the minibuffer as: defn: (core/and (seq? quoted-sym)), but fortunately the full message went to the REPL once. Note that this is the same error I was when using Monroe instead of inf-clojure. The other message I see is: ReferenceError: planck is not defined () which pops up in the minibuffer as: defn: () I also got this error once when trying to get the docstring for a var: WARNING: No such namespace: lumo.repl, could not locate lumo/repl.cljs, lumo/repl.cljc, or JavaScript source providing "lumo.repl" at line 1 WARNING: Use of undeclared Var lumo.repl/doc at line 1 WARNING: Can't take value of macro cljs.core/declare at line 1 ReferenceError: lumo is not defined () To my knowledge, I'm not using lumo or planck. Andrea, do you still think these are issues with inf-clojure? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: What is the minimal Emacs config for practical Clojure development?
I tried this, changing node to browser, like so: clojure -J-Dclojure.server.repl="{:port ${1:-} :accept cljs.server.browser/repl}" -cljs-canary -m cljs.main -re browser -r That starts a REPL in my terminal, but when I try to connect to it from Emacs, using C-c M-c RET localhost RET , I get the following in my Emacs *inf-clojure* buffer: Process inf-clojure connection broken by remote peer and the following the terminal REPL: Exception in thread "Clojure Connection repl 1" java.lang.RuntimeException: Unable to resolve symbol: PrintWriter-on in this context, compiling:(cljs/core/server.clj:81:29) On Friday, July 6, 2018 at 4:50:57 PM UTC-7, Andrea Richiardi wrote: > > Ok this command will open a socket REPL directly in cljs.user: > > clojure -J-Dclojure.server.repl="{:port ${1:-} :accept > cljs.server.node/repl}" -R:cljs-canary -m cljs.main -re node -r > > You need the right deps.edn aliases - then you will be able to nc > localhost or inf-clojure-connect to it. > > On Friday, July 6, 2018 at 11:18:56 AM UTC-7, Austin Haas wrote: >> >> I spent a couple more hours working with Monroe and Figwheel. I still >> can't figure out how to use the REPL. After trying to evaluate a few >> expressions, Emacs gets completely locked up spewing the following error >> message 1000s of times: >> >> clojure.lang.ExceptionInfo: Arguments to require must be quoted. >> Offending spec: (symbol (namespace (quote clojure.repl/pst))) at line 1 >> {:file "", :line 1, :column 5, :root-source-info >> {:source-type :fragment, :source-form (do (require (symbol (namespace >> (quote clojure.repl/pst (clojure.repl/pst *e))}, :tag >> :cljs/analysis-error} >> >> I've switched back to inf-clojure and Figwheel with the following config: >> >> (add-to-list 'load-path "~/.emacs.d/site-lisp/third-party/inf-clojure/") >> (require 'inf-clojure) >> (setf inf-clojure-lein-cmd "lein run -m clojure.main") >> (add-hook 'clojure-mode-hook #'inf-clojure-minor-mode) >> (add-hook 'inf-clojure-mode-hook #'eldoc-mode) >> >> That seems to work, but I see something like this in the minibuffer every >> time I move the cursor, with or without eldoc mode enabled: >> >> def: (:arglists^[[0m >> ^[[36m3^[[0m ^[[36m(clojure.core/meta^[[0m >> ^[[36m4^[[0m ^[[36m(clojure.core/resolve^[[0m >> ^[[36m5^[[0m ^[[36m(clojure.core/read-string "def") >> >> Does "lein run -m clojure.main" create a socket REPL? >> >> I followed the instructions for inf-clojure for a "Clojure Command Line >> Socket REPL" ( >> https://github.com/clojure-emacs/inf-clojure#clojure-command-line-socket-repl), >> >> but then (fig-start) is not found. >> >> I followed the instructions for inf-clojure for a "Leiningen Socket REPL" >> (https://github.com/clojure-emacs/inf-clojure#leiningen-socket-repl), >> and that produces results like with "lein run -m clojure.main"; it works, >> but I get the "eldoc" garbage in the minibuffer. AFAICT, the eldoc problem >> doesn't occur until I run (cljs-repl). >> >> Any insight greatly appreciated. >> >> >> >> >> -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: What is the minimal Emacs config for practical Clojure development?
I shouldn't have said that two of those errors were the same. They're different, but they both mention unquoted symbols. Monroe clojure.lang.ExceptionInfo: Arguments to require must be quoted. Offending spec: (symbol (namespace (quote clojure.repl/pst))) at line 1 {:file "", :line 1, :column 5, :root-source-info {:source-type :fragment, :source-form (do (require (symbol (namespace (quote clojure.repl/pst (clojure.repl/pst *e))}, :tag :cljs/analysis-error} inf-clojure WARNING: Use of undeclared Var cljs.user/Throwable at line 6 clojure.lang.ExceptionInfo: Assert failed: Argument to resolve must be a quoted symbol (core/and (seq? quoted-sym) (= (quote quote) (first quoted-sym))) at line 4 {:file "", :line 4, :column 2, :root-source-info {:source-type :fragment, :source-form (try (:arglists (clojure.core/meta (clojure.core/resolve (clojure.core/read-string "ClojureScript" (catch Throwable t nil))}, :tag :cljs/analysis-error} -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: What is the minimal Emacs config for practical Clojure development?
I've determined that the previously mentioned errors are related to incompatibilities with inf-clojure and clojurescript. I filed a bug, and a workaround, with inf-clojure here: https://github.com/clojure-emacs/inf-clojure/issues/150 -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: group rows on basis of value in a column in CSV with clojure
Hi All, Thanks for the tip to use (group-by last …) It was working fine until my csv file got updated. Now i am not sure abt the number of columns in my csv. It could change in every row, but I still need to group it with Heading 3 itself. Example of my updated CSV is as below Heading1 Heading 2 Heading 3 Heading 4 Heading 5 > abc 123 Value1 newValue > def 234 Value1 anotherValue oneMoreValue > ghi dfgew Value1 aValue > jkl 456 Value5 > pqr 567 Value5 > stu 678 value3 > vwx sdf value4 > yza 900 value4 Now i cant use (group-by last ...) instead i tried using (nth On Tuesday, July 3, 2018 at 10:42:08 PM UTC+5:30, Philipp Neumann wrote: > > Hi. > > This is a job for (group-by last ...) > > Regards > > Varun J.P > schrieb am Di., 3. Juli > 2018, 19:05: > >> My CSV file is something like the attached file which could have 'n' >> number of line. I need to group by the values in the last column. >> Current I believe the below code will return me a vector of vector. >> >> (defn read-csv-file >> >> [path] >> >> (try >> >>(with-open [input-file (io/reader path)] >> >> (let [a_list (doall (map (comp first clojure-csv.core/parse-csv) ( >> line-seq input-file)))] >> >>(rest (into [] a_list >> >>(catch Exception exception (throw exception >> >> >> i need to iterate through this vector of vector and create a new vector >> of vector containing only elements of the first group, then in next >> iteration i need the second set and so on. >> >> Example CSV >> >>> Heading1 Heading 2 Heading 3 >>> abc 123 Value1 >>> def 234 Value1 >>> ghi dfgew Value1 >>> jkl 456 Value5 >>> pqr 567 Value5 >>> stu 678 value3 >>> vwx sdf value4 >>> yza 900 value4 >> >> >> >> so when this CSV is parsed i will have something like >> [ >> [abc 123 Value1] >> [def 234 Value1] >> [ghi dfgew Value1] >> [jkl 456 Value5] >> [pqr 567 Value5] >> [stu 678 value3] >> [vwx sdf value4] >> [yza 900 value4]] >> So when i iterate through this i need to group the vector of vector by >> the last column >> so my first iteration output should be something like >> >> [ >> [abc 123 Value1] >> [def 234 Value1] >> [ghi dfgew Value1]] >> 2nd iteration should be >> [ >> [jkl 456 Value5] >> [pqr 567 Value5]] >> 3rd should be >> >> [ >> [stu 678 value3]] >> and so on. >> >> How would i achieve this in clojure. is there any build in csv parsing >> function >> >> Regards >> JP >> >> >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Clojure" group. >> To post to this group, send email to clo...@googlegroups.com >> >> Note that posts from new members are moderated - please be patient with >> your first post. >> To unsubscribe from this group, send email to >> clojure+u...@googlegroups.com >> For more options, visit this group at >> http://groups.google.com/group/clojure?hl=en >> --- >> You received this message because you are subscribed to the Google Groups >> "Clojure" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to clojure+u...@googlegroups.com . >> For more options, visit https://groups.google.com/d/optout. >> > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: group rows on basis of value in a column in CSV with clojure
Hi All, Thanks for the tip to use (group-by last …) It was working fine until my csv file got updated. Now i am not sure abt the number of columns in my csv. It could change in every row, but I still need to group it with Heading 3 itself. Example of my updated CSV is as below Heading1 Heading 2 Heading 3 Heading 4 Heading 5 > abc 123 Value1 newValue > def 234 Value1 anotherValue oneMoreValue > ghi dfgew Value1 aValue > jkl 456 Value5 > pqr 567 Value5 > stu 678 value3 > vwx sdf value4 > yza 900 value4 Now i cant use (group-by last ...) instead i tried using (group-by (nth (nth testvector 0) 2) testvector) where testvector is a vector of vector but is throwing an error > "ClassCastException java.lang.String cannot be cast to clojure.lang.IFn > clojure.core/group-by/fn--7011 > (core.clj:6870)" Can someone suggest a different approch On Tuesday, July 3, 2018 at 10:42:08 PM UTC+5:30, Philipp Neumann wrote: > > Hi. > > This is a job for (group-by last ...) > > Regards > > Varun J.P > schrieb am Di., 3. Juli > 2018, 19:05: > >> My CSV file is something like the attached file which could have 'n' >> number of line. I need to group by the values in the last column. >> Current I believe the below code will return me a vector of vector. >> >> (defn read-csv-file >> >> [path] >> >> (try >> >>(with-open [input-file (io/reader path)] >> >> (let [a_list (doall (map (comp first clojure-csv.core/parse-csv) ( >> line-seq input-file)))] >> >>(rest (into [] a_list >> >>(catch Exception exception (throw exception >> >> >> i need to iterate through this vector of vector and create a new vector >> of vector containing only elements of the first group, then in next >> iteration i need the second set and so on. >> >> Example CSV >> >>> Heading1 Heading 2 Heading 3 >>> abc 123 Value1 >>> def 234 Value1 >>> ghi dfgew Value1 >>> jkl 456 Value5 >>> pqr 567 Value5 >>> stu 678 value3 >>> vwx sdf value4 >>> yza 900 value4 >> >> >> >> so when this CSV is parsed i will have something like >> [ >> [abc 123 Value1] >> [def 234 Value1] >> [ghi dfgew Value1] >> [jkl 456 Value5] >> [pqr 567 Value5] >> [stu 678 value3] >> [vwx sdf value4] >> [yza 900 value4]] >> So when i iterate through this i need to group the vector of vector by >> the last column >> so my first iteration output should be something like >> >> [ >> [abc 123 Value1] >> [def 234 Value1] >> [ghi dfgew Value1]] >> 2nd iteration should be >> [ >> [jkl 456 Value5] >> [pqr 567 Value5]] >> 3rd should be >> >> [ >> [stu 678 value3]] >> and so on. >> >> How would i achieve this in clojure. is there any build in csv parsing >> function >> >> Regards >> JP >> >> >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Clojure" group. >> To post to this group, send email to clo...@googlegroups.com >> >> Note that posts from new members are moderated - please be patient with >> your first post. >> To unsubscribe from this group, send email to >> clojure+u...@googlegroups.com >> For more options, visit this group at >> http://groups.google.com/group/clojure?hl=en >> --- >> You received this message because you are subscribed to the Google Groups >> "Clojure" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to clojure+u...@googlegroups.com . >> For more options, visit https://groups.google.com/d/optout. >> > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.