Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ######################## FLASH FLASH FLASH ############################
- See how Clojure is useful
- Small code in Java(really not small) to create a data structure called Book
- Class Book{
- String title;
- String author;
- public Book(String title,String author)
- {
- this.title=title;
- this.author=author;
- }
- String getTitle()
- {
- return title
- }
- String getAuthor()
- {
- return author
- }
- void setTitle(String title)
- this.title=title
- void setAuthor(String author)
- this.author=author
- }
- ########################################################################
- @@@@@@@@@@@@@@@@@@@@@@@@ NOW THE SAME CODE IN CLOJURE @@@@@@@@@@@@@@@@@@@
- (defstruct Book :title :author)
- @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
- finally both run on Java Virtual Machine,which one you think best.
Advertisement
Add Comment
Please, Sign In to add comment