Re: throw-if with no exception class

2008-12-11 Thread Ralf Bensmann
Just throwing Exception is discouraged in Java, because its the supertype checked and unchecked exceptions. I often saw a JVM die of an unproper exception handling -- mainly when NullPointerExceptions were involved. So we are on the JVM, want Java interop and so my isistent recommendation is to

Re: Clojure Code Analysis Tools

2008-12-11 Thread [EMAIL PROTECTED]
On Dec 2, 4:52 pm, Peter Wolf [EMAIL PROTECTED] wrote: I vote that we take Merlyn's code as a base and put it on SourceForge.   I'll add my Lexer and Parser and work on formatting, parens matching and coloring.  Erik can add his REPL and completion stuff. However, I think it would be polite

Apache Tapestry Creator to Speak on Clojure, Tapestry 5

2008-12-11 Thread Shaguf
Apache Tapestry Creator to Speak on Clojure, Tapestry 5 Bangalore, December 10, 2008: If you are a Java developer building web- based applications and tired of the countless frameworks that promise you a slick UI fast but fail to live up to their promise, then switch to Apache Tapestry to get

The return of the monads: lessons learned about macros

2008-12-11 Thread Konrad Hinsen
A while ago I uploaded an implementation of monads in Clojure to the group's file section. I have now replaced it by a more or less complete rewrite. This rewrite was motivated by one serious problem with the original implementation, plus a number of minor points that I was not happy with. I have

Re: throw-if with no exception class

2008-12-11 Thread Rich Hickey
On Dec 10, 10:52 pm, Stephen C. Gilardi [EMAIL PROTECTED] wrote: On Dec 10, 2008, at 4:38 AM, Ralf Bensmann wrote: Being a Java trainer for a long time, we talk with students about the handle-or-declare rule in Java and the two types of exceptions: checked (declared) and unchecked

Re: Dr. Dobbs: It's Time to Get Good at Functional Programming

2008-12-11 Thread Michael Wood
On Wed, Dec 10, 2008 at 11:28 PM, Randall R Schulz [EMAIL PROTECTED] wrote: Hi, I just found this article on Dr. Dobbs' Web site. It's dated Dec 3rd of this year: - It's Time to Get Good at Functional Programming Subtitle: Is it Finally Functional Programming's Turn?

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

Re: Clojure Code Analysis Tools

2008-12-11 Thread Peter Wolf
Hi Darren, Work continues. Merlyn has invited me to take over admin of the code. I have taken Merlyn's code as a base, and am fleshing it out. Currently, I am struggling though the lack of documentation and examples for building a custom language plugin. I have implemented a Lexer, and am

frequency of each unique item in collection

2008-12-11 Thread bOR_
Hi all, I thought I remembered there was a method in the api somewhere that would count the frequency of each unique item in a collection, but I can't find it anymore. What would be a brief way to write that in clojure? (In ruby: array.inject(Hash.new(0)) {|hash,key| hash[key] += 1 ; hash})

Re: In core structure editor, anyone?

2008-12-11 Thread evins.mi...@gmail.com
On Dec 10, 2:59 pm, falcon [EMAIL PROTECTED] wrote: Could you describe in-core editing a bit more?  Sounds interesting. The canonical structure editor (not structured editor) is probably Interlisp-D's SEDIT, or its predecessor DEDIT. (See

Re: Is it possible to tell programatically if I'm in a transactional context?

2008-12-11 Thread Rich Hickey
On Dec 8, 7:44 pm, Dave Griffith [EMAIL PROTECTED] wrote: The basic use case is as a guard for I/O, to prevent them from from filling the disk/spamming the network accidentally in case of transaction live-lock. Probably a bit more paranoia than is idiomatic in the dynamically-typed world,

Re: frequency of each unique item in collection

2008-12-11 Thread Dave Griffith
(defn frequencies [coll] (reduce (fn [map val] (assoc map val (if (contains map val) (get map val) 1)) #{}) ) On Dec 11, 9:21 am, bOR_ [EMAIL PROTECTED] wrote: Hi all, I thought I remembered there was a method in the api somewhere that would count the frequency of each unique

Re: frequency of each unique item in collection

2008-12-11 Thread Mark McGranaghan
I don't recall a histogram-like method, though I may just be forgetting. (defn frequencies [coll] (reduce (fn [map val] (assoc map val (inc (get map val 1 {} coll)) On Thu, Dec 11, 2008 at 9:33 AM, Dave Griffith [EMAIL PROTECTED] wrote: (defn frequencies [coll]

Re: In core structure editor, anyone?

2008-12-11 Thread Stuart Sierra
On Dec 11, 9:32 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I don't know whether Rich regards the text of a Clojure program as the source, or whether he thinks of the source as the data structure created by the reader when it reads the text. In Common Lisp and some older dialects, it's

Re: Is it possible to tell programatically if I'm in a transactional context?

2008-12-11 Thread Dave Griffith
Excellent! This is a great way of making code fail-fast for a class of bugs that would normally only occur under load (i.e. at the worst possible time). --Dave Griffith --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: frequency of each unique item in collection

2008-12-11 Thread Randall R Schulz
On Thursday 11 December 2008 06:33, Dave Griffith wrote: On Dec 11, 9:21 am, bOR_ [EMAIL PROTECTED] wrote: Hi all, I thought I remembered there was a method in the api somewhere that would count the frequency of each unique item in a collection, but I can't find it anymore. What would

Re: frequency of each unique item in collection

2008-12-11 Thread Stuart Sierra
On Dec 11, 9:21 am, bOR_ [EMAIL PROTECTED] wrote: I thought I remembered there was a method in the api somewhere that would count the frequency of each unique item in a collection, but I can't find it anymore. What would be a brief way to write that in clojure? I think what you want is:

Re: frequency of each unique item in collection

2008-12-11 Thread Dave Griffith
Yup, five bugs by my count. Not bad for a one-liner. More coffee necessary. Same algorithm, but tested. (defn frequencies [coll] (reduce (fn [map val] (assoc map val (if (contains? map val) (+ 1 (get map val)) 1))) {} coll) ) On Dec 11, 9:52 am, Randall R Schulz [EMAIL PROTECTED]

Re: frequency of each unique item in collection

2008-12-11 Thread Stuart Sierra
I've added a slightly modified version to clojure.contrib.seq-utils: (defn frequencies Returns a map from distinct items in coll to the number of times they appear. [coll] (reduce (fn [counts x] (assoc counts x (inc (get counts x 0 {} coll)) -Stuart Sierra

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

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 being

Re: The return of the monads: lessons learned about macros

2008-12-11 Thread jim
Konrad, I haven't had a chance to look at this in depth but I did see two things. First, the function 'group' that you define seems to be the same as Clojure's 'partition' function. Second, when I tried to load monads, I get the following error. java.lang.ExceptionInInitializerError

Re: In core structure editor, anyone?

2008-12-11 Thread falcon
Can't say I understood all of it (being a LISP noob) but appreciate the explanation. Does the following fit into the current discussion? Barista editor: http://faculty.washington.edu/ajko/barista.shtml Barista editor is based on Citrus http://faculty.washington.edu/ajko/citrus.shtml The

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

Re: memory issue with nth

2008-12-11 Thread Paul Mooser
I think this might just be a JVM version issue. I can reproduce this issue with a 1.5 JVM, but I can't reproduce it with 1.6. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send

Re: Patch: precompiling Clojure core sources in Ant build script

2008-12-11 Thread MattyDub
Well, I had the .clj files in my clojure.jar, and clojure.jar is on slime-search-paths, but I still wasn't getting M-. to work with clojure's functions and macros. I added the source files to my classpath, and I get them now. Also, I updated clojure and swank-clojure this morning, so it looks

Re: jEdit Mode for Clojure

2008-12-11 Thread Daniel Spiewak
It's been too long since I've looked at this thread... I took a look at the mode you linked. My mode is quite a bit more powerful, particularly with the changes I added today. The linked mode does do some highlighting of special forms like @[...] that mine doesn't do yet, mainly because I

Re: jEdit Mode for Clojure

2008-12-11 Thread Daniel Spiewak
Oh, also I should mention that I found the magic incantation to make auto-indentation work perfectly. It handles multiple unindents just fine now. Daniel On Dec 11, 12:34 pm, Daniel Spiewak djspie...@gmail.com wrote: It's been too long since I've looked at this thread... I took a look at

Re: In core structure editor, anyone?

2008-12-11 Thread TNeste
On Dec 10, 2:15 pm, Simon Brooke still...@googlemail.com wrote: I note people seem mainly to be using Emacs as an editing/development environment for Clojure. But as people keep pointing out, Clojure is homoiconic; the canonical source of a function is not a stream of bytes read from a

Re: jEdit Mode for Clojure

2008-12-11 Thread Randall R Schulz
On Thursday 11 December 2008 10:34, Daniel Spiewak wrote: It's been too long since I've looked at this thread... I took a look at the mode you linked. My mode is quite a bit more powerful, particularly with the changes I added today. ... Where do we find your latest version? Or do you want

Re: memory issue with nth

2008-12-11 Thread Christian Vest Hansen
Wo-hoo! I found a fix. I think it is only a JVM issue to the extent that the 1.6 JVM might be able to mask the bug by doing escape analysis or some such other magic, but that dosn't mean that the bug isn't there. It's a super-simple little thing, and I can't imagine a CA is needed to apply it.

Java interop question

2008-12-11 Thread Mark Engelberg
I understand how Clojure lets you consume Java objects, and pass Clojure objects to Java programs. However, it is not uncommon for Java libraries to be designed in such a way that you need to create a subclass of something in the library in order to make use of the library. I don't understand

xml/parse

2008-12-11 Thread Robert Koberg
Hi, (very new to clojure, emacs and lispish things) I am using the latest downloadable clojure (rather than SVN, which I do have and see it is a bit different) in Aquamacs. I have installed the clojure mode and am using it with inferior-lisp to see output. When looking at the source for the

Re: jEdit Mode for Clojure

2008-12-11 Thread David Moss
Hi, just saw this thread. I had made some modifications to the edit mode and uploaded it for inclusion (as a patch) here: http://sourceforge.net/tracker/index.php?func=detailaid=2201893group_id=588atid=300588 . I haven't checked the status in a while as my internet is very intermittent ATM.

Re: Learning Clojure

2008-12-11 Thread rb
On Dec 11, 7:06 am, Alex Burka zapper3...@gmail.com 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  

Re: xml/parse

2008-12-11 Thread Robert Koberg
On Dec 11, 2008, at 3:23 PM, Kevin Downey wrote: your problem is ' ' makes xml/parse a symbol and stops evaling it to a function symbols are callable like keywords so if you have a hash with symbols as keys you can ('a {'a 1 'b 2}) - 1 so ('xml/parse /Users/me/correct/path/to/my.xml) is

Why allow both ({:map 'example} :map) and (:map {:map 'example})?

2008-12-11 Thread Aaron Cohen
Isn't it just asking for confusion? I really like that maps are functions of their keys though. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: xml/parse

2008-12-11 Thread Robert Koberg
On Dec 11, 2008, at 3:25 PM, Shawn Hoover wrote: On Thu, Dec 11, 2008 at 3:01 PM, Robert Koberg r...@koberg.com wrote: Hi, (very new to clojure, emacs and lispish things) I am using the latest downloadable clojure (rather than SVN, which I do have and see it is a bit different) in

Re: Java interop question

2008-12-11 Thread Brian Doyle
This article has a good example using the proxy function. http://gnuvince.wordpress.com/2008/11/18/fetching-web-comics-with-clojure-part-2/ On Thu, Dec 11, 2008 at 1:22 PM, Randall R Schulz rsch...@sonic.net wrote: On Thursday 11 December 2008 11:31, Mark Engelberg wrote: I understand how

Re: XML Namespaces :xmlns, was Re: xml/parse

2008-12-11 Thread Robert Koberg
On Dec 11, 2008, at 3:44 PM, Robert Koberg wrote: Hi again, I see the default ContentHandler implementation does not handle XML Namespaces. Is that the case or does the :xmlns symbol I meant keyword (I think) here. For example, say I have /xml/ like: {:tag :my-root, attrs {:xmlns:x

Re: jEdit Mode for Clojure

2008-12-11 Thread Randall R Schulz
On Thursday 11 December 2008 12:54, Daniel Spiewak wrote: Where do we find your latest version? Or do you want / need to refine it further? I'm constantly messing around with it and trying to make it a little better. The very latest version is always here:

Re: jEdit Mode for Clojure

2008-12-11 Thread Daniel Spiewak
Hi, just saw this thread. I had made some modifications to the edit mode and uploaded it for inclusion (as a patch) here:http://sourceforge.net/tracker/index.php?func=detailaid=2201893grou... . I haven't checked the status in a while as my internet is very intermittent ATM. Please let me

Re: jEdit Mode for Clojure

2008-12-11 Thread Daniel Spiewak
Where do we find your latest version? Or do you want / need to refine it further? I'm constantly messing around with it and trying to make it a little better. The very latest version is always here: http://github.com/djspiewak/jedit-modes/tree/master/clojure.xml Daniel

Lisp/Clojure doesn't have syntax?

2008-12-11 Thread Paul Barry
I've been reading the latest chapter from Stuart's book, Chapter 7: Macros, and he makes this statement: Clojure has no special syntax for code. Code is simply Clojure data. This is true for normal functions, but also for special forms and macros. Consider a language with syntax, such as Java.

Strings as functions of maps

2008-12-11 Thread Stefan Rusek
If we have the following map: (def m {:key 1 'sym 2 str 3}) The following are equivalent: (:key m) (m :key) As are the following: ('sym m) (m 'sym) I think the commutativity of maps with symbols and keywords is a valuable and good thing. I realize that the String class doesn't implement the

Re: jEdit Mode for Clojure

2008-12-11 Thread Randall R Schulz
On Thursday 11 December 2008 12:54, Daniel Spiewak wrote: Where do we find your latest version? Or do you want / need to refine it further? I'm constantly messing around with it and trying to make it a little better. The very latest version is always here:

Re: Lisp/Clojure doesn't have syntax?

2008-12-11 Thread Randall R Schulz
On Thursday 11 December 2008 13:37, Paul Barry wrote: I've been reading the latest chapter from Stuart's book, Chapter 7: Macros, and he makes this statement: Clojure has no special syntax for code. Code is simply Clojure data. This is true for normal functions, but also for special forms

Re: Lisp/Clojure doesn't have syntax?

2008-12-11 Thread Sean Spencer
That was one of the best explanations of code as data I've ever read. Kudos! On Thu, Dec 11, 2008 at 4:44 PM, Randall R Schulz rsch...@sonic.net wrote: On Thursday 11 December 2008 13:37, Paul Barry wrote: I've been reading the latest chapter from Stuart's book, Chapter 7: Macros, and he

Re: Lisp/Clojure doesn't have syntax?

2008-12-11 Thread Paul Barry
On Dec 11, 4:44 pm, Randall R Schulz rsch...@sonic.net wrote: All these things are syntactic sugar. Shorthand ways to write things that have vanilla S-Expression counterparts. Again, I would not call them syntax. syntactic sugar is not syntax?

Re: memory issue with nth

2008-12-11 Thread Paul Mooser
Nice job finding it ...! Once I could not reproduce it on JDK 6, I stopped looking for a real answer. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: memory issue with nth

2008-12-11 Thread Rich Hickey
On Dec 11, 2:28 pm, Christian Vest Hansen karmazi...@gmail.com wrote: Wo-hoo! I found a fix. I think it is only a JVM issue to the extent that the 1.6 JVM might be able to mask the bug by doing escape analysis or some such other magic, but that dosn't mean that the bug isn't there. It's

Re: Lisp/Clojure doesn't have syntax?

2008-12-11 Thread Dave Newton
--- On Thu, 12/11/08, Paul Barry wrote: syntactic sugar is not syntax? I think that depends on which particular nits are being picked. Is it strictly true that Clojure has no syntax? Meh--probably not. (defun foo [bar] ...) has more unique characters than (defun foo (bar) ...) or (define

Re: Strings as functions of maps

2008-12-11 Thread Rich Hickey
On Dec 11, 4:37 pm, Stefan Rusek sru...@gmail.com wrote: If we have the following map: (def m {:key 1 'sym 2 str 3}) The following are equivalent: (:key m) (m :key) As are the following: ('sym m) (m 'sym) I think the commutativity of maps with symbols and keywords is a valuable

Re: Lisp/Clojure doesn't have syntax?

2008-12-11 Thread Dave Griffith
My view is that Lisps have very a simple syntax, achieved at the cost of moving a fair amount of error checking until runtime. If you ignore reader macros, you can tell if a Clojure expression is well- formed by just keeping a count of open parentheses, which is about the least amount of state

Re: memory issue with nth

2008-12-11 Thread Rich Hickey
On Dec 11, 5:56 pm, Rich Hickey richhic...@gmail.com wrote: On Dec 11, 2:28 pm, Christian Vest Hansen karmazi...@gmail.com wrote: Wo-hoo! I found a fix. I think it is only a JVM issue to the extent that the 1.6 JVM might be able to mask the bug by doing escape analysis or some such

Retired: clojure.contrib.pred and clojure.contrib.memoize

2008-12-11 Thread Stephen C. Gilardi
I removed the pred and memoize libs from clojure.contrib today. The most useful functions formerly in pred and the only function in memoize are now defined in clojure.core. --Steve smime.p7s Description: S/MIME cryptographic signature

Re: Working combination of .emacs, Aquamacs, swank-clojure, clojure-mode?

2008-12-11 Thread mosi
Hi Bill, it seems I found the tick with swank-clojure, slime and emacs. Swank/clojure works only if the user is not root. (Or so it seems on my linux setup) Following your instructions on http://bc.tech.coop/blog/081023.html if the user is root, swank-clojure spawns a server listening on a given

Re: why can't I set! stuff in user.clj?

2008-12-11 Thread Rich Hickey
On Dec 10, 2008, at 1:50 PM, Stephen C. Gilardi wrote: On Dec 10, 2008, at 8:51 AM, Stuart Halloway wrote: Thanks for the info. Is this limitation of user.clj arbitrary, or motivated by some concern that the average Clojure user should know about? Is the a reason not to load the bindings

defining keywords ?

2008-12-11 Thread Robert Koberg
Hi, Would it be desirable to further define keywords such that it allows a special kind of namespacing. * This could allow for more efficient (for the user) and targeted navigation over large, nested collections. * It would allow for mixing related data that might need to be treated in

Re: Working combination of .emacs, Aquamacs, swank-clojure, clojure-mode?

2008-12-11 Thread mosi
My apologies, found the error. It was the linux setup. The portmap daemon was interfering with the swank server. If the portmap is stopped, everything works fine. Running everything as a root? I like to live on the edge of a cliff, gives me a nice buzz high ;-) You don`t? Bye, mosi On Dec 12,

Re: why can't I set! stuff in user.clj?

2008-12-11 Thread Stephen C. Gilardi
On Dec 11, 2008, at 7:24 PM, Rich Hickey wrote: I am interested in the issues you are trying to address, and thanks for volunteering! Excellent. You're welcome. I'd like to try to focus our efforts on release 1.0. Sounds good. Towards that end, it would be nice if your repl code got

Re: jEdit Mode for Clojure

2008-12-11 Thread Daniel Spiewak
I merged in all the interesting stuff from David Moss's Clojure jEdit mode. We do highlight things in very different colors, but all of the elements that his recognizes are also recognized by mine now. Also, I fixed the annoying issue with def: (def this)(def that) The above now highlights

Re: XML Namespaces :xmlns, was Re: xml/parse

2008-12-11 Thread Robert Koberg
Hi, Given an XML structure like: root xmlns:dc=http://purl.org/dc/elements/1.1/; fragment xmlns:xyz=http://www.w3.org/1999/xhtml; dc:titleA HEAD Title/dc:title xyz:titleA BODY Title/xyz:title /fragment fragment xmlns:zyx=http://www.w3.org/1999/xhtml; dc:titleA HEAD

Re: defining keywords ?

2008-12-11 Thread Chouser
On Thu, Dec 11, 2008 at 7:49 PM, Robert Koberg r...@koberg.com wrote: Hi, Would it be desirable to further define keywords such that it allows a special kind of namespacing. * This could allow for more efficient (for the user) and targeted navigation over large, nested collections. * It

Purpose of memfn?

2008-12-11 Thread Oscar Picasso
On Programming Clojure I read: The method-as-function idiom is a common one, so Clojure provides the memfn macro to wrap methods for you: (map (memfn toUpperCase) [a short message]) - (A SHORT MESSAGE) But one could already write: (map #(.toUpperCase %) [a short message]) - (A SHORT

Re: Purpose of memfn?

2008-12-11 Thread Stuart Halloway
I like the second form better, and may remove memfn from the book entirely. Stuart On Programming Clojure I read: The method-as-function idiom is a common one, so Clojure provides the memfn macro to wrap methods for you: (map (memfn toUpperCase) [a short message]) - (A SHORT MESSAGE)

Re: Purpose of memfn?

2008-12-11 Thread Chouser
On Thu, Dec 11, 2008 at 7:44 PM, Oscar Picasso oscarpica...@gmail.com wrote: (map (memfn toUpperCase) [a short message]) - (A SHORT MESSAGE) But one could already write: (map #(.toUpperCase %) [a short message]) - (A SHORT MESSAGE) Are they cases where we cannot use the second form and

Re: Swing GUI Builder and Clojure

2008-12-11 Thread wubbie
Hi, The same hello world did not work for me. The error msgs are: (defn hello-world [] (qt4 (let [app (QCoreApplication/instance) button (new QPushButton Go Clojure Go)] (.. button clicked (connect app quit())) (doto button (resize 250 100) (setFont (new

Apache Tapestry Creator to Speak on Clojure, Tapestry 5

2008-12-11 Thread Shaguf
Apache Tapestry Creator to Speak on Clojure, Tapestry 5 Bangalore, December 10, 2008: If you are a Java developer building web- based applications and tired of the countless frameworks that promise you a slick UI fast but fail to live up to their promise, then switch to Apache Tapestry to get

Venkat Subramaniam to Speak on Debugging Ajax, Agile Development, Test Driven Development in .NET, Programming Groovy

2008-12-11 Thread Shaguf
Venkat Subramaniam to Speak on Debugging Ajax, Agile Development, Test Driven Development in .NET, Programming Groovy Great Indian Developer Summit 2009 – India’s Biggest Gathering of Software Developers Bangalore, November 24, 2008: Developing Ajax applications is a lot of fun, up until things

re-seq and other functions

2008-12-11 Thread Oscar Picasso
user (sort (re-seq #\w+ the quick brown fox)) (brown fox quick the) but user (sort (re-seq #q(u(i))? the quick brown fox)) ([qui ui i]) Why it's not sorted on the later case? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Re: Running out of memory when using filter?

2008-12-11 Thread Mark Engelberg
On Mon, Dec 8, 2008 at 6:51 PM, Rich Hickey richhic...@gmail.com wrote: I don't have the latest build of Clojure with atoms, so I reimplemented Rich's filter solution using refs, turning: (defn filter [pred coll] (let [sa (atom (seq coll)) step (fn step []

Re: defining keywords ?

2008-12-11 Thread Mon Key
cool. was wondering if this was possible the other day myself :) Good to know RH crew have accounted for this possibility already. s_P On Dec 11, 10:08 pm, Chouser chou...@gmail.com wrote: On Thu, Dec 11, 2008 at 7:49 PM, Robert Koberg r...@koberg.com wrote: Hi, Would it be desirable to

Re: re-seq and other functions

2008-12-11 Thread Stephen C. Gilardi
In the latter case the result is a seq containing a single element: the vector. There is nothing to sort/it us sorted. --Steve On Dec 12, 2008, at 12:14 AM, Oscar Picasso oscarpica...@gmail.com wrote: user (sort (re-seq #\w+ the quick brown fox)) (brown fox quick the) but user (sort

Re: frequency of each unique item in collection

2008-12-11 Thread mago
Slightly shorter version: (defn frequencies Returns a map from distinct items in coll to the number of times they appear. [coll] (reduce (fn [counts x] (merge-with + counts {x 1})) {} coll)) On Dec 11, 9:14 am, Stuart Sierra

Re: Lisp/Clojure doesn't have syntax?

2008-12-11 Thread Mon Key
Clojure does not allow for programmer-defined reader macros (unlike other lisps). I know this has been touched upon last Spring - and Stu Halloway refs at least one discussion of this in his book. From a practical standpoint I am beginning to understand more why the choice was made to not

Re: Lisp/Clojure doesn't have syntax?

2008-12-11 Thread Mon Key
Clojure does not allow for programmer-defined reader macros (unlike other lisps). I know this has been touched upon last Spring - and Stu Halloway refs at least one discussion of this in his book. From a practical standpoint I am beginning to understand more why the choice was made to not

Extending deref

2008-12-11 Thread Mark Engelberg
If you wanted to extend deref to new types, is there any way to do that? For example, deref of a delay could be equivalent to a force. Or deref of a Future could invoke the Future's get method. This would give you the handy @ reader macro for things that frequently need to be forced to evaluate