Re: REPL integration in a existing java project

2009-10-02 Thread Fredrik Appelberg
On Thu, Oct 1, 2009 at 2:29 PM, DomS dominik.schaefe...@googlemail.comwrote: Hello all, I'm trying to integrate an REPL in a existing java project, but i dont know how it works or where to start. At first it should only have the functionality from an ordinary clj repl. Later we want to

Re: Citing clojure

2009-10-02 Thread Jung Ko
On Thu, Oct 1, 2009 at 1:17 PM, John Harrop jharrop...@gmail.com wrote: On Thu, Oct 1, 2009 at 3:42 PM, Dragan Djuric draga...@gmail.com wrote: I usualy cite Rich's conference paper and Stuart's book. @conference{hickey2008clojure, title={{The Clojure programming language}},

Re: REPL integration in a existing java project

2009-10-02 Thread Marc Downie
We got started by staring at: http://github.com/pmf/clojure-jsr223 Although familiarity with the suboptimal jsr223 spec helped. (Unlike a server socket, this approach means that you can share parts of your host directly with the Clojure environment by binding var's. I find this either is, or at

Re: Two minor typos in the cheatsheet

2009-10-02 Thread Miron Brezuleanu
Hello, I assume this is about the cheatsheet at http://clojure.org/cheatsheet The odd/even typos are in the PDF version. Some suggestions: add update-in, assoc-in, get-in in the 'Maps' section; Add the ignore-next-form #_ reader macro in the reader macros section. Otherwise, great resource.

into function

2009-10-02 Thread Mark Volkmann
(into [1 2] [3 4]) - [1 2 3 4] (into [1 2] [3 4] [5 6]) - wrong number of arguments It's seems more Clojure-like to allow any number of collections to be passed to into. In this case the result would be [1 2 3 4 5 6]. -- R. Mark Volkmann Object Computing, Inc.

Re: Two minor typos in the cheatsheet

2009-10-02 Thread Lauri Pesonen
Hi, 2009/10/2 Miron Brezuleanu mbr...@gmail.com: Hello, I assume this is about the cheatsheet at http://clojure.org/cheatsheet The odd/even typos are in the PDF version. Some suggestions: add update-in, assoc-in, get-in in the 'Maps' section;  Add the ignore-next-form #_ reader macro in

Re: into function

2009-10-02 Thread Mark
This seems to work: (reduce into '([1 2] [3 4] [5 6])) although it does lack the simplicity. On Oct 2, 7:10 am, Mark Volkmann r.mark.volkm...@gmail.com wrote: (into [1 2] [3 4]) - [1 2 3 4] (into [1 2] [3 4] [5 6]) - wrong number of arguments It's seems more Clojure-like to allow any

immutable defs?

2009-10-02 Thread Mark
Is there a way to make a declaration in Clojure that cannot be rebound later? Ideally, I'd like something that fails if I try to do this: (def myname mark) ; ...more code, elided... (def myname Mark) Perhaps this is obvious, but I see a lot of discussion of immutable data structures, but I

Re: immutable defs?

2009-10-02 Thread Laurent PETIT
I can think of 'defvar that comes close to what you're about : it does not rebind the root value if it is different from nil (though it doesn't warn you about the problem, it's more to prevent reinitializing vars when their containing files are reloaded) 2009/10/2 Mark mjt0...@gmail.com Is

Re: immutable defs?

2009-10-02 Thread Meikel Brandmeyer
Hi, On Oct 2, 4:29 pm, Mark mjt0...@gmail.com wrote: Is there a way to make a declaration in Clojure that cannot be rebound later?  Ideally, I'd like something that fails if I try to do this: (def myname mark) ; ...more code, elided... (def myname Mark) Perhaps this is obvious, but I

Re: RFC: laziness-safe, semi-dynamic environment Var(Lite)

2009-10-02 Thread Meikel Brandmeyer
Hi, Am 01.10.2009 um 19:08 schrieb Rich Hickey: It simply doesn't compose or flow. Making the nil env special (e.g. non-replacing) just moves the problem into higher-order functions that use the construct: (defn needs-x [] (use-env-x)) (defn needs-y [] (use-env-y)) (defn foo [] (with-env

Re: RFC: laziness-safe, semi-dynamic environment Var(Lite)

2009-10-02 Thread Rich Hickey
On Oct 2, 12:23 pm, Meikel Brandmeyer m...@kotka.de wrote: Hi, Am 01.10.2009 um 19:08 schrieb Rich Hickey: It simply doesn't compose or flow. Making the nil env special (e.g. non-replacing) just moves the problem into higher-order functions that use the construct: (defn needs-x

Re: immutable defs?

2009-10-02 Thread Mark Tomko
When I write code in Java, I declare everything final that's possible to be declared final, and I deliberately look for solutions that avoid reassignment to variables, so all my variables are final). I'm new to Clojure, so I might be wrong, but it seems that within a function, mutable bindings

apply for macros?

2009-10-02 Thread b2m
Hi everbody, I am having some problems using macros which I will explain by using the core macro 'and'. Imagine having a macro accepting multiple arguments: (and true false true false) But all the arguments are in a list e.g. (def arglist '(true false true false)) Is there a simple way to

Re: apply for macros?

2009-10-02 Thread Stuart Sierra
On Oct 2, 12:47 pm, b2m b2monl...@googlemail.com wrote: Is there a simple way to 'apply' the macro to a list of arguments like it works for functions: (apply + '(1 2 3)) ? Nope, no can do. For an example of why, check out clojure.contrib.apply-macro -- the warnings are there for a reason.

Re: immutable defs?

2009-10-02 Thread Stuart Sierra
On Oct 2, 11:52 am, Mark Tomko mjt0...@gmail.com wrote: However, outside the scope of a function, it seems that it's possible for bindings to be redefined later in a file without causing an immediate error.  This could easily lead to mistakes that would manifest as silent and potentially

Re: immutable defs?

2009-10-02 Thread John Newman
From what I've seen, people never redef vars in source code. In general, you shouldn't have to worry about users of your code redefing your vars as it's against common convention, non-idiomatic. The exception, as Stuart Sierra said, is when writing interactively from the REPL, where you'd like

Re: immutable defs?

2009-10-02 Thread John Newman
Also, I'm not sure if your understanding of binding is correct. because within any lexical scope inside a function, I can pretty much count on my bindings to never change. binding is actually like a lexical re-def: user= (def x 1) #'user/x user= (binding [x 2] (pr x) (binding [x 3] (pr x))

Re: immutable defs?

2009-10-02 Thread Jonathan Smith
I use a let at the top of the file to denote things that I want to have as captured and constant. ... you can do things like (let [x 1] (defn foo-that-uses-x [y] (function-here x y))) On Oct 2, 10:29 am, Mark mjt0...@gmail.com wrote: Is there a way to make a declaration in Clojure that

Re: apply for macros?

2009-10-02 Thread b2m
Hi Stuart, Nope, no can do. For an example of why, check out clojure.contrib.apply-macro -- the warnings are there for a reason. For some reason I missed this library. Looks the same like the code I wrote and declared as to evil to use. apply is a function, so it's evaluated at runtime.  

Switching off lazyness

2009-10-02 Thread Vagif Verdi
This is not a suggestion or anything, just entertaining myself with some uneducated thinking. What if all lazy functions (map filter etc) would check some global value and decide upon it lazyness ? Then we could do something like this: (eager (map ...(filter ...))) That would allow to not

Re: Getting REPL transcript

2009-10-02 Thread Thorsen Eric
Enclojure has repl history as well as a log of all the unique commands issued that persists across restarts of Netbeans (and your repl instances). The command history can be opened in the editor and the expressions can be executed just like any other clojure source file. Standard command

Re: Citing clojure

2009-10-02 Thread Dragan Djuric
Yes, Bibtex is ugly, but guess what - you newer need to write a single line. You find a reference in google scholar, copy paste a reference into your reference file and it works. Please call Google and ask for another, more lispy export format in their Google Scholar. Additionally, if you have to

Re: immutable defs?

2009-10-02 Thread Mark Tomko
That's what I meant when I mentioned the 'binding' form above. The reason that's okay (to me) is that it explicitly calls out that bindings may be about to change. On Oct 2, 11:47 am, John Newman john...@gmail.com wrote: Also, I'm not sure if your understanding of binding is correct. because

Re: Switching off lazyness

2009-10-02 Thread Meikel Brandmeyer
Hi, Am 02.10.2009 um 22:01 schrieb Vagif Verdi: This is not a suggestion or anything, just entertaining myself with some uneducated thinking. What if all lazy functions (map filter etc) would check some global value and decide upon it lazyness ? Then we could do something like this: (eager

clojure cheatsheet typos

2009-10-02 Thread Albert Cardona
1. Missing a '!': set-validator 2. Typo: Rearrangment (under sequences) 3. Macros looping doesn't have loop. So loop is special form and not a macro? Albert -- Albert Cardona http://albert.rierol.net --~--~-~--~~~---~--~~ You received this

Re: Switching off lazyness

2009-10-02 Thread Vagif Verdi
On Oct 2, 1:37 pm, Meikel Brandmeyer m...@kotka.de wrote: You can do so by with doall:      (doall (map ... (filter ...))) Unfortunately this is not true. Yo are paying penalty for lazyness in this case. Try it yourself. Write non lazy versions of map and filter and time them against

Re: Switching off lazyness

2009-10-02 Thread Meikel Brandmeyer
Hi, Am 03.10.2009 um 06:09 schrieb Vagif Verdi: You can do so by with doall: (doall (map ... (filter ...))) Unfortunately this is not true. Yo are paying penalty for lazyness in this case. Try it yourself. Write non lazy versions of map and filter and time them against standard ones.