Re: special handling of :type in meta data

2009-04-27 Thread Konrad Hinsen
On 27.04.2009, at 00:33, David Chamberlin wrote: I can get round this by not using a structure map for the metadata, but since I'm going to be creating container loads of these structures I understand that I need to be using struct-maps for efficiency. Is there a reason why this should not

Re: Unloading a namespace?

2009-04-27 Thread atreyu
http://clojure.org/api#remove-ns ?? i never used it but it seems to do it ;-) On 27 abr, 06:08, Mark Derricutt m...@talios.com wrote: Is it possible to unload/remove a namespace at runtime at all? Mark ...and then Buffy staked Edward.  The End.

Re: Getting slime-edit-definition to work with Clojure

2009-04-27 Thread Baishampayan Ghose
Phil, It works for me. Are you trying to look up a built-in clojure function or one from your own application? How did you install SLIME and swank-clojure etc? It doesn't work for either. When I try looking up a clojure-contrib function, I get let*: Search failed:

Re: special handling of :type in meta data

2009-04-27 Thread Meikel Brandmeyer
Hi Konrad, Am 27.04.2009 um 08:44 schrieb Konrad Hinsen: As for efficiency, I doubt that struct maps make that much of a difference, but I didn't do any timings. AFAIU, struct-maps are not an optimisation for efficiency of the key lookup, but for the storage space of the keys. So timings

Re: How to call function (or Java method) using string name?

2009-04-27 Thread Christophe Grand
fft1976 a écrit : On Apr 26, 9:21 am, Stuart Sierra the.stuart.sie...@gmail.com wrote: resolve will find the Var that is named by the symbol. Can there be Vars without names? Can I have a vector of Vars? You can, see with-local-vars for example.

Re: special handling of :type in meta data

2009-04-27 Thread Konrad Hinsen
On 27.04.2009, at 09:42, Meikel Brandmeyer wrote: AFAIU, struct-maps are not an optimisation for efficiency of the key lookup, but for the storage space of the keys. So timings should probably read memstats. If memory is the issue, then creating a single instance of the metadata map for

Re: Unloading a namespace?

2009-04-27 Thread Mark Derricutt
Well that was a simple answer ;-) That should help with using clojure in OSGi, having a way to trigger an unload when a bundle dissapears should get around the problem of coercing everything to use the same classloader. I sense some more hacking in the near future :) On Mon, Apr 27, 2009 at

Oddity with clojure-contrib/sql

2009-04-27 Thread Mark Derricutt
Hey guys, Just started looking at clojure-contrib's sql namespace, however, using the following code: (let [user_id (.toString (java.util.UUID/randomUUID))] (sql/with-connection db (sql/insert-records :users {:user_id user_id}))) and clojure-contrib-1.0-20090421.092453-8.jar seems to

Re: 32-bit Unicode character literals

2009-04-27 Thread Christophe Grand
samppi a écrit : I see. Does this mean that, if I expect to handle 32-bit characters, then I need to consider changing my character-handling functions to accept sequences of vectors instead? Also, how does (seq \ud800\udc00) work? Does it split the character into two 16-bit characters? In

Re: 32-bit Unicode character literals

2009-04-27 Thread Stephen C. Gilardi
On Apr 27, 2009, at 10:07 AM, samppi wrote: I see. Does this mean that, if I expect to handle 32-bit characters, then I need to consider changing my character-handling functions to accept sequences of vectors instead? The blog post touches on this and searching around on Google and

Re: How to call function (or Java method) using string name?

2009-04-27 Thread Stuart Sierra
On Apr 27, 3:49 am, fft1976 fft1...@gmail.com wrote: Can there be Vars without names? Can I have a vector of Vars? Vars always have names, but you can create temporary Vars using with- local-vars. If you want to create a vector of unnamed, mutable objects, you probably want Refs or Atoms

Re: AppEngine in Atlanta this week

2009-04-27 Thread Robert Campbell
Is there any way you could record the presentation and post it on your site? On Mon, Apr 27, 2009 at 1:36 PM, slc sari.conn...@gmail.com wrote: If you are interested in Google AppEngine and live in the Atlanta area ... Tuesday - Clojure    

similar to find-first

2009-04-27 Thread Mark Volkmann
find-first in seq_utils returns the first item in a collection where (pred item) returns logical true. I needed a function that returns the result of (pred item) instead of item. This seems to do the trick. Maybe this should be added to seq_utils. (defn find-first-result [fn coll] (first

Re: The Path to 1.0

2009-04-27 Thread David Andrews
Rich, refer to the patch described by Stephen Gilardi at http://groups.google.com/group/clojure/msg/2b7dd55d9f766125 (which makes it possible to run Clojure under z/OS). Based on Steve and Laurent PETIT's comments in that thread, I gather that the UTF-8 vs platform-default issue has been around

vimclojure help

2009-04-27 Thread jim
Meikel, I'm having a heck of a time getting started with VimClojure and it's probably all due to my lack of knowing vim. After a lot of poking, I got the plugin to load and got syntax highlighting working. I also have got some autocmd's in my .vimrc so that they're listed when I do a :map. I got

Re: similar to find-first

2009-04-27 Thread Laurent PETIT
Shouldn't this return nil ? : 1:4 user= (find-first-result false? [true]) false Maybe this definition of find-first-result may fill the gap: (defn find-first-result [pred coll] (find-first identity (map pred coll))) = 1:22 user= (find-first-result false? [true]) nil 1:23 user=

Re: Oddity with clojure-contrib/sql

2009-04-27 Thread Stephen C. Gilardi
On Apr 27, 2009, at 9:57 AM, Stephen C. Gilardi wrote: As a result of your report, I'm working on adding better error reporting on BatchUpdateException and SQLException to clojure.contrib.sql. I've added this in SVN Revision 720 of clojure-contrib. Comments welcome. --Steve

Re: similar to find-first

2009-04-27 Thread Christophe Grand
find-first-result is already in core: some Mark Volkmann a écrit : find-first in seq_utils returns the first item in a collection where (pred item) returns logical true. I needed a function that returns the result of (pred item) instead of item. This seems to do the trick. Maybe this should

typo in clojure.org sequences page

2009-04-27 Thread Laurent PETIT
The sequence page ( http://clojure.org/sequences ) reads : (rest coll) Returns a seq of the items after the first. Calls seq on its argument. If there are no more items, returns nil. It should state , ... returns (). HTH, -- Laurent --~--~-~--~~~---~--~~ You

Re: similar to find-first

2009-04-27 Thread Laurent PETIT
2009/4/27 Christophe Grand christo...@cgrand.net: find-first-result is already in core: some OH! yes :-$ Mark Volkmann a écrit : find-first in seq_utils returns the first item in a collection where (pred item) returns logical true. I needed a function that returns the result of (pred

Re: AppEngine in Atlanta this week

2009-04-27 Thread Sari Connard
We will attempt to record the AppEngine Clojure talk. If it turns out ok, it will be posted on youtube and I will link to it from atlclj.org On Mon, Apr 27, 2009 at 10:15 AM, Robert Campbell rrc...@gmail.com wrote: Is there any way you could record the presentation and post it on your site?

Re: vimclojure help

2009-04-27 Thread Meikel Brandmeyer
Hi Jim, Am 27.04.2009 um 18:08 schrieb jim: I'm having a heck of a time getting started with VimClojure and it's probably all due to my lack of knowing vim. After a lot of poking, I got the plugin to load and got syntax highlighting working. I also have got some autocmd's in my .vimrc so that

Re: vimclojure help

2009-04-27 Thread jim
Thanks for the response. Here's specifically what's happening: I have vim 7.2, according to the :version command in gvim I start the nailgun server with: java -cp /home/jim/clojure/clojure.jar:/home/jim/clojure/ clojure.contrib/clojure-contrib.jar:/home/jim/clojure/vimclojure.jar

Re: How to call function (or Java method) using string name?

2009-04-27 Thread Richard Lyman
There's a section on the wiki with almost the exact same title: http://en.wikibooks.org/wiki/Clojure_Programming/Examples#Invoking_Java_method_through_method_name_as_a_String If I'm understanding the question correctly that should do what you're wanting to do. -Rich On Sun, Apr 26, 2009 at

Re: vimclojure help

2009-04-27 Thread jim
I forgot to say that I have: let clj_want_gorilla = 1 in my .vimrc On Apr 27, 12:08 pm, Meikel Brandmeyer m...@kotka.de wrote: Hi Jim, Am 27.04.2009 um 18:08 schrieb jim: I'm having a heck of a time getting started with VimClojure and it's probably all due to my lack of knowing vim.

Re: vimclojure help

2009-04-27 Thread jim
I forgot to say that I have: let clj_want_gorilla = 1 let vimclojure#NailgunClient = /home/jim/clojure/ng in my .vimrc file. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group,

Re: Abstract data types in functional languages

2009-04-27 Thread David Nolen
For anybody who's still following, I've updated accessors.clj with a new behavior. I realized assoc-in and get-in are very powerful, they work with all sorts of collections (not just maps, duh on my part), thus now if anything in the list of accessor symbols is not actually a clojure.lang.Symbol,

Re: PeepCode screencast

2009-04-27 Thread Paul Barry
Yeah, I agree that it was pretty good. I like that you have a non-trivial working application at the end of it. My one criticism is that it's too hard to try to follow along and write the code as you go because there are too many changes from each step to step that aren't discussed in the

Re: PeepCode screencast

2009-04-27 Thread Andrew Wagner
I can agree with that, for the most part. But if you've been doing clojure for a while, why cover basic syntax, basic map/reduce stuff, etc.? The time could have been spent more usefully. It just failed to pick an audience and stick with it, that's all. On Mon, Apr 27, 2009 at 2:45 PM, Paul Barry

Re: Oddity with clojure-contrib/sql

2009-04-27 Thread Mark Derricutt
The table def was: CREATE TABLE users ( user_id VARCHAR(255) NOT NULL, msisdn VARCHAR(255), date_created timestamp with time zone NOT NULL, date_verified timestamp with time zone NOT NULL ); I'll try to build it up as a test case tonight. On Tue, Apr 28, 2009 at 1:57 AM, Stephen C. Gilardi

Stack Overflow problem with Maps

2009-04-27 Thread fitzpatrick...@googlemail.com
Hi, I am working with a very long list and populating it to a map. What i have is three pieces of data from the list; -Row Number -Heading info List -Actual Info List note: both the Heading Info List and Actual Info List have the same number of elements as each heading name will have a

Re: vimclojure help

2009-04-27 Thread Meikel Brandmeyer
Hi, Am 27.04.2009 um 19:56 schrieb jim: I forgot to say that I have: let clj_want_gorilla = 1 let vimclojure#NailgunClient = /home/jim/clojure/ng in my .vimrc file. That's clear. Otherwise you wouldn't have the mapping in the :map output. I'm a bit confused about the beep... There is no

Re: vimclojure help

2009-04-27 Thread jim
The lack of error message stuck me as well. The result of :messages simply lists Bram Molenaar as the messages maintainer. I also mapped \ab to a so that it would enter insert mode and that worked fine. So I don't think it's a problem with the mapping. I'm guessing the plugin isn't fully loaded

Re: similar to find-first

2009-04-27 Thread billh04
On Apr 27, 11:22 am, Christophe Grand christo...@cgrand.net wrote: find-first-result is already in core: some As an aside, I would have liked (some pred coll) to return the item that makes the pred true and the current implementation of `some to be renamed `any? so that we would have the

Re: Stack Overflow problem with Maps

2009-04-27 Thread David Nolen
Can you post your code, always helpful :) On Mon, Apr 27, 2009 at 4:07 PM, fitzpatrick...@googlemail.com fitzpatrick...@googlemail.com wrote: Hi, I am working with a very long list and populating it to a map. What i have is three pieces of data from the list; -Row Number -Heading info

Re: Stack Overflow problem with Maps

2009-04-27 Thread Dimiter malkia Stanev
Unless you provide some kind of isolated source code that reproduces the problem, I don't think it is going to be easy to help you out. But try adding (doall ..) to some your map calls and others. Even better, look at this excellent explanation why this might be happening by Cristophe Grand:

areduce flaw

2009-04-27 Thread Boris Mizhen
Hello all, It seems to me that areduce can not be used with an anonymous array. Consider: (areduce (.. System getProperties values toArray) i r 0 (some_expression)) It seems to me that there is no way to get i'th element of the array in (some_expression) other than let'-ing it first. It would

Re: Stack Overflow problem with Maps

2009-04-27 Thread pjfitz
Hi, Here is the code. Each row of data is a string with @ between the three types of data i mentioned. -Row Number -Heading info List -Actual Info List The Heading Info List is created by splitting on , as is the Actual info list. tks, PJ (import '(java.io InputStreamReader OutputStreamWriter))

Re: vimclojure help

2009-04-27 Thread jim
I think in my attempt to fix the problem, I masked a symptom. When I saw that I didn't have the key mappings, I added some autocmds to my .vimrc. From reading the vim plugin, I believe those should have been generated automatically when a *.clj file is loaded. Removing those autocmds from the

Re: vimclojure help

2009-04-27 Thread Meikel Brandmeyer
Hi, Am 27.04.2009 um 22:18 schrieb jim: The lack of error message stuck me as well. The result of :messages simply lists Bram Molenaar as the messages maintainer. I also mapped \ab to a so that it would enter insert mode and that worked fine. So I don't think it's a problem with the mapping.

Re: The Path to 1.0

2009-04-27 Thread Laurent PETIT
New patch with corrections posted to google code, regards, -- laurent 2009/4/27 Laurent PETIT laurent.pe...@gmail.com: I've created issue 110 with the patch attached in clojure's google code project. Hi Rich, Howard, I'll answer to both at the same time, trying to reconcile things a

Re: areduce flaw

2009-04-27 Thread Boris Mizhen
I suspect I will be asking more questions, so in order not to start another thread I will post below :) Why ((comp - +) -3 -4) = 7 but ((comp Math/abs +) -3 -4) = Error? java.lang.Exception: No such namespace: Math (NO_SOURCE_FILE:1) [Thrown class clojure.lang.Compiler$CompilerException]

Re: vimclojure help

2009-04-27 Thread Meikel Brandmeyer
Hi, Am 27.04.2009 um 22:50 schrieb jim: Reading the vimclojure plugin, I see that it checks for the existence of b:vimclojure_namespace before adding those mappings. When I do a :echo b:vimclojure_namespace, I get an undefined variable error. Please try the following from outside vim: ng

Re: areduce flaw

2009-04-27 Thread Meikel Brandmeyer
Hi, Am 27.04.2009 um 23:17 schrieb Boris Mizhen: ((comp #(Math/abs %) +) -3 -4) = 7 How can I pass a static java function to another function? Here you already gave the answer to your question. Wrap it in a Clojure fn/#(). A member function must be trickier because this must be supplied,

hashmap default values

2009-04-27 Thread Mark Volkmann
Is there something in core or contrib that supports creating a map where gets on undefined keys return a specified default value? For example, I'd like to create a hashmap where the default value for missing keys is zero. -- R. Mark Volkmann Object Computing, Inc.

Re: hashmap default values

2009-04-27 Thread Meikel Brandmeyer
Hi Mark, Am 27.04.2009 um 23:42 schrieb Mark Volkmann: Is there something in core or contrib that supports creating a map where gets on undefined keys return a specified default value? For example, I'd like to create a hashmap where the default value for missing keys is zero. You can specify

Re: areduce flaw

2009-04-27 Thread Boris Mizhen
Hi Meikel, thanks for the answer. I wonder if someone could explain or point me to the explanation about *why* a Java static fn can't be passed just like a closure fn? After all the syntax to call them is the same :) Thanks, Boris On Apr 27, 5:34 pm, Meikel Brandmeyer m...@kotka.de wrote:

Re: areduce flaw

2009-04-27 Thread Kevin Downey
no, the syntax is not the same. user= (macroexpand-1 '(.foo bar)) (. bar foo) On Mon, Apr 27, 2009 at 2:51 PM, Boris Mizhen bo...@boriska.com wrote: Hi Meikel, thanks for the answer. I wonder if someone could explain or point me to the explanation about *why* a Java static fn can't be

Re: special handling of :type in meta data

2009-04-27 Thread David Chamberlin
Konrad, Thanks for the guidance, this makes a lot of sense - I was planning to provide a method for printing these objects in the future anyway. A bit of background: I'm trying to put together a simple framework that uses structures to represent business-domain objects read from a database,

Re: areduce flaw

2009-04-27 Thread Stuart Sierra
On Apr 27, 5:51 pm, Boris Mizhen bo...@boriska.com wrote: I wonder if someone could explain or point me to the explanation about *why* a Java static fn can't be passed just like a closure fn? The only reason I can give you is that Java methods aren't first-class objects, like Clojure fns. The

Would it be worth rewriting a parser library to use monads?

2009-04-27 Thread samppi
I have a library called FnParse, and I'm wondering if I should rewrite it using monads. (You can see FnParse's documentation at http:// wiki.github.com/joshua-choi/fnparse and its implementation at http:// github.com/joshua-choi/fnparse/blob/

Re: areduce flaw

2009-04-27 Thread Timothy Pratley
How can I pass a static java function to another function? There is also memfn: (memfn name args) Macro Expands into code that creates a fn that expects to be passed an object and any args and calls the named instance method on the object passing the args. Use when you want to treat a Java

Re: Would it be worth rewriting a parser library to use monads?

2009-04-27 Thread jim
Monads are a great thing to learn because they can be used in so many ways to make code simpler and more modular. But, they require an investment of time to understand. You'll definitely be a better programmer by trying to understand them. I'd say go for it, but realize that it's going to be a

Re: vimclojure help

2009-04-27 Thread jim
That was exactly what I was reading through the vimclojure.vim plugin trying to find when I saw your post. It's a great thing to have when trying to trouble shoot problems because you can isolate the server. Anyway, I started over by wiping out my .vim and vimclojure-2.1.0 directories. Updated

Re: cannot use swig native shared libraries

2009-04-27 Thread jim
Hey Antonio, I'm getting a similar error. I wanted to call setuid from Clojure, so I followed this link's example: http://www2.sys-con.com/itsg/virtualcd/Java/archives/0510/Silverman/index.html to build a java class and a shared library. I added the class to my classpath and was able to import

Re: areduce flaw

2009-04-27 Thread Boris Mizhen
Thanks to all who replied. To summarize what I learned - Clojure has a special form (. ) to *call* java functions, but does not have concept of a *value* corresponding to a java function. This makes Java functions a second class citizen :) In addition special forms are expanded in the first

Re: Stack Overflow problem with Maps

2009-04-27 Thread Christophe Grand
Hi Patrick, Please provide some code. fitzpatrick...@googlemail.com a écrit : I iterate through the list and for each row look up each of the heading names in the Heading Info List to get an index of where a particular element should be in the Actual Info List and then i go and get this