Re: separation of concerns w/o encapsulation

2015-05-13 Thread Brian Craft
http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming)#As_information_hiding_mechanism On Wednesday, May 13, 2015 at 1:09:48 AM UTC-7, Juan A. Ruz @tangrammer wrote: > > Hi guys, > when you talk about encapsulation do you mean using defrecords + protocols > ? > In this case, w

Re: contains? on String

2015-05-13 Thread Erik Price
> (get "the char at index" 4) \c e ​ On Wed, May 13, 2015 at 9:55 PM, Sam Raker wrote: > I always assumed (contains? "foo" 2) worked because strings are arrays > (i.e. vectors) of characters, on some level. > > -- > You received this message because you are subscribed to the Google > Groups "C

Re: contains? on String

2015-05-13 Thread Sam Raker
I always assumed (contains? "foo" 2) worked because strings are arrays (i.e. vectors) of characters, on some level. -- 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 n

Re: is destructuring implemented as a macro?

2015-05-13 Thread Fluid Dynamics
On Wednesday, May 13, 2015 at 8:01:33 PM UTC-4, Gary Trakhman wrote: > > You can only safely assume that the first symbol (defn) is a macro, it > turns out 'destructure' is a function called by the macro (which might call > other functions/macros that call other functions/macros :-). > > > https:

Re: is destructuring implemented as a macro?

2015-05-13 Thread Gary Trakhman
You can only safely assume that the first symbol (defn) is a macro, it turns out 'destructure' is a function called by the macro (which might call other functions/macros that call other functions/macros :-). https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L4233 On Wed, May

is destructuring implemented as a macro?

2015-05-13 Thread piastkrakow
Maybe I should have already known this, but I am struck by this, and I'd like to confirm it. If I'm working with this code: https://github.com/drewr/postal/blob/389162cafab08224e50bd6721cac93fe14ca3257/src/postal/support.clj and if, at the REPL, I do this: user=> (require '[postal.suppor

Re: [ANN] Clojure 1.7.0-beta3

2015-05-13 Thread Andrew Keedle
Looks good for current project. Project compiles and runs with clojure "1.7.0-beta3", clojurescript "0.0-3269", figwheel "0.3.1" + core.async core.match + om + ... Figwheel repl still works from within Cursive. Thanks, Andrew -- You received this message because you are subscribed to the Goog

Re: Need advice/idiom to reduce number of parameters in functions

2015-05-13 Thread David James
Well, this is question many people ask. :) It is a matter of tradeoffs: - Too many arguments may be an aesthetic problem. It may also reflect a design problem; you might be able to rethink a system to simplify it. (What "too many" means is debatable.) - With many arguments, you may c

[ANN] Clojure 1.7.0-beta3

2015-05-13 Thread Alex Miller
Clojure 1.7.0-beta3 is now available. Try it via - Download: https://repo1.maven.org/maven2/org/clojure/clojure/1.7.0-beta3/ - Leiningen: [org.clojure/clojure "1.7.0-beta3"] Additional enhancements to new features since 1.7.0-beta2: 1) CLJ-1728 - `source` fn now works for vars in cljc files 2) C

Re: Need advice/idiom to reduce number of parameters in functions

2015-05-13 Thread Herwig Hochleitner
In functional programming you can do a similar thing as in OOP: Define your functions as closures that can access common arguments via lexical scope. So instead of creating a context object, you create functions: (defn make-context [some context parameters] {:op1 (fn [x] ...) :op2 (fn [y] ...

Re: ring.middleware.reload and figwheel

2015-05-13 Thread Paco Viramontes
Any luck with this? I want to do the same :P On Thursday, April 30, 2015 at 3:06:13 AM UTC-7, Dan Kersten wrote: > > Hi, > > I've got a clojure(script) project where I use figwheel to live-reload > cljs and this works great, but I'm now trying to set up live reloading of > the server-side clojur

Re: extend-type and extend-protocol: different syntax for multi-arity methods

2015-05-13 Thread Tassilo Horn
Alexey Cherkaev writes: Hi Alexey, > If you have a protocol > > (defprotocol Foo (foo [x] [x y])) > > and implement it for the record > > (defrecord Bar [p q r] > Foo > (foo [x] x) > (foo [x y] [x y])) > > you write each method separately. The same is true for extend-type. > Yet, if you u

extend-type and extend-protocol: different syntax for multi-arity methods

2015-05-13 Thread Alexey Cherkaev
Hi all, If you have a protocol (defprotocol Foo (foo [x] [x y])) and implement it for the record (defrecord Bar [p q r] Foo (foo [x] x) (foo [x y] [x y])) you write each method separately. The same is true for extend-type. Yet, if you use extend-protocol syntax is more like usual Clojure

Re: separation of concerns w/o encapsulation

2015-05-13 Thread Juan A. Ruz @tangrammer
Hi guys, when you talk about encapsulation do you mean using defrecords + protocols ? In this case, we are talking of choosing defrecords instead of plain functions. Maybe it would be better if we talk too about the drawbacks of this choice. For example, can we compose or extend protocol functio