Vector plays a very special role in Clojure, its one of the most primitive data strucutre in Clojure. Its impossible to master Clojure without a very deep understanding about vector.
Optional arguments of function is a nice feature and many programming language support it. For example in VB.NET
This is how to define optional arguments and its default value in VB.NET. If we put the optional arguments in the end of parameter list.
Clojure is a dynamical functional language runs on JVM. Its also a modern LISP with elegant syntax and powerful data structures. And whats more, Clojure is fully inter operatable with JAVA, all the JAVA libraries are readily available.
This post introduce you an easy way to save a slideshare as one pdf file with Clojure.
In last post Executing shell command in Clojure REPL. I present a function that can execute shell command from Clojure REPL.
Well, the script will work in most situations but you will find it not work in some edge cases because there are something missing in our implementation.
When you are working in Clojure REPL and want do something in shell. How to do it ? Most of the time I will Ctrl + C break from REPL and switch back after shell interaction.
And its inconvenient, and most importantly, if I already defined something in REPL , I have to restore them after switching back.
I was reading The Joy Of Clojure the first edition and looking at chapter 7, and experimenting the A* path finding code.
And it gives me this error
The trampoline function is Clojure's way to explicitly optimize mutual recursion.
A quick Wikipedia check you will get the idea, but lets just get an simple overview right here.
Or naive recursion, linear recursion, mundane recursion. They are semantically equivalent to iteration. But recursive version consumes more memory. At each loop, recursive function call creates a new stack frame and all the local variables have a new copy , by doing this, the recursive version don't have to mutate anything, the cost is stack frame consumption.