Re: Native Clojure

2010-12-20 Thread nickik
Clojure is designed to be hosted. So I'm pretty sure that there are no
plan to write a nativ clojure VM but you could try to compile the byte
code with llvm. I here there is a java byte code frontend.

On Dec 20, 8:43 am, kaveh_shahbazian kaveh.shahbaz...@gmail.com
wrote:
 Is there a natively compiled version of Clojure? Is there any plans to
 do so?

 Thanks

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Ah-hah! Clojure is a Lisp

2010-12-20 Thread Meikel Brandmeyer
 Can you articulate it any better than ah hah!?

Heureka!

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Ah-hah! Clojure is a Lisp

2010-12-20 Thread Alex Osborne
Ken Wesson kwess...@gmail.com writes:

 * OO programs conflate value, state, and identity.

 Ah. So, like the confused situations you get with Java's mutable
 collections.

I just thought of a non programming language example which might help
explain what state and identity conflation means.  The web (as
traditionally implemented) conflates state and identity.

For instance, suppose I give you this URL:

   http://www.infoq.com/about;

When you resolve that, you instantly get back a value: a particular
string of HTML.  I can't give you a reference to a particular state of
that page.  By the time you look at it, it could be completely different
to what I saw.

This flaw in the model of the web is one of the driving forces behind
projects like Memento [1] and WebCite [2]. 

Wikis on the other hand, typically separate state and identity.  With a
wiki there's a distinction between an identity:

   http://en.wikipedia.org/wiki/Clojure

and a state:

   http://en.wikipedia.org/wiki/Clojure?oldid=396404196

I can give you a reference to each independently.  

Unfortunately while wikis solve the problem, they do it in ad-hoc way.
There's no standard mechanism in the HTTP protocol to deref a wiki
page and get back the URL of its current state.

   OO typically unifies identity and state, i.e. an object (identity)
   is a pointer to the memory that contains the value of its
   state. There is no way to obtain the state independent of the
   identity other than copying it. -- clojure.org/state

--
[1] http://www.mementoweb.org/about/
[2] http://www.webcitation.org/

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: clj-http timeouts

2010-12-20 Thread dsapala
Thanks! That's just what I was looking for.

On Dec 19, 5:56 pm, Miki miki.teb...@gmail.com wrote:
  Does anyone know how to set connection or read timeouts for clj-http?

 I didn't see anything in the API. clj-apache-http has that option though
 (setting http.socket.timeout parameter).

 HTH,
 --
 Miki

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Can I use pr-str and read-string on datatype?

2010-12-20 Thread linjie nie
Hi gurus,

I find clojure can use pr-str and read-string to save/load data. But when I
use read-string to load a instance of a datatype, which is saved to file
using pr-str, an exception thrown.
java.lang.RuntimeException: java.lang.Exception: No dispatch macro for: :
at clojure.lang.RT.readString(RT.java:1263)
at clojure.core$read_string.invoke(core.clj:2897)

And I opened the file, it looks like following, I think the second char is
the problem.

#:doctor.domain.Project{:name mock-name, :stream mock-stream, .

please advice, thanks alot.
Jason.

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Ah-hah! Clojure is a Lisp

2010-12-20 Thread Alex Baranosky

 You can't step into the same river twice.


In this quote the river is the identity. At any snapshot in time the river
is a specific value.

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Can I use pr-str and read-string on datatype?

2010-12-20 Thread Stuart Sierra
`read` does not yet support datatypes. This is a known problem which *may* 
be fixed in 1.3.

-Stuart Sierra
clojure.com

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Native Clojure

2010-12-20 Thread Stuart Sierra
It's theoretically possible, but not under active investigation at this 
time.

-Stuart Sierra
clojure.com

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Can I use pr-str and read-string on datatype

2010-12-20 Thread linjie nie
Hi gurus, 

I find clojure can use pr-str and read-string to save/load data. But when I 
use read-string to load a instance of a datatype, which is saved to file 
using pr-str, an exception thrown.
java.lang.RuntimeException: java.lang.Exception: No dispatch macro for: :
at clojure.lang.RT.readString(RT.
java:1263)
at clojure.core$read_string.invoke(core.clj:2897)

And I opened the file, it looks like following, I think the second char is 
the problem. 

#:doctor.domain.Project{:name mock-name, :stream mock-stream, .

please advice, thanks alot. 
Jason.

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Beginner question to a error please

2010-12-20 Thread uap12
Hi,
I just started a hobby project, it download a webbpage, and extract number 
data witch exits between brStart rad:/SPAN   --and --  /TD
Example
brStart rad:/SPAN01 20 20 52 32 85 89/TD

Everything works fine exept -main witch gives a error i don't understand.
Becurse i try to learn Clojure, i like to now what's wrong a way :)

Here is my code

(ns com.persson.extract
;(:import )
;(:require )
)

(defn remove-endlines [file]
  (filter #(not= % \newline)
(filter #(not= % \return) file)))

(defn get-file-without-endlines[file]
(remove-endlines (slurp file) ))

(defn -main[]
(re-find #brStart rad:\/SPAN*.\/TD (get-file-without-endlines 
E:/testing/data/1999_1.txt )))

And here is the error
---
com.persson.extract= (-main)
#CompilerException java.lang.ClassCastException: clojure.lang.LazySeq 
cannot be cast to java.lang.CharSequence (NO_SOURCE_FILE:117)

Best regards
Anders

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Beginner question to a error please

2010-12-20 Thread Laurent PETIT
2010/12/20 uap12 anders.u.pers...@gmail.com

 Hi,
 I just started a hobby project, it download a webbpage, and extract number
 data witch exits between brStart rad:/SPAN   --and --  /TD
 Example
 brStart rad:/SPAN01 20 20 52 32 85 89/TD

 Everything works fine exept -main witch gives a error i don't understand.
 Becurse i try to learn Clojure, i like to now what's wrong a way :)

 Here is my code
 
 (ns com.persson.extract
 ;(:import )
 ;(:require )
 )

 (defn remove-endlines [file]
   (filter #(not= % \newline)
 (filter #(not= % \return) file)))

 (defn get-file-without-endlines[file]
 (remove-endlines (slurp file) ))

 (defn -main[]
 (re-find #brStart rad:\/SPAN*.\/TD (get-file-without-endlines
 E:/testing/data/1999_1.txt )))

 And here is the error

 ---
 com.persson.extract= (-main)
 #CompilerException java.lang.ClassCastException: clojure.lang.LazySeq
 cannot be cast to java.lang.CharSequence (NO_SOURCE_FILE:117)


The return value of get-file-without-endlines will be a seq of Chars, while
re-find expects a CharSequence (generally a String).
So to follow in the spirit of your example, you'd have to first convert your
seq of Chars back into a string, e.g. via
(apply str (get-file-without-endlines ))

HTH,

-- 
Laurent


 Best regards
 Anders

  --
 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 to
 clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Beginner question to a error please

2010-12-20 Thread uap12
Tanks very mutch for the help.
/Anders

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Native Clojure

2010-12-20 Thread nicolas.o...@gmail.com
If you wait for clojure in clojure and then use VMkit (LLVM based
thing to do Virtual Machine), it can be an interesting project.
I am not sure if it would be considered as really native, though.

Nicolas.

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: currying in clojure for fixed number of arg functions

2010-12-20 Thread ka
+1 on partial with no args !

I have a doubt: using partial conveys the intent, but with automatic
currying one may get confused between partial application 
function call, no?

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


ANN: Clojure web application using NHPM for server push

2010-12-20 Thread rob levy
I have posted a repository containing the code for a web application I made
using a server push (AKA Comet, long polling) architecture.  The front end
is in Javascript, and the back end is in Clojure.  The clojure code is able
to send notifications to clients' browsers effectively through use of
nginx's push module, which the clients subscribe to.  With websockets
presently out of reach this can be a good way of doing this sort of thing,
and at least on my small-scale testing it is a super responsive way of
simulating a socket.

https://github.com/rplevy/sayoperation

The application itself is online (for now) at:

http://www.robertplevy.net/sayoperation/

A little bit of context is necessary here.  This is a game I made as part of
my final project for a course I am in (I am taking courses part time as part
of an MA program I will eventually complete) on the topic of Machine
Learning and Natural Language Processing.  The purpose of the game is to
collect game move data.  I'm in the process of figuring out how to train a
classifier to learn to make the same sorts of game moves (though the text
generation piece is out of scope), to have 1/2 of an AI game player.

If you want to play the game and help me collect training data, here are
some things to know:

   1.  You will be asked to give an instruction to your team mate, given the
information on the screen.  The red is the target, and the green is what
your teammate will move to the target.  Notice that the target is always an
empty space.   For example put the crab above the butterfly would make
sense if the crab had a green border, and there were a red bordered target
above the butterfly.

   2.  Use clear and natural language when entering data., try to explain in
the way you would explain to a person.  Punctuation and capitalization is
stripped out/lowercased.

   3.  The rounds work like this.  Player 1 instruct - Player 2 move --
Player 2 instruct -- Player 1 move.  The game automatically presents your
next available move just like in RIAs such as gchat or facebook (no need to
refresh).

   4.  Multiple concurrent games are encouraged.  The game should be
responsive and will immediately tell you if you have a move to play in any
of your games.

   5. Caveat:  The application has been tested thoroughly in Firefox and
Chrome.  While there is no inherent reason why it shouldn't be possible to
make it work in Opera or Internet Explorer, I have not tested it in IE (so
it probably doesn't work in that browser), and I am aware that it doesn't
work in Opera.  This is just a matter of time and effort, that I need to
spend on the NLP side of this project at the moment.

   6. The high scoring team as of 2am tonight will win something (I haven't
decide what, give me ideas please).

Thanks,
Rob

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Native Clojure

2010-12-20 Thread Ken Wesson
On Mon, Dec 20, 2010 at 10:41 AM, nicolas.o...@gmail.com
nicolas.o...@gmail.com wrote:
 If you wait for clojure in clojure and then use VMkit (LLVM based
 thing to do Virtual Machine), it can be an interesting project.
 I am not sure if it would be considered as really native, though.

Has anyone tried compiling a Clojure project (along with Clojure
itself) with gcj or jet?

Is it really necessary, though? Hotspot's JIT yields up
native-ballpark speeds when you really need them, if you optimize your
code appropriately.

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Beginner question to a error please

2010-12-20 Thread Ken Wesson
On Mon, Dec 20, 2010 at 10:27 AM, uap12 anders.u.pers...@gmail.com wrote:
 Tanks very mutch for the help.
 /Anders

Of course (apply str ...) will suck the whole file into ram all at
once, eagerly. If it's a multi-gigabyte file expect OOME. It would be
nice if there was a variation on re support that worked on arbitrary
seqs -- seqs of Characters, at least, and preferably (with suitable
additional features) perhaps also seqs of other objects. (Ultimately,
it always boils down to a test of whether a particular object meets
some criterion. Sometimes that's equality with a particular other
object; sometimes membership in a range. Using = and, with ranges,
compare with the endpoints seems like it should generalize well, but
you might want to be able to supply a set of class-comparator pairs.
These could be combined into a multimethod under the hood that acts as
a global comparator during what followed. Ranges wouldn't always make
sense, such as for maps and sets; lists, seqs, and vectors might have
a default comparison that generalizes that for strings, though that
will wedge if two equal, infinite seqs ever get compared. Then again
so will =.)

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Ah-hah! Clojure is a Lisp

2010-12-20 Thread Ken Wesson
On Mon, Dec 20, 2010 at 12:26 AM, Tim Daly d...@axiom-developer.org wrote:
 On 12/19/2010 10:53 PM, Ken Wesson wrote:
 Ah. So, like the confused situations you get with Java's mutable
 collections. Two lists are equal if they have the same contents in the
 same order -- but then you use one as a key in a hashmap, and then add
 an item to it, and boom! Clojure separates this stuff out because the
 Clojure vector's immutability makes its value stable given its
 identity. Refs and atoms and agents can encapsulate mutable state, but
 their identity (as defined by = and hash) is fixed rather than
 changing with its state. And some objects (keywords and symbols) exist
 to be almost pure identity, used to label other things.

 Something like that?

 Ummm. no. You're approaching the question in an OO mindset.

Excuse me? How rude. In the future if you'd like to offer a criticism
of my mindset you can do it off-list!

 Rich spent the better part of an hour trying to explain the
 insights that he got from what must certainly be months of
 reading and thinking.

I don't have the better part of an hour, let alone months. If you'd
like to effectively convey what you have been trying to convey to
various people in this thread, please find some way to condense it. If
a single bullet point doesn't suffice to convey it that is hardly my
fault. You may have erred too far the other way, condensing it too
much. Surely there is a middle ground?

 @mike, Yes, a video isn't documentation. But the MVCC paper
 certainly is. Open source software doesn't seem to do documentation
 (which annoys me also since I'm a literate programming fanatic).

For the most part this project's documentation has been pretty good --
the api page, the other clojure.org and clojure.github.com pages, etc.

But some of this underlying-philosophy stuff still seems to be locked
up in videos and presentations in disparate places, invisible to
Google's search and not even all linked from one place (the closest to
one place being scattered posts to this list). And apparently these
are generally quite long. Videos have several disadvantages over text:

* Google can't see inside of them.
* You cannot search inside of them.
* Tools for bookmarking specific places inside of them are primitive.
* You can't read at your own pace, nor skim at all.
* Videos tend to mix the meaty information in with jokes, anecdotes,
  people moving around, and other filler that takes up not only space
  but time. Much of this wouldn't exist in text and what remained
  could easily be skimmed or scrolled past by people in a hurry.
* Video is bandwidth-intensive. In particular, a talk on video is
  a staggeringly inefficient use of bandwidth: the textual content,
  besides being effectively hidden from google and control-F search,
  takes the form of an audio track of several tens of megabytes in
  which it is inevitably mixed with some amount of extraneous noise,
  rather than being a few tens of KB of HTML or a few KB of plain
  text; what could be a handful of few-KB-each jpegs (e.g. slides
  presented) embedded in the text via img tags bloats up into a
  multi-gigabyte video stream where each slide is partly obscured
  by a talking head. Or perhaps only a couple of hundred megabytes,
  accompanied by massive quality degradation. Line art slides become
  blurs at those compression levels. Compare a jerky, stuttery,
  expensive-if-you're-on-mobile, blurry image of mostly a talking
  head with somewhat-indistinct and somewhat-noisy audio to a clean
  page design with text and inline still images that conveys the
  same information. And can be searched for text, etc.
* If animation is really necessary to convey some point, animated
  gifs and, if you really must resort to it, Flash can be employed.

I'm not saying there isn't a place for videos, but they are not
*substitutes* for text and if they convey anything we should be
referring to commonly (and especially if we should sometimes be
referring to a small subset of the information in one, rather than the
whole thing at one time) there should be an HTML presentation (text
with perhaps inline images, perhaps some of them animated) of the core
content as well somewhere.

Right now the Clojure documentation-cloud seems to contain several of
these indigestible lumps masquerading as proper documentation. That
seems like it should be addressed; and the sooner the better. The
longer, the more of these non-text resources will accumulate and,
worse, the more users will be expected to be familiar with some
growing subset of their contents. In the worst case, it would require
the equivalent of a week-long training seminar to brush up on it all.
Right now Clojure has the great property that with a bit of
familiarity with Java and at least one Java IDE you can get started
hacking in it within minutes, and even do something useful within
hours. I'd hate to see that change or get bogged down in hundreds of
minutes and tens of gigabytes of video 

Re: Ah-hah! Clojure is a Lisp

2010-12-20 Thread Ken Wesson
On Mon, Dec 20, 2010 at 2:49 AM, Alex Osborne a...@meshy.org wrote:
 Ken Wesson kwess...@gmail.com writes:

 Ah. So, like the confused situations you get with Java's mutable
 collections. Two lists are equal if they have the same contents in the
 same order -- but then you use one as a key in a hashmap, and then add
 an item to it, and boom! Clojure separates this stuff out because the
 Clojure vector's immutability makes its value stable given its
 identity. Refs and atoms and agents can encapsulate mutable state, but
 their identity (as defined by = and hash) is fixed rather than
 changing with its state.

 Sort of.  Identity (in the Clojure model) is not the same concept as
 equality.  Nor is it reference equality (identical?).  The overloading
 of terminology is somewhat unfortunate.

    By identity I mean a stable logical entity associated with a series
     of different values over time. -- clojure.org/state

 As Laurent mentioned the usual identities in Clojure are reference
 objects: vars, atoms, refs and so on.

 And some objects (keywords and symbols) exist
 to be almost pure identity, used to label other things.

 Symbols and keywords (and database IDs) aren't identities, they're
 identifiers (names).

It seems you're using identity a little bit oddly here. In ordinary
usage, identity would indeed be close to synonymous with
identifier; the way you're using it here is actually closer to the
usual comp-sci concept of a variable: a holder of mutable state,
which can be pointed to a succession of different individual states.

So part of this is a confusion arising from slightly odd or
idiosyncratic terminology.

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Ah-hah! Clojure is a Lisp

2010-12-20 Thread Meikel Brandmeyer
Hi,

if you prefer text over talk:

http://clojure.googlegroups.com/web/AreWeThereYet.pdf

Sincerely
Meikel

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Ah-hah! Clojure is a Lisp

2010-12-20 Thread Alyssa Kwan
No, identifiers are names.  Identity transcends names.  For example,
in a distributed shared object system, multiple machines on the same
network will have different identifiers for the same identity.

Ordinary usage isn't good enough for metaphysical discussions.
There is a metaphysical discussion of identity which applies to this
situation, and Rich Hickey has taken a particular position.  His
position is rigorous, internally consistent, and applicable to how
most people in our culture model the world, e.g. it can be used to
accomplish work by most of us.  Most philosophical discussions of
identity really mean equality, at least in Hickey nomenclature.

On Dec 20, 12:56 pm, Ken Wesson kwess...@gmail.com wrote:
 On Mon, Dec 20, 2010 at 2:49 AM, Alex Osborne a...@meshy.org wrote:
  Ken Wesson kwess...@gmail.com writes:

  Ah. So, like the confused situations you get with Java's mutable
  collections. Two lists are equal if they have the same contents in the
  same order -- but then you use one as a key in a hashmap, and then add
  an item to it, and boom! Clojure separates this stuff out because the
  Clojure vector's immutability makes its value stable given its
  identity. Refs and atoms and agents can encapsulate mutable state, but
  their identity (as defined by = and hash) is fixed rather than
  changing with its state.

  Sort of.  Identity (in the Clojure model) is not the same concept as
  equality.  Nor is it reference equality (identical?).  The overloading
  of terminology is somewhat unfortunate.

     By identity I mean a stable logical entity associated with a series
      of different values over time. -- clojure.org/state

  As Laurent mentioned the usual identities in Clojure are reference
  objects: vars, atoms, refs and so on.

  And some objects (keywords and symbols) exist
  to be almost pure identity, used to label other things.

  Symbols and keywords (and database IDs) aren't identities, they're
  identifiers (names).

 It seems you're using identity a little bit oddly here. In ordinary
 usage, identity would indeed be close to synonymous with
 identifier; the way you're using it here is actually closer to the
 usual comp-sci concept of a variable: a holder of mutable state,
 which can be pointed to a succession of different individual states.

 So part of this is a confusion arising from slightly odd or
 idiosyncratic terminology.- Hide quoted text -

 - Show quoted text -

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Ah-hah! Clojure is a Lisp

2010-12-20 Thread Ken Wesson
On Mon, Dec 20, 2010 at 1:26 PM, Meikel Brandmeyer m...@kotka.de wrote:
 Hi,

 if you prefer text over talk:

 http://clojure.googlegroups.com/web/AreWeThereYet.pdf

*giggle*

It figures.

I ask for text instead of video so, naturally, I get a PDF link.

*falls over laughing*

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Ah-hah! Clojure is a Lisp

2010-12-20 Thread Ken Wesson
On Mon, Dec 20, 2010 at 1:30 PM, Alyssa Kwan alyssa.c.k...@gmail.com wrote:
 No, identifiers are names.  Identity transcends names.  For example,
 in a distributed shared object system, multiple machines on the same
 network will have different identifiers for the same identity.

 Ordinary usage isn't good enough for metaphysical discussions.
 There is a metaphysical discussion of identity which applies to this
 situation, and Rich Hickey has taken a particular position.  His
 position is rigorous, internally consistent, and applicable to how
 most people in our culture model the world, e.g. it can be used to
 accomplish work by most of us.  Most philosophical discussions of
 identity really mean equality, at least in Hickey nomenclature.

Thanks for making my point for me: identity normally means something
other than what it means in Hickey nomenclature. :)

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Ah-hah! Clojure is a Lisp

2010-12-20 Thread Aaron Bedra

On 12/20/10 1:39 PM, Ken Wesson wrote:

On Mon, Dec 20, 2010 at 1:26 PM, Meikel Brandmeyerm...@kotka.de  wrote:

Hi,

if you prefer text over talk:

http://clojure.googlegroups.com/web/AreWeThereYet.pdf

*giggle*

It figures.

I ask for text instead of video so, naturally, I get a PDF link.

*falls over laughing*
You have asked others not to reply to you in the same tone you are 
taking here.  This was a sincere effort to help.  Please show a little 
bit more respect.


Aaron
--
Clojure/core
http://clojure.com

--
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Ah-hah! Clojure is a Lisp

2010-12-20 Thread Tim Robinson
I think too many posters here are equating Clojure with Lisp.
Clojure is a LISP, but it is not LISP itself.

* Mutability is not a given in all LISP implementations, only some of
them.
* STM transactions (i.e. state and time management upon non-mutable
objects) is a Clojure concept, that no other LISP's have.

So I will suggest the OP is not having a LISP ah-ha moment, but rather
a Clojure ah-ha moment. Lisp does have it's ah-ha moments in other
regards as I am sure is the case with any other language when you move
from being able use the language for general programming to being able
to use the language abstractions  ideology to change how you approach
programs. It's not like programmers didn't have this when everyone
moved to OO languages in the first place - they too had an ah-ha I get
OO now.


On Dec 19, 6:25 pm, Tim Daly d...@axiom-developer.org wrote:
 On 12/19/2010 8:20 PM, Ken Wesson wrote: On Sun, Dec 19, 2010 at 8:18 PM, 
 Tim Dalyd...@axiom-developer.org  wrote:
    I didn't mean to imply that other people
  don't have the ah-hah! experience with
  other languages. However, I have only had
  the (before lisp)|(after lisp) experience
  with lisp.

  Your enlightenment might vary.

  Rich gave his Whitehead talk and brought
  up the fact that OO languages get several
  things wrong.
  Out of curiosity, which several things were these?

 http://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hickey

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Ah-hah! Clojure is a Lisp

2010-12-20 Thread Ken Wesson
On Mon, Dec 20, 2010 at 1:42 PM, Aaron Bedra aaron.be...@gmail.com wrote:
 On 12/20/10 1:39 PM, Ken Wesson wrote:

 On Mon, Dec 20, 2010 at 1:26 PM, Meikel Brandmeyerm...@kotka.de  wrote:

 Hi,

 if you prefer text over talk:

 http://clojure.googlegroups.com/web/AreWeThereYet.pdf

 *giggle*

 It figures.

 I ask for text instead of video so, naturally, I get a PDF link.

 *falls over laughing*

 You have asked others not to reply to you in the same tone you are taking
 here.  This was a sincere effort to help.  Please show a little bit more
 respect.

I'm sorry, but it's just hilarious the lengths some people apparently
go to to avoid plain text/html that you don't need a special browser
plugin and a multimegabyte download to view. All those video links and
then, when someone finally points to a textual summary for one of
them, it's a pdf! It's tragicomic. :)

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Ah-hah! Clojure is a Lisp

2010-12-20 Thread Meikel Brandmeyer
Hi,

Am 20.12.2010 um 19:39 schrieb Ken Wesson:

 On Mon, Dec 20, 2010 at 1:26 PM, Meikel Brandmeyer m...@kotka.de wrote:
 Hi,
 
 if you prefer text over talk:
 
 http://clojure.googlegroups.com/web/AreWeThereYet.pdf
 
 *giggle*
 
 It figures.
 
 I ask for text instead of video so, naturally, I get a PDF link.
 
 *falls over laughing*

How rude. Searching in the PDF (yes, that works), one finds with ease the 
definition of all discussed terms like value, identity and state. All on one 
sheet. How much shorter do you want it? And gone is all ambiguity in the 
discussion.

Sincerely
Meikel

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Ah-hah! Clojure is a Lisp

2010-12-20 Thread Ken Wesson
On Mon, Dec 20, 2010 at 1:48 PM, Meikel Brandmeyer m...@kotka.de wrote:
 http://clojure.googlegroups.com/web/AreWeThereYet.pdf

 *giggle*

 It figures.

 I ask for text instead of video so, naturally, I get a PDF link.

 *falls over laughing*

 How rude. Searching in the PDF (yes, that works), one finds with ease the 
 definition of all discussed terms like value, identity and state. All on one 
 sheet. How much shorter do you want it?

I'd like it to fit in under 10KB if at all possible. :) I sometimes
browse with mobile devices.

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Ah-hah! Clojure is a Lisp

2010-12-20 Thread Aaron Bedra

On 12/20/10 1:47 PM, Ken Wesson wrote:

On Mon, Dec 20, 2010 at 1:42 PM, Aaron Bedraaaron.be...@gmail.com  wrote:

On 12/20/10 1:39 PM, Ken Wesson wrote:

On Mon, Dec 20, 2010 at 1:26 PM, Meikel Brandmeyerm...@kotka.dewrote:

Hi,

if you prefer text over talk:

http://clojure.googlegroups.com/web/AreWeThereYet.pdf

*giggle*

It figures.

I ask for text instead of video so, naturally, I get a PDF link.

*falls over laughing*

You have asked others not to reply to you in the same tone you are taking
here.  This was a sincere effort to help.  Please show a little bit more
respect.

I'm sorry, but it's just hilarious the lengths some people apparently
go to to avoid plain text/html that you don't need a special browser
plugin and a multimegabyte download to view. All those video links and
then, when someone finally points to a textual summary for one of
them, it's a pdf! It's tragicomic. :)
If you think it is funny that's absolutely your opinion to keep.  It has 
no place or constructive worth on this mailing list.  Please keep this 
kind of response off the list.


Aaron

--
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: HTML5 Validator

2010-12-20 Thread Alyssa Kwan
I hadn't considered using an online validator.  Given that these are
only unit tests, this is the simplest solution.  Thanks!

On Dec 18, 7:27 pm, Jeff Valk jv-li...@tx.rr.com wrote:
 On Saturday, December 18, 2010 at 02:10 pm, Alyssa Kwan wrote:

  I'd like to unit test my html output for well-formedness.  What's an
  easy way to test it for HTML5 validity?  Are there good Clojure libs
  for this?  I only need to check for validity, not parse.

 I'm not aware of a native clojure html validator. That said, the first thing 
 that comes to mind is to use something like clj-http [1] to post your markup 
 to the w3c validator [2]. If you're doing this often, or offline, you could 
 run the validator locally [3].

 As a bonus, this method would get you validation for css, rss/atom, etc with 
 miminal extra effort. Perhaps you've already considered this, but I figured 
 I'd toss it out there anyway. Good luck!

 - Jeff

 [1]https://github.com/clj-sys/clj-http
 [2]http://validator.w3.org/#validate_by_input
 [3]http://validator.w3.org/docs/install.html
     (also in the debian/ubuntu repos as w3c-markup-validator)

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Java out of memory problem

2010-12-20 Thread clj123
Thank Ken, your suggestion solved my problem with the OOM exception.

I tried your suggestion to run it in parallel but I didn't see much
difference. Instead I called future on the let call and that helped
the performance.

On Dec 17, 2:55 pm, Ken Wesson kwess...@gmail.com wrote:
 On Fri, Dec 17, 2010 at 5:39 PM, clj123 ariela2...@gmail.com wrote:
  (defn persist-rows
   [headers rows id]
   (let [mrows (transform-rows rows id)]
     (with-db *db* (try
          (apply insert-into-table
                 :my-table
                 [:col1 :col2 :col3]
                 mrows)))
      nil ))

  (defn filter-data
   [rows item-id header id]
    (persist-rows
       header
       (filter #(= (:item_id %) item-id) rows)
       id))

  (dorun (pmap #(filter-data rows %1 header %2)
              items id ))

 Rows gets traversed repeatedly, for each item/id pair. So the head
 gets held onto.

 To make this scale you're going to need to regenerate the rows seq for
 each traversal; you need something like

 (doseq [[item-id id] (map vector items ids)]
   (let [rows (generate-rows-however)]
     (filter-data rows item-id header id)))

 That's not parallel, but I don't know that parallel buys you much when
 the task is I/O bound and takes however long it takes the database
 server to process that number of requests.

 If parallelism really does buy you something here you could replace
 (doseq ...) with (dorun (pmap identity (for ...))) and that might
 parallelize the realization of the items, and thus all of the nested
 operations.- Hide quoted text -

 - Show quoted text -

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Ah-hah! Clojure is a Lisp

2010-12-20 Thread Alyssa Kwan
What things normally mean has no place in computer science.  You
have to embrace the jargon to be able to think rationally in the
space.  This in no way detracts from this discussion.

When I say Hickey nomenclature, I mean vis a vis classical
philosophy or Hegel.  Lay nomenclature only muddies the water.

On Dec 20, 1:41 pm, Ken Wesson kwess...@gmail.com wrote:
 On Mon, Dec 20, 2010 at 1:30 PM, Alyssa Kwan alyssa.c.k...@gmail.com wrote:
  No, identifiers are names.  Identity transcends names.  For example,
  in a distributed shared object system, multiple machines on the same
  network will have different identifiers for the same identity.

  Ordinary usage isn't good enough for metaphysical discussions.
  There is a metaphysical discussion of identity which applies to this
  situation, and Rich Hickey has taken a particular position.  His
  position is rigorous, internally consistent, and applicable to how
  most people in our culture model the world, e.g. it can be used to
  accomplish work by most of us.  Most philosophical discussions of
  identity really mean equality, at least in Hickey nomenclature.

 Thanks for making my point for me: identity normally means something
 other than what it means in Hickey nomenclature. :)

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Ah-hah! Clojure is a Lisp

2010-12-20 Thread Tim Robinson
Hi Ken,

I'd like to nominate you on behalf of the Clojure community to convert
all non-text resources into text only resources. You officially have
my vote. I think your passion makes you the perfect candidate to do
this work. In the mean time I'd like to extend a thanks to all the
folks having taken the time producing these resources - they have
helped immensely.


On Dec 20, 11:50 am, Ken Wesson kwess...@gmail.com wrote:
 On Mon, Dec 20, 2010 at 1:48 PM, Meikel Brandmeyer m...@kotka.de wrote:
 http://clojure.googlegroups.com/web/AreWeThereYet.pdf

  *giggle*

  It figures.

  I ask for text instead of video so, naturally, I get a PDF link.

  *falls over laughing*

  How rude. Searching in the PDF (yes, that works), one finds with ease the 
  definition of all discussed terms like value, identity and state. All on 
  one sheet. How much shorter do you want it?

 I'd like it to fit in under 10KB if at all possible. :) I sometimes
 browse with mobile devices.

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Native Clojure

2010-12-20 Thread Mikhail Kryshen
On Mon, 20 Dec 2010 12:19:59 -0500
Ken Wesson kwess...@gmail.com wrote:

 Has anyone tried compiling a Clojure project (along with Clojure
 itself) with gcj or jet?

I tried to compile Clojure 1.2 with GCJ. To avoid compilation errors I
had to replace some classes in GNU Classpath with versions from OpenJDK.
Still no success: GCJ displayed no errors but used up all available
virtual memory and crashed.

Compiling Clojure to native code would likely degrade overall performance
but may improve startup speed. HotSpot uses adaptive optimizations based
on runtime profiling information and also can better handle dynamically
generated bytecode.

--
Mikhail

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Native Clojure

2010-12-20 Thread kaveh_shahbazian
I understand hosting on a VM has it's own (huge) advantages: GC,
libraries, proved practices and vast amount of research and community
effort already available; no doubt on that part.

It is just having a mature and well designed cross-platform natively
compiled language (other than C and C++) has it's own advantages (I do
not mean Clojure should go down that path; I was just asking). Some
high level languages come to mind like Haskell, OCaml, Gambit-C Scheme
(and for sure some others) but they lack in some areas and not fully
cross platform.

Clojure is a fantastic language (Although I have just scratched the
surface) and It would be nice to have it natively compiled.

Thanks

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Ah-hah! Clojure is a Lisp

2010-12-20 Thread Tim Daly



On 12/20/2010 1:47 PM, Ken Wesson wrote:

On Mon, Dec 20, 2010 at 1:42 PM, Aaron Bedraaaron.be...@gmail.com  wrote:

On 12/20/10 1:39 PM, Ken Wesson wrote:

On Mon, Dec 20, 2010 at 1:26 PM, Meikel Brandmeyerm...@kotka.dewrote:

Hi,

if you prefer text over talk:

http://clojure.googlegroups.com/web/AreWeThereYet.pdf

*giggle*

It figures.

I ask for text instead of video so, naturally, I get a PDF link.

*falls over laughing*

You have asked others not to reply to you in the same tone you are taking
here.  This was a sincere effort to help.  Please show a little bit more
respect.

I'm sorry, but it's just hilarious the lengths some people apparently
go to to avoid plain text/html that you don't need a special browser
plugin and a multimegabyte download to view. All those video links and
then, when someone finally points to a textual summary for one of
them, it's a pdf! It's tragicomic. :)

I am amazed that you find a link to a scholarly article inappropriate.
It is copyrighted material and cannot be converted to ascii for your use.
Don't read the pdf, print it.

It takes time to watch the videos and it takes time to read the papers.
It takes time to read Whitehead's book and the Spikes book. It takes
time to read the source code. There is no need to summarize these sources
in order to understand them since I have invested considerable time already.
The posted links to my primary source materials are for your convenience.

This is an open source project and, as such, it suggests that
Advocacy is volunteering. If you advocate better documentation and
well-written summaries then volunteer to do it.

Tim Daly



--
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Ah-hah! Clojure is a Lisp

2010-12-20 Thread Mike Meyer
On Mon, 20 Dec 2010 19:26:49 +0100
Meikel Brandmeyer m...@kotka.de wrote:

 Hi,
 
 if you prefer text over talk:
 
 http://clojure.googlegroups.com/web/AreWeThereYet.pdf

Thanks for the link.

To bad it made Tufte kill a kitten. I had forgotten there was a
textual representation with a lower information density per bit than
video.

But it does get the ideas across. It seems a lot of this could have
come from other applications I'm using these days, like mercurial
(with an immutable history) or zfs (with an immutable file system).

  Thanks again,
  mike
-- 
Mike Meyer m...@mired.org http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.

O ascii ribbon campaign - stop html mail - www.asciiribbon.org

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Ah-hah! Clojure is a Lisp

2010-12-20 Thread Tim Daly



On 12/20/2010 1:42 PM, Tim Robinson wrote:

I think too many posters here are equating Clojure with Lisp.
Clojure is a LISP, but it is not LISP itself.

Since I've worked in a dozen Lisps (golden common, VMLisp, Lisp370,
Zetalisp, MacLisp, Lisp 1.5, Orien Lisp, etc.) I don't think I would
equate Clojure with Lisp. The question I was wrestling with was whether
Clojure IS a Lisp, as opposed to a domain-specific language for using
immutable Seq data structures over Java.


* Mutability is not a given in all LISP implementations, only some of
them.
* STM transactions (i.e. state and time management upon non-mutable
objects) is a Clojure concept, that no other LISP's have.

So I will suggest the OP is not having a LISP ah-ha moment, but rather
a Clojure ah-ha moment. Lisp does have it's ah-ha moments in other
regards as I am sure is the case with any other language when you move
from being able use the language for general programming to being able
to use the language abstractions  ideology to change how you approach
programs. It's not like programmers didn't have this when everyone
moved to OO languages in the first place - they too had an ah-ha I get
OO now.


You may be right that other people have the ah-hah! moment for
their particular language or concepts. My comment was that this
event is associated with Lisp and that it is different from getting
the OO mindset or getting rule-based programming, etc. I was
getting the STM and immutability concepts but those were not
sufficient to establish (for me) Lisp. Your enlightenment may vary.

Tim Daly


--
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Native Clojure

2010-12-20 Thread Timothy Baldridge
I looked into this a while back. Unfortunetly, Clojure really is
designed to be run on a VM. It makes heavy use of the GC, reflection,
and OOP.

 Clojure is a fantastic language (Although I have just scratched the
 surface) and It would be nice to have it natively compiled.

Why would it be nice? When I started working on clojure-cxx I thought
it would be nice as well. But the fact remains, you gain so much from
writing it on a VM, it would take a massive effort to port it to C++
or another machine language. And in the end, your native code really
isn't going to be too much faster. You might get better memory
performance, but I'm not convinced it's worth the effort.

Even if you get all that straightened out, you still lack a good
standard lib. This is what really killed the project for me. Read up
on C++ linking sometime. Trying to get something like .JARs or .net
assemblies working on a native level is a nightmare to say the least.

If anyone has questions about the work I did, let me know, I'd be more
than happy to expound on my findings.

Timothy


-- 
“One of the main causes of the fall of the Roman Empire was
that–lacking zero–they had no way to indicate successful termination
of their C programs.”
(Robert Firth)

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Native Clojure

2010-12-20 Thread Konrad Hinsen

On 20 Dec 2010, at 18:19, Ken Wesson wrote:


Is it really necessary, though? Hotspot's JIT yields up
native-ballpark speeds when you really need them, if you optimize your
code appropriately.


For me, a native-code implementation of Clojure would be of interest  
for interfacing with libraries written in C, C++, and Fortran. The  
same goal could probably be achieved otherwise (compiling Java  
bytecode to native code, or simply a JVM with a better native  
interface than JNI), but at the moment I see no satisfying solution.


Konrad.

--
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Native Clojure

2010-12-20 Thread Timothy Baldridge

 Is it really necessary, though? Hotspot's JIT yields up
 native-ballpark speeds when you really need them, if you optimize your
 code appropriately.

 For me, a native-code implementation of Clojure would be of interest for
 interfacing with libraries written in C, C++, and Fortran. The same goal
 could probably be achieved otherwise (compiling Java bytecode to native
 code, or simply a JVM with a better native interface than JNI), but at the
 moment I see no satisfying solution.


Have fun with that. For C it would be easy-ish to create a pinvoke
like system. But for C++.yehhh.the way C++ is linked is
just wrong. Sometimes linkers can't even link between two different
versions of the same compiler. On top of that, how are you going to
get class definitions? Parsing the C++ headers is a job and a half.
And you can't start with the .dll as most of those have function names
stripped out of them. This is was the reason COM was created. And in
the end, you still don't have any sort of reflection.

I know nothing of Fortran, so you may have some luck there.

Timothy

-- 
“One of the main causes of the fall of the Roman Empire was
that–lacking zero–they had no way to indicate successful termination
of their C programs.”
(Robert Firth)

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Native Clojure

2010-12-20 Thread Konrad Hinsen

On 20 Dec 2010, at 21:28, Timothy Baldridge wrote:


Have fun with that. For C it would be easy-ish to create a pinvoke
like system. But for C++.yehhh.the way C++ is linked is
just wrong. Sometimes linkers can't even link between two different


C would be fine. I wouldn't mind writing a C wrapper for the  
occasional C++ library. Same for Fortran: interfacing at the C level  
is fine, there are tools already that take care of the Fortran  
specificities.


The important point for me is the ability to access large (even huge)  
arrays from the JVM and the C side without any copying, transforming,  
or whatever. Plus a portable way to call C routines.


Konrad.

--
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Beginner question to a error please

2010-12-20 Thread Laurent PETIT
2010/12/20 Ken Wesson kwess...@gmail.com

 On Mon, Dec 20, 2010 at 10:27 AM, uap12 anders.u.pers...@gmail.com
 wrote:
  Tanks very mutch for the help.
  /Anders

 Of course (apply str ...) will suck the whole file into ram all at


slurp will suffice to suck everything into memory


 once, eagerly. If it's a multi-gigabyte file expect OOME. It would be
 nice if there was a variation on re support that worked on arbitrary
 seqs -- seqs of Characters, at least, and preferably (with suitable
 additional features) perhaps also seqs of other objects. (Ultimately,
 it always boils down to a test of whether a particular object meets
 some criterion. Sometimes that's equality with a particular other
 object; sometimes membership in a range. Using = and, with ranges,
 compare with the endpoints seems like it should generalize well, but
 you might want to be able to supply a set of class-comparator pairs.
 These could be combined into a multimethod under the hood that acts as
 a global comparator during what followed. Ranges wouldn't always make
 sense, such as for maps and sets; lists, seqs, and vectors might have
 a default comparison that generalizes that for strings, though that
 will wedge if two equal, infinite seqs ever get compared. Then again
 so will =.)

 --
 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 to
 clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en


-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Ah-hah! Clojure is a Lisp

2010-12-20 Thread Laurent PETIT
I generally find it easier to get the bigger picture of something when I'm
stepping a little bit back.
With programming languages, sometimes it can involve discovering language
n+1 to give some new perspective on language n, and getting the ah ah
moment with language n.

For example, it's hard to find books about the philosophy of
object-oriented programming in Java. Books generally go to the details.
I had to go get some knowledge in Bertrand Meyer's books as well as see
prototype-based object oriented programming in javascript (as opposed to
class-based object oriented programming in java). Smalltak serves the
purpose as well, putting the focus more on the object than the class.

With lisp flavors, maybe it's because lisp is homoiconic you can get the
language without going outside it ;-)

2010/12/20 Tim Daly d...@axiom-developer.org



 On 12/20/2010 1:42 PM, Tim Robinson wrote:

 I think too many posters here are equating Clojure with Lisp.
 Clojure is a LISP, but it is not LISP itself.

 Since I've worked in a dozen Lisps (golden common, VMLisp, Lisp370,
 Zetalisp, MacLisp, Lisp 1.5, Orien Lisp, etc.) I don't think I would
 equate Clojure with Lisp. The question I was wrestling with was whether
 Clojure IS a Lisp, as opposed to a domain-specific language for using
 immutable Seq data structures over Java.


  * Mutability is not a given in all LISP implementations, only some of
 them.
 * STM transactions (i.e. state and time management upon non-mutable
 objects) is a Clojure concept, that no other LISP's have.

 So I will suggest the OP is not having a LISP ah-ha moment, but rather
 a Clojure ah-ha moment. Lisp does have it's ah-ha moments in other
 regards as I am sure is the case with any other language when you move
 from being able use the language for general programming to being able
 to use the language abstractions  ideology to change how you approach
 programs. It's not like programmers didn't have this when everyone
 moved to OO languages in the first place - they too had an ah-ha I get
 OO now.

  You may be right that other people have the ah-hah! moment for
 their particular language or concepts. My comment was that this
 event is associated with Lisp and that it is different from getting
 the OO mindset or getting rule-based programming, etc. I was
 getting the STM and immutability concepts but those were not
 sufficient to establish (for me) Lisp. Your enlightenment may vary.

 Tim Daly



 --
 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 to
 clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en


-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Ah-hah! Clojure is a Lisp

2010-12-20 Thread Laurent PETIT
2010/12/20 Ken Wesson kwess...@gmail.com

 On Mon, Dec 20, 2010 at 12:26 AM, Tim Daly d...@axiom-developer.org
 wrote:
  On 12/19/2010 10:53 PM, Ken Wesson wrote:
  Ah. So, like the confused situations you get with Java's mutable
  collections. Two lists are equal if they have the same contents in the
  same order -- but then you use one as a key in a hashmap, and then add
  an item to it, and boom! Clojure separates this stuff out because the
  Clojure vector's immutability makes its value stable given its
  identity. Refs and atoms and agents can encapsulate mutable state, but
  their identity (as defined by = and hash) is fixed rather than
  changing with its state. And some objects (keywords and symbols) exist
  to be almost pure identity, used to label other things.
 
  Something like that?
 
  Ummm. no. You're approaching the question in an OO mindset.

 Excuse me? How rude. In the future if you'd like to offer a criticism
 of my mindset you can do it off-list!

  Rich spent the better part of an hour trying to explain the
  insights that he got from what must certainly be months of
  reading and thinking.

 I don't have the better part of an hour, let alone months.


Ken, with all the respect which is due to you, if you're out of ideas to
find some time reading the linked material, you could probably re-focus
*some* of the time you spend sometimes debating (arguing) at lengths (lots
of brower pages in my 1024x768 laptop) in this list to see/read/watch the
material you're critical about.

And if you don't like videos or pdfs, you can certainly find a way to say so
without being rude to the people which (still) take the time to answer you.

Cheers,

-- 
Laurent


 If you'd
 like to effectively convey what you have been trying to convey to
 various people in this thread, please find some way to condense it. If
 a single bullet point doesn't suffice to convey it that is hardly my
 fault. You may have erred too far the other way, condensing it too
 much. Surely there is a middle ground?

  @mike, Yes, a video isn't documentation. But the MVCC paper
  certainly is. Open source software doesn't seem to do documentation
  (which annoys me also since I'm a literate programming fanatic).

 For the most part this project's documentation has been pretty good --
 the api page, the other clojure.org and clojure.github.com pages, etc.

 But some of this underlying-philosophy stuff still seems to be locked
 up in videos and presentations in disparate places, invisible to
 Google's search and not even all linked from one place (the closest to
 one place being scattered posts to this list). And apparently these
 are generally quite long. Videos have several disadvantages over text:

 * Google can't see inside of them.
 * You cannot search inside of them.
 * Tools for bookmarking specific places inside of them are primitive.
 * You can't read at your own pace, nor skim at all.
 * Videos tend to mix the meaty information in with jokes, anecdotes,
  people moving around, and other filler that takes up not only space
  but time. Much of this wouldn't exist in text and what remained
  could easily be skimmed or scrolled past by people in a hurry.
 * Video is bandwidth-intensive. In particular, a talk on video is
  a staggeringly inefficient use of bandwidth: the textual content,
  besides being effectively hidden from google and control-F search,
  takes the form of an audio track of several tens of megabytes in
  which it is inevitably mixed with some amount of extraneous noise,
  rather than being a few tens of KB of HTML or a few KB of plain
  text; what could be a handful of few-KB-each jpegs (e.g. slides
  presented) embedded in the text via img tags bloats up into a
  multi-gigabyte video stream where each slide is partly obscured
  by a talking head. Or perhaps only a couple of hundred megabytes,
  accompanied by massive quality degradation. Line art slides become
  blurs at those compression levels. Compare a jerky, stuttery,
  expensive-if-you're-on-mobile, blurry image of mostly a talking
  head with somewhat-indistinct and somewhat-noisy audio to a clean
  page design with text and inline still images that conveys the
  same information. And can be searched for text, etc.
 * If animation is really necessary to convey some point, animated
  gifs and, if you really must resort to it, Flash can be employed.

 I'm not saying there isn't a place for videos, but they are not
 *substitutes* for text and if they convey anything we should be
 referring to commonly (and especially if we should sometimes be
 referring to a small subset of the information in one, rather than the
 whole thing at one time) there should be an HTML presentation (text
 with perhaps inline images, perhaps some of them animated) of the core
 content as well somewhere.

 Right now the Clojure documentation-cloud seems to contain several of
 these indigestible lumps masquerading as proper documentation. That
 seems like it should be addressed; and 

Re: Beginner question to a error please

2010-12-20 Thread Ken Wesson
On Mon, Dec 20, 2010 at 3:55 PM, Laurent PETIT laurent.pe...@gmail.com wrote:


 2010/12/20 Ken Wesson kwess...@gmail.com

 On Mon, Dec 20, 2010 at 10:27 AM, uap12 anders.u.pers...@gmail.com
 wrote:
  Tanks very mutch for the help.
  /Anders

 Of course (apply str ...) will suck the whole file into ram all at

 slurp will suffice to suck everything into memory

True. You need a seq view of the file, perhaps with line-seq or
perhaps with a seq wrapper around the stream to get a char seq. The
latter can probably be hacked up fairly quickly using lazy-seq; it's
surprising it's not (to my knowledge) in core, really.

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Ah-hah! Clojure is a Lisp

2010-12-20 Thread Ken Wesson
On Mon, Dec 20, 2010 at 1:57 PM, Alyssa Kwan alyssa.c.k...@gmail.com wrote:
 What things normally mean has no place in computer science.  You
 have to embrace the jargon to be able to think rationally in the
 space.  This in no way detracts from this discussion.

I meant what things normally mean in computer science. :)

Maybe it's good if Hickey is able to rewrite the books on computer
science; but in the meantime we are left with some terminological
impedance mismatches between Hickey nomenclature and more typical
comp sci nomenclature. That's not a value judgment; it's just a
statement of fact.

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Ah-hah! Clojure is a Lisp

2010-12-20 Thread Ken Wesson
On Mon, Dec 20, 2010 at 2:10 PM, Tim Robinson tim.blacks...@gmail.com wrote:
 Hi Ken,

 I'd like to nominate you on behalf of the Clojure community to convert
 all non-text resources into text only resources.

Sorry, but I must decline; I simply don't have the time to do so. As I
already mentioned I don't even have the time to browse those non-text
resources right now.

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Ah-hah! Clojure is a Lisp

2010-12-20 Thread Ken Wesson
On Mon, Dec 20, 2010 at 2:55 PM, Tim Daly d...@axiom-developer.org wrote:
 I am amazed that you find a link to a scholarly article inappropriate.

I didn't find the link inappropriate. No doubt the content is just peachy.

I did find the format problematic. I much prefer stuff I can simply
browse in my web browser as normal, without involving special plugins
or external applications and without the files themselves being
enormous, as videos and pdfs are wont to be.

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Ah-hah! Clojure is a Lisp

2010-12-20 Thread Raoul Duke
On Mon, Dec 20, 2010 at 1:20 PM, Ken Wesson kwess...@gmail.com wrote:
 I did find the format problematic. I much prefer stuff I can simply
 browse in my web browser as normal, without involving special plugins
 or external applications and without the files themselves being
 enormous, as videos and pdfs are wont to be.

$0.02 for the most part i'm quite +N with Mr. Wesson. in case he's
feeling lonely.

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Ah-hah! Clojure is a Lisp

2010-12-20 Thread Ken Wesson
On Mon, Dec 20, 2010 at 3:00 PM, Mike Meyer
mwm-keyword-googlegroups.620...@mired.org wrote:
 On Mon, 20 Dec 2010 19:26:49 +0100
 Meikel Brandmeyer m...@kotka.de wrote:
 http://clojure.googlegroups.com/web/AreWeThereYet.pdf

 Thanks for the link.

 To bad it made Tufte kill a kitten. I had forgotten there was a
 textual representation with a lower information density per bit than
 video.

Did you mean a higher information density per bit? The key concepts
can no doubt be conveyed in a few tens of KB of html and still images
-- under a megabyte, certainly. Compare that to the larger size of a
pdf, and the still larger size of video of any decent quality and
resolution. The information density is higher for the more compact
representation of the same key information; the rest is, in effect,
anti-compressed. It may add some side channel information that was
otherwise lack

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Working with maps and vectors

2010-12-20 Thread Anclj
Hi,


I have some questions related with maps and vectors, if someone can
help me I will appreciate it a lot.

I have a vector like:
[a1 a2 a3 b1 b2 b3 c1 c2 c3]

And I would like to have:
[[a1 a2 a3] [b1 b2 b3] [c1 c2 c3]]

Until now I have done:
(map vector (take 3 [a1 a2 a3 b1 b2 b3 c1 c2 c3]))

Which returns (a LazySeq, and I would like a vector):
([a1] [a2] [a3])



I have a map that represents provinces and seats, like this:
{p1 5, p2 8, p3 13, p4 11}

Which means that in p1 5 seats will be distributed, 8 for p2, and
so on.


And a vector where its elements are vectors formed by a political
party, a province and the votes he got. Like this:
[[A p1 32] [B p1 55] [A p2 77] [B p2 21] ...]


I need, for each province, to distribute the seats among the parties
according to the number of votes following this rule:

For each party, i should get a lazy sequence with the values of:
#votes/1, #votes/2, #votes/3, #votes/4, ...

So, in this example, for the p1 province I would have:
For A party: 32, 16, 32/3, 8, ...
And for B party: 55, 55/2, 55/3, 55/4, ...

And I should pick up the first X bigger values between all the
sequences, where X is the number of seats. In this example is 5.
So I should pick up: 55, 32, 55/2, 55/3, 16

And the result for this province would be a map showing, for each
party, the seats that they got. In this example: {B 3, A 2}



I'm not familiar with Clojure, and I don't know how to use many
functions. Any reference to high-level functions that I should use,
and how to use them will be appreciated.


Thanks.

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Ah-hah! Clojure is a Lisp

2010-12-20 Thread Ken Wesson
On Mon, Dec 20, 2010 at 4:10 PM, Laurent PETIT laurent.pe...@gmail.com wrote:


 2010/12/20 Ken Wesson kwess...@gmail.com

 On Mon, Dec 20, 2010 at 12:26 AM, Tim Daly d...@axiom-developer.org
 wrote:
  On 12/19/2010 10:53 PM, Ken Wesson wrote:
  Ah. So, like the confused situations you get with Java's mutable
  collections. Two lists are equal if they have the same contents in the
  same order -- but then you use one as a key in a hashmap, and then add
  an item to it, and boom! Clojure separates this stuff out because the
  Clojure vector's immutability makes its value stable given its
  identity. Refs and atoms and agents can encapsulate mutable state, but
  their identity (as defined by = and hash) is fixed rather than
  changing with its state. And some objects (keywords and symbols) exist
  to be almost pure identity, used to label other things.
 
  Something like that?
 
  Ummm. no. You're approaching the question in an OO mindset.

 Excuse me? How rude. In the future if you'd like to offer a criticism
 of my mindset you can do it off-list!

  Rich spent the better part of an hour trying to explain the
  insights that he got from what must certainly be months of
  reading and thinking.

 I don't have the better part of an hour, let alone months.

 Ken, with all the respect which is due to you, if you're out of ideas to
 find some time reading the linked material, you could probably re-focus
 *some* of the time you spend sometimes debating (arguing) at lengths (lots
 of brower pages in my 1024x768 laptop) in this list to see/read/watch the
 material you're critical about.

Sorry, things are a little hectic around here right now.

 And if you don't like videos or pdfs, you can certainly find a way to say so
 without being rude to the people which (still) take the time to answer you.

I'm not trying to be rude. I just thought it hilarious that after I
specifically objected to videos partly on bandwidth grounds, partly on
have-to-use-a-proprietary-browser-plugin grounds, and etc., someone
suggested a pdf as a substitute. You have to admit that that IS kind
of funny. :)

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Working with maps and vectors

2010-12-20 Thread Ken Wesson
On Mon, Dec 20, 2010 at 4:28 PM, Anclj anb...@gmail.com wrote:
 Hi,

 I have some questions related with maps and vectors, if someone can
 help me I will appreciate it a lot.

 I have a vector like:
 [a1 a2 a3 b1 b2 b3 c1 c2 c3]

 And I would like to have:
 [[a1 a2 a3] [b1 b2 b3] [c1 c2 c3]]

user= (into [] (map vec (partition 3 [1 2 3 4 5 6 7 8 9])))
[[1 2 3]
 [4 5 6]
 [7 8 9]]

 I have a map that represents provinces and seats, like this:
 {p1 5, p2 8, p3 13, p4 11}

 Which means that in p1 5 seats will be distributed, 8 for p2, and
 so on.


 And a vector where its elements are vectors formed by a political
 party, a province and the votes he got. Like this:
 [[A p1 32] [B p1 55] [A p2 77] [B p2 21] ...]


 I need, for each province, to distribute the seats among the parties
 according to the number of votes following this rule:

 For each party, i should get a lazy sequence with the values of:
 #votes/1, #votes/2, #votes/3, #votes/4, ...

 So, in this example, for the p1 province I would have:
 For A party: 32, 16, 32/3, 8, ...
 And for B party: 55, 55/2, 55/3, 55/4, ...

(map #(/ votes %) (iterate inc 1))

 I'm not familiar with Clojure, and I don't know how to use many
 functions. Any reference to high-level functions that I should use,
 and how to use them will be appreciated.

Hope the above gets you started. Obviously it won't do any more than
that -- partly because I don't have much time right now and partly
because I suspect I might be doing your homework for you if I went
much further. :)

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Working with maps and vectors

2010-12-20 Thread Alan
Since Ken doesn't mention it explicitly: there's a difference between
vec and vector. (vec x) returns a vector containing all the elements
of x - a vector view of x, I think the doc mentions. (vector x)
returns a vector containing the single element x.

On Dec 20, 1:33 pm, Ken Wesson kwess...@gmail.com wrote:
 On Mon, Dec 20, 2010 at 4:28 PM, Anclj anb...@gmail.com wrote:
  Hi,

  I have some questions related with maps and vectors, if someone can
  help me I will appreciate it a lot.

  I have a vector like:
  [a1 a2 a3 b1 b2 b3 c1 c2 c3]

  And I would like to have:
  [[a1 a2 a3] [b1 b2 b3] [c1 c2 c3]]

 user= (into [] (map vec (partition 3 [1 2 3 4 5 6 7 8 9])))
 [[1 2 3]
  [4 5 6]
  [7 8 9]]



  I have a map that represents provinces and seats, like this:
  {p1 5, p2 8, p3 13, p4 11}

  Which means that in p1 5 seats will be distributed, 8 for p2, and
  so on.

  And a vector where its elements are vectors formed by a political
  party, a province and the votes he got. Like this:
  [[A p1 32] [B p1 55] [A p2 77] [B p2 21] ...]

  I need, for each province, to distribute the seats among the parties
  according to the number of votes following this rule:

  For each party, i should get a lazy sequence with the values of:
  #votes/1, #votes/2, #votes/3, #votes/4, ...

  So, in this example, for the p1 province I would have:
  For A party: 32, 16, 32/3, 8, ...
  And for B party: 55, 55/2, 55/3, 55/4, ...

 (map #(/ votes %) (iterate inc 1))

  I'm not familiar with Clojure, and I don't know how to use many
  functions. Any reference to high-level functions that I should use,
  and how to use them will be appreciated.

 Hope the above gets you started. Obviously it won't do any more than
 that -- partly because I don't have much time right now and partly
 because I suspect I might be doing your homework for you if I went
 much further. :)

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Ah-hah! Clojure is a Lisp

2010-12-20 Thread Mike Meyer
On Mon, 20 Dec 2010 16:27:11 -0500
Ken Wesson kwess...@gmail.com wrote:

 On Mon, Dec 20, 2010 at 3:00 PM, Mike Meyer
 mwm-keyword-googlegroups.620...@mired.org wrote:
  On Mon, 20 Dec 2010 19:26:49 +0100
  Meikel Brandmeyer m...@kotka.de wrote:
  http://clojure.googlegroups.com/web/AreWeThereYet.pdf
 
  Thanks for the link.
 
  To bad it made Tufte kill a kitten. I had forgotten there was a
  textual representation with a lower information density per bit than
  video.
 
 Did you mean a higher information density per bit?

No, I meant lower.

mike
-- 
Mike Meyer m...@mired.org http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.

O ascii ribbon campaign - stop html mail - www.asciiribbon.org

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Working with maps and vectors

2010-12-20 Thread Anclj
Thanks a lot for the fast reply!
Now I have the vector as I wanted.

I have been playing with your code: (map #(/ votes %) (iterate inc 1))

user= (take 10 (map #(/ 100 %) (iterate inc 1)))
(100 50 100/3 25 20 50/3 100/7 25/2 100/9 10)

I have managed to put that in a lazy sequence:
user= (def ls (lazy-seq (map #(/ 100 %) (iterate inc 1
#'user/ls

And then retrieve the values I want with:
user= (take 5 ls)
(100 50 100/3 25 20)


I don't know how to filter and work with the vector  map in order to
apply that function for each party, in each province.
I have been trying to use the filter function but I get the following
error:

user= (filter #A [[A p1 32] [B p1 55] [A p2 77]
[B p2 21]])
java.lang.ClassCastException: java.util.regex.Pattern cannot be cast
to clojure.lang.IFn


Thanks again and I will be posting any advances!


On 20 Des, 22:44, Alan a...@malloys.org wrote:
 Since Ken doesn't mention it explicitly: there's a difference between
 vec and vector. (vec x) returns a vector containing all the elements
 of x - a vector view of x, I think the doc mentions. (vector x)
 returns a vector containing the single element x.

 On Dec 20, 1:33 pm, Ken Wesson kwess...@gmail.com wrote:







  On Mon, Dec 20, 2010 at 4:28 PM, Anclj anb...@gmail.com wrote:
   Hi,

   I have some questions related with maps and vectors, if someone can
   help me I will appreciate it a lot.

   I have a vector like:
   [a1 a2 a3 b1 b2 b3 c1 c2 c3]

   And I would like to have:
   [[a1 a2 a3] [b1 b2 b3] [c1 c2 c3]]

  user= (into [] (map vec (partition 3 [1 2 3 4 5 6 7 8 9])))
  [[1 2 3]
   [4 5 6]
   [7 8 9]]

   I have a map that represents provinces and seats, like this:
   {p1 5, p2 8, p3 13, p4 11}

   Which means that in p1 5 seats will be distributed, 8 for p2, and
   so on.

   And a vector where its elements are vectors formed by a political
   party, a province and the votes he got. Like this:
   [[A p1 32] [B p1 55] [A p2 77] [B p2 21] ...]

   I need, for each province, to distribute the seats among the parties
   according to the number of votes following this rule:

   For each party, i should get a lazy sequence with the values of:
   #votes/1, #votes/2, #votes/3, #votes/4, ...

   So, in this example, for the p1 province I would have:
   For A party: 32, 16, 32/3, 8, ...
   And for B party: 55, 55/2, 55/3, 55/4, ...

  (map #(/ votes %) (iterate inc 1))

   I'm not familiar with Clojure, and I don't know how to use many
   functions. Any reference to high-level functions that I should use,
   and how to use them will be appreciated.

  Hope the above gets you started. Obviously it won't do any more than
  that -- partly because I don't have much time right now and partly
  because I suspect I might be doing your homework for you if I went
  much further. :)

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Ah-hah! Clojure is a Lisp

2010-12-20 Thread Steve
On Tuesday, December 21, 2010 4:47:56 AM UTC+11, Ken Wesson wrote:

 But some of this underlying-philosophy stuff still seems to be locked
 up in videos and presentations in disparate places, invisible to
 Google's search and not even all linked from one place (the closest to
 one place being scattered posts to this list). And apparently these


The short version is here: http://clojure.org/state 

- 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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Working with maps and vectors

2010-12-20 Thread Ken Wesson
On Mon, Dec 20, 2010 at 5:05 PM, Anclj anb...@gmail.com wrote:
 Thanks a lot for the fast reply!
 Now I have the vector as I wanted.

 I have been playing with your code: (map #(/ votes %) (iterate inc 1))

 user= (take 10 (map #(/ 100 %) (iterate inc 1)))
 (100 50 100/3 25 20 50/3 100/7 25/2 100/9 10)

 I have managed to put that in a lazy sequence:
 user= (def ls (lazy-seq (map #(/ 100 %) (iterate inc 1
 #'user/ls

Eh. (map #(/ votes %) (iterate inc 1)) itself produces a lazy
sequence, since map and iterate are lazy.

 I don't know how to filter and work with the vector  map in order to
 apply that function for each party, in each province.
 I have been trying to use the filter function but I get the following
 error:

 user= (filter #A [[A p1 32] [B p1 55] [A p2 77]
 [B p2 21]])
 java.lang.ClassCastException: java.util.regex.Pattern cannot be cast
 to clojure.lang.IFn

For this, you can just use #(= A %) as your predicate; there's no
need to use regex matching.

If you need a regex, use #(re-matches #pattern %) as your predicate,
instead of the regex itself.

 Thanks again and I will be posting any advances!

You're welcome.

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Ah-hah! Clojure is a Lisp

2010-12-20 Thread Ken Wesson
On Mon, Dec 20, 2010 at 4:49 PM, Mike Meyer
mwm-keyword-googlegroups.620...@mired.org wrote:
 On Mon, 20 Dec 2010 16:27:11 -0500
 Ken Wesson kwess...@gmail.com wrote:

 On Mon, Dec 20, 2010 at 3:00 PM, Mike Meyer
 mwm-keyword-googlegroups.620...@mired.org wrote:
  On Mon, 20 Dec 2010 19:26:49 +0100
  Meikel Brandmeyer m...@kotka.de wrote:
  http://clojure.googlegroups.com/web/AreWeThereYet.pdf
 
  Thanks for the link.
 
  To bad it made Tufte kill a kitten. I had forgotten there was a
  textual representation with a lower information density per bit than
  video.

 Did you mean a higher information density per bit?

 No, I meant lower.

But I just explained how a bloated presentation of the same
information has a lower (useful) information density per bit than does
a textual one.

 O ascii ribbon campaign - stop html mail - www.asciiribbon.org

This is a bit ironic in context. You appear to champion big clunky
video and pdf files in place of html+inline images documentation on
the web, but for email, the lighter the better? That seems a little
bit inconsistent to me. :)

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Ah-hah! Clojure is a Lisp

2010-12-20 Thread Ken Wesson
On Mon, Dec 20, 2010 at 5:18 PM, Steve stephen.a.lind...@gmail.com wrote:
 On Tuesday, December 21, 2010 4:47:56 AM UTC+11, Ken Wesson wrote:

 But some of this underlying-philosophy stuff still seems to be locked
 up in videos and presentations in disparate places, invisible to
 Google's search and not even all linked from one place (the closest to
 one place being scattered posts to this list). And apparently these

 The short version is here: http://clojure.org/state

Thanks; I'll check it out.

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Ah-hah! Clojure is a Lisp

2010-12-20 Thread javajosh


On Dec 20, 10:53 am, Aaron Bedra aaron.be...@gmail.com wrote:
 On 12/20/10 1:47 PM, Ken Wesson wrote:

  On Mon, Dec 20, 2010 at 1:42 PM, Aaron Bedraaaron.be...@gmail.com  wrote:
  On 12/20/10 1:39 PM, Ken Wesson wrote:
  On Mon, Dec 20, 2010 at 1:26 PM, Meikel Brandmeyerm...@kotka.de    
  wrote:
  Hi,

  if you prefer text over talk:

 http://clojure.googlegroups.com/web/AreWeThereYet.pdf
  *giggle*

  It figures.

  I ask for text instead of video so, naturally, I get a PDF link.

  *falls over laughing*
  You have asked others not to reply to you in the same tone you are taking
  here.  This was a sincere effort to help.  Please show a little bit more
  respect.
  I'm sorry, but it's just hilarious the lengths some people apparently
  go to to avoid plain text/html that you don't need a special browser
  plugin and a multimegabyte download to view. All those video links and
  then, when someone finally points to a textual summary for one of
  them, it's a pdf! It's tragicomic. :)

 If you think it is funny that's absolutely your opinion to keep.  It has
 no place or constructive worth on this mailing list.  Please keep this
 kind of response off the list.

Agreed.

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


'case' macro problem when clause is a type

2010-12-20 Thread Stephen Pardue
Hello Clojure land!
I am writing a function that I just realized that I could implement
using multi methods (I think).
However, I will describe the problem anyways.

I want to be able to call a function that will take different actions
depending on the type of in the input.
I first wrote this function.
--
(defn panda [x]
(case (type x)
java.lang.String HELLZ YEAH IT'S A STRING!
java.lang.Integer it's an integer..))
--
Here is the output of when I test the function.
--
user= (panda 6)
java.lang.IllegalArgumentException: No matching clause: class
java.lang.Integer
(NO_SOURCE_FILE:0)
user= (panda apple)
java.lang.IllegalArgumentException: No matching clause: class
java.lang.String (
NO_SOURCE_FILE:0)
--
An error gets thrown even though I provided a matching clause. I
believe it has something to do with the 'case' macro but I am
probably wrong.
I rewrote the function as so:
--
(defn panda-2 [x]
(let [xType (type x)]
(cond
(= java.lang.String xType) HELLZ YEAH IT'S A STRING!
(= java.lang.Integer xType) it's an integer...)))
--
It works as expected but I would really like to be able to use the
'case' macro instead because it would make my code prettier and I like
pretty code.
Thank you for your time!



-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: 'case' macro problem when clause is a type

2010-12-20 Thread David Nolen
On Mon, Dec 20, 2010 at 10:54 PM, Stephen Pardue
pardue.step...@gmail.comwrote:

 (defn panda-2 [x]
(let [xType (type x)]
(cond
(= java.lang.String xType) HELLZ YEAH IT'S A STRING!
(= java.lang.Integer xType) it's an integer...)))


You should take a look at condp.

If you find yourself dispatching on type a lot and performance is of the
essence then you should take a look at deftype/record and protocols.

If generality is more important (dispatching on more than the first
argument), multimethods are great.

David

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Ah-hah! Clojure is a Lisp

2010-12-20 Thread Ken Wesson
On Mon, Dec 20, 2010 at 10:39 PM, javajosh javaj...@gmail.com wrote:


 On Dec 20, 10:53 am, Aaron Bedra aaron.be...@gmail.com wrote:
 On 12/20/10 1:47 PM, Ken Wesson wrote:

  On Mon, Dec 20, 2010 at 1:42 PM, Aaron Bedraaaron.be...@gmail.com  wrote:
  On 12/20/10 1:39 PM, Ken Wesson wrote:
  On Mon, Dec 20, 2010 at 1:26 PM, Meikel Brandmeyerm...@kotka.de    
  wrote:
  Hi,

  if you prefer text over talk:

 http://clojure.googlegroups.com/web/AreWeThereYet.pdf
  *giggle*

  It figures.

  I ask for text instead of video so, naturally, I get a PDF link.

  *falls over laughing*
  You have asked others not to reply to you in the same tone you are taking
  here.  This was a sincere effort to help.  Please show a little bit more
  respect.
  I'm sorry, but it's just hilarious the lengths some people apparently
  go to to avoid plain text/html that you don't need a special browser
  plugin and a multimegabyte download to view. All those video links and
  then, when someone finally points to a textual summary for one of
  them, it's a pdf! It's tragicomic. :)

 If you think it is funny that's absolutely your opinion to keep.  It has
 no place or constructive worth on this mailing list.  Please keep this
 kind of response off the list.

 Agreed.

But that would leave people with the misleading impression that a pdf
file is an adequate choice, even when I'm on my mobile ...

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Native Clojure

2010-12-20 Thread Sunil S Nandihalli
Hi Konrad,

Have you tried giws (spelt opposite of swig) .. it automatically generates
all the necessary jni stuff necessary for any java-class .. It takes an xml
file as input and generates any necessary jni-wrappers .. It can only acess
the class member-functions not member-values.   I have tried it .. it is
really nice .. all one would have to do is just generate an xml file for the
class under consideration.. but I have only looked at it from the point of
view of calling java/clojure code from c/c++ .. not the other way around ..
it was infact designed for that purpose.. This is what enable scilab to
acess some of the java functionality in scipy. you may want to look at it...

http://www.scilab.org/products/other/giws

http://www.scilab.org/products/other/giwsIt is very seamless once you have
the xml file .. but it can be easily generated using reflection in java ..
so is not much of an issue..

Sunil.

On Tue, Dec 21, 2010 at 1:53 AM, Konrad Hinsen
konrad.hin...@fastmail.netwrote:

 On 20 Dec 2010, at 18:19, Ken Wesson wrote:

  Is it really necessary, though? Hotspot's JIT yields up
 native-ballpark speeds when you really need them, if you optimize your
 code appropriately.


 For me, a native-code implementation of Clojure would be of interest for
 interfacing with libraries written in C, C++, and Fortran. The same goal
 could probably be achieved otherwise (compiling Java bytecode to native
 code, or simply a JVM with a better native interface than JNI), but at the
 moment I see no satisfying solution.

 Konrad.


 --
 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 to
 clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en


-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: 'case' macro problem when clause is a type

2010-12-20 Thread Kevin Downey
user (type 'java.lang.Integer)
clojure.lang.Symbol
user

the docs for case say the test constants are not evaluated.

On Mon, Dec 20, 2010 at 8:16 PM, David Nolen dnolen.li...@gmail.com wrote:
 On Mon, Dec 20, 2010 at 10:54 PM, Stephen Pardue pardue.step...@gmail.com
 wrote:

 (defn panda-2 [x]
    (let [xType (type x)]
        (cond
            (= java.lang.String xType) HELLZ YEAH IT'S A STRING!
            (= java.lang.Integer xType) it's an integer...)))

 You should take a look at condp.
 If you find yourself dispatching on type a lot and performance is of the
 essence then you should take a look at deftype/record and protocols.
 If generality is more important (dispatching on more than the first
 argument), multimethods are great.
 David

 --
 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 to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en



-- 
And what is good, Phaedrus,
And what is not good—
Need we ask anyone to tell us these things?

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Ah-hah! Clojure is a Lisp

2010-12-20 Thread Sean Corfield
On Mon, Dec 20, 2010 at 8:23 PM, Ken Wesson kwess...@gmail.com wrote:
 But that would leave people with the misleading impression that a pdf
 file is an adequate choice, even when I'm on my mobile ...

It's a perfectly adequate choice on my mobile... I read PDFs all the
time on my phone.

(sorry, I've been trying really hard not to respond to Ken's posts but
in the end I just couldn't help myself!)
-- 
Sean A Corfield -- (904) 302-SEAN
Railo Technologies, Inc. -- http://getrailo.com/
An Architect's View -- http://corfield.org/

If you're not annoying somebody, you're not really alive.
-- Margaret Atwood

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: 'case' macro problem when clause is a type

2010-12-20 Thread Sean Corfield
On Mon, Dec 20, 2010 at 7:54 PM, Stephen Pardue
pardue.step...@gmail.com wrote:
 (defn panda [x]
    (case (type x)
        java.lang.String HELLZ YEAH IT'S A STRING!
        java.lang.Integer it's an integer..))

Since (type x) returns a Class object, you could do this:

user= (defn panda[x] (case (.getName (type x))
java.lang.String HELLZ YEAH IT'S A STRING!
java.lang.Integer it's an integer..))
#'user/panda
user= (panda 6)
it's an integer..
user= (panda apple)
HELLZ YEAH IT'S A STRING!
user=
-- 
Sean A Corfield -- (904) 302-SEAN
Railo Technologies, Inc. -- http://getrailo.com/
An Architect's View -- http://corfield.org/

If you're not annoying somebody, you're not really alive.
-- Margaret Atwood

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Ah-hah! Clojure is a Lisp

2010-12-20 Thread Ken Wesson
On Tue, Dec 21, 2010 at 12:16 AM, Sean Corfield seancorfi...@gmail.com wrote:
 On Mon, Dec 20, 2010 at 8:23 PM, Ken Wesson kwess...@gmail.com wrote:
 But that would leave people with the misleading impression that a pdf
 file is an adequate choice, even when I'm on my mobile ...

 It's a perfectly adequate choice on my mobile... I read PDFs all the
 time on my phone.

Well, that's interesting. But not all of us either have mobiles that
have pdf readers or have a mobile plan that won't have us in the
poorhouse if we download a multi-megabyte file on it. Not to mention,
some of us will be sitting there staring at a download progress that
crawls slowly over hours with files that size on our mobiles. And some
of us have just the kind of luck that would see the battery run out
just before the download would have finished. :)

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: 'case' macro problem when clause is a type

2010-12-20 Thread David Nolen
On Tue, Dec 21, 2010 at 12:23 AM, Sean Corfield seancorfi...@gmail.comwrote:

 On Mon, Dec 20, 2010 at 7:54 PM, Stephen Pardue
 pardue.step...@gmail.com wrote:
  (defn panda [x]
 (case (type x)
 java.lang.String HELLZ YEAH IT'S A STRING!
 java.lang.Integer it's an integer..))

 Since (type x) returns a Class object, you could do this:

 user= (defn panda[x] (case (.getName (type x))
 java.lang.String HELLZ YEAH IT'S A STRING!
 java.lang.Integer it's an integer..))
 #'user/panda
 user= (panda 6)
 it's an integer..
 user= (panda apple)
 HELLZ YEAH IT'S A STRING!
 user=
 --
 Sean A Corfield -- (904) 302-SEAN
 Railo Technologies, Inc. -- http://getrailo.com/
 An Architect's View -- http://corfield.org/

 If you're not annoying somebody, you're not really alive.
 -- Margaret Atwood


But of course that will use reflection which probably defeats the purpose of
using case which dispatches very quickly.

David

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

parallel colt vs. colt

2010-12-20 Thread Sunil S Nandihalli
Hello everybody,
   I was under the impression that parallel colt is a parallelized subset of
colt libraries. but it seems like colt has less functionality than parallel
colt libraries.. Am I missing something?
Sunil.

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: 'case' macro problem when clause is a type

2010-12-20 Thread Stephen Pardue
How about a macro like this?
--
(defmacro my-case [e  clauses]
`(condp = ~e
~...@clauses))
--
(defn panda-3 [x]
(my-case (type x)
java.lang.String HELLZ YEAH IT'S A STRING!
java.lang.Integer it's an integer...))
--
I'll just stick with condp though. Thanks David.

On Tue, Dec 21, 2010 at 12:45 AM, David Nolen dnolen.li...@gmail.comwrote:

 On Tue, Dec 21, 2010 at 12:23 AM, Sean Corfield seancorfi...@gmail.comwrote:

 On Mon, Dec 20, 2010 at 7:54 PM, Stephen Pardue
 pardue.step...@gmail.com wrote:
  (defn panda [x]
 (case (type x)
 java.lang.String HELLZ YEAH IT'S A STRING!
 java.lang.Integer it's an integer..))

 Since (type x) returns a Class object, you could do this:

 user= (defn panda[x] (case (.getName (type x))
 java.lang.String HELLZ YEAH IT'S A STRING!
 java.lang.Integer it's an integer..))
 #'user/panda
 user= (panda 6)
 it's an integer..
 user= (panda apple)
 HELLZ YEAH IT'S A STRING!
 user=
 --
 Sean A Corfield -- (904) 302-SEAN
 Railo Technologies, Inc. -- http://getrailo.com/
 An Architect's View -- http://corfield.org/

 If you're not annoying somebody, you're not really alive.
 -- Margaret Atwood


 But of course that will use reflection which probably defeats the purpose
 of using case which dispatches very quickly.

 David

 --
 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 to
 clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en


-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: parallel colt vs. colt

2010-12-20 Thread Konrad Hinsen

On 21 Dec 2010, at 06:57, Sunil S Nandihalli wrote:

   I was under the impression that parallel colt is a parallelized  
subset of colt libraries. but it seems like colt has less  
functionality than parallel colt libraries.. Am I missing something?


My impression is the same as yours. Parallel Colt is an extension of  
Colt that adds more than just parallelism.


Konrad.

--
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Native Clojure

2010-12-20 Thread Konrad Hinsen

On 20 Dec 2010, at 21:43, Michael Glaesemann wrote:

For me, a native-code implementation of Clojure would be of  
interest for interfacing with libraries written in C, C++, and  
Fortran. The same goal could probably be achieved otherwise  
(compiling Java bytecode to native code, or simply a JVM with a  
better native interface than JNI), but at the moment I see no  
satisfying solution.


Have you looked at JNA? https://jna.dev.java.net/


Not much myself, but I talked to someone who explored it more in- 
depth. He found some feature missing that was important for his  
application, but I don't remember what exactly it was. I'll have to  
explore myself...


On 21 Dec 2010, at 05:42, Sunil S Nandihalli wrote:

Have you tried giws (spelt opposite of swig) .. it automatically  
generates all the necessary jni stuff necessary for any java- 
class .. It takes an xml file as input and generates any necessary  
jni-wrappers .. It can only acess the class member-


GIWS is new to me, I'll have a look!

Konrad.

--
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en