ANN: cljs-info 1.0.0 Help and reflection facilities for ClojureScript

2012-10-18 Thread Frank Siebenlist
cljs-info is a collection of Clojure-functions to provide basic help and reflection facilities for ClojureScript. Some of the functions provided are: cljs-doc, cljs-doc*, cljs-find-doc, cljs-apropos, cljs-source cljs-ns-map, cljs-ns-publics, cljs-ns-refers, cljs-ns-aliases,

Re: code design in clojure

2012-10-18 Thread Alex Ott
Hi Brian Which books had you read? I found that Clojure Programming provides many useful tips on how organize code, etc. On Thu, Oct 18, 2012 at 5:51 AM, Brian Craft craft.br...@gmail.com wrote: I'm finding the books on clojure to be very focused on low-level language features. Are there any

Re: Coming from Common Lisp to Clojure

2012-10-18 Thread Stathis Sideris
One thing that you might be missing is the expressive power of the sequence handling functions (everything under sequences here: http://clojure.org/cheatsheet ). I found it very useful to follow a few other users in 4clojure [1] which allowed me to compare different styles in their solutions

Re: Clojure turns 5

2012-10-18 Thread Mauricio Aldazosa
Congrats! -- 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 - please be patient with your first post. To unsubscribe from this group, send email

UTF-8 behavior ClojureScript (vs. Clojure)

2012-10-18 Thread Henrik Mohr
Hi there! I'm wondering why ClojureScript seems to handle international characters differently from Clojure. Simple example in Clojure (= my preferred behaviour): user= (str ø) ø The same example in ClojureScript: ClojureScript:cljs.user #_= (str 'ø') \xF8' Can anyone explain to me why

ClojureScript FileNotFoundException

2012-10-18 Thread Angel Java Lopez
Hi people! I just cloned the current clojurescript repo, in a Windows 2008 server machine, and follow the instructions: https://github.com/clojure/clojurescript/wiki/Windows-Setup https://github.com/clojure/clojurescript/wiki/Quick-Start But when I run .\script\repl.bat and tried (require

Re: UTF-8 behavior ClojureScript (vs. Clojure)

2012-10-18 Thread Andy Fingerhut
Hopefully someone else can answer why there is a difference in the output of the str function. I suspect in ClojureScript's case, it is simply the default behavior to use \x and two hex digits to display a character in a string with a code point in the range 128 through 255, inherited from

Re: UTF-8 behavior ClojureScript (vs. Clojure)

2012-10-18 Thread Henrik Mohr
Thanks for your reply Andy! BRgds, Henrik On Thursday, October 18, 2012 2:17:22 PM UTC+2, Andy Fingerhut wrote: Hopefully someone else can answer why there is a difference in the output of the str function. I suspect in ClojureScript's case, it is simply the default behavior to use \x and

why is get not giving me a default value?

2012-10-18 Thread larry google groups
I have some Javascript on a website that pings my Clojure app. My app adds in the user info like this: (defn add-to-logged-in-registry [this-users-params] We assume some user is looking at a site such as wpquestions.com and the Javascript on that site is sending an Ajax request to this app,

Re: ANN: LispIndent, jEdit plugin that indents lisp code

2012-10-18 Thread Jonathan Fischer Friberg
Presets have been implemented in the latest version. It's selectable in the plugin options. The clojure preset should make LispIndent more or less exactly emacs. (I think, I still haven't tested emacs - will check out your guide soon John :) ) Jonathan On Thu, Oct 18, 2012 at 5:55 AM, John

Re: why is get not giving me a default value?

2012-10-18 Thread Tassilo Horn
larry google groups lawrencecloj...@gmail.com writes: (let [right-now (. (Date.) getTime) new-user-entry (conj this-users-params { updated right-now })] (swap! registry (fn [map-of-user-maps] (assoc (assoc map-of-user-maps (get new-user-entry username

Re: why is get not giving me a default value?

2012-10-18 Thread Toby Crawley
Does new-user-entry include a username entry that points to nil? get only uses default value if the key is not present: user= (get {:x nil} :x :not-found) nil user= (get {:x nil} :y :not-found) :not-found user= (or (get {:x nil} :x) :not-found) :not-found user= On Oct 18, 2012, at 10:11 AM,

Re: code design in clojure

2012-10-18 Thread Sean Corfield
Which books on Clojure have you read so far? On Wed, Oct 17, 2012 at 8:51 PM, Brian Craft craft.br...@gmail.com wrote: I'm finding the books on clojure to be very focused on low-level language features. Are there any good references for how to design code in clojure (or perhaps in functional

Re: [ANN] neurotic-0.2.1 and blind-0.2.2

2012-10-18 Thread Bronsa
I'm following clojure's LispReader implementation in blind, you should ask that question to clojure devs 2012/10/14 AtKaaZ atk...@gmail.com Hi! What would you do about this ? https://github.com/quil/quil/commit/d0312f0f119db066a8d613dec8803571b92bea39 Would you edit the file or change the

Re: [ANN] neurotic-0.2.1 and blind-0.2.2

2012-10-18 Thread Bronsa
In these days I've released a new version of neurotic To use it simply put on your project.clj [bronsa/neurotic 0.3.3] With the 0.3.3 release neurotic fully supports implementing deftrait from: deftype, defrecor, extend and extend-type. Error messages has also been improved. A new version of

Re: why is get not giving me a default value?

2012-10-18 Thread larry google groups
Okay, this is very confusing to me. If I try this: (defn add-to-logged-in-registry [this-users-params] (let [right-now (. (Date.) getTime) new-user-entry (conj this-users-params { updated right-now })] (swap! registry (fn [map-of-user-maps] (conj

Re: why is get not giving me a default value?

2012-10-18 Thread Nate Young
On Thu, Oct 18, 2012 at 10:16 AM, larry google groups lawrencecloj...@gmail.com wrote: Okay, this is very confusing to me. If I try this: (defn add-to-logged-in-registry [this-users-params] (let [right-now (. (Date.) getTime) new-user-entry (conj this-users-params { updated

Re: why is get not giving me a default value?

2012-10-18 Thread Sean Corfield
I tried your code and got the expected result: user (def registry (atom {})) #'user/registry user (import 'java.util.Date) java.util.Date user (defn add-to-logged-in-registry [this-users-params] (let [right-now (. (Date.) getTime) new-user-entry (conj this-users-params { updated

Re: why is get not giving me a default value?

2012-10-18 Thread larry google groups
Interesting. I am using Clojure 1.3. And I'm using clojure-jack-in inside of emacs. What are you using? On Thursday, October 18, 2012 11:22:26 AM UTC-4, Sean Corfield wrote: I tried your code and got the expected result: user (def registry (atom {})) #'user/registry user (import

class name clashes on importing classes of same name from different Java packages into the same clojure namespace...

2012-10-18 Thread Sunil S Nandihalli
Hi Everybody, class name clashes on importing same named classes from different java-packages into same clojure namespace. Is this expected. I think that it should be possible to import them and can be used by completely qualifying the class name with the appropriate java-package name. Thanks,

Re: class name clashes on importing classes of same name from different Java packages into the same clojure namespace...

2012-10-18 Thread Sunil S Nandihalli
Am I doing it wrong ? is there a way to get around this?.. I guess I pressed the send button before I completed the email.. Thanks, Sunil. On Thu, Oct 18, 2012 at 8:57 PM, Sunil S Nandihalli sunil.nandiha...@gmail.com wrote: Hi Everybody, class name clashes on importing same named classes

Re: class name clashes on importing classes of same name from different Java packages into the same clojure namespace...

2012-10-18 Thread Tassilo Horn
Sunil S Nandihalli sunil.nandiha...@gmail.com writes: Hi! class name clashes on importing same named classes from different java-packages into same clojure namespace. Is this expected. Yes, that's expected. Import the one you are using more frequently and access the other one qualified. it

Re: class name clashes on importing classes of same name from different Java packages into the same clojure namespace...

2012-10-18 Thread Jim foo.bar
On 18/10/12 16:27, Sunil S Nandihalli wrote: Hi Everybody, class name clashes on importing same named classes from different java-packages into same clojure namespace. Is this expected. I think that it should be possible to import them and can be used by completely qualifying the class name

Replacing nested let statements with assignments

2012-10-18 Thread JvJ
I'm not sure if anyone's already done this, but I recently got tired of writing code that looked like this: (let [a 1] (ns cljutils.core) (defn- form-check Ensures the form represents an assignment. Such as (:= a 1) [form] (and (= 3 (count form)) (= := (first form)) (symbol?

Re: class name clashes on importing classes of same name from different Java packages into the same clojure namespace...

2012-10-18 Thread Sunil S Nandihalli
thanks tassillo, that fixed it .. I didn't know that we can use the classes with out importing them. Sunil. On Thu, Oct 18, 2012 at 9:07 PM, Tassilo Horn t...@gnu.org wrote: Sunil S Nandihalli sunil.nandiha...@gmail.com writes: Hi! class name clashes on importing same named classes from

Re: class name clashes on importing classes of same name from different Java packages into the same clojure namespace...

2012-10-18 Thread Sunil S Nandihalli
Thanks Jim, That fixed the issue. I did not know that I can access the classes without importing them.. Sunil. On Thu, Oct 18, 2012 at 9:14 PM, Jim foo.bar jimpil1...@gmail.com wrote: On 18/10/12 16:27, Sunil S Nandihalli wrote: Hi Everybody, class name clashes on importing same named

Re: code design in clojure

2012-10-18 Thread Brian Craft
Clojure Programming, and The Joy of ... On Thursday, October 18, 2012 7:53:38 AM UTC-7, Sean Corfield wrote: Which books on Clojure have you read so far? On Wed, Oct 17, 2012 at 8:51 PM, Brian Craft craft...@gmail.comjavascript: wrote: I'm finding the books on clojure to be very focused

Replacing nested let statements with assignments

2012-10-18 Thread JvJ
I'm not sure if anyone's done this before, but I'm fed up with writing code that looks like this: (let [a 1] (println this is a: a) (let [b 2] (println this is b: b) (let [c 3] (println this is c: c) (+ a b c I'd rather do something more like

Re: Replacing nested let statements with assignments

2012-10-18 Thread David Nolen
On Thu, Oct 18, 2012 at 12:01 PM, JvJ kfjwhee...@gmail.com wrote: I'm not sure if anyone's done this before, but I'm fed up with writing code that looks like this: What problem does this solve given you can do the following? (let [a 1 _ (println a) b 2 _ (println b) c

Re: Replacing nested let statements with assignments

2012-10-18 Thread keeds
I'm confused. How does the following not work? (let [a 1 b 2 c 3] (println a) (println b) (println c) (+ a b c)) On Thursday, October 18, 2012 5:01:33 PM UTC+1, JvJ wrote: I'm not sure if anyone's done this before, but I'm fed up with writing code that looks like this: (let [a 1]

Re: Replacing nested let statements with assignments

2012-10-18 Thread Ben Wolfson
On Thu, Oct 18, 2012 at 9:12 AM, keeds akee...@gmail.com wrote: I'm confused. How does the following not work? (let [a 1 b 2 c 3] (println a) (println b) (println c) (+ a b c)) It works, but all of the expressions on the RHS of the let expression's binding vector have to be applied

Re: Replacing nested let statements with assignments

2012-10-18 Thread JvJ
I didn't realize you could bind to empty identifiers like that. Alright, that makes more sense. I figured I was missing something. On Thursday, 18 October 2012 12:11:49 UTC-4, David Nolen wrote: On Thu, Oct 18, 2012 at 12:01 PM, JvJ kfjwh...@gmail.com javascript:wrote: I'm not sure if

Re: Replacing nested let statements with assignments

2012-10-18 Thread JvJ
Exactly. A big part of the reason was that I needed to do things between when other variables were initialized. On Thursday, 18 October 2012 12:17:17 UTC-4, Ben wrote: On Thu, Oct 18, 2012 at 9:12 AM, keeds ake...@gmail.com javascript: wrote: I'm confused. How does the following not

Re: Replacing nested let statements with assignments

2012-10-18 Thread David Nolen
On Thu, Oct 18, 2012 at 12:23 PM, JvJ kfjwhee...@gmail.com wrote: I didn't realize you could bind to empty identifiers like that. Alright, that makes more sense. I figured I was missing something. Just to be clear _ has not special meaning beyond convention. I could have used x but that

Re: Replacing nested let statements with assignments

2012-10-18 Thread Ambrose Bonnaire-Sergeant
There's nothing special going on, no empty identifiers. It's just a common convention to use _ when uninterested in the return value. (let [_ 1] _) ;= 1 Pretty evil to actually use bindings called _ though :) Thanks, Ambrose On Fri, Oct 19, 2012 at 12:23 AM, JvJ kfjwhee...@gmail.com wrote:

Re: Coming from Common Lisp to Clojure

2012-10-18 Thread Brian Craft
It's not just you. I'm also surprised at the amount of syntax and the number of ways of doing some things. I suspect that if you come from java or C++ it seems like a simple language, but it feels pretty cluttered compared to other languages. The '-' macro, for example. I've learned to read

Re: ANN: LispIndent, jEdit plugin that indents lisp code

2012-10-18 Thread John Gabriele
On Thursday, October 18, 2012 10:18:09 AM UTC-4, Jonathan Fischer Friberg wrote: Presets have been implemented in the latest version. It's selectable in the plugin options. Works nicely. Thanks, Jonathan! BTW, I created the beginnings of a CDS development tools guide

Re: why is get not giving me a default value?

2012-10-18 Thread Sean Corfield
On Thu, Oct 18, 2012 at 8:26 AM, larry google groups lawrencecloj...@gmail.com wrote: Interesting. I am using Clojure 1.3. And I'm using clojure-jack-in inside of emacs. What are you using? I was using Clojure 1.4 via jack-in from emacs. I just tried it again with lein repl in a clean

Re: Coming from Common Lisp to Clojure

2012-10-18 Thread Jim - FooBar();
On 18/10/12 17:37, Brian Craft wrote: It's not just you. I'm also surprised at the amount of syntax and the number of ways of doing some things. I suspect that if you come from java or C++ it seems like a simple language, but it feels pretty cluttered compared to other languages. The '-'

Re: code design in clojure

2012-10-18 Thread Sean Corfield
On Thu, Oct 18, 2012 at 8:58 AM, Brian Craft craft.br...@gmail.com wrote: Clojure Programming, and The Joy of ... Hmm, I was going to suggest Joy of but if you don't think that helps with some of those design issues, I'm not sure what to suggest. Others suggested Clojure Programming but,

Re: code design in clojure

2012-10-18 Thread Paul deGrandis
Brian, Those are two excellent books. If you are looking at more general project organization and approaches, I'd suggest: - Just Enough Architecture (specifically its discussion on architectural evident coding) - watch the Halloway talks on evident code - thumb through Ring, Leiningen, and

Re: Clojure turns 5

2012-10-18 Thread Mimmo Cosenza
I came very recently to clojure, having crossed CL in the 80's, c/c++ in the 90's and java in the 00's. A long travel to find with clojure a kind of very comfortable destination very close to where I started from + seqs and laziness. thanks Rich, and all of you too to brought me back on joy

Re: code design in clojure

2012-10-18 Thread David Nolen
On Thu, Oct 18, 2012 at 1:02 PM, Paul deGrandis paul.degran...@gmail.comwrote: - thumb through Ring, Leiningen, and ClojureScript as prime examples of well written Clojure applications +1 I think it's informative to look at non-trivial yet small Clojure libraries. ClojureScript doesn't

Re: Coming from Common Lisp to Clojure

2012-10-18 Thread Sean Corfield
On Thu, Oct 18, 2012 at 9:37 AM, Brian Craft craft.br...@gmail.com wrote: I suspect that if you come from java or C++ it seems like a simple language, but it feels pretty cluttered compared to other languages. Interesting observation and probably true. Although I did Lisp back at university

Re: code design in clojure

2012-10-18 Thread Roberto Mannai
See Functional Programming for the Object-Oriented Programmer ( https://leanpub.com/fp-oo) Il giorno 18/ott/2012 19:01, Sean Corfield seancorfi...@gmail.com ha scritto: On Thu, Oct 18, 2012 at 8:58 AM, Brian Craft craft.br...@gmail.comwrote: Clojure Programming, and The Joy of ... Hmm, I

Re: Coming from Common Lisp to Clojure

2012-10-18 Thread Grant Rettke
On Thu, Oct 18, 2012 at 12:07 PM, Sean Corfield seancorfi...@gmail.com wrote: Clojure feels like a VERY simple language with almost no syntax. Having recently read more Scheme / CL code, I can see how folks coming from those languages think Clojure is cluttered. Why do they think it is

Re: Correct usage of data-readers

2012-10-18 Thread AtKaaZ
It is; *data_readers.clj* {db/id datomic.db/id-literal db/fn datomic.function/construct base64 datomic.codec/base-64-literal} On Wed, Oct 17, 2012 at 5:54 PM, Robert Luo l...@basecity.com wrote: Is #db/id defined in datomic library? -- You received this message because you are

Re: Replacing nested let statements with assignments

2012-10-18 Thread AtKaaZ
Thank you for this clarification! On Thu, Oct 18, 2012 at 6:26 PM, David Nolen dnolen.li...@gmail.com wrote: On Thu, Oct 18, 2012 at 12:23 PM, JvJ kfjwhee...@gmail.com wrote: I didn't realize you could bind to empty identifiers like that. Alright, that makes more sense. I figured I was

Re: Cdr car

2012-10-18 Thread AtKaaZ
(cons 1 nil) On Wed, Oct 17, 2012 at 8:16 PM, Curtis cur...@ram9.cc wrote: Cons seems to be strange How do i use Cons with an atom to make a list? (cons 1 1) On Tuesday, October 16, 2012 5:08:26 PM UTC-7, Baishampayan Ghose wrote: `car` is called `first` here and `cdr` could mean

Re: Replacing nested let statements with assignments

2012-10-18 Thread Evan Gamble
For the situation where the lets are nested because you're checking the values in some way after each binding, I wrote a macro called let?. I find it very useful and use it in nearly all my code. https://github.com/egamble/let-else -- You received this message because you are subscribed to

Re: Replacing nested let statements with assignments

2012-10-18 Thread Grant Rettke
On Thu, Oct 18, 2012 at 11:11 AM, David Nolen dnolen.li...@gmail.com wrote: On Thu, Oct 18, 2012 at 12:01 PM, JvJ kfjwhee...@gmail.com wrote: I'm not sure if anyone's done this before, but I'm fed up with writing code that looks like this: What problem does this solve given you can do the

Re: Replacing nested let statements with assignments

2012-10-18 Thread Alan Malloy
It's rare to get tired of this, because nobody does it: it's not common because your interleaved statements are side-effecting only, which is not encouraged in Clojure, and rarely needed. Certainly sometimes it's the best way to do something, but not so often that I'd become frustrated; if

Re: Replacing nested let statements with assignments

2012-10-18 Thread Grant Rettke
On Thu, Oct 18, 2012 at 1:55 PM, Alan Malloy a...@malloys.org wrote: It's rare to get tired of this, because nobody does it: it's not common because your interleaved statements are side-effecting only, which is not encouraged in Clojure, and rarely needed. Certainly sometimes it's the best way

Re: Replacing nested let statements with assignments

2012-10-18 Thread David Nolen
On Thu, Oct 18, 2012 at 2:55 PM, Alan Malloy a...@malloys.org wrote: It's rare to get tired of this, because nobody does it: it's not common because your interleaved statements are side-effecting only, which is not encouraged in Clojure, and rarely needed. Certainly sometimes it's the best

Re: Replacing nested let statements with assignments

2012-10-18 Thread Grant Rettke
On Thu, Oct 18, 2012 at 1:32 PM, Grant Rettke gret...@acm.org wrote: On Thu, Oct 18, 2012 at 11:11 AM, David Nolen dnolen.li...@gmail.com wrote: On Thu, Oct 18, 2012 at 12:01 PM, JvJ kfjwhee...@gmail.com wrote: I'm not sure if anyone's done this before, but I'm fed up with writing code that

Re: Replacing nested let statements with assignments

2012-10-18 Thread David Nolen
On Thu, Oct 18, 2012 at 3:06 PM, Grant Rettke gret...@acm.org wrote: (- ((fn [] (let [a 1] (println this is a: a) a))) ((fn [a] (let [b 2] (println this is b: b) (list a b ((fn [[a b]] (let [c 3] (println this is c:

Re: Replacing nested let statements with assignments

2012-10-18 Thread Ben Wolfson
On Thu, Oct 18, 2012 at 12:01 PM, Grant Rettke gret...@acm.org wrote: On Thu, Oct 18, 2012 at 1:55 PM, Alan Malloy a...@malloys.org wrote: It's rare to get tired of this, because nobody does it: it's not common because your interleaved statements are side-effecting only, which is not

Re: Replacing nested let statements with assignments

2012-10-18 Thread Grant Rettke
On Thu, Oct 18, 2012 at 2:07 PM, David Nolen dnolen.li...@gmail.com wrote: On Thu, Oct 18, 2012 at 3:06 PM, Grant Rettke gret...@acm.org wrote: (- ((fn [] (let [a 1] (println this is a: a) a))) ((fn [a] (let [b 2] (println this is b: b)

Re: Replacing nested let statements with assignments

2012-10-18 Thread Grant Rettke
On Thu, Oct 18, 2012 at 2:09 PM, Ben Wolfson wolf...@gmail.com wrote: On Thu, Oct 18, 2012 at 12:01 PM, Grant Rettke gret...@acm.org wrote: It isn't side effecting it is sequencing. Clojure's let is already sequential, like Scheme's let*: The bindings are sequential, so each binding can see

Re: Replacing nested let statements with assignments

2012-10-18 Thread Alan Malloy
On Oct 18, 12:02 pm, David Nolen dnolen.li...@gmail.com wrote: On Thu, Oct 18, 2012 at 2:55 PM, Alan Malloy a...@malloys.org wrote: It's rare to get tired of this, because nobody does it: it's not common because your interleaved statements are side-effecting only, which is not encouraged in

Re: Replacing nested let statements with assignments

2012-10-18 Thread Mark Engelberg
When I want to add print commands for debugging, I usually either do it the way David Nolen described, i.e., binding _ to a printf statement, or I use a little utility macro like this (picked up from stackoverflow): (defmacro dbg[x] `(let [x# ~x] (println dbg: '~x = x#) x#)) I agree with Evan

Re: Clojure turns 5

2012-10-18 Thread Brian Kirkbride
Congratulations Rich. Many thanks to you and the many people that have contributed to making Clojure what it is today. Learning and using Clojure has truly brought the joy back to creating software and I needed that! Best, Brian On Tuesday, October 16, 2012 8:53:55 PM UTC-5, Rich Hickey

Re: Interest in Scribble for Clojure?

2012-10-18 Thread Gary Johnson
Alright, Eli. You've piqued my interest. I'll have to take a closer look sometime soon. ~Gary On Wednesday, October 17, 2012 10:22:54 AM UTC-4, Eli Barzilay wrote: Gary Johnson gwjohnso at uvm.edu writes: I see. After taking a closer look, I can see that you could do LP in Scribble

Re: Replacing nested let statements with assignments

2012-10-18 Thread Grant Rettke
On Thu, Oct 18, 2012 at 2:50 PM, Mark Engelberg mark.engelb...@gmail.com wrote: Either way works well. I think Evan's way results in somewhat more compact code for the common case, whereas Cgrand's way feels a little more versatile (and his flatter cond is what I use). I strongly urge you to

Re: Replacing nested let statements with assignments

2012-10-18 Thread David Nolen
On Thu, Oct 18, 2012 at 4:15 PM, Grant Rettke gret...@acm.org wrote: On Thu, Oct 18, 2012 at 2:50 PM, Mark Engelberg mark.engelb...@gmail.com wrote: Either way works well. I think Evan's way results in somewhat more compact code for the common case, whereas Cgrand's way feels a little

Re: Replacing nested let statements with assignments

2012-10-18 Thread Grant Rettke
On Thu, Oct 18, 2012 at 3:17 PM, David Nolen dnolen.li...@gmail.com wrote: On Thu, Oct 18, 2012 at 4:15 PM, Grant Rettke gret...@acm.org wrote: On Thu, Oct 18, 2012 at 2:50 PM, Mark Engelberg mark.engelb...@gmail.com wrote: Either way works well. I think Evan's way results in somewhat more

Re: Clojure turns 5

2012-10-18 Thread Denis Labaye
bravo! On Thu, Oct 18, 2012 at 9:29 PM, Brian Kirkbride br...@otherpeoplespixels.com wrote: Congratulations Rich. Many thanks to you and the many people that have contributed to making Clojure what it is today. Learning and using Clojure has truly brought the joy back to creating software

Re: Replacing nested let statements with assignments

2012-10-18 Thread David Nolen
On Thu, Oct 18, 2012 at 4:22 PM, Grant Rettke gret...@acm.org wrote: When you use def inside a defn is it equivalent to a let binding like this? (defn foo [] (def a 1) (println a)) (defn foo [] ((fn [a] (println a)) 1)) Not equivalent. -- You received this message because

Re: code design in clojure

2012-10-18 Thread abp
You probably want to watch this: vimeo.com/46163090 Also, try to think of your programs in terms of pipelines as much as possible. You get input, you produce output. That probably applies to every program ever written, but when you get how that works in Clojure, it's like an enlightment, at

Re: Replacing nested let statements with assignments

2012-10-18 Thread Grant Rettke
On Thu, Oct 18, 2012 at 3:32 PM, David Nolen dnolen.li...@gmail.com wrote: On Thu, Oct 18, 2012 at 4:22 PM, Grant Rettke gret...@acm.org wrote: When you use def inside a defn is it equivalent to a let binding like this? (defn foo [] (def a 1) (println a)) (defn foo [] ((fn [a]

Re: Replacing nested let statements with assignments

2012-10-18 Thread Mark Engelberg
A def, even inside defn, creates and binds a global variable. -- 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 - please be patient with your

Re: Replacing nested let statements with assignments

2012-10-18 Thread Grant Rettke
On Thu, Oct 18, 2012 at 3:42 PM, Mark Engelberg mark.engelb...@gmail.com wrote: A def, even inside defn, creates and binds a global variable. Woa, I see, thanks! -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: Replacing nested let statements with assignments

2012-10-18 Thread Grant Rettke
On Thu, Oct 18, 2012 at 3:45 PM, Grant Rettke gret...@acm.org wrote: On Thu, Oct 18, 2012 at 3:42 PM, Mark Engelberg mark.engelb...@gmail.com wrote: A def, even inside defn, creates and binds a global variable. Woa, I see, thanks! Anyone voted for internal define lately? -- You received

Re: Midje popularity?

2012-10-18 Thread Brian Marick
On Oct 17, 2012, at 2:35 PM, Andreas Liljeqvist wrote: Just to clear something up: Are you maintaining midje-mode? I thought it was Dmitri? That's where I left my pull request anyway. I'm a committer for `midje-mode`. - Brian Marick, Artisanal Labrador Contract programming in Ruby and

Re: Replacing nested let statements with assignments

2012-10-18 Thread David Nolen
On Thu, Oct 18, 2012 at 4:45 PM, Grant Rettke gret...@acm.org wrote: On Thu, Oct 18, 2012 at 3:45 PM, Grant Rettke gret...@acm.org wrote: On Thu, Oct 18, 2012 at 3:42 PM, Mark Engelberg mark.engelb...@gmail.com wrote: A def, even inside defn, creates and binds a global variable. Woa, I

Re: Replacing nested let statements with assignments

2012-10-18 Thread JvJ
Exactly. Not only debugging, but java interop that involved calling methods with side effects. On Thursday, 18 October 2012 15:02:47 UTC-4, David Nolen wrote: On Thu, Oct 18, 2012 at 2:55 PM, Alan Malloy al...@malloys.orgjavascript: wrote: It's rare to get tired of this, because nobody

Re: Replacing nested let statements with assignments

2012-10-18 Thread Grant Rettke
I figured you would use doto for that. On Thu, Oct 18, 2012 at 4:09 PM, JvJ kfjwhee...@gmail.com wrote: Exactly. Not only debugging, but java interop that involved calling methods with side effects. On Thursday, 18 October 2012 15:02:47 UTC-4, David Nolen wrote: On Thu, Oct 18, 2012 at

Re: Replacing nested let statements with assignments

2012-10-18 Thread Grant Rettke
On Thu, Oct 18, 2012 at 4:05 PM, David Nolen dnolen.li...@gmail.com wrote: On Thu, Oct 18, 2012 at 4:45 PM, Grant Rettke gret...@acm.org wrote: Anyone voted for internal define lately? At this point I think it's highly unlikely to change - the behavior is pretty well documented: I see. Just a

Re: Replacing nested let statements with assignments

2012-10-18 Thread JvJ
On a side note, I was partially inspired by Haskell's do notation, which is imperative-looking syntactic sugar for monadic binds. On Thursday, 18 October 2012 12:01:33 UTC-4, JvJ wrote: I'm not sure if anyone's done this before, but I'm fed up with writing code that looks like this: (let

Re: Replacing nested let statements with assignments

2012-10-18 Thread JvJ
On a side note, I was partially inspired by Haskell's do notation, which is imperative-looking syntactic sugar for monadic bind operators. -- 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

Re: Replacing nested let statements with assignments

2012-10-18 Thread JvJ
Most of what could be accomplished by an internal define could be done with a let statement. But if you don't want to add the brackets, you can create your own function definition macro that converts defs to lets. On Thursday, 18 October 2012 17:12:04 UTC-4, Grant Rettke wrote: On Thu, Oct

Re: Replacing nested let statements with assignments

2012-10-18 Thread JvJ
The doto form is great, but as far as I know, it only lets you thread a single object. I'm looking at creating several objects consecutively. On Thursday, 18 October 2012 17:11:08 UTC-4, Grant Rettke wrote: I figured you would use doto for that. On Thu, Oct 18, 2012 at 4:09 PM, JvJ

Re: Replacing nested let statements with assignments

2012-10-18 Thread Mark Engelberg
On Thu, Oct 18, 2012 at 1:45 PM, Grant Rettke gret...@acm.org wrote: Anyone voted for internal define lately? On the one hand, internal define would be nice because it would help alleviate the nested let problem and possibly be more intuitive for newcomers. On the other hand, sometimes

Re: Replacing nested let statements with assignments

2012-10-18 Thread AtKaaZ
deja-vu :) On Thu, Oct 18, 2012 at 11:16 PM, JvJ kfjwhee...@gmail.com wrote: On a side note, I was partially inspired by Haskell's do notation, which is imperative-looking syntactic sugar for monadic bind operators. -- You received this message because you are subscribed to the Google

Re: code design in clojure

2012-10-18 Thread abp
Now I remember the more important video: www.infoq.com/presentations/Thinking-in-Data Also (haven't watched): www.infoq.com/presentations/Programming-with-Values-in-Clojure -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send

Re: Replacing nested let statements with assignments

2012-10-18 Thread Stuart Sierra
It's slightly different, but libraries such as Flow or Prismatic's Graph can be used to achieve a similar effect. Flow: https://github.com/stuartsierra/flow Graph: http://blog.getprismatic.com/blog/2012/10/1/prismatics-graph-at-strange-loop.html Example using Flow: (def the-flow (flow b

Redubicle NIO

2012-10-18 Thread Bruno França dos Reis
Hello! I've recently started playing with Clojure, and a couple of days ago I've been pointed to Reducers in Clojure 1.5 after a discussion on #clojure at Freenode. I've read Rich's posts announcing the Reducers library, and he says that there's a ***lack of reducible IO sources***. I'm

Re: Redubicle NIO

2012-10-18 Thread Bruno França dos Reis
Damn, just noticed a small mistake in the macro: I use the original buffer, not the duplicated one. Here's the correct version: (defmacro buffer-reduce [b f val] `(let [b# (.duplicate ~b)] (loop [remaining# (.remaining b#) result# ~val] (if (zero? remaining#)

Re: XML parsing with namespace prefixes

2012-10-18 Thread Maurits
Bit of a late reaction, but there is nothing special about a tag with a namespace prefixed. For example I have been using: (zf/xml- zipper :ListRecords :record :metadata :oai_dc:dc :dc:language zf/text) which works perfectly well. Maurits Op zondag 22 juli 2012 22:02:59 UTC+2 schreef Marcel

Re: Redubicle NIO

2012-10-18 Thread Alan Malloy
As a general-macro aside, you are multiply-evaluating the `f` argument, by expanding it in-place inside the recursive clause. This is almost certainly not what you want, and you could avoid it by starting with (let [f# ~f] ...). Better still, ask why this is a macro at all. This should really just

profiling question: ReadAheadInputStream.fill

2012-10-18 Thread Brian Craft
Another java newbie question, I expect. I tried using jvisualvm to profile my clojure app. It's spending all its time in jdbc.util.ReadAheadInputStream.fill(). The call tree points to clojure-agent-send-off-pool-n. I'm not sure what this is telling me. -- You received this message because you

Re: code design in clojure

2012-10-18 Thread Brian Craft
Thanks to everyone for the suggestions! -- 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 - please be patient with your first post. To

Re: Redubicle NIO

2012-10-18 Thread Bruno França dos Reis
Thanks for the input. Didn't know that I was multiply-evaluating f. The reason why I wrote a macro instead of a function is because 'get' and 'duplicate' are not declared in any common superclass of the different buffers, so I was getting lots of reflection! Are there alternatives to the macro

Re: Replacing nested let statements with assignments

2012-10-18 Thread Herwig Hochleitner
2012/10/18 Mark Engelberg mark.engelb...@gmail.com When I want to add print commands for debugging, I usually either do it the way David Nolen described, i.e., binding _ to a printf statement, or I use a little utility macro like this (picked up from stackoverflow): (defmacro dbg[x] `(let

Re: Redubicle NIO

2012-10-18 Thread Herwig Hochleitner
2012/10/19 Bruno França dos Reis bfr...@gmail.com The reason why I wrote a macro instead of a function is because 'get' and 'duplicate' are not declared in any common superclass of the different buffers, so I was getting lots of reflection! Are there alternatives to the macro that avoid

Re: Coming from Common Lisp to Clojure

2012-10-18 Thread Brian Craft
C is a C-language, and it seems a lot simpler than clojure to me. KR is about 200 pages. I expect you mean C++, Java, etc. Not meaning to start a language war, but my own experiences with C++ and Java have mostly convinced me that the added complexity in those languages don't lead to better

Re: Redubicle NIO

2012-10-18 Thread David Nolen
On Thu, Oct 18, 2012 at 7:15 PM, Herwig Hochleitner hhochleit...@gmail.comwrote: 2012/10/19 Bruno França dos Reis bfr...@gmail.com The reason why I wrote a macro instead of a function is because 'get' and 'duplicate' are not declared in any common superclass of the different buffers, so I

Re: Replacing nested let statements with assignments

2012-10-18 Thread Mark Engelberg
On Thu, Oct 18, 2012 at 4:11 PM, Herwig Hochleitner hhochleit...@gmail.comwrote: FWIW, when just wanting to print out debug values, I use a custom reader tag similar to the above macro: (let [x #log/spy (+ a b)] (usage-of x)) That's nice! I haven't done anything with reader macros.

Re: Replacing nested let statements with assignments

2012-10-18 Thread Mark Engelberg
OK, just looked it up and realized that it's just how # works, and not a special kind of macro. On Thu, Oct 18, 2012 at 5:25 PM, Mark Engelberg mark.engelb...@gmail.comwrote: On Thu, Oct 18, 2012 at 4:11 PM, Herwig Hochleitner hhochleit...@gmail.com wrote: FWIW, when just wanting to print

Re: Redubicle NIO

2012-10-18 Thread Bruno França dos Reis
So, the current version, after the suggestion by Alan Malloy, is the following: (defmacro buffer-reduce [b f val] `(let [b# (.duplicate ~b) f# ~f] (loop [remaining# (.remaining b#) result# ~val] (if (zero? remaining#) result# (recur (dec

  1   2   >