Re: OO Programmer trying to move to Clojure: Encapsulation

2015-02-11 Thread Herwig Hochleitner
Hm, the most common way to encapsulate in clojure is with a closure: Your account repository would be: (defn account-repository [connection] ;; <- here goes additional constructor logic (fn save [account] (sql-save connection account)) If the repository has more methods than just save, y

Re: OO Programmer trying to move to Clojure: Namespace Organization

2015-02-11 Thread Colin Yates
x27;m looking > for concrete stuff to imitate. :) > > Thank you everyone for the ideas and thoughts, > > -d > > > On Saturday, February 7, 2015 at 10:23:43 AM UTC-6, Dru Sellers wrote: >> >> Greetings, >> >> I am trying to convert my mind from OO (C#) to one

Re: OO Programmer trying to move to Clojure: Namespace Organization

2015-02-11 Thread Dru Sellers
at 10:23:43 AM UTC-6, Dru Sellers wrote: > > Greetings, > > I am trying to convert my mind from OO (C#) to one more functionally > friendly. I am increasingly comfortable with simple applications in > clojure, but as I start to build more complex applications, I start to fall >

Re: OO Programmer trying to move to Clojure: Encapsulation

2015-02-11 Thread Dru Sellers
time to share your thoughts and ideas with me. -d On Saturday, February 7, 2015 at 10:07:45 AM UTC-6, Dru Sellers wrote: > > Greetings, > > I am trying to convert my mind from OO (C#) to one more functionally > friendly. I am increasingly comfortable with simple applications in

Re: OO Programmer trying to move to Clojure: Encapsulation

2015-02-09 Thread Gregg Williams
n Scala and Clojure, by Michael Bevilacqua-Linn (Pragmatic Programmer, publisher). In it, he takes standard OO patterns, gives Java examples, then shows how the same things are accomplished in functional style in Scala and Clojure. I found it to be very instructive. A similar book by Brian

Re: OO Programmer trying to move to Clojure: Encapsulation

2015-02-09 Thread Henrik Eneroth
tractions. In OO (Java at least) almost everything was a special case, > in Clojure it is the polar opposite; almost nothing is a special case. > > It is astonishing how many domains can be sufficiently modeled as a > sequence of maps [{..} {..} ...] and can be sufficiently transfo

Re: OO Programmer trying to move to Clojure: Namespace Organization

2015-02-08 Thread Sean Corfield
to group > functions by the first argument. Yes, this means that my Clojure projects > resemble OO projects, at least in terms of what logic goes where. See what > works for you. At World Singles we’ve ended up with just over 40 main namespaces that correspond to the major "domai

Re: OO Programmer trying to move to Clojure: Namespace Organization

2015-02-08 Thread David James
that my Clojure projects resemble OO projects, at least in terms of what logic goes where. See what works for you. Some Clojure projects I see use fairly long files. I tend to prefer smaller files myself. In my opinion, just as a function that is too long often indicates unnecessary complexity

Re: OO Programmer trying to move to Clojure: Encapsulation

2015-02-08 Thread Colin Yates
I missed the salient point about data transformations which is that of abstractions. In OO (Java at least) almost everything was a special case, in Clojure it is the polar opposite; almost nothing is a special case. It is astonishing how many domains can be sufficiently modeled as a sequence

Re: OO Programmer trying to move to Clojure: Encapsulation

2015-02-08 Thread Colin Yates
+1 This separation of behaviour and state is a key part of Clojure's philosophy. That isn't to say that stateful components are bad as such (Stuart Sierra's https://github.com/stuartsierra/component is an obvious analog here) only that they aren't a given as they are in OO lang

Re: OO Programmer trying to move to Clojure: Namespace Organization

2015-02-08 Thread Timothy Baldridge
aybe as a > responsibility of a function) by looking at the tests. (This is true for > any language I work with.) > > http://butunclebob.com/ArticleS.UncleBob.TheThreeRulesOfTdd > > > On Sat, Feb 7, 2015 at 6:23 PM, Dru Sellers wrote: > >> Greetings, >> >&g

Re: OO Programmer trying to move to Clojure: Encapsulation

2015-02-08 Thread Jony Hudson
REPL. The OO approach you have often makes it difficult (for less trivial examples) to run a particular function in the right context. But with the self-contained function it's just a case of getting the parameters right, which is often easier to think about. Jony On Saturday, 7 Februar

Re: OO Programmer trying to move to Clojure: Namespace Organization

2015-02-08 Thread Atamert Ölçgen
b.com/ArticleS.UncleBob.TheThreeRulesOfTdd On Sat, Feb 7, 2015 at 6:23 PM, Dru Sellers wrote: > Greetings, > > I am trying to convert my mind from OO (C#) to one more functionally > friendly. I am increasingly comfortable with simple applications in > clojure, but as I start to build more complex applicati

Re: OO Programmer trying to move to Clojure: Encapsulation

2015-02-07 Thread James Reeves
2015 at 16:07, Dru Sellers wrote: > Greetings, > > I am trying to convert my mind from OO (C#) to one more functionally > friendly. I am increasingly comfortable with simple applications in > clojure, but as I start to build more complex applications, I start to fall > do

OO Programmer trying to move to Clojure: Encapsulation

2015-02-07 Thread Dru Sellers
Greetings, I am trying to convert my mind from OO (C#) to one more functionally friendly. I am increasingly comfortable with simple applications in clojure, but as I start to build more complex applications, I start to fall down about how to structure my application. I don't want to just

OO Programmer trying to move to Clojure: Namespace Organization

2015-02-07 Thread Dru Sellers
Greetings, I am trying to convert my mind from OO (C#) to one more functionally friendly. I am increasingly comfortable with simple applications in clojure, but as I start to build more complex applications, I start to fall down about how to structure my application. I don't want to just

Re: Good learning resources for Clojure novice but with a long background i programming, both OO and some Fp?

2014-01-11 Thread Guru Devanla
Sure that could be the case. But I found the coverage interesting and quite different from the other books. There was also some good tips for using Clojure in the real world. That said, may be its still worth a wait for next version. Thanks Guru On Sat, Jan 11, 2014 at 1:51 PM, Sean Corfield wr

Re: Good learning resources for Clojure novice but with a long background i programming, both OO and some Fp?

2014-01-11 Thread Sean Corfield
On Jan 11, 2014, at 10:05 AM, Guru Devanla wrote: > Sorry, I mixed up. I meant the second book to be 'Clojure in Action' : > http://manning.com/rathore/ That book was already outdated when it was released (and many of the examples won't work properly now). There's a second edition coming: http

Re: Good learning resources for Clojure novice but with a long background i programming, both OO and some Fp?

2014-01-11 Thread Guru Devanla
Sorry, I mixed up. I meant the second book to be 'Clojure in Action' : http://manning.com/rathore/ On Fri, Jan 10, 2014 at 4:26 PM, Sean Corfield wrote: > On Jan 10, 2014, at 11:26 AM, Guru Devanla wrote: > > Another good book I thought you could get through faster in 'Pragmatic > Clojure'.I

Re: Good learning resources for Clojure novice but with a long background i programming, both OO and some Fp?

2014-01-10 Thread Sean Corfield
On Jan 10, 2014, at 11:26 AM, Guru Devanla wrote: > Another good book I thought you could get through faster in 'Pragmatic > Clojure'.I found this book to be the next level to Clojure Programming. Do you mean "Programming Clojure (2nd Ed)" by Stuart Halloway? http://pragprog.com/book/shcloj2/pr

Re: Good learning resources for Clojure novice but with a long background i programming, both OO and some Fp?

2014-01-10 Thread christian jacobsen
ginal post :). > > On Friday, 10 January 2014 12:52:53 UTC, christian jacobsen wrote: >> >> I have +10 years experience of OO programming (C++, C# and a little Java) >> and a couple of years of FP programming (mainly F#, some Scala and a little >> Haskell). >> Are t

Re: Good learning resources for Clojure novice but with a long background i programming, both OO and some Fp?

2014-01-10 Thread Colin Yates
example of how elegant Clojure can become. * it isn't self promotion at all! It is self deprecation - my solution is clearly lame, hence the original post :). On Friday, 10 January 2014 12:52:53 UTC, christian jacobsen wrote: > > I have +10 years experience of OO programming (C+

Re: Good learning resources for Clojure novice but with a long background i programming, both OO and some Fp?

2014-01-10 Thread Guru Devanla
IMO there are 2 aspects of learning Clojure coming from an imperative and/or OO background. One s the functional aspect of it and other the idioms and the language itself. To learn the language a book like 'Clojure Programming' would be a good start as others have suggested. It wil

Re: Good learning resources for Clojure novice but with a long background i programming, both OO and some Fp?

2014-01-10 Thread Andrey Antukh
anuary 10, 2014 4:52:53 AM UTC-8, christian jacobsen wrote: >> >> I have +10 years experience of OO programming (C++, C# and a little Java) >> and a couple of years of FP programming (mainly F#, some Scala and a little >> Haskell). >> Are there any resources for learning

Re: Good learning resources for Clojure novice but with a long background i programming, both OO and some Fp?

2014-01-10 Thread Curtis Gagliardi
or all) of the way through, you'll have a very > solid understanding of Clojure. > > On Friday, January 10, 2014 4:52:53 AM UTC-8, christian jacobsen wrote: >> >> I have +10 years experience of OO programming (C++, C# and a little Java) >> and a couple of years

Re: Good learning resources for Clojure novice but with a long background i programming, both OO and some Fp?

2014-01-10 Thread Curtis Gagliardi
I really think Clojure Programming is the best Clojure book out there. If you read that thing most (or all) of the way through, you'll have a very solid understanding of Clojure. On Friday, January 10, 2014 4:52:53 AM UTC-8, christian jacobsen wrote: > > I have +10 years exper

Re: Good learning resources for Clojure novice but with a long background i programming, both OO and some Fp?

2014-01-10 Thread Sean Corfield
On Jan 10, 2014, at 11:02 AM, Gary Trakhman wrote: > I loved the 'Joy of Clojure' as my first clojure book, but it was a little > over my head at the time I started reading it, so it took subjectively quite > a while to internalize everything. JoC was my first Clojure book - but I had plenty of

Re: Good learning resources for Clojure novice but with a long background i programming, both OO and some Fp?

2014-01-10 Thread Gary Trakhman
lojure > > Programming) > > I'll second that recommendation, and also suggest Brian Marick's > "Functional Programming for the Object-Oriented Programmer": > > https://leanpub.com/fp-oo > > But, yes, coming from a heavy OOP background can make it chal

Re: Good learning resources for Clojure novice but with a long background i programming, both OO and some Fp?

2014-01-10 Thread Sean Corfield
On Jan 10, 2014, at 7:18 AM, Stefan Kanev wrote: > I strongly suggest you get a copy of the O'Reilly book (Clojure > Programming) I'll second that recommendation, and also suggest Brian Marick's "Functional Programming for the Object-Oriented Programmer": http

Re: Good learning resources for Clojure novice but with a long background i programming, both OO and some Fp?

2014-01-10 Thread Stefan Kanev
On 10/01/14, christian jacobsen wrote: > I have +10 years experience of OO programming (C++, C# and a little Java) > and a couple of years of FP programming (mainly F#, some Scala and a little > Haskell). > Are there any resources for learning Clojure that are particular good fo

Re: Good learning resources for Clojure novice but with a long background i programming, both OO and some Fp?

2014-01-10 Thread Colin Yates
For me (a similarly entrenched OO guy) I found it very challenging. Nothing to do with the syntax, but you are moving from a world of locked up bits of data behind a (hopefully) impenetrable API to a world full of lightweight data with a myriad of tiny functions which pretty much all perform

Re: Good learning resources for Clojure novice but with a long background i programming, both OO and some Fp?

2014-01-10 Thread mynomoto
With that background I would go with Joy of Clojure by Michael Fogus and Chris Houser. http://manning.com/fogus2/ On Friday, January 10, 2014 10:52:53 AM UTC-2, christian jacobsen wrote: > > I have +10 years experience of OO programming (C++, C# and a little Java) > and a couple of ye

Good learning resources for Clojure novice but with a long background i programming, both OO and some Fp?

2014-01-10 Thread christian jacobsen
I have +10 years experience of OO programming (C++, C# and a little Java) and a couple of years of FP programming (mainly F#, some Scala and a little Haskell). Are there any resources for learning Clojure that are particular good for someone with the above background? -- -- You received

Re: Jormungandr: Prototype-based OO on top of functions

2013-02-12 Thread eduardoejp
> I wonder what are the specific advantages of putting the objects first / making them functions? There wasn't any specific advantage. I did it because I could and I thought it was an interesting approach. I didn't just want to create Yet-Another-OO-System. I wanted it to

Re: Jormungandr: Prototype-based OO on top of functions

2013-02-12 Thread Mikera
; However, I must admit that I made it mainly as a toy project, with no > serious intent for actually using it (I actually try to avoid OO as much as > possible, since I don't see it as a good solution to most problems). I just > wanted to see how feasible it was to implement

Re: Jormungandr: Prototype-based OO on top of functions

2013-02-11 Thread eduardoejp
ent for actually using it (I actually try to avoid OO as much as possible, since I don't see it as a good solution to most problems). I just wanted to see how feasible it was to implement an OO system on top of functions. However, reading what you wrote gave me some ideas, so I might work on

Re: Jormungandr: Prototype-based OO on top of functions

2013-02-10 Thread Mikera
Nice, I have been looking for something like this to experiment with. Suggestions on syntax: It would be much nicer to use and more idiomatic if the method name came first, e.g. (method some-object arg1 arg2) This would bring many benefits: you could use the standard "->" syntax, you can "appl

Jormungandr: Prototype-based OO on top of functions

2013-02-10 Thread eduardoejp
Just a simple toy project I made moments ago... https://github.com/eduardoejp/jormungandr -- -- 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

Re: Newbie question on OO/records

2011-11-07 Thread Alan Malloy
> > very object-oriented to me. Am I wrong? Is it just because the > > > function comes before the record instance? > > > > (fly hummingbird) > > > > As opposed to calling: > > > > hummingbird.fly() in a standard OO language. > > > Records &a

Re: Newbie question on OO/records

2011-11-07 Thread stevelewis
? > > > (fly hummingbird) > > > As opposed to calling: > > > hummingbird.fly() in a standard OO language. > > Records & Protocols are indeed a way of achieving polymorphism and is > quite similar to class-based single dispatch found in Java, etc. Thus > th

Re: Newbie question on OO/records

2011-11-06 Thread Baishampayan Ghose
>> Records & Protocols are indeed a way of achieving polymorphism and is >> quite similar to class-based single dispatch found in Java, etc. Thus >> the calling conventions can look quite familiar. >> >> Having said that, records & protocols are fundamentally

Re: Newbie question on OO/records

2011-11-06 Thread Alan Malloy
; found it helpful, but the usage of datatypes and protocols looks/feels > > very object-oriented to me. Am I wrong? Is it just because the > > function comes before the record instance? > > > (fly hummingbird) > > > As opposed to calling: > > > hummingbird.f

Re: Newbie question on OO/records

2011-11-05 Thread Baishampayan Ghose
s/feels > very object-oriented to me. Am I wrong? Is it just because the > function comes before the record instance? > > (fly hummingbird) > > As opposed to calling: > > hummingbird.fly() in a standard OO language. Records & Protocols are indeed a way of achieving

Re: Newbie question on OO/records

2011-11-05 Thread Matt Hoyt
Subject: Newbie question on OO/records Okay, I'm trying to understand records. I read this article: http://freegeek.in/blog/2010/05/clojure-protocols-datatypes-a-sneak-peek/ (Clojure Protocols & Datatypes - A sneak peek by Baishampayan Ghose. I found it helpful, but the usage of data

Newbie question on OO/records

2011-11-05 Thread stevelewis
-oriented to me. Am I wrong? Is it just because the function comes before the record instance? (fly hummingbird) As opposed to calling: hummingbird.fly() in a standard OO language. Thanks for any insight. Steve -- You received this message because you are subscribed to the Google Groups "

Re: coming from statically typed oo languages - how do deal with complex objects graphs in clojure?

2011-09-06 Thread Nico Kruger
On 4 September 2011 20:40, Dennis Haupt wrote: > > Am 04.09.2011 19:08, schrieb Justin Kramer: >> On Sunday, September 4, 2011 12:21:23 PM UTC-4, HamsterofDeath >> wrote: >> >> >> Some other comments: >> >> - Nested defns are not good. > > why? imo, nested function/method definitions are a tool to

Re: coming from statically typed oo languages - how do deal with complex objects graphs in clojure?

2011-09-06 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Am 06.09.2011 16:28, schrieb Meikel Brandmeyer (kotarak): > > Am Dienstag, 6. September 2011 15:57:16 UTC+2 schrieb Mark > Rathwell: > > You want an anonymous function: > > (fn [x] (= x 2)) > > or the equivalent shorthand form: > > #(= % 2) > > O

Re: coming from statically typed oo languages - how do deal with complex objects graphs in clojure?

2011-09-06 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 > > or the equivalent shorthand form: > > #(= % 2) > should i ever write a bigger app with clojure, it will be filled with these. i like them. -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.14 (MingW32) Comment: Using GnuPG with Mozilla - http:

Re: coming from statically typed oo languages - how do deal with complex objects graphs in clojure?

2011-09-06 Thread Meikel Brandmeyer (kotarak)
Am Dienstag, 6. September 2011 15:57:16 UTC+2 schrieb Mark Rathwell: > > You want an anonymous function: > > (fn [x] (= x 2)) > > or the equivalent shorthand form: > > #(= % 2) > Or even more short-hand: #{2} (for all 2s not in #{nil false}) Scary. Sincerely Meikel -- You received this mess

Re: coming from statically typed oo languages - how do deal with complex objects graphs in clojure?

2011-09-06 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 > It was not a syntax error. Your expression just had the wrong > return value. I don't see how an IDE could help here. > > by type inference. i don't know how far an ide could track the types in clojure since it's completely lacking any type ann

Re: coming from statically typed oo languages - how do deal with complex objects graphs in clojure?

2011-09-06 Thread Mark Rathwell
You want an anonymous function: (fn [x] (= x 2)) or the equivalent shorthand form: #(= % 2) Sent from my iPhone On Sep 6, 2011, at 9:35 AM, Dennis Haupt wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > figured it out, i the () were a bit messed up. the working code: > > (def op

Re: coming from statically typed oo languages - how do deal with complex objects graphs in clojure?

2011-09-06 Thread Stefan Kamphausen
Hi, On Tuesday, September 6, 2011 3:35:08 PM UTC+2, HamsterofDeath wrote: > > > (every? (= parameter player) currow > i'd like to write something like: > > do i have to define the function via letfn before, or is there a way > to do it nested in the code? > you can create a function anytime using

Re: coming from statically typed oo languages - how do deal with complex objects graphs in clojure?

2011-09-06 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 thx, that's what i figured out a moment ago. i am used to allknowing ides Am 06.09.2011 15:25, schrieb Stefan Kamphausen: > hi, > > why does clojure want to cast the result to IFn? > > > if I parse that correctly, you have two parens around the >

Re: coming from statically typed oo languages - how do deal with complex objects graphs in clojure?

2011-09-06 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 figured it out, i the () were a bit messed up. the working code: (def open 0) (def p1 1) (def p2 2) (def emptyfield [open open open open open open open open open]) (defn indexOf [x y] (+ x (* y 3))) (defn withmove [x,y,player,field] (assoc field (

Re: coming from statically typed oo languages - how do deal with complex objects graphs in clojure?

2011-09-06 Thread Stefan Kamphausen
hi, > why does clojure want to cast the result to IFn? > if I parse that correctly, you have two parens around the let-expression. That leads to Clojure evaluating the let-expression, taking the result (which is the return value of the line you mentioned: a Boolean) and trying to call that as

Re: coming from statically typed oo languages - how do deal with complex objects graphs in clojure?

2011-09-06 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 i tried using letfn insteaf of defn for inner functions. (def open 0) (def p1 1) (def p2 2) (def emptyfield [open open open open open open open open open]) (defn indexOf [x y] (+ x (* y 3))) (defn withmove [x,y,player,field] (assoc field (indexOf

Re: coming from statically typed oo languages - how do deal with complex objects graphs in clojure?

2011-09-04 Thread Eric Lavigne
> i started with a tic tac toe implementation, but i'm stuck: I used the same example problem last year to teach Clojure to two people that were new to programming. Hopefully you'll find their code helpful. https://github.com/algarete13/tic-tac-toe -- You received this message because you

Re: coming from statically typed oo languages - how do deal with complex objects graphs in clojure?

2011-09-04 Thread Sean Corfield
On Sun, Sep 4, 2011 at 11:40 AM, Dennis Haupt wrote: >> - Nested defns are not good. > why? imo, nested function/method definitions are a tool to fine-tune > accessibility. just like public/private, but much more powerful. why Right, but defn binds function names at the top-level (which is why it

Re: coming from statically typed oo languages - how do deal with complex objects graphs in clojure?

2011-09-04 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Am 04.09.2011 19:04, schrieb Luc Prefontaine: > Have a look at reduce: > > (reduce conj [] (take 9 (cycle [0]))) > > take returns a lazy seq. but reduce will return you a vector. > > Looks like you try to translate as if you were using a language >

Re: coming from statically typed oo languages - how do deal with complex objects graphs in clojure?

2011-09-04 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Am 04.09.2011 19:08, schrieb Justin Kramer: > On Sunday, September 4, 2011 12:21:23 PM UTC-4, HamsterofDeath > wrote: > > * in the last loop where i am just printing out what i want to do, > i need something like "foldLeft" (from scala). how do i fold

Re: coming from statically typed oo languages - how do deal with complex objects graphs in clojure?

2011-09-04 Thread Sergey Didenko
Dennis, may I suggest you to read this great article on Clojure: http://java.ociweb.com/mark/clojure/article.html -- 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 me

Re: coming from statically typed oo languages - how do deal with complex objects graphs in clojure?

2011-09-04 Thread Justin Kramer
On Sunday, September 4, 2011 12:21:23 PM UTC-4, HamsterofDeath wrote: > > * in the last loop where i am just printing out what i want to do, i > need something like "foldLeft" (from scala). how do i fold in clojure? > doseq is the way to iterate over a collection and perform side effects: (let [mo

Re: coming from statically typed oo languages - how do deal with complex objects graphs in clojure?

2011-09-04 Thread Luc Prefontaine
Have a look at reduce: (reduce conj [] (take 9 (cycle [0]))) take returns a lazy seq. but reduce will return you a vector. Looks like you try to translate as if you were using a language that allows mutations but you use functions to hold values that you redefine since mutation is restricted t

Re: coming from statically typed oo languages - how do deal with complex objects graphs in clojure?

2011-09-04 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 solved my last problem, and now i'm stucker than before: (def open 0) (def p1 1) (def p2 2) (def emptyfield [open open open open open open open open open]) (defn updated [seq index replacement] (concat (take index seq) [replacement] (dr

Re: coming from statically typed oo languages - how do deal with complex objects graphs in clojure?

2011-09-04 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 i started with a tic tac toe implementation, but i'm stuck: (def open 0) (def p1 1) (def p2 2) (def emptyfield [open open open open open open open open open]) (defn updated [seq index replacement] (concat (take index seq) [replacement]

Re: coming from statically typed oo languages - how do deal with complex objects graphs in clojure?

2011-09-03 Thread Sergey Didenko
You can also put a commented out example call of the function, like this: (defn some-magic [spells wizards] ...) ; (some-magic 5 [:gendalf :einstein]) Which is also handy for quick evaluation in the REPL. Or you can put these example calls in the (automatic) test code. -- You received this mes

Re: coming from statically typed oo languages - how do deal with complex objects graphs in clojure?

2011-09-03 Thread Luc Prefontaine
On Sat, 3 Sep 2011 13:43:42 -0700 (PDT) HamsterofDeath wrote: > this might seem like a stupid question, but for me, not knowing the > type of something is like being stuck in a dead end for anything non > trivial. It's not stupid, it's normal :) In functional programming, most of the time you w

coming from statically typed oo languages - how do deal with complex objects graphs in clojure?

2011-09-03 Thread HamsterofDeath
this might seem like a stupid question, but for me, not knowing the type of something is like being stuck in a dead end for anything non trivial. i've made a few little experiments with clojure (not much, just testing some features) and i see how powerful clojure can be - for small to medium sized

Re: Good book on migrating from (Java) OO to FP

2011-07-30 Thread Matthias Cords
ridging the gap between OO and FP. It isn't Clojure specific, but as a > (well established) Java/OO guy, this helped me "get FP". > > (not connected in anyway with the book or author other than through > appreciation :)) > > -- > You received this message because

Re: Good book on migrating from (Java) OO to FP

2011-07-30 Thread Kenny Stone
lin Yates > wrote: > > Not sure whether this is good etiquette or not, but I wanted to > > praise http://oreilly.com/catalog/0636920021667. I found it pretty > useful > > in bridging the gap between OO and FP. It isn't Clojure specific, but as > a > > (well

Re: Good book on migrating from (Java) OO to FP

2011-07-29 Thread Sean Corfield
On Fri, Jul 29, 2011 at 5:03 AM, Colin Yates wrote: > Not sure whether this is good etiquette or not, but I wanted to > praise http://oreilly.com/catalog/0636920021667.  I found it pretty useful > in bridging the gap between OO and FP.  It isn't Clojure specific, but as a >

Re: Good book on migrating from (Java) OO to FP

2011-07-29 Thread Wilson MacGyver
for java, I use google guava quite a bit. (formerly known as google collections). http://code.google.com/p/guava-libraries/ there is quite a bit of FPish things in it. On Fri, Jul 29, 2011 at 9:49 PM, Jeff Heon wrote: > In the vein of FP for Java programmers, these two libraries might be > of i

Re: Good book on migrating from (Java) OO to FP

2011-07-29 Thread Jeff Heon
In the vein of FP for Java programmers, these two libraries might be of interest. Sequence-like operations on collection using annotations. Nice and small. http://jedi.codehaus.org/ More advanced and Scalaish. Benefits from a bigger community. http://functionaljava.org/ -- You received this mes

Re: Good book on migrating from (Java) OO to FP

2011-07-29 Thread Laurent PETIT
2011/7/29 Colin Yates > Hi all, > > Not sure whether this is good etiquette or not, but I wanted to praise > http://oreilly.com/catalog/0636920021667. I found it pretty useful in > bridging the gap between OO and FP. It isn't Clojure specific, but as a > (well establi

Re: Good book on migrating from (Java) OO to FP

2011-07-29 Thread Colin Yates
, so > essentially I'm asking you to convince me to let this book jump the > queue. :^) > > > On Jul 29, 5:03 am, Colin Yates wrote: >> Hi all, >> >> Not sure whether this is good etiquette or not, but I wanted to >> praisehttp://oreilly.com/catalog/0636

Re: Good book on migrating from (Java) OO to FP

2011-07-29 Thread ax2groin
I found it pretty useful in > bridging the gap between OO and FP.  It isn't Clojure specific, but as a > (well established) Java/OO guy, this helped me "get FP". > > (not connected in anyway with the book or author other than through > appreciation :)) -- You recei

Good book on migrating from (Java) OO to FP

2011-07-29 Thread Colin Yates
Hi all, Not sure whether this is good etiquette or not, but I wanted to praise http://oreilly.com/catalog/0636920021667. I found it pretty useful in bridging the gap between OO and FP. It isn't Clojure specific, but as a (well established) Java/OO guy, this helped me "get FP".

Re: OO design in clojure

2010-10-03 Thread Mark Engelberg
e and returns a new Shape with an updated x and y. Technically, Object Oriented programming handles both approaches, but in practice, most OO programmers tend to think of programming in terms of breaking down problems into objects that destructively update. So this is really the big change for

OO design in clojure

2010-10-03 Thread SpiderPig
I was wondering what's a good way to use OO concepts in clojure. Just using multimethods and maps? Or maybe protocols? Let's say I write a program that deals with many graphical elements e.g. a game or a vector graphic editor. I could represent each graphic/sprite/shape etc. as a map

Re: Advice for someone coming from an OO world?

2009-12-20 Thread ajay gopalakrishnan
rained in > > using an object-oriented hammer on every nail they see? I know Rich > > and Stuart have some good design examples around (I've read many), but > > if there are any tutorials that show how to re-envision OO problems in > > an FP world, I'd love to see

Re: Advice for someone coming from an OO world?

2009-12-19 Thread Mike Meyer
if there are any tutorials that show how to re-envision OO problems in > an FP world, I'd love to see them. I haven't seen an answer to this, so here's my one-page guide. This is meant more for LISP in general than Clojure specific, but should be better than nothing. I. Fun

Re: Advice for someone coming from an OO world?

2009-12-19 Thread Joost
Oh and another thing: In my experience, it's easier to start by putting all the code in a single package, and only split it up once you get to a level of complexity that really demands splitting it up. Emacs/SLIME (and probably other interactive environments) really help too: once you've written/

Re: Advice for someone coming from an OO world?

2009-12-19 Thread Joost
that show how to re-envision OO problems in > an FP world, I'd love to see them. You are probably running into two problems at the same time: 1 is the expectation that you can modify stuff left and right 2. is the "dispatch" issue In my (short) experience with clojure, the m

Re: Advice for someone coming from an OO world?

2009-12-19 Thread Laurent PETIT
simulator with > Clojure in my nights & weekends. There's just one problem: I think > I'm tainted by too much exposure to OO. > > I often find my self going upstream, against the language. I want to > have an object and send it a message or invoke it, rather than >

Re: Advice for someone coming from an OO world?

2009-12-18 Thread Sean Devlin
been doing a stock-market backtesting simulator with > Clojure in my nights & weekends.  There's just one problem: I think > I'm tainted by too much exposure to OO. > > I often find my self going upstream, against the language.  I want to > have an object and send it a message

Advice for someone coming from an OO world?

2009-12-18 Thread IslandRick
get to know Clojure is to write something in it. So I've been doing a stock-market backtesting simulator with Clojure in my nights & weekends. There's just one problem: I think I'm tainted by too much exposure to OO. I often find my self going upstream, against the language.

Re: from OO to Lisp style (a blog post)

2009-09-07 Thread Jonathan Smith
; And so then, to get a dialog that is like a sequence of panels, you > > can go through and do like: > > > (make-login-app env make-next-widget) > > > Anyway, is not particularly any better than using signal passing > > technique, &g

Re: from OO to Lisp style (a blog post)

2009-09-06 Thread rb
r application. > > On Sep 4, 11:01 am, rb wrote: > > > Hi, > > > In using the Jwt library, for which I only found examples in object > > oriented languages that structure the code in class definitions and do > > heavy usage of instance variables, I was in a situ

Re: from OO to Lisp style (a blog post)

2009-09-04 Thread Jonathan Smith
In using the Jwt library, for which I only found examples in object > oriented languages that structure the code in class definitions and do > heavy usage of instance variables, I was in a situation where I > wondered how I could best structure my code. > > With help on the IRC channel I

from OO to Lisp style (a blog post)

2009-09-04 Thread rb
working solution which I document in a blog post at http://www.nsa.be/index.php/eng/Blog/From-OO-to-Lisp-style-structuring-my-Clojure-Jwt-app I'm interested in feedback and advices for improvements Thanks Raph --~--~-~--~~~---~--~~ You received this message be

Re: No OO restrictions is good. why not still add dependency injection?

2009-06-17 Thread Raoul Duke
Andrew, you have just said what needs to be said about DI that for some reason it seems like nobody else on earth ever says -- no, they have to write some giant screed that includes references to Hollywood. No wonder technology sucks, when the people writing the tutorials can't even explain things

Re: No OO restrictions is good. why not still add dependency injection?

2009-06-17 Thread AndrewC.
On Jun 16, 11:34 am, Jules wrote: > I still don't know what dependency injection means exactly. The > examples I've seen that are said to use dependency injection can be > solved by using first class functions. Are first class functions what > you want? Dependecy injection is nothing more than

Re: No OO restrictions is good. why not still add dependency injection?

2009-06-16 Thread Howard Lewis Ship
I've written two successful open source IoC containers (HiveMind and T5 IoC). I don't really see the need for an IoC container for Clojure. It is interesting that coding a stateless IoC layer in OO is a step towards functional (T5 IoC does a lot of functional composition and sup

Re: No OO restrictions is good. why not still add dependency injection?

2009-06-16 Thread Sean Devlin
That would be point 5 :) On Jun 16, 3:45 pm, Daniel Lyons wrote: > Sean, > > On Jun 16, 2009, at 10:59 AM, Sean Devlin wrote: > > > The last example was okay, but it felt a little forced.  Let's create > > a function to do the currying for us: > > > user=>(defn my-parab [a b c] (fn[x](quad a b c

Re: No OO restrictions is good. why not still add dependency injection?

2009-06-16 Thread Daniel Lyons
Sean, On Jun 16, 2009, at 10:59 AM, Sean Devlin wrote: > The last example was okay, but it felt a little forced. Let's create > a function to do the currying for us: > > user=>(defn my-parab [a b c] (fn[x](quad a b c x))) > > Now, it isn't immediately obvious, but my-parab returns a function. >

Re: No OO restrictions is good. why not still add dependency injection?

2009-06-16 Thread Sean Devlin
Hari, First, I'd recommend you watch Rich's videos on Clojure, both for Java programmers and LISP programmers. In it Rich explains why Clojure *isn't* OO. It's heresy to some who has written lots of Java, but once you see Clojure in action, everything starts to make sense.

Re: No OO restrictions is good. why not still add dependency injection?

2009-06-16 Thread J. McConnell
On Tue, Jun 16, 2009 at 12:18 PM, hari sujathan wrote: > > I was trying to look from some mathematical concepts by representing - > OOP's inheritance by tree/graph structurtes(tree for single , and > graph > for multiple inheritence) with classes acting as  each node. > With functional programmin

Re: No OO restrictions is good. why not still add dependency injection?

2009-06-16 Thread Jeff Heon
I've seen dependency injection used in choosing an implementation for an interface with a configuration file i.e. without having to modify the code. I've only seen it used in component frameworks with lifecycle (a lifetime ago with Jakarta Avalon and now with Spring.) Currently we're using it in

Re: No OO restrictions is good. why not still add dependency injection?

2009-06-16 Thread hari sujathan
> Stu > > > Hi, > >  clojure web site says - "Clojure multimethods are a simple yet > > powerful mechanism for runtime polymorphism that is free of the > > trappings of OO, types and inheritance" . > > > I think dependency Injection has nothing to do with ju

Re: No OO restrictions is good. why not still add dependency injection?

2009-06-16 Thread Jules
re web site says - "Clojure multimethods are a simple yet > powerful mechanism for runtime polymorphism that is free of the > trappings of OO, types and inheritance" . > > I think dependency Injection has nothing to do with just OOP, though > it came out in OOP. > Why no

  1   2   >