Hi Patrick,
Sorry for requesting code you already posted.
I'm quite unsure about what functions (in particular get-key-instance)
should do.
Btw there's two easy ways to test if a collection is empty in clojure
(rather than (= 0 (count coll))):
(empty? coll) ;; true when empty
or (seq coll) ;;
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
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 pos
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 m
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 an
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 ste
> 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 me
I have a library called FnParse, and I'm wondering if I should rewrite
it using monads. (You can see FnParse's documentation at and its implementation at .) It implements a bunch of "rule functions" that consume
tokens:
Sequence of tokens -> [a new product from the consumed tokens,
remaining to
On Apr 27, 5:51 pm, Boris Mizhen 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 (.method object
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, simi
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 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 passed just li
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 wrote:
> Hi,
>
> Am 27.
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
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.
--~--~-~--~~--
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,
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 de.
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]
a
New patch with corrections posted to google code,
regards,
--
laurent
2009/4/27 Laurent PETIT :
> 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 bit.
>
> Howard, my
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 mappi
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 .vi
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))
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 be
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:
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 i
On Apr 27, 11:22 am, Christophe Grand 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 following:
(any? o
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 loa
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
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 correspondi
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 wrote
On Mon, Apr 27, 2009 at 11:22 AM, Christophe Grand
wrote:
>
> find-first-result is already in core: some
Ya know, I was considering not posting my code. But the thought did
occur to me that someone might point out it wasn't necessary. Thanks!
> Mark Volkmann a écrit :
>> find-first in seq_utils
Thanks again!
On Apr 27, 6:41 pm, Richard Lyman wrote:
> There's a section on the wiki with almost the exact same title:
>
> http://en.wikibooks.org/wiki/Clojure_Programming/Examples#Invoking_Ja...
>
> If I'm understanding the question correctly that should do what you're
> wanting to do.
>
> -R
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
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
screenc
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, i
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,
I forgot to say that I have:
let clj_want_gorilla = 1
in my .vimrc
On Apr 27, 12:08 pm, Meikel Brandmeyer 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. After a
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 11:
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
com.martiansof
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 t
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 wrote:
>
> Is there any way you could record the presentation and post it on your
> site?
>
>
> On Mon, A
2009/4/27 Christophe Grand :
>
> 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 item) instead o
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
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 shou
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
smime.p7
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=> (find-first-r
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
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 a
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 (filte
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 wrote:
>
> If you are interested in Google AppEngine and live in the Atlanta
> area ...
>
> Tuesday - Clojure
>
> * Who: John Hum
On Apr 27, 3:49 am, fft1976 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 instead.
-Stuart Sier
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
Wikipedi
The CLojureCLR code was my contribution. I'm still working on it.
AFAIK, no one else is. After I get the next release out, I hope some
others might be tempted to get involved.
I almost had the CLR version working on the new lazy code, but ran
into a change that Rich made (allowing a user-speci
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 character
Hi,
As a side note, do you know that (as far as I understand your need),
what you're trying to achieve already exists and is called memoize :
http://clojure.org/api#toc366
HTH,
--
Laurent
2009/4/27 Tzach :
>
> Hi all
> I’m playing on a mechanism for function call results caching.
> This can
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 the REPL, it seems to
Hi all
I’m playing on a mechanism for function call results caching.
This can be used to improve performance in case of a complex or
remote function call.
The basic idea is as follow:
;; The cache is implement as a global map. Function arguments are the
key, the return result is the value.
(def
On Apr 27, 2009, at 6:19 AM, Mark Derricutt wrote:
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})))
Since Clojure seems like feature complete for 1.0 release, I am
starting to be curious what are the features planned for after 1.0
release?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to t
Could the documentation at http://clojure.org/refs be updated to
reflect the latest laziness changes? fnseq has been removed and
there's no mention anywhere of how to modify the code. Thank you!
--~--~-~--~~~---~--~~
You received this message because you are subs
I though the screen cast was really very good,especially as it gives a
good overview of how to break up your code and about packaging. It
does go a bit quick, but I found that by re-watching + reading the
code at the same time very helpful. It a useful demo to see the power
and conciseness of cloj
If you are interested in Google AppEngine and live in the Atlanta
area ...
Tuesday - Clojure
* Who: John Hume
* What: Clojure on Google AppEngine
* When: Tuesday, April 28th at 7pm
* Where: Norcross Group — 135 Technology Parkway,
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 g
Well, I came up with something similar over the weekend, longer notes
about it here:
http://ianp.org/2009/04/embedding-clojure-in-an-existi
Also, since writing thse notes down I've worked out getting my app
data into Clojure; that, combined with Christophe's notes about and
I'm pretty much s
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 7:08
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
fft1976 a écrit :
>
> On Apr 26, 9:21 am, Stuart Sierra 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.
--~--~-~--~~~--
On Apr 26, 9:21 am, Stuart Sierra 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 received this message because you are subscribed to the Google Groups
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"
sh
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: " clojure/contrib/str_uti
http://clojure.org/api#remove-ns ??
i never used it but it seems to do it ;-)
On 27 abr, 06:08, Mark Derricutt wrote:
> Is it possible to unload/remove a namespace at runtime at all?
>
> Mark
>
> ...and then Buffy staked Edward. The End.
--~--~-~--~~~---~--~~
You
70 matches
Mail list logo