Re: Conceptual difference between map and class

2020-04-05 Thread James Gatannah
"A language that doesn't affect the way you think about programming is not worth knowing." - Alan Perlis A lot clojure's culture and philosophy is centered around Rich's talks. I resisted this for a very long time. I'd rather spend 10 hours reading a book than 1 hour watching someone speak. I wa

Re: Conceptual difference between map and class

2020-04-05 Thread Ernesto Garcia
In my humble opinion, main benefits of Clojure: - Development cycle: modifying and experimenting on a running program. - Treating data as maps. Direct and efficient immutability. - Macros: Though used very scarcely, it's good to know that you'll be able to extend the language from within if you

Re: Conceptual difference between map and class

2020-04-04 Thread Brandon R
I think someone else here could give a more detailed answer, and I will just give it from my point of view. What I really like about Clojure, coming from C# and JavaScript (and toying with other languages), is the immutability, the concurrency features, the state management features, and the concis

Re: Conceptual difference between map and class

2020-04-03 Thread Dieter Van Eessen
Thanks, I'm currently reading the book you mentioned (Joy of Clojure). Just started on 'Types, protocols and records'... Still doubting if I should continue learning clojure. From my point of view, the only major advantages of the language so far, are 'clojurescript' and the idea that I can eval

Re: Conceptual difference between map and class

2020-04-02 Thread Dieter Van Eessen
Thanks alot for all the answers, still getting my head around the matter :) On Tuesday, March 31, 2020 at 10:41:02 AM UTC+2, Dieter Van Eessen wrote: > > Hello, > > I've got a clojure and a python piece of code. Both seem to create what > can be considered an instance of a class. Wherein lies t

Re: Conceptual difference between map and class

2020-04-01 Thread Johannes
A few years ago I built some kind of internal DSL using Clojure macros which allowed to create objects and classes like in conventional OOP languages as Smalltalk and Java. The macro obj creates a classless, immutable object, for example: (obj {:x 1, :y 2} {:f (fn [] (+ (self :x) (self :y)))}) o

Re: Conceptual difference between map and class

2020-03-31 Thread James Gatannah
It might be worth mentioning that, ultimately, python class instances are syntactical sugar built around an internal __dict__. It gets twistier, since classes are also instances of the base class object. It would be tricky (though I've seen an example...maybe in Joy of Clojure? I think the auth

Re: Conceptual difference between map and class

2020-03-31 Thread Matching Socks
Witty and instructive: http://wiki.c2.com/?ClosuresAndObjectsAreEquivalent -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient

Re: Conceptual difference between map and class

2020-03-31 Thread Justin Smith
I think it's also important here that Clojure methods are actual Java methods - Clojure likes to stay close to the host functionality. A map with a function isn't a class with a method because the JVM bytecode doesn't let you invoke it that way directly. A Clojure function is not a method because m

Re: Conceptual difference between map and class

2020-03-31 Thread Jason Felice
A subtle difference between a map of functions and a Python class is that the class has implicit "self" or "this". Otherwise, these are semantically the same. Well, ignoring that Clojure maps are immutable. In fact, C++ compilers compile methods by inserting a first "this" argument and mangling