Applying clojure

I watched clojure for some time, and some of its functions are very interesting (constant data structures, functional approach, immutable state). However, since I was still studying, I would like to understand how to apply it in real-world scenarios, prove my advantages, and then develop and apply more complex problems. that is, what easy winnings with clojure (for example, in setting up e-commerce) that can be used to study, and also to find out its advantages.

I researched clojure-based web frameworks, but I'm not interested in them since they need hand-written javascript (as opposed to gwt). So for me it's more about backend handling. Can anyone explain where they applied clojure (in real deployments) and how it turned out to be useful (and the minuses, if any, of using clojure)

Further analysis: Lazy evaluation is one example of the power of Lisp. clojure, which is Lisp, offers the same advantage. So, a real world example of such an application (in the context of clojure) will help me get an idea.

+6
source share
1 answer

You mentioned that you work with CSV files. I found that they are very useful because I had to parse the csv file - used by clojure -csv; then extract specific columns from this csv file using sequence functions; alternate the field names of the http form with zipmap; and then make http calls to the ASP application using clj-http.client.

(def accumail-url-keys ["CA", "STREET", "STREET2", "CITY", "STATE", "ZIP", "YR", "BILL_NO", "BILL_TYPE"] ) . . . (defn ret-params "Generates all q-parameters and returns them in a vector of vectors." [all-csv-rows] (reduce (fn [param-vec one-full-csv-row] (let [q-param (zipmap accumail-url-keys one-full-csv-row) accu-q-param (first (rest (split-at 3 q-param))) billing-param (first (split-at 3 q-param))] (conj param-vec [accu-q-param billing-param]))) [] all-csv-rows)) 

This project was an accelerated training exercise by Clojure.

The two sites 4Clojure.com and http://www.cis.upenn.edu/~matuszek/cis554-2010/Assignments/clojure-01-exercises.html are good places to start working on Clojure exercises. You can rely on them.

The Clojure Google Group is also a very useful place to get information.

Univ of Penn CIS exercises, no matter how they seem, have given me a lot of digestion, especially getting a tree skeleton, and lately the skeleton issue has received a long discussion in the Google Clojure group.

Good luck. CMN

+5
source

Source: https://habr.com/ru/post/897561/


All Articles