How do I set jvm options for a lein repl

2012-05-20 Thread Larry Travis
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 -- You received thi

ANN: Clisk - Clojure image synthesis kit

2012-05-20 Thread Mikera
Hello all, You may be interested in my new project - a procedural image synthesis toolkit for Clojure. Designed for creating all kinds of patterns, textures etc. https://github.com/mikera/clisk Feel free to have a explore, comments / extra ideas welcome! Mike. -- You received this messag

Re: defrecord with "inheritance"

2012-05-20 Thread David Nolen
On Sun, May 20, 2012 at 10:43 PM, Mark Engelberg wrote: > Until it has all been factored into protocols that make it easy for people > to implement their own data structures that hook into Clojure's built-in > functions, I'd say the jury's still out. Currently, Clojure uses a mixture > of interfa

Re: defrecord with "inheritance"

2012-05-20 Thread Warren Lynn
Thanks a lot for the discussions/suggestions. Maybe the Clojure way, whatever it means, will become natural to me someday. I still remember how awkward it was for me to use Emacs (just because I could not find another editor to do syntax highlighting for my particular file format), and now I canno

Re: defrecord with "inheritance"

2012-05-20 Thread Mark Engelberg
On Sun, May 20, 2012 at 4:31 PM, David Nolen wrote: > Nearly all of the data structures have been ported to ClojureScript. It's > not clear to me that we needed traits at any point. > > David > > > Until it has all been factored into protocols that make it easy for people to implement their own d

Re: defrecord with "inheritance"

2012-05-20 Thread David Nolen
On Sun, May 20, 2012 at 9:35 PM, Warren Lynn wrote: > I hope my original "feature > request" at the beginning falls into such category. Don't hold your breath :) Look forward to seeing what you think further down the line. David -- You received this message because you are subscribed to the

Re: defrecord with "inheritance"

2012-05-20 Thread Warren Lynn
I surely agree there is individual difference in thinking what is natural. Mozart might thought writing a symphony was a very natural thing to accomplish, which I would strongly disagree. But if the language does not meet the natural thinking of the majority people (which I do think exist), then th

Re: defrecord with "inheritance"

2012-05-20 Thread Softaddicts
Hi Warren, "familiar" implies that your understanding relies on your previous experiences. To get away from "familiar" concepts you need to think "out of the box". How do you get rid of cabled thinking that brings you back always to the same track ? Or should I say rut ? It's an uneasy experienc

Re: defrecord with "inheritance"

2012-05-20 Thread Warren Lynn
That is certainly a philosophical question to which I cannot give any proof to my view. In my view, as long as human beings are still writing code, you cannot be truly efficient and effective without a language that can let you express and organize your ideas in a natural way (which itself is subje

Re: defrecord with "inheritance"

2012-05-20 Thread Peter Buckley
-> high-level languages are there to make coding more efficient and effective -> the whole point of high-level languages is to satisfy our need to express our ideas/logics in a more natural way I'd argue that you're in violent agreement with each other :-) If I can express my idea/logic in a mo

Re: defrecord with "inheritance"

2012-05-20 Thread Alex Baranosky
I'd argue with you over whether that is the whole point of high-level languages. I might say that high-level languages are there to make coding more efficient and effective. On Sun, May 20, 2012 at 5:16 PM, Warren Lynn wrote: > > I agree "familiar" is often mixed with "natural". But nevertheles

Re: ClojureScript: How to call console.log with variable args?

2012-05-20 Thread Kevin Lynagh
Moritz, One thing that I found helpful was to define log as a macro so that it'll be inlined in the JavaScript. That way Chrome will give you the correct line numbers (for the compiled JS, anyway) when you print things out to the console. On May 20, 11:50 am, David Nolen wrote: > Hmm for some

Re: defrecord with "inheritance"

2012-05-20 Thread Warren Lynn
I agree "familiar" is often mixed with "natural". But nevertheless that does not mean there is no such thing as "natural" thinking or programming pattern. In a broader sense, the whole point of high-level languages is to satisfy our need to express our ideas/logics in a more natural way, hence the

Re: defrecord with "inheritance"

2012-05-20 Thread David Nolen
FWIW, the first thing I did when I encountered Clojure was built a Tiny CLOS like system with inheritance. I've since come to the conclusion it was a waste of time and Clojure offers an equally good set of tools. After examining a few powerful paradigms, OO, FP, LP, etc I'm not sure what "natural"

Re: defrecord with "inheritance"

2012-05-20 Thread David Nolen
On Sun, May 20, 2012 at 6:39 PM, nicolas.o...@gmail.com < nicolas.o...@gmail.com> wrote: > > So I suggest you take it to heart. Put deftype, defrecord and > defprotocol > > away and don't pull them back out for quite some time. At the beginning, > > they are just a distraction from Clojure's cor

Re: Core.logic, dynamically generated goals

2012-05-20 Thread Brian Marick
On May 19, 2012, at 1:12 PM, Alex Robbins wrote: > Is it possible to use dynamically generated goals in run* ? You might want to think macros. I have written macros that tweak `run` bodies for various purposes: `(~@runner [~qvar] (l/fresh [~(gensyms :procedure) ~(gens

Re: defrecord with "inheritance"

2012-05-20 Thread nicolas.o...@gmail.com
> So I suggest you take it to heart.  Put deftype, defrecord and defprotocol > away and don't pull them back out for quite some time.  At the beginning, > they are just a distraction from Clojure's core philosophy.  Focus on maps, > vectors, sets, functions, multimethods and macros. But there are

Re: defrecord with "inheritance"

2012-05-20 Thread Alex Baranosky
For me learning Clojure was a real pain. It was awkward and weird and felt wrong. But really I was just trapped in an OO-only world and didn't know better. I don't think there is s such a thing as what is "natural" in programming. For loops are natural? -- psha. Objects are natural? -- no way

Re: algebra system & core.logic

2012-05-20 Thread Julian
Core.logic isn't the only way to approach this problem. In Peter Norvig's PAIP he included a simple algebra system, macsyma http://norvig.com/paip/macsyma.lisp (in common lisp). JG On Sunday, 20 May 2012 06:21:56 UTC+10, Brent Millare wrote: > That's more or less what I'm going to have to do

Re: defrecord with "inheritance"

2012-05-20 Thread Warren Lynn
Thanks for the suggestion. I understand part of the joy (and pain) of learning a new language is to change the way of thinking. So I probably need to take on something no-trivial but also not overwhelming to understand the issue or benefit better. But eventually, a language cannot meet everybody's

Re: Extending core.logic (Datomic example)

2012-05-20 Thread David Nolen
The details of working efficiently with Datomic are outside the scope of the tutorial. And yes you can and should be more specific about how you access Datomic's indexes. David On Sun, May 20, 2012 at 2:58 PM, john wrote: > please forgive me if I am wrong because I know so little about > clojur

Re: defrecord with "inheritance"

2012-05-20 Thread Kevin Downey
why does defrecord and deftype exist? shouldn't deftype be sufficient? Why is defrecord encouraged over deftype, with defype reserved for low level bits? it is because records can act like a generic map, which means data is not hidden inside the type, which makes types created with defrecord much

Re: defrecord with "inheritance"

2012-05-20 Thread Bill Caputo
On May 20, 2012, at 4:23 PM, Warren Lynn wrote: >> defrecord, deftype, and defprotocol provide extensible low level >> abstractions like the kind Clojure is built on. >> >> As a Clojure programmer you should only need them rarely. >> >> As a beginner you should never use them. > Well, I don't w

Re: defrecord with "inheritance"

2012-05-20 Thread Kevin Downey
On Sun, May 20, 2012 at 2:23 PM, Warren Lynn wrote: > Well, I don't want to be a beginner for too long, :-) then "As a Clojure programmer you should only need them rarely." > On May 20, 5:19 pm, Kevin Downey wrote: >> On Sun, May 20, 2012 at 2:13 PM, Warren Lynn wrote: >> > Maybe for Person/Em

Re: defrecord with "inheritance"

2012-05-20 Thread Kevin Downey
On Sun, May 20, 2012 at 2:16 PM, nicolas.o...@gmail.com wrote: > I had wished such a feature all week. > You don't need it often, but when you need it, it is really annoying > to circumvent. > traits would really be useful. If you find yourself wanting traits you are using defrecord, deftype, and

Re: defrecord with "inheritance"

2012-05-20 Thread Warren Lynn
Well, I don't want to be a beginner for too long, :-) On May 20, 5:19 pm, Kevin Downey wrote: > On Sun, May 20, 2012 at 2:13 PM, Warren Lynn wrote: > > Maybe for Person/Employee example with very simple functions do not > > need data types, but I don't think that is generally true (isn't > > "de

Re: defrecord with "inheritance"

2012-05-20 Thread Kevin Downey
On Sun, May 20, 2012 at 2:13 PM, Warren Lynn wrote: > Maybe for Person/Employee example with very simple functions do not > need data types, but I don't think that is generally true (isn't > "defrecord" trying to patching that up?).  When I say "need" I am not > saying you cannot achieve what you

Re: defrecord with "inheritance"

2012-05-20 Thread nicolas.o...@gmail.com
I had wished such a feature all week. You don't need it often, but when you need it, it is really annoying to circumvent. traits would really be useful. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googl

Re: defrecord with "inheritance"

2012-05-20 Thread Kevin Downey
On Sun, May 20, 2012 at 2:05 PM, Warren Lynn wrote: > I don't quite understand where I introduced the rigidity. And what I > described is not a true inheritance as in traditional OO languages > (hence the quoted "inheritance"). It seems just some simple almost > syntax-level change (maybe some mac

Re: defrecord with "inheritance"

2012-05-20 Thread Warren Lynn
Maybe for Person/Employee example with very simple functions do not need data types, but I don't think that is generally true (isn't "defrecord" trying to patching that up?). When I say "need" I am not saying you cannot achieve what you want to do without it (just as assembly code can do anything)

Re: defrecord with "inheritance"

2012-05-20 Thread Warren Lynn
I don't quite understand where I introduced the rigidity. And what I described is not a true inheritance as in traditional OO languages (hence the quoted "inheritance"). It seems just some simple almost syntax-level change (maybe some macros can solve it) will make people's life a little bit easier

Re: defrecord with "inheritance"

2012-05-20 Thread Kevin Downey
On Sun, May 20, 2012 at 1:50 PM, Warren Lynn wrote: > Thanks. That will work. But I wish things can get more concise and > elegant. > > I like the Python idea of "make simple things easier and difficult > things possible". So I think the limited "inheritance" I mentioned can > make a large portion

Re: defrecord with "inheritance"

2012-05-20 Thread Kevin Downey
On Sun, May 20, 2012 at 10:22 AM, Warren Lynn wrote: > So from what I read  the philosophy of Clojure discourages inheritance > on concrete data types. However, maybe I am too entrenched in my OO > thinking, how do I define a new record type that includes all the data > members of another record t

Re: defrecord with "inheritance"

2012-05-20 Thread Warren Lynn
Thanks. That will work. But I wish things can get more concise and elegant. I like the Python idea of "make simple things easier and difficult things possible". So I think the limited "inheritance" I mentioned can make a large portion of use cases easier, without sacrificing any of Clojure's more

Re: defrecord with "inheritance"

2012-05-20 Thread nicolas.o...@gmail.com
> (extend Employee >         AProtocol >         (merge default-implementation {:new-function (fn ...)})) > But you lose a bit of performance with that... -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@go

Re: Extending core.logic (Datomic example)

2012-05-20 Thread john
please forgive me if I am wrong because I know so little about clojure,logic and datomic But you are using (d/datoms (db conn) :eavt) which seems to give you a sequence over all datoms of a database. In a large database this sequence would not fit in memory. So wouldn't it be better if you s

Re: Reducers

2012-05-20 Thread Leif
>From the article: "The combining fn must supply an identity value when called with no arguments" This means that you can't use combining functions whose identity value can't be computed, but satisfies the proper rules. E.g. set intersection: (intersection) == e == the set of all possible ele

Re: ClojureScript: How to call console.log with variable args?

2012-05-20 Thread David Nolen
Hmm for some reason I recall this doesn't work consistently in all browsers. Might be wrong. On Sunday, May 20, 2012, Moritz Ulrich wrote: > > Found a more or less nice solution: > > --8<---cut here---start->8--- > (defn log [& more] > (.apply (.-log js/consol

Re: defrecord with "inheritance"

2012-05-20 Thread Vinzent
You can reuse methods by putting them in a map and then just merging it with the new methods: (extend Employee AProtocol (merge default-implementation {:new-function (fn ...)})) The problem is that you can't reuse methods defined inline, i.e. you can't say "my record implements

defrecord with "inheritance"

2012-05-20 Thread Warren Lynn
So from what I read the philosophy of Clojure discourages inheritance on concrete data types. However, maybe I am too entrenched in my OO thinking, how do I define a new record type that includes all the data members of another record type? I am thinking about the classic Employee/Person example.

Re: Lexer and parser generator in Clojure

2012-05-20 Thread Jason Jackson
This is a really great project. If you add LR1, you may want to retain ~LR0 as an option. My understanding is most grammars today are designed for LALR1. On Sun, May 20, 2012 at 4:26 AM, Christophe Grand wrote: > On Sat, May 19, 2012 at 9:44 PM, Jason Jackson wrote: > >> In retrospect, I would ha

Re: ClojureScript: How to call console.log with variable args?

2012-05-20 Thread Moritz Ulrich
Found a more or less nice solution: --8<---cut here---start->8--- (defn log [& more] (.apply (.-log js/console) js/console (into-array (map #(if (satisfies? cljs.core.ISeqable %) (pr-str %)

Re: ClojureScript: How to call console.log with variable args?

2012-05-20 Thread David Nolen
I didn't think that console.log.apply worked. On Sunday, May 20, 2012, Moritz Ulrich wrote: > > Hello, > > I want to write a simple logging-wrapper around console.log, with the > background of being able to enable/disable logging at any time. This is > my current implementation: > > --8<-

Re: Clojure for shell scripts

2012-05-20 Thread Edward Ruggeri
Thanks, guys! Thanks, Stu; that's an option. My limited experience with clojurescript has been that it takes sort of a while to compile cljsc files; it took me maybe 3sec to compile hello world. I'm sure this up-front cost is offset by savings at future invocations; but it isn't a superior alter

Re: Bootstrapping Clojure-in-Clojure

2012-05-20 Thread Chris Gray
Sorry to come in a bit late on this conversation; I've been moving recently. On Mon, May 14, 2012 at 5:35 AM, Timothy Baldridge wrote: > Platforms that do not have the ability to eval (gambit, JS, etc.) they > could simply stick with writing Java macros. For the rest of the > platforms (CLR, JVM,

Re: Clojure for shell scripts

2012-05-20 Thread Roberto Mannai
Maybe this experiment could interest you (clojurescript as a plugin of gnome): https://github.com/technomancy/lein-gnome In general, if AFAIK the main performance issue is the jvm startup time and the loading of the clojure.core library, one first solution could be keeping a single background repl

ClojureScript: How to call console.log with variable args?

2012-05-20 Thread Moritz Ulrich
Hello, I want to write a simple logging-wrapper around console.log, with the background of being able to enable/disable logging at any time. This is my current implementation: --8<---cut here---start->8--- (defn log [& more] (.log js/console (apply pr-str mo

Re: Clojure for shell scripts

2012-05-20 Thread Stuart Halloway
Hi Ned, I think the medium-term strategy likely to yield good results is for someone to put together a story around ClojureScript + advanced mode + V8. I know a few people have played with this, but I am not sure if anyone has gone so far as to package it up for easy consumption. Stu Stuart

Clojure for shell scripts

2012-05-20 Thread Edward Ruggeri
Hey everyone!, I know this is an old story. I've played with clojure, but the main thing that has kept me from never looking back is the startup speed. "Hello world!" in Java takes me .303s, but just "java -cp clojure-1.5.0-master-SNAPSHOT.jar" takes 1.989s (sending C-d to close the repl even be

Re: Different behavior at REPL vs compiled code

2012-05-20 Thread Brandon Bickford
The type of "n" (passed to main) is a string. Command line arguments are strings.  - Brandon On Thu, May 17, 2012 at 11:39 PM, Ankit Goel wrote: > Hi, > > I have recently started learning clojure and have been setting up > leiningen for managing projects. > I create a new project using "lein n

[Clojure Programming: Chapter 4] question about return form of `send`

2012-05-20 Thread Michael Erickson
Hello all, I've been reading Clojure Programming by Emerick, Carper, and Grand from O'Reilly and have a question. Towards the end of Chapter 4, they implement a little web-crawler that uses agents. I'm having some trouble getting my head around one piece of the code. Specifically the `run` f

Re: Lexer and parser generator in Clojure

2012-05-20 Thread Christophe Grand
On Sat, May 19, 2012 at 9:44 PM, Jason Jackson wrote: > In retrospect, I would have tried > https://github.com/cgrand/**parsley afaik > it has ~LR1 performance characteristics. > Parsley is closer to LR(0) (but I'd like to make it LR(1) using Pager's lane trac

Re: Extending core.logic (Datomic example)

2012-05-20 Thread Baishampayan Ghose
Try this one - https://github.com/clojure/core.logic/wiki/Extending-core.logic-%28Datomic-example%29 Regards, BG On Sun, May 20, 2012 at 12:22 PM, Thomas G. Kristensen wrote: > That link is dead - sorry, > > Thomas > > On May 19, 3:24 am, David Nolen wrote: >> core.logic has had the facilities