Re: [Learning] Clojure web programming - thoughts and series of articles

2012-11-23 Thread Johan Sundström
Nice pointers, I'm soo noob in the clojure world that I'm not able to answer your question, but I will look into your articles. Cheers, Johan Den torsdagen den 8:e november 2012 kl. 19:42:31 UTC+2 skrev Yakovlev Roman: > > Some time have passed since i posted > "Is clojure need it's own web f

Re: Learning clojure: debugging?

2012-06-03 Thread Softaddicts
Not yet, I'll put this on my agenda. I need some research time not being familiar yet with how it would translate in ClojureScript and if it's worthwhile to implement it. Comments from any one using ClojureScript ? Luc > Does Clojurescript have a trace function? > > On Sat, Jun 2, 2012 at 5:26

Re: Learning clojure: debugging?

2012-06-03 Thread Sean Neilan
Nvm. Not yet. I'm reluctant to dive into clojurescript because the debugger and trace functions aren't ready yet. I suppose if I make test cases for everything and stick to tiny functions, I should be alright. Anyway, if Chris Granger uses it, it's probably pretty good. HERE GOES! On Sun, Jun

Re: Learning clojure: debugging?

2012-06-03 Thread Sean Neilan
Does Clojurescript have a trace function? On Sat, Jun 2, 2012 at 5:26 PM, Softaddicts wrote: > clojure.tools.trace beats println by far (biased advice, I maintain > it:))) > It's also easier to segregate between debug and normal output in the code. > > You can enable/disable fn tracing dynami

Re: Learning clojure: debugging?

2012-06-03 Thread Sean Corfield
On Sun, Jun 3, 2012 at 1:55 AM, Vinzent wrote: > Actually, it's kinda the same (Fogus and me decided to merge trammel and > clojure-contracts into one library) Yeah, I figured. I just wanted to point people to the newly created contrib library since that's where (I assume) future development will

Re: Learning clojure: debugging?

2012-06-03 Thread Vinzent
Actually, it's kinda the same (Fogus and me decided to merge trammel and clojure-contracts into one library) воскресенье, 3 июня 2012 г., 6:31:50 UTC+6 пользователь Sean Corfield написал: > > On Sat, Jun 2, 2012 at 5:22 PM, Vinzent wrote: > > BTW, you may want to use clojure-contracts > > (ht

Re: Learning clojure: debugging?

2012-06-02 Thread Sean Corfield
On Sat, Jun 2, 2012 at 5:22 PM, Vinzent wrote: > BTW, you may want to use clojure-contracts > (https://github.com/dnaumov/clojure-contracts) instead of asserts or > :pre\:post in order to get much nicer and informative error reporting. Or keep an eye on https://github.com/clojure/core.contracts c

Re: Learning clojure: debugging?

2012-06-02 Thread Vinzent
BTW, you may want to use clojure-contracts ( https://github.com/dnaumov/clojure-contracts) instead of asserts or :pre\:post in order to get much nicer and informative error reporting. > > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to thi

Re: Learning clojure: debugging?

2012-06-02 Thread Softaddicts
clojure.tools.trace beats println by far (biased advice, I maintain it:))) It's also easier to segregate between debug and normal output in the code. You can enable/disable fn tracing dynamically from the REPL for all fns in a given namespace. I seldom use a debugger. When I do it's to dive

Re: Learning clojure: debugging?

2012-06-02 Thread Sean Corfield
On Sat, Jun 2, 2012 at 2:34 PM, Moritz Ulrich wrote: > I think one important point here is that you use two different data > structures to hold the same kind of data. Points and deltas are not the "same kind of data". Yes, they both have x/y/z values but their meaning is different. Perhaps {:poin

Re: Learning clojure: debugging?

2012-06-02 Thread Moritz Ulrich
On Fri, Jun 1, 2012 at 8:18 PM, Abraham Egnor wrote: > Is there some technique I'm not seeing to make this kind of simple > typo-based error less of a hassle to track down?  Or is this simply a matter > of getting better at deciphering the stack traces? I think one important point here is that yo

Re: Learning clojure: debugging?

2012-06-02 Thread Sean Corfield
On Fri, Jun 1, 2012 at 11:18 AM, Abraham Egnor wrote: > I'm early in the process of learning clojure, and am hoping that the > community has suggestions for a frustration I've run into. ... > I eventually tracked it down by evaluating each subexpression of line - the > root bug is that mul should

Re: Learning clojure - comments on my function?

2011-09-29 Thread Peter Hull
Thank you, both! I guessed there would be a neater solution (I wasn't aware of partition-by) Pete -- 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 mode

Re: Learning clojure - comments on my function?

2011-09-29 Thread Islon Scherer
You probably want something like (defn split-zero [ls] (filter #(not= (first %) 0) (partition-by zero? ls))) -- 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 me

Re: Learning clojure - comments on my function?

2011-09-29 Thread Jonathan Fischer Friberg
First of all, you should switch from ((fn [ls wip ans] ...) ls [] nil) to (loop [ls ls wip [] ans nil] ...) Read about it here: http://clojure.org/special_forms Using higher-order functions, you could do: (defn split-zero [coll] (if (seq coll) (let [divided (partition-by zero? coll)]

Re: learning clojure library

2011-08-03 Thread Islon Scherer
You can use (ns-publics 'your.namespace) to see every public intern mapping in this namespace. Islon -- 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 m

Re: Learning Clojure Offline

2010-06-20 Thread Wilson MacGyver
Other than downloading clojure and clojure.contrib itself, I'd suggest you get the "progmraming in clojure" book by Stuart Halloway. Book in hand, try out the examples in clojure REPL. That's good enough to get started. Welcome! On Sun, Jun 20, 2010 at 3:50 AM, Martin Larsson wrote: > Hi! > I'm

Re: Learning Clojure Wiki

2009-05-29 Thread Rock
Ok. I'll try to correct that. It was already there when I started working on that section. My main concern is the part where I describe the rules for the syntax-quote expansion. Does it seem correct to you? Thanks so much for helping :) Rock On May 29, 5:47 pm, Rich Hickey wrote: > On May 29,

Re: Learning Clojure Wiki

2009-05-29 Thread Rich Hickey
On May 29, 10:18 am, Rock wrote: > By the way, here's the link: > > http://en.wikibooks.org/w/index.php?title=Learning_Clojure&stable=0#R... > > On May 29, 4:14 pm, Rock wrote: > > > Hi, > > > I've just finished updating the "Reader Macros" section of the Wiki > > (especially the syntax-quote

Re: Learning Clojure Wiki

2009-05-29 Thread Rock
By the way, here's the link: http://en.wikibooks.org/w/index.php?title=Learning_Clojure&stable=0#Reader_Macros On May 29, 4:14 pm, Rock wrote: > Hi, > > I've just finished updating the "Reader Macros" section of the Wiki > (especially the syntax-quote part), and I would like to know if it's > r

Re: Learning Clojure Wiki

2009-05-29 Thread Rock
By the way, here's the link: http://en.wikibooks.org/wiki/Learning_Clojure#Reader_Macros On May 29, 4:14 pm, Rock wrote: > Hi, > > I've just finished updating the "Reader Macros" section of the Wiki > (especially the syntax-quote part), and I would like to know if it's > reasonably correct. It'

Re: learning clojure, converting a sequence with repetitions to a multi-map

2009-04-29 Thread Christophe Grand
IMHO, the slowdown comes from allocation: with (apply merge-with concat (map (fn [x] {(key-fn x) [x]}) s)) you build a map containing a vector, plus a seq (merge-with calls seq on each argument) for each item before performing a reduction which calls assoc and concat. In seq-to-multimap you o

Re: learning clojure, converting a sequence with repetitions to a multi-map

2009-04-29 Thread Boris Mizhen
Thanks Jason. merge-with seems to be made to support a function like this, I wonder where is the slowdown coming from? Is apply slow? I named your version seq-to-multimap2. The timing results are below: user> (def a (reverse (take 10 (iterate (fn [x] (rand-int 100)) 1 #'user

Re: learning clojure, converting a sequence with repetitions to a multi-map

2009-04-29 Thread Boris Mizhen
Thanks Christophe, > Using a default return value, you can rewrite the (if-let...) as (conj > (amap key ()) item). A good point, getting clojure and clojure :) (defn seq-to-multimap "takes a sequence s of possibly repeating elements and converts it to a map, where keys are obtained by app

Re: learning clojure, converting a sequence with repetitions to a multi-map

2009-04-28 Thread Jason Wolfe
(defn seq-to-multimap   "takes a sequence s of possibly repeating elements    and converts it to a map, where keys are obtained by applying key- fn    to elements of s and values are sequence of all elements of s with the particular key" [s key-fn] (apply merge-with concat (map (fn [x]

Re: learning clojure, converting a sequence with repetitions to a multi-map

2009-04-28 Thread Meikel Brandmeyer
Hi, Am 28.04.2009 um 23:28 schrieb Boris Mizhen: BTW, I hope I'm not abusing this mailing list by asking questions like this? This list and the #clojure channel are the right place to ask such questions. That said, there is the search facility of google groups and the log of the channel at ht

Re: learning clojure, converting a sequence with repetitions to a multi-map

2009-04-28 Thread Christophe Grand
Hi Boris, Boris Mizhen a écrit : > I am starting to learn clojure. I would appreciate comments on the > utility function below. > Coding style, idiomatic Clojure, comment style, efficiency, naming > conventions, indentations (used slime) ... anything I should > improve :) > > (defn seq-to-multima

Re: learning clojure, converting a sequence with repetitions to a multi-map

2009-04-28 Thread Boris Mizhen
Thanks Stuart, preserving order is a nice touch :) I also did not realize that conj preserves sequence type ... BTW, I hope I'm not abusing this mailing list by asking questions like this? Boris On Apr 28, 5:15 pm, Stuart Sierra wrote: > Hi Boris, welcome to Clojure! > > This function looks r

Re: learning clojure, converting a sequence with repetitions to a multi-map

2009-04-28 Thread Stuart Sierra
Hi Boris, welcome to Clojure! This function looks reasonable to me. In your example, you don't need to write "#(identity %)" -- just "identity" is enough. If you want to preserve the order of objects in the sequence, you can use a vector instead of a list. I would use "contains?" in the condit

Re: Learning Clojure

2009-01-28 Thread Emeka
Thanks Steve and Tim. --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to clojure+unsubscr...@g

Re: Learning Clojure

2009-01-28 Thread Timothy Pratley
Thanks for the detailed explanation Steve! --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to

Re: Learning Clojure

2009-01-28 Thread Stephen C. Gilardi
On Jan 28, 2009, at 6:48 PM, Timothy Pratley wrote: You didn't do anything wrong, there is a definition of + with no arguments which just returns 0, but no definition of - with no arguments. Similarly (*) is defined as 1, but (/) is undefined. I guess there is no such thing as negative 0, then

Re: Learning Clojure

2009-01-28 Thread Timothy Pratley
On Jan 29, 6:03 am, janus wrote: > While reading Programming Clojure the other night I found this code > interesting (+), however, when I tried out (-) I got my fingers burnt. > Why this? Or did I do something wrong which has nothing to do with > the code in question? You didn't do anything wro

Re: Learning Clojure WikiBook

2009-01-14 Thread Rock
On 14 Gen, 17:58, Chouser wrote: > On Wed, Jan 14, 2009 at 6:07 AM, Rock wrote: > > [snip] > > > #^{:ack bar} foo      ; (clojure/with-meta foo {:ack bar}) > > This is not correct, and a common misunderstanding. > > "#^ is not sugar for with-meta. It does not expand into a call to > with- meta

Re: Learning Clojure WikiBook

2009-01-14 Thread Chouser
On Wed, Jan 14, 2009 at 6:07 AM, Rock wrote: > [snip] > > #^{:ack bar} foo ; (clojure/with-meta foo {:ack bar}) This is not correct, and a common misunderstanding. "#^ is not sugar for with-meta. It does not expand into a call to with- meta. They are not equivalent." http://groups.google.

Re: Learning Clojure WikiBook

2009-01-14 Thread Rock
Here's an update on syntax-quote in the WikiBook (Reader Macro section): The most complicated reader macro is syntax-quote, denoted by ` (back- tick). When used on a symbol, syntax-quote is like quote but the symbol is resolved to its fully-qualified name: `meow; (quote cat/meow) ...assuming

Re: Learning Clojure WikiBook

2009-01-14 Thread Rock
On Jan 13, 11:35 am, Rock wrote: > I've added some info regarding the backquote expansion mechanism in > the Reader section here: > > http://en.wikibooks.org/wiki/Learning_Clojure#The_Reader > > I tried to answer the author's question regarding the possible > expansion order in nested backquote

Re: Learning Clojure

2008-12-11 Thread rb
On Dec 11, 7:06 am, Alex Burka wrote: > To the debate on whether there should be examples early in the text,   > here are my two cents: > > When I click on something called "Learning [programming language]" I   > like to see a representative example of the syntax early on. If   > there's just t

Re: Learning Clojure

2008-12-11 Thread Brian Will
Tim, just go ahead and make any changes you like. If I don't like them, I can always revert ;) Actually, I'm sure anything you add we can find a place for, but like I said, that would likely be a separate example page in most cases. Thanks, Randall, I mention keywords-as-functions where I talk ab

Re: Learning Clojure

2008-12-11 Thread Randall R Schulz
On Thursday 11 December 2008 07:41, samppi wrote: > Great article, but I'm not sure this part in the keyword section is > correct: > > "Keywords exist simply because, as you'll see, it's useful to have > names in code which are symbol-like but not actually symbols. > Keywords have no concept of be

Re: Learning Clojure

2008-12-11 Thread samppi
Great article, but I'm not sure this part in the keyword section is correct: "Keywords exist simply because, as you'll see, it's useful to have names in code which are symbol-like but not actually symbols. Keywords have no concept of being namespace qualified as they have nothing to do with names

Re: Learning Clojure

2008-12-11 Thread janus
Timothy, Your post is a great one indeed , you have developed a template that anyone could use to introduce Clojure. I would implore to fresh out thoughts and deepen it for all to enjoy. Emeka --~--~-~--~~~---~--~~ You received this message because you are subsc

Re: Learning Clojure

2008-12-11 Thread Alex Burka
To the debate on whether there should be examples early in the text, here are my two cents: When I click on something called "Learning [programming language]" I like to see a representative example of the syntax early on. If there's just text as far as the eye can see (that is, the first

Re: Learning Clojure

2008-12-10 Thread Timothy Pratley
Hi Brian, > Rich talks about destructuring in the part about "let" on the "special > forms" page. Ah indeed, thanks for pointing that out :) > If you have any examples to add, please add them yourself (it is a wiki > page). You've given some really good reasons why I shouldn't mess with it *

Re: Learning Clojure

2008-12-10 Thread Brian Will
Tim: Rich talks about destructuring in the part about "let" on the "special forms" page. The discussion of functions and basic syntax is deliberately delayed because of dependencies, e.g. evaluation can't really be understood without understanding the reader, and explaining the reader involves t

Re: Learning Clojure

2008-12-10 Thread Stephen C. Gilardi
On Dec 10, 2008, at 9:03 PM, Brian Will wrote: btw, you'll see a few notes I left in the text in square brackets where I wasn't sure on some point. If someone could address those questions, I'd appreciate it. [hmm, what are the chances of a false positive due to hash collision? are the odds

Re: Learning Clojure

2008-12-10 Thread Timothy Pratley
Hi Brian, Looks really good. > My intro is meant as a > sequential tour through the essential concepts, not a practical > tutorial. In particular, my examples are deliberately cursory and > abstract, and my API coverage is very minimal. I have some comments which may go beyond your desired scop

Re: Learning Clojure

2008-12-10 Thread Brian Will
Thanks for explaining the origin of "var" and "ref". An important thing you should do for learners is to explain their origin of odd/ cryptic names because that makes them much easier to remember. For example, no text on C I've ever read explains the meaning of standard library function names, lik

Re: Learning Clojure

2008-12-10 Thread Rich Hickey
On Wed, Dec 10, 2008 at 4:32 PM, Brian Will <[EMAIL PROTECTED]> wrote: > > A Java reference type is basically any type allocated on the heap. The > four Clojure reference types are particular Java reference types. My > complaint is this is exactly the sort of weirdness that causes > learners to sc

Re: Learning Clojure

2008-12-10 Thread J. McConnell
On Wed, Dec 10, 2008 at 4:32 PM, Brian Will <[EMAIL PROTECTED]> wrote: > > A Java reference type is basically any type allocated on the heap. The > four Clojure reference types are particular Java reference types. My > complaint is this is exactly the sort of weirdness that causes > learners to sc

Re: Learning Clojure

2008-12-10 Thread Brian Will
A Java reference type is basically any type allocated on the heap. The four Clojure reference types are particular Java reference types. My complaint is this is exactly the sort of weirdness that causes learners to scratch their heads. Not the biggest issue, sure, but this sort of thing is nice to

Re: Learning Clojure

2008-12-10 Thread Cosmin Stejerean
On Wed, Dec 10, 2008 at 2:10 PM, Randall R Schulz <[EMAIL PROTECTED]> wrote: > > On Wednesday 10 December 2008 10:27, Brian W wrote: > > I've created a new Clojure intro at > > http://en.wikibooks.org/wiki/Learning_Clojure. ... > > > > ... > > > > Another issue I had is we don't have a good blanke

Re: Learning Clojure

2008-12-10 Thread Randall R Schulz
On Wednesday 10 December 2008 10:27, Brian W wrote: > I've created a new Clojure intro at > http://en.wikibooks.org/wiki/Learning_Clojure. ... > > ... > > Another issue I had is we don't have a good blanket term for Vars, > Refs, Agents, and Atoms. Speaking of these, your article mentions and des

Re: Learning Clojure

2008-12-10 Thread J. McConnell
On Wed, Dec 10, 2008 at 1:27 PM, Brian W <[EMAIL PROTECTED]> wrote: > > Another issue I had is we don't have a good blanket term for Vars, > Refs, Agents, and Atoms. Rich sometimes calls them "reference types", > but that term already has a different meaning in Java. I considered > "meta-reference

Re: learning clojure

2008-11-24 Thread Ethan Herdrick
For the File / IO things, skip the Java libs - they are pretty low level. Go with the Jakarta Commons libs: http://commons.apache.org/io/description.html , as Stuart has recommended elsewhere. On Mon, Nov 24, 2008 at 6:48 AM, Stuart Sierra <[EMAIL PROTECTED]> wrote: > > It's useful to know the s

Re: learning clojure

2008-11-24 Thread Stuart Sierra
It's useful to know the standard Java libraries, especially for File/ IO stuff. You can pick up nearly all of it from the Sun Java tutorials: http://java.sun.com/docs/books/tutorial/ -Stuart Sierra On Nov 23, 11:34 pm, syamajala <[EMAIL PROTECTED]> wrote: > How easy is it to pick up clojure wi

Re: learning clojure

2008-11-24 Thread Vincent Foley
As somebody who did only a few hours of Java, but knows object oriented programming well and had its fair share of fun with Common Lisp, Scheme and Haskell, Clojure was quite easy to pick up. For all pure Clojure stuff, I don't think that you need to know anything about Java. When you work with