@@onthecodeagain No wonder, in soviet Ukraine reference gets you. Btw. Russian word "ссылка" both means "reference" like in "got the reference" and "exile" like in Gulag.
Ah-mazing! Thanks for this. Also, you are making great use of the in-editor evaluation of expressions to demonstrate fns from the standard library (as with assoc-in). Makes what you are doing very clear. Question about the animal-list at the end. Does it make a difference if you deref the subscription directly in the let binding vs when using the animals var in the mapping?
Hi , There exist NodeJs,Python,Ruby available in market. May i know why we go with clojure and what advantage it brings us for application Im happy if you reply and even happy if you make video on it
It's possible I will make a video on this but as a quick answer, some key reasons you may prefer to use Clojure is that it's a purely functional language that gives you immutable data types, it has the repl so you can evaluate code on the fly and write applications quickly. It runs on the JVM and is quick, it has multi-threading and it uses simple data structures. It's also dynamically typed which I like. My personal feeling is that you should use a language that you feel makes you most productive and which suits your application :) It's best to choose what you want but it's good to know what choices you have.
Here's a Google translate of what I wrote to Ukrainian dude not so long ago :D *pros* 1 The main idea of Clojure is "Simple made easy" - the supremacy of simple abstractions with high synergy over the familiar, familiar, abundance of syntactic sugar at the language level - "easy". Topics: Complexity as the main enemy of "Out of the Tar Pit", the difference between "accidental complexity" and "domain complexity", "why it is better to have many functions working with a small number of types" and the state as the main source of complexity. 2 Good two-way interop. protocols, records, expansion of Java types. These abstractions can also be used to create interesting features such as funcool / cats and smeared with monads. 3 Clojure is attended by (mostly) old people who love the craft. Few shit coders. Most of the ecosystem is written by experienced coders who know what they're doing and don't abuse macros. 4 Infinite Lisp extensibility. The EmacsLisp example is a major factor in why Emacs is still relevant. 5 At the same time, Clojure is not really a LISP. It adds [] for form binding and {} for metadata - this is an example of a rational approach to syntax. "decomplecting" brackets with different semantic categories. 6 Accretion policy is not to break legacy code. The fact that Clojure doesn't use the traditional Wooop with inheritance helps a lot with this. 7 "Multimethods and Hierarchies" as an alternative to Ooooooo. 8 Clojure has "immutability by default" (versus "mutability by default" as in Scala "Scala Collections: Why Not?") 9 Global immutability and "persistent data structures" are trivial to parallel (map ..) just add p (pmap ...) 10 Pure functions are easy to test, memoized and viewed as a black box. The JVM is very fond of simplicity and simple functions. 11 EDN is an alternative to JSON with extensibility, time format and Clojure code subtype EDN that allows you to manipulate code as data using a standard set of functions. Makes serialization trivial. 12 Clojure is uniquely suited to "REPL Driven Development" due to the homoiconicity and purity of functions, which allows you to change parts of the program while keeping the state. Demo "Interactive programming Flappy Bird in ClojureScript" 13 Spec is a killer feature. It allows you to describe the shape of data much more expressively and more accurately than a strong type system using the same language, the same set of functions instead of the lasso meta type language as in other functional languages. These descriptions can be bound to functions like "Design by Contract" using jeaye / orchestra, this can be done in the usual way - like types. For example, try using the type system to describe in your favorite language that a function that takes an array as an argument should return an array of the same length. This is trivial in Clojure. Spec also allows you to generate data that satisfies it. For example, for "generative testing". It even has a QuickCheck port with haskell, and it's easier to use in the dynamic language "generative testing" since you don't need to write generators for a bunch of types. The fact that tests (specs) are executed at runtime does not affect production as they can be disabled at the compiler level. 14 Unique blend of functionality with an emphasis on immutability and dynamic typing. The main feature of functional programming is immutability (no assignment). Typing in most languages allows you to catch typos and simple errors at the cost of a boilerplate and fragility of the code. Since strongly typed code cannot have a partially valid state (for example, transitional during refactoring) and code that is expensive to change quickly decays. Tests with good coverage solve the type problem, serve as a specification, and allow granularity of code correctness. 15 Almost everything in klozhure is lazy - if no one came for the result of calculations, then it will not happen. 16 JVM is very important to Clojure. First, the JVM is designed with a focus on dynamism and lazy loading. She can inline code, rewrite polymorphic calls into monomorphic ones, deduce types, re-optimize code based on the current load. Secondly, it is a huge ecosystem of ready-made solutions. And since Clojure is just a library, it can be pulled into the JVM project. 17. Clojure's design takes into account the 80/20 rule (20% of the effort yields 80% of the result) - naive Clojure code by default balances versatility, performance, and security. But for the critical 20% (and usually 3%) there is an opportunity to go down to a level lower. You can use math functions without overflow check, you can add type hints to get rid of reflexes. It is possible to create local mutability using volatil or transient, use a transducer instead of macro threading. Finally, you can rewrite the function in Java and call it from Clojure. It is extremely rare to prescribe since the optimized code in Clojure is compiled into approximately the same bytecode as in Java, it even without a tambourine is compiled into native code through GraalVM (unlike other dynamic languages) *Cons* 1 Bus factor - If someone hardens Rich then you can start learning Kotlin. 2 Entry threshold - Unusual syntax requiring an editor with the need to learn basic key combinations so as not to edit the brackets by hand. Immunity by default also requires a shift in consciousness. An attempt to simultaneously learn a new paradigm, syntax and Emax will most likely end up badly. Despite the fact that the language itself is quite simple and has a minimal syntax, its standard library is bottomless. The core namespace is a real trash heap into which everything that is possible is crammed. There are 5 ways to make something mutable with different constraints. A whole bunch of ways to combine functions: comp, miscellaneous threading macros -> - >> ... transducers, nesting (foo (bar x)) ... The laziness of the language sometimes throws unexpected surprises too.Especially when you work with side effects (for example, you want to printline debug something), the worst is when it is combined with macros ... Despite the fact that macros are very cool, there is always a temptation to smear them over your ears and write in your cozy language that you know only you. And also chtuk 17 primitives for working with streams and asynchronous code. Fortunately, no one uses most of them. The problem with all this abundance is that the threshold for entering into reading someone else's code becomes much higher.that the threshold of entering into reading someone else's code becomes much higher.that the threshold of entering into reading someone else's code becomes much higher. 3 Performance, although good, is extremely unpredictable. The Clojure compiler does its magic, then the JVM hotspot wraps around ... 4 There is no standard approach to organizing code at the system level. 5 Hell's stacktrace. 6 In other languages, types often play the role of documentation that editors know how to work with. 7 In other languages, types often play the role of documentation that editors know how to work with. In Clojure, you often need to encode additional information in names. For example, let's say we have a function that converts a shopping cart from JSON to EDN. In Clojure, its name could be something like customer-order-json-> customer-order-edn Now let's imagine that JSON comes to us in a lazy form (we need to dereference it before using it) and someone decided that our function is a convenience for the sake, it should take the reference as input. Then its name would look something like this customer-order- * json-> customer-order-edn The "*" sign is considered to be a symbol of the fact that the value is a reference (by analogy with pointers in the link), now imagine that it is also a dynamic variable * customer -order- * json->customer-order-edn * and control in the head - there is another function like this but not with everyone and its name is * customer-order- * json-> customer-order-edn ** how do you like this Elon Musk? Integration of Spec with the editor will partially help solve this problem. 8 With the help of types (with sweat and blood), you can prove the validity of a program at compile time. Spec has a lot of advantages, but nevertheless it only allows you to catch disabled people at runtime. 9 Editors love types for linting, autocomplete, refactoring. Compilers love them too, especially for removing dead code (which would greatly help reduce the minimum size of ClojureScript projects) 10 After Clojure, it hurts to code in other languages, but sometimes you have to.
Too fast without any good explanation of what happening, no context no nothing,what you can do is copy and paste what is happening in the screen...in my opinion unless you are and advance programmer.