• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Clojure in Action

 
Ranch Hand
Posts: 258
2
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Amit & Francis,

Welcome to the forum and congratulation for the book. Some questions for Clojure and your book
1) Clojure syntax is prefix notation with some infix parser tool supported. I tried to learn Clojure before and found it hard to switch to prefix mode. Do you think it would worth to learn Clojure (or FP) in prefix notation ? or just personal preferences?
2) What do you think about Software Transactional Memory (STM) ? and does your book cover that in details with comparison to other concurrent approaches ?
3) Anythings you think Clojure may not do well or would be good if added / enhanced (or currently in progress)?
4) I think one of the approaches to learn a new language is building a small web app. Would you have recommendation web frameworks and free cloud hosting ?

Thanks,
Raymond
 
Ranch Hand
Posts: 343
Mac OS X Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I understand that your question is for the original authors, however, I would like to answer few questions asked here.


1) Clojure syntax is prefix notation with some infix parser tool supported. I tried to learn Clojure before and found it hard to switch to prefix mode. Do you think it would worth to learn Clojure (or FP) in prefix notation ? or just personal preferences?



I can understand that being taught to use infix notation throughout the school and then in most of other programming languages of choice, it is difficult to switch to prefix mode, which is also known as Polish notation. Having said that it is easier to understand and grasp but needs a good amount of patience to reach that level.
The syntax may come handy if you think about tree-structured data. So, expression say * A B, which is equivalent to A + B in infix is represented as




So, prefix notation is just a way to represent the s-expression in a tree data structure in one lin, * comes first followed by A and B = * A B and in LISP world of parenthesis (*A B)

The complication is mostly for mathematical functions like +, -, * and /. However, other functions are very easy. For eg:

A call in Java like programming language would look like,


which is actually a prefix notation and can be represented in LISP/Clojure as:


I have never developed a full-scale application in Clojure or LISP, but I find it much easier to understand the code in Clojure then Java. It is easier to make Java code look horrible, it is equally difficult to do so in LISP.

You would find the following article worth reading The Nature of Lisp on the steep curve in learning LISP. [color]

....does your book cover that (Software Transactional Memory (STM)) in details ....?


[color=darkblue]
Yes, the book treats Software Transaction Memory well enough.


Would you have recommendation web frameworks and free cloud hosting ?




I don't have any particular recommendations but know few services that offer Clojure hosting - Heroku, Open Shift and Scalingo


 
Rancher
Posts: 379
22
Mac OS X Monad Clojure Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just to follow up on a point Palak made...

Palak Mathur wrote:
The complication is mostly for mathematical functions like +, -, * and /. However, other functions are very easy. For eg:


Most real world Clojure is not math / numeric code so this is really a red herring or at least a very minor concern. In 30,000 lines of production Clojure, we have a handful of mathematical expressions: where we're operating on numbers at all, we tend to be working holistically with map / filter / reduce -- or other even higher-level math (matrix algebra or more). Don't get hung up on prefix vs infix for math operators.
 
Raymond Tong
Ranch Hand
Posts: 258
2
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Palak and Sean for your input.
I tried to learn Clojure few years back and found it pretty hard and gave up.
But since then I have learnt Scala -> Haskell which I think may help my mind to think in FP way -> everything is a function way.
Clojure as a Dialect of Lisp. Would you think it would be good to learn Clojure (or Lisp) even I may not write Production code with it?

It is easier to make Java code look horrible


I agree the above a lot

Thanks,
Raymond
 
Bartender
Posts: 2968
6
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Raymond Tong wrote:Clojure as a Dialect of Lisp. Would you think it would be good to learn Clojure (or Lisp) even I may not write Production code with it?



Clearly having experience with Scala and Haskell you are already ahead of the game however you may be interested following the blog entry (keeping in mind that Cognitect is "Clojure Central"):
2 Myths and 2 Facts about Clojure that change Everything
In particular:

There may be fewer Clojure developers than developers in some languages - but you only need to hire a few of them


I often hear that it is easier to introduce Scala into a Java shop as a "better Java" but that goes back to what Rich Hickey states in his "Simple Made Easy" talk. Scala looks more "familiar" to Java programmers, so it seems "easier" than Clojure but that doesn't mean that Scala is "simple". Neal Ford stated in a tongue-in-cheek manner that "Scala will be the next Big Thing on the JVM because it fetishizes complexity exactly the way that Java Developers are used to."((Neal's) Master Plan for Clojure Enterprise Mindshare Domination). In the past lots of places introduced C++ as a "better C" but that didn't necessarily improve their codebase nor by default create brilliant C++ developers. So I'm a bit doubtful that adoption of Scala will lead to a wholesale adoption of functional programming principles - it simply makes things easier for those who are trying to adopt them anyway. Learning Clojure shouldn't be any harder than learning Scala or Haskell; Clojure (Lisp) is just "different".

Personally I used to prefer that the compiler told me when I messed up so I was a a big fan of static typing. It wasn't until I moved more into JavaScript that I felt liberated from the boilerplate of static typing because it made it much easier to exploit polymorphism via duck typing. Clojure can be similarly liberating but you can use something like Prismatic Schema to type check were it is helpful or necessary.
(PolyConf 15: Contracts as Types / Jessica Kerr).

At first you don't need to use Clojure "in production" - seems some places use it initially for scripting tasks until they get more comfortable with it. See also Sneaking Clojure Past the Boss and Selling Clojure to the Business.
 
Why am I so drawn to cherry pie? I can't seem to stop. Save me tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic