Re: defrecord with "inheritance"

2012-05-21 Thread nicolas.o...@gmail.com
> > Have you actually looked at the data structure implementations in > ClojureScript? The work is done. It's all protocols. > Hi David, I just have. This is a nice work. There is a lot of repetitions though. For example: - IEquiv (-equiv [coll other] (equiv-sequential coll other)) - IHash

Re: defrecord with "inheritance"

2012-05-21 Thread Mark Engelberg
On Mon, May 21, 2012 at 1:53 AM, nicolas.o...@gmail.com < nicolas.o...@gmail.com> wrote: > I just have. This is a nice work. There is a lot of repetitions though. > Thanks Nicolas for putting together these examples. This is exactly what I've been talking about. Whenever someone talks about the

Re: algebra system & core.logic

2012-05-21 Thread Martin Jul
Symbolic computation sounds like a really great project! For your specific problem of sorting the dependencies, you can do a "topological sort" of the dependency graph of your equations in linear time (given there are no cyclic dependencies, otherwise it would detect the failure). There are st

Re: How do I set jvm options for a lein repl

2012-05-21 Thread Raju Bitter
Check the sample project.clj on Github: https://github.com/technomancy/leiningen/blob/master/sample.project.clj There's an entry for JVM options: ;; You can set JVM-level options here. :jvm-opts ["-Xmx1g"] In a quick test, that worked for me when lein repl was executed. - Raju -- You receiv

Re: How do I set jvm options for a lein repl

2012-05-21 Thread Raju Bitter
Oh, sorry, misunderstood your question. I found this blog post, maybe this still works, although it's from 2010: http://www.clojurepla.net/2010/05/increase-jvm-memory-when-using-swank.html -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to thi

Re: How do I set jvm options for a lein repl

2012-05-21 Thread Moritz Ulrich
That blog post is pretty outdated. When using leiningen, you can pass arbitrary jvm opts via project.clj[1]: :jvm-opts ["-Xmx1g"] [1]: https://github.com/technomancy/leiningen/blob/master/sample.project.clj On Mon, May 21, 2012 at 1:37 PM, Raju Bitter wrote: > Oh, sorry, misunderstood your ques

Re: How do I set jvm options for a lein repl

2012-05-21 Thread Raju Bitter
> How do I set jvm options for a lein repl initiated independently of a > project?   In particular, I want the heap expansion that results from doing > "M-x clojure-jack-in" in an emacs project.clj buffer with ":jvm-opts [ > "-Xms4G" "-Xmx4G"]" in its defproject form. Larry is looking for a way to

Re: How do I set jvm options for a lein repl

2012-05-21 Thread Roberto Mannai
You could add the following evinroment variable to your OS: LEIN_JVM_OPTS=-Xms4G -Xmx4G On Windows for example, you could add at the top of "lein.bat" file the following line (under "@echo off"): SET LEIN_JVM_OPTS=-Xms4G -Xmx4G This should be enough to do the trick. On Mon, May 21, 2012 at 6:51

Re: defrecord with "inheritance"

2012-05-21 Thread Aaron Cohen
On Mon, May 21, 2012 at 4:53 AM, nicolas.o...@gmail.com < nicolas.o...@gmail.com> wrote: > > > > Have you actually looked at the data structure implementations in > > ClojureScript? The work is done. It's all protocols. > > > Hi David, > > I just have. This is a nice work. There is a lot of repeti

Re: algebra system & core.logic

2012-05-21 Thread Brent Millare
On Monday, May 21, 2012 7:11:01 AM UTC-4, Martin Jul wrote: > > Symbolic computation sounds like a really great project! > > For your specific problem of sorting the dependencies, you can do a > "topological sort" of the dependency graph of your equations in linear time > (given there are no c

Re: defrecord with "inheritance"

2012-05-21 Thread David Nolen
On Mon, May 21, 2012 at 4:53 AM, nicolas.o...@gmail.com < nicolas.o...@gmail.com> wrote: > > ClojureScript? The work is done. It's all protocols. > > > Hi David, > > I just have. This is a nice work. There is a lot of repetitions though. > For example: > - IEquiv > (-equiv [coll other] (equiv-seq

Re: defrecord with "inheritance"

2012-05-21 Thread David Nolen
On Mon, May 21, 2012 at 5:39 AM, Mark Engelberg wrote: > On Mon, May 21, 2012 at 1:53 AM, nicolas.o...@gmail.com < > nicolas.o...@gmail.com> wrote: > >> I just have. This is a nice work. There is a lot of repetitions though. >> > > Thanks Nicolas for putting together these examples. This is exact

Re: defrecord with "inheritance"

2012-05-21 Thread David Nolen
On Mon, May 21, 2012 at 5:39 AM, Mark Engelberg wrote: > On Mon, May 21, 2012 at 1:53 AM, nicolas.o...@gmail.com < > nicolas.o...@gmail.com> wrote: > We need to figure out a way to make reusable partial implementations the > norm. Maybe the solution is a Clojure construct along the lines of: > (g

Re: defrecord with "inheritance"

2012-05-21 Thread nicolas.o...@gmail.com
> > And now any of those implementations can easily change at anytime without > any external considerations. So what's the problem? Well if you want to amend all of them at the same time, you have to modify all of them. On your advice of using extend-type: maybe I am wrong but I think it has a pe

Re: algebra system & core.logic

2012-05-21 Thread Brent Millare
Actually, after working through the algorithm presented in the wiki, I think my implementation is basically equivalent given the data structures I'm using. :| On Monday, May 21, 2012 9:27:01 AM UTC-4, Brent Millare wrote: > > > > On Monday, May 21, 2012 7:11:01 AM UTC-4, Martin Jul wrote: >> >>

Re: defrecord with "inheritance"

2012-05-21 Thread David Nolen
On Mon, May 21, 2012 at 11:11 AM, nicolas.o...@gmail.com < nicolas.o...@gmail.com> wrote: > > > > And now any of those implementations can easily change at anytime without > > any external considerations. So what's the problem? > > Well if you want to amend all of them at the same time, you have t

"when" function

2012-05-21 Thread Christian Guimaraes
Hi all, I'm struggling with "when" code structures and my imperative mindset. What is the better approach (or functional approach) to work with a code like the below? (defn parse-group [group-identifier line] (when (= group-identifier "ID1") (handle-id1 line)) (when (= group-identifier "

Re: "when" function

2012-05-21 Thread Bill Caputo
On May 21, 2012, at 10:54 AM, Christian Guimaraes wrote: > I'm struggling with "when" code structures and my imperative mindset. > > What is the better approach (or functional approach) to work with a code like > the below? I think you're looking for cond (from memory, syntax might be wrong): (

Re: "when" function

2012-05-21 Thread Timothy Baldridge
In this case I prefer either: (cond (= group-identifier "ID1") (handle-id1 line) (= group-identifier "ID2") (handle-id2 line) (= group-identifier "ID3") (handle-id3 line)) Or just use core.match: (match [group-identifier] ["ID1"

Re: "when" function

2012-05-21 Thread Jay Fields
I'm surprised no one went for condp (defn parse-group [group-identifier line] (condp = group-identifier "ID1" (handle-id1 line) "ID2" (handle-id2 line) "ID3" (handle-id3 line) (handle-unknown-id line))) or something like that... On Mon, May 21, 2012 at 11:59 AM, Timothy Baldri

Re: "when" function

2012-05-21 Thread Sean Corfield
On Mon, May 21, 2012 at 8:54 AM, Christian Guimaraes wrote: > What is the better approach (or functional approach) to work with a code > like the below? A simple translation to condp: (defn parse-group [group-identifier line] (condp = group-identifier "ID1" (handle-id1 line) "ID2" (han

Re: "when" function

2012-05-21 Thread Jonas
On Monday, May 21, 2012 6:54:28 PM UTC+3, Christian Guimaraes wrote: > > Hi all, > > I'm struggling with "when" code structures and my imperative mindset. > > What is the better approach (or functional approach) to work with a code > like the below? > > (defn parse-group [group-identifier line]

Re: "when" function

2012-05-21 Thread Bronsa
or simply use `case` (case group-identifier "ID1" (handle-id1 line) "ID2" (handle-id2 line) "ID3" (handle-id3 line)) 2012/5/21 Timothy Baldridge > In this case I prefer either: > > (cond (= group-identifier "ID1") >(handle-id1 line) > (= group-identifier "ID2")

Re: How do I set jvm options for a lein repl

2012-05-21 Thread Mikhail Kryshen
Also there is an environment variable _JAVA_OPTIONS (note the leading underscore) which is handled by the HotSpot JVM (OpenJDK or Oracle JDK) and can be used with any java application. -- Mikhail -- You received this message because you are subscribed to the Google Groups "Clojure" group. To pos

Re: "when" function

2012-05-21 Thread Timothy Baldridge
> A multimethod might also be an appropriate way forward for you. +1 For multimethods, don't hardcode it if you don'tt have to. Timothy -- 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 Not

Re: How do I set jvm options for a lein repl

2012-05-21 Thread Phil Hagelberg
On Mon, May 21, 2012 at 5:28 AM, Raju Bitter wrote: >> How do I set jvm options for a lein repl initiated independently of a >> project?   In particular, I want the heap expansion that results from doing >> "M-x clojure-jack-in" in an emacs project.clj buffer with ":jvm-opts [ >> "-Xms4G" "-Xmx4G"

Re: defrecord with "inheritance"

2012-05-21 Thread Softaddicts
The following is not about the merits of your request (or its foolishness :), it maybe a taste issue. If I look at productivity/efficiency, I cannot see the interest of sticking to the tools and frameworks the majority is using presently. They are highly inefficients. Doing things the same way

Re: defrecord with "inheritance"

2012-05-21 Thread Phil Hagelberg
On Sun, May 20, 2012 at 2:37 PM, Bill Caputo wrote: > I am not a clojure beginner (though far from feeling I know all there is to > learn about it). I have been using clojure for almost a year; my team has > rebuilt the central part of our system (which is relied on by just about > every other

Re: docstrings of if-let and when-let incorrect

2012-05-21 Thread Borkdude
Wow, the discussion continued! I agree on what most people have said: AND-combined and none of the bindings available in the else. On Friday, May 18, 2012 7:20:06 AM UTC+2, FrankS wrote: > > Christophe Grand was "experimenting" with some extensions to if-let and > when-let that had implicit AN

Re: docstrings of if-let and when-let incorrect

2012-05-21 Thread Aaron Cohen
On Wed, May 16, 2012 at 9:53 AM, Walter Tetzner < robot.ninja.saus...@gmail.com> wrote: > On Wednesday, May 16, 2012 9:16:29 AM UTC-4, Aaron Cohen wrote: >> >> Saying something is obvious and then using the word monad a paragraph >> later is contradictory. ;) >> >> What should happen on the else b

Re: defrecord with "inheritance"

2012-05-21 Thread nicolas.o...@gmail.com
> Same here--I can count on one hand the number of times I've wanted to > implement polymorphism in three and a half years. Every time > multimethods have worked great for the task. If you had polymorphism > in a tight loop they might not suffice, but the decision to abandon > multimethods should o

Re: "when" function

2012-05-21 Thread Christian Guimaraes
Hi, I think that multimethods will fit better in my case, since I have more than three ID's to handle. Thank you all for the answers. -- christian. On Mon, May 21, 2012 at 5:04 PM, Timothy Baldridge wrote: > > A multimethod might also be an appropriate way forward for you. > > +1 For multimeth

Re: docstrings of if-let and when-let incorrect

2012-05-21 Thread Borkdude
I guess it wouldn't hurt having them available in the else, even if people won't use them often. On Monday, May 21, 2012 7:11:05 PM UTC+2, Aaron Cohen wrote: > > On Wed, May 16, 2012 at 9:53 AM, Walter Tetzner < > robot.ninja.saus...@gmail.com> wrote: > >> On Wednesday, May 16, 2012 9:16:29 AM UT

Re: docstrings of if-let and when-let incorrect

2012-05-21 Thread Jay Fields
There's a few issues there, first of which is that the code doesn't evaluate to what's shown: REPL started; server listening on localhost port 21867 user=> (if-let [a 1] (if-let [b 2] (if-let [c nil] [a b c] [a b c]) [a b c]) [a b c]) java.lang.Exception: Unabl

Re: docstrings of if-let and when-let incorrect

2012-05-21 Thread Aaron Cohen
On Mon, May 21, 2012 at 1:43 PM, Jay Fields wrote: > There's a few issues there, first of which is that the code doesn't > evaluate to what's shown: > REPL started; server listening on localhost port 21867 > user=> > (if-let [a 1] >(if-let [b 2] > (if-let [c nil] > [a b c] >

Re: defrecord with "inheritance"

2012-05-21 Thread David Nolen
On Mon, May 21, 2012 at 1:12 PM, nicolas.o...@gmail.com < nicolas.o...@gmail.com> wrote: > > Same here--I can count on one hand the number of times I've wanted to > > implement polymorphism in three and a half years. Every time > > multimethods have worked great for the task. If you had polymorphi

Re: defrecord with "inheritance"

2012-05-21 Thread Mark Engelberg
On Mon, May 21, 2012 at 10:12 AM, nicolas.o...@gmail.com < nicolas.o...@gmail.com> wrote: > The point is not whether deftype is useful or not. It is in the > language so it must be useful, even it it is rarely. > The point is whether it is an expressive construct or not. > And it is not expressive

Re: defrecord with "inheritance"

2012-05-21 Thread David Nolen
On Mon, May 21, 2012 at 1:59 PM, Mark Engelberg wrote: > On the other hand, defrecord/deftype encourage you to write your protocol > implementation in a way that cannot be reused unless you very specifically > plan for it (factoring the protocol implementation into a separate map) and > use a codi

Re: defrecord with "inheritance"

2012-05-21 Thread Raoul Duke
On Mon, May 21, 2012 at 10:59 AM, Mark Engelberg wrote: > The whole beauty of protocols, for example, is that unlike interfaces, you > can graft it on to a type that wasn't originally designed to support it. > This is good, and a step forward from other languages. i know protocols != structural t

Re: defrecord with "inheritance"

2012-05-21 Thread David Nolen
On Mon, May 21, 2012 at 2:12 PM, Raoul Duke wrote: > On Mon, May 21, 2012 at 10:59 AM, Mark Engelberg > wrote: > > The whole beauty of protocols, for example, is that unlike interfaces, > you > > can graft it on to a type that wasn't originally designed to support it. > > This is good, and a ste

Re: defrecord with "inheritance"

2012-05-21 Thread Raoul Duke
On Mon, May 21, 2012 at 11:14 AM, David Nolen wrote: > How does duck typing support sensibly extending types you don't control? ah, i missed the implicit part of the excerpt that was about extending rather than just use. catching up. thanks. -- You received this message because you are subscri

Re: defrecord with "inheritance"

2012-05-21 Thread nicolas.o...@gmail.com
>> On the other hand, defrecord/deftype encourage you to write your protocol >> implementation in a way that cannot be reused unless you very specifically >> plan for it (factoring the protocol implementation into a separate map) and >> use a coding style that (might?) be less efficient (i.e., addi

Re: defrecord with "inheritance"

2012-05-21 Thread Warren Lynn
Sometimes it seems to me"OO" and "inheritance" have become some kind of taboos. I don't believe OO is all that wrong. To me Clojure seems to have good potential to harness the good part of OO without carrying into the bad parts. So I am hoping. :-) On May 21, 2:25 pm, "nicolas.o...@gmail.com" wro

Re: How do I set jvm options for a lein repl

2012-05-21 Thread Larry Travis
I should be switching over to Leiningen 2 shortly in any case, but I am curious. How does one "set JVM_OPTS as an environment variable"? --Larry On 5/21/12 11:42 AM, Phil Hagelberg wrote: On Mon, May 21, 2012 at 5:28 AM, Raju Bitter wrote: How do I set jvm options for a lein repl initiated

Re: defrecord with "inheritance"

2012-05-21 Thread Mark Engelberg
On Mon, May 21, 2012 at 11:12 AM, David Nolen wrote: > So "real world" complex systems avoid inheritance like the plague. So > remind me again why it's desirable? > > David > > > I never said I want inheritance. I want convenient reuse of partial implementations. Inheritance is one way to achiev

Re: How do I set jvm options for a lein repl

2012-05-21 Thread Softaddicts
If you are running in a unix shell, something like JVM_OPTS=-Xms4G ... Followed by export JVM_OPTS Bash allows you to combine the two as in: export JVM_OPTS-Xms4G ... In a windows Cmd shell, something like this should work: set JVM_OPTS=Xms4G ... before running lein from the command line.

Re: defrecord with "inheritance"

2012-05-21 Thread David Nolen
On Mon, May 21, 2012 at 6:08 PM, Mark Engelberg wrote: > As I proposed in an earlier email, one brainstorm I have about this is: > > (get-protocol-implementation ) gives you > back a mapping of the functions used by that type to implement that > protocol. > I think there's some assumptions here

Re: How do I set jvm options for a lein repl

2012-05-21 Thread Softaddicts
The bash example is export JVM_OPTS=-Xms4G ... missed the = ... Luc > If you are running in a unix shell, something like > > JVM_OPTS=-Xms4G ... > > Followed by > export JVM_OPTS > > Bash allows you to combine the two as in: > > export JVM_OPTS-Xms4G ... > > In a windows Cmd shell, somethi

Re: defrecord with "inheritance"

2012-05-21 Thread kovas boguta
On Mon, May 21, 2012 at 6:08 PM, Mark Engelberg wrote: > I never said I want inheritance.  I want convenient reuse of partial > implementations.  Inheritance is one way to achieve it, but I'd like to > think that Clojure can find a better way. We also have macros. You can always make your own

Re: defrecord with "inheritance"

2012-05-21 Thread Mark Engelberg
On Mon, May 21, 2012 at 4:00 PM, David Nolen wrote: > The only two protocols that involve specifying more than 2 fns is > IWatchable (3) and MultiFn (5). It's not clear to me that they would > benefit from partial specification. > I don't think there's enough body of code using protocols to real

Re: defrecord with "inheritance"

2012-05-21 Thread Mark Engelberg
On Mon, May 21, 2012 at 4:23 PM, kovas boguta wrote: > On Mon, May 21, 2012 at 6:08 PM, Mark Engelberg > wrote: > > > I never said I want inheritance. I want convenient reuse of partial > > implementations. Inheritance is one way to achieve it, but I'd like to > > think that Clojure can find a

Re: defrecord with "inheritance"

2012-05-21 Thread meb
I think it's misleading to use inheritance to reduce code duplication. Inheritance is about indicating function typing and creating typed contracts, both of which are fairly un-idiomatic in Clojure. However, there is another way to prevent code duplication: use composition instead. Instead of

Re: defrecord with "inheritance"

2012-05-21 Thread Laurent PETIT
Le 22 mai 2012 à 04:19, Mark Engelberg a écrit : On Mon, May 21, 2012 at 4:00 PM, David Nolen wrote: > The only two protocols that involve specifying more than 2 fns is > IWatchable (3) and MultiFn (5). It's not clear to me that they would > benefit from partial specification. > I don't think

Re: defrecord with "inheritance"

2012-05-21 Thread Softaddicts
Interesting demonstration, except for one thing, defining getters is a waste of time :) When you need to define accessors, you start to run into inefficient use of your time. It still a bearable workload in Java because of all this heavy tooling that allows to select for which fields accessors wi

Re: How do I set jvm options for a lein repl

2012-05-21 Thread Larry Travis
It took me a while to figure out how to put multiple entries into an environment variable (that is, settings for both min and max heap sizes, to wit, "export JVM_OPTS=\ -Xms4G\ -Xmx4G") but, once I did, Phil's and Luc's suggestions have worked well and things have gone swimmingly. They work for

[ANN] checkero 0.1.0 : A Clojure code similarity search tool

2012-05-21 Thread Arnoldo Muller
Checkero finds common Clojure source code inside a set of directories. It is primarily intended to study how Clojure learners write functions. As a side effect, you can find if students have honestly completed their homework. It could also be used to find commonly used patterns in code that req

Re: defrecord with "inheritance"

2012-05-21 Thread Philip Potter
On May 22, 2012 7:09 AM, "Softaddicts" wrote: > A better way would be something like: > > (defprotocol Personable >(person [this]) > (age [this] ) > > (defprotocol CensusOperators >(age [this])) > > (extend-protocol Personable >Person >(person [this] this) >Employee >(p

Re: defrecord with "inheritance"

2012-05-21 Thread Meikel Brandmeyer (kotarak)
Hi, Am Dienstag, 22. Mai 2012 00:08:52 UTC+2 schrieb puzzler: > Mergeable maps are a good idea, but the current way of doing things > steers people away from that solution and requires too much > forethought to actively plan for reuse. I wonder why the current way of doing things “steers away” p

Re: defrecord with "inheritance"

2012-05-21 Thread meb
Hey Luc, That's a cool casting strategy to cleanly build a standard way to get at the person piece of any type of applicable record. In the pure composition case, it's actually a nice solution to build functions know how to unpack the Person aspect of a subtype. However, I think which strateg