I am trying to construct java object and assign it's fields from a map.
That is given Java object of class Something { long id; String name; }
and Clojure map {:id 12, :name Impostor}
I would like to set fields of java object to respective values from map.
Now, this works
(let [o (Something.)]
Hi,
you should go through the normal Clojure Vars to access the functions. To
actually call the functions you use invoke. Note: table is a macro, so you
can't call it directly. You have to use the table* function and do any sugar
provided by the table macro yourself. Here is an example how
On Tue, Jul 26, 2011 at 12:43 PM, mmwaikar mmwai...@gmail.com wrote:
Hi,
I am using the Lobos library - https://github.com/budu/lobos
In it there's a function create, which is called like this - (create db
(table :some-name)), where db is earlier defined as - (def db
{:classname
siyu798 siyu...@gmail.com writes:
Hi Siyu,
Your with-default fn is neat. So it appears there's no
idiomatic/built-in clojure fn/macro to do parsing and wrapper
functions such as follow would be needed to avoid typing the whole
expression every time.
(def parse-double (with-default
On Saturday, May 14, 2011 4:48:03 PM UTC-4, James Reeves wrote:
On 14 May 2011 20:49, Shree Mulay shree...@gmail.com wrote:
One final thought I had is I've noticed if I reload a page, the
session information is lost. How do we get around this?
You could use defonce to define an atom to
Use this function:
(defn ^java.lang.reflect.Field get-field
Return Field object
[^Class class ^String field-name]
(let [f (.getDeclaredField class field-name)]
(.setAccessible f true)
f))
(let [o (Something.)]
(set! (. o :id) 12)
(set! (. o :name) Impostor)
o)
...as
On Jul 26, 12:52 pm, Shantanu Kumar kumar.shant...@gmail.com wrote:
Use this function:
(defn ^java.lang.reflect.Field get-field
Return Field object
[^Class class ^String field-name]
(let [f (.getDeclaredField class field-name)]
(.setAccessible f true)
f))
(let [o
Hi Nick,
On 25 Jul 2011, at 23:55, cassiel wrote:
Not very practical, but if you want a safe transaction-free operation
on an atom which returns whether it was changed, you can perhaps hack
it by embedding the change state into the atom itself:
(def a (atom {:value 45 :changed? false}))
On Jul 25, 11:10 pm, Petr Gladkikh petrg...@gmail.com wrote:
I am trying to construct java object and assign it's fields from a map.
That is given Java object of class Something { long id; String name; }
and Clojure map {:id 12, :name Impostor}
I would like to set fields of java object to
On Tue, Jul 26, 2011 at 4:00 AM, Sam Aaron samaa...@gmail.com wrote:
However, it seems remarkably kludgy to encode the old value into the contract
of the atom and *all* update fns when really this could be achieved in a much
cleaner fashion with a version of swap! that returned a vec of new
Speaking of video hosting, could the videos also be uploaded to Vimeo?
(Is one person in charge of all the videos, presumably the one who
controls the blip.tv/clojure account?)
I like both services, but Blip.tv seems to have made video downloading
more difficult -- video download (and the lack of
Does anyone know how to create an autoincrementing ID field for a
table schema on Heroku?
It uses PostgreSQL and a common way for this DB is to create a
sequence and then take default ID's from this sequence. But I haven't
found a way to do something like that.
I know that rails migrations do
Hey Ken,
On 26 Jul 2011, at 09:45, Ken Wesson wrote:
This seems to have been left out:
(defn swap-and-also-return-old! [^clojure.lang.Atom a f]
(loop []
(let [v @a
nv (f v)]
(if (compare-and-set! a v nv)
[nv v]
(recur)
:)
Thanks for this :-)
On Tue, Jul 26, 2011 at 4:56 AM, Sam Aaron samaa...@gmail.com wrote:
Hey Ken,
Thanks for this :-)
You're welcome.
Actually I was just looking at compare-and-set! just now. This solution seems
nicer than Nick's 'place changed/old-val in atom' but still not particularly
clean as you have
Hi Sam,
an another hardcore solution:
(defn update!
[a f args]
(let [updated? (promise)
watch (fn [k a o n] (remove-watch a k) (deliver updated? (not= o
n)))]
(add-watch a (Object.) watch)
(apply swap! a f args)
@updated?))
But...
Am Dienstag, 26. Juli 2011 10:56:25
Hi again,
Am Dienstag, 26. Juli 2011 11:35:08 UTC+2 schrieb Meikel Brandmeyer:
(defn update!
[a f args]
(let [updated? (promise)
watch (fn [k a o n] (remove-watch a k) (deliver updated? (not= o
n)))]
(add-watch a (Object.) watch)
(apply swap! a f args)
On Tue, Jul 26, 2011 at 3:28 PM, Alan Malloy a...@malloys.org wrote:
On Jul 25, 11:10 pm, Petr Gladkikh petrg...@gmail.com wrote:
I am trying to construct java object and assign it's fields from a map.
That is given Java object of class Something { long id; String name; }
and Clojure map {:id
On Tue, Jul 26, 2011 at 6:02 AM, Petr Gladkikh petrg...@gmail.com wrote:
On Tue, Jul 26, 2011 at 3:28 PM, Alan Malloy a...@malloys.org wrote:
On Jul 25, 11:10 pm, Petr Gladkikh petrg...@gmail.com wrote:
I am trying to construct java object and assign it's fields from a map.
That is given Java
My motivation is need to construct list of Java objects and I would
like to have some concise syntax to write them. So I decided to do
this with maps.
Perhaps something like this:
(defn ^java.lang.reflect.Field get-field
Return Field object
[class-or-obj ^String field-name]
(let [c (if
Baishampayan Ghose posted this download link in another thread.
http://blip.tv/file/get/Richhickey-RichHickeyUnveilsClojureScript918.avi
On Tue, Jul 26, 2011 at 4:47 AM, Michel Alexandre Salim
michael.silva...@gmail.com wrote:
Speaking of video hosting, could the videos also be uploaded to
Clojure was my first Lisp, I learned it just after Rich's first vids came
out, but I hung up my hat as I prefer 1 language on all tiers(ajax on
client) for web apps. So, Clojurescript now presents me with the ability to
do that, and really piques my interest again in Clojure. I think this is a
Thanks Peter for sharing this.
Great workflow!
Cheers,
Hubert.
On Jul 26, 2011, at 6:59 AM, Peter Taoussanis wrote:
I would also love to know how you set this up in a little more detail. It
really sounds like an excellent approach…
Sure: it's not complicated! I'm writing this in a hurry
While tinkering with ClojureScript I've created sample that uses WebSockets to
communicate between Clojure and ClojureScript.
WebSocket support in closure-library is only in SVN for now, so current
bootstrap of ClojureScript will not have it.
I've patched bootstrap to get ClojureScript running
First of all, thanks a lot for ClojureScript. A lot of interesting new stuff
to learn and it has been very educational to read the ClojureScript source
code.
The following had me scratching my head for far too long. I translated some
quite simple code from the closure book (the one with the
On Jul 26, 1:53 am, Christian Marks 9fv...@gmail.com wrote:
On Jul 25, 6:11 pm, James Keats james.w.ke...@gmail.com wrote: I ask, what
is it that I did other than seriously inquire about the
rationale?!
You started a thread with the non-serious title, Alright, fess up,
whose unhappy with
First of all, thanks a lot for ClojureScript. A lot of interesting new stuff
to learn and it has been very educational to read the ClojureScript source
code.
The following had me scratching my head for far too long. I translated some
quite simple code from the closure book (the one with the
YouTube has the cap removed for some time already now, so maybe a good idea
to get it there as well... The integration with several sites and YouTube's
CND are very good, watching on YouTube in e.g. Brasil usually is faster than
most other sites...
2011/7/26 Eric Lavigne lavigne.e...@gmail.com
Based on the majority of posts in this thread, I think you can see you're in
the minority, both with regards to your opinions of ClojureScript and with
regards to how this community should behave. Here's one more person who
doesn't appreciate the attitude your posts embody. Rich, and everyone
I wish I had a plug I could pull to stop this thread right n
2011/7/26 semperos daniel.l.grego...@gmail.com
Based on the majority of posts in this thread, I think you can see you're
in the minority, both with regards to your opinions of ClojureScript and
with regards to how this community
2011/7/26 Laurent PETIT laurent.pe...@gmail.com
I wish I had a plug I could pull to stop this thread right n
+1
2011/7/26 semperos daniel.l.grego...@gmail.com
Based on the majority of posts in this thread, I think you can see you're
in the minority, both with regards to your opinions of
On Jul 26, 2:01 pm, semperos daniel.l.grego...@gmail.com wrote:
Based on the majority of posts in this thread, I think you can see you're in
the minority, both with regards to your opinions of ClojureScript and with
regards to how this community should behave. Here's one more person who
So I've hit an issue with the ClojureScript compiler memory
requirements several times now. The command line arguments in use for
both the compiler and the repl are thus:
-Xmx2G -Xms2G -Xmn256m
So basically this requires 2GB of memory right off the bat to even run
the compiler. Now I'm not
Not sure why that is there I just deleted that the 2G params, seams to
be working fine.
--
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 -
I've removed the first two flags since I work on a 32 bit machine and
haven't run into any problems either. I'm guessing the the extra memory
simply helps with compilation times.
On Tue, Jul 26, 2011 at 9:49 AM, Timothy Baldridge tbaldri...@gmail.comwrote:
So I've hit an issue with the
On Tue, Jul 26, 2011 at 9:29 AM, Laurent PETIT laurent.pe...@gmail.com wrote:
I wish I had a plug I could pull to stop this thread right n
LOL
--
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random
Hello!
Take a look at this tutorial and search for the word 'serial'.
http://devcenter.heroku.com/articles/clojure-web-application
I think that'll get you where you want to be.
Let me know if you have any questions!
Best,
Michael Gorsuch
On Tue, Jul 26, 2011 at 3:50 AM, Tarantoga
Oh I will be washing my hands and be gone for sure, as coding and
making things better is precisely what I offered in my OP, which was
taken as a threat and I was told to start a separate mailing list
for it; perhaps this community welcomes folks who don't know any
better than to be
You can lower the values. I changed them to -Xmx1G -Xms1G
There was not enough memory on my machine to meet these values.
My next laptop will have 8Gigs of RAM but now I am topped to 4Gigs...
Luc P.
On Tue, 26 Jul 2011 09:53:06 -0400
Tamreen Khan histor...@gmail.com wrote:
I've removed the
On Jul 26, 3:08 pm, Timothy Baldridge tbaldri...@gmail.com wrote:
Hi Timothy, and thanks for your much-better-than-others' reply.
Oh I will be washing my hands and be gone for sure, as coding and
making things better is precisely what I offered in my OP, which was
taken as a threat and
These were the four major features which first got me interested in
GWT:
Widgets that work identically [and correctly!] on all browsers +
Custom widgets
Client Bundling (pushing resources into random access files to reduce
file transfer latency)
UIBinder
Optimized Obfuscated js (adjustable by
GWT is Java to JavaScript, so you can as far as I know use it with
Clojure...
2011/7/26 Daniel doubleagen...@gmail.com
These were the four major features which first got me interested in
GWT:
Widgets that work identically [and correctly!] on all browsers +
Custom widgets
Client Bundling
Widgets that work identically [and correctly!] on all browsers +
You get widgets through goog.ui, which is part of Closure Library.
There are no special wrappers in ClojureScript for this yet, but the
infrastructure appears to be in place.
Custom widgets
You can write new goog.ui widgets, and
Re widgets, see [1] for the ui library documentation. There is a fairly
decent widget offering. For custom widgets, you would generally be building
on Component, Container, or Control, I would think.
Re compilation options, I think there are just the 3 options: Whitespace,
Simple, and Advanced.
The thing with GWT is that it is a Java *source* to Javascript compiler, not
a JVM byte code to Javascript compiler. So, in order to write Clojure code
targetting GWT, you would need to have a Clojure to Java source compiler,
something like Mirah offers.
On Tue, Jul 26, 2011 at 11:46 AM, Joop
Agree, the same for ipod/ipad devs.
Youtube is defacto standard for contet publishing, due to wide support.
--
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
The first thing I do when experiencing something strange like this is to
remove anything possible. In this case, try taking Leiningen out of the
picture and just running it directly. I am thinking that Colin is
correct in his assessment that this is related to the bug that has
already been
Hi,
Am 25.07.2011 um 23:58 schrieb Sam Aaron:
Sorry, I should have been more specific. The callback-based watchers are
cool, but I don't believe they specifically address my problem (which I don't
believe I sufficiently explained from the outset).
Hopefully this is a more succinct and
Let's stop feeding this thread and turn our attention toward healthy and
productive discussion. This is my first and final post on this matter.
Sent via Mobile
On Jul 26, 2011, at 9:56 AM, James Keats james.w.ke...@gmail.com wrote:
On Jul 26, 3:08 pm, Timothy Baldridge
Hi,
I'm starting a open source project which involves web based Java,
JBoss application server and JBoss Seam 3. I'm a student and I work on
the project in my free time for training. Every one who want to take a
part in this hobby project in his free time is invited. Send me e-
mail.
peter.
Thanks Meikel, I tried the below stuff -
package com.codionics.flyway;
import clojure.lang.RT;
import clojure.lang.Var;
public class wrapper {
static final Var symbol = RT.var(clojure.core, symbol);
static final Var require = RT.var(clojrue.core, require);
static final Var keyword
Hi,
Am 26.07.2011 um 19:48 schrieb mmwaikar:
RT.load(lobos/core, true);
RT.load(lobos/schema, true);
You should go through require.invoke(). Not RT.load().
and called wrapper.createTable() then I get - (#core$create_STAR_
lobos.core$create_STAR_@49431028 (quote
+1
On Jul 26, 12:31 pm, Devin Walters dev...@gmail.com wrote:
Let's stop feeding this thread and turn our attention toward healthy and
productive discussion. This is my first and final post on this matter.
Sent via Mobile
On Jul 26, 2011, at 9:56 AM, James Keats james.w.ke...@gmail.com
The irony of +1 doesn't escape me, but +1
Sent from my iPad
On 26 Jul 2011, at 20:15, Base basselh...@gmail.com wrote:
+1
On Jul 26, 12:31 pm, Devin Walters dev...@gmail.com wrote:
Let's stop feeding this thread and turn our attention toward healthy and
productive discussion. This is my
you guys realize there are functions in contrib that do the reflection
for you, yes?
On Tue, Jul 26, 2011 at 3:31 AM, Shantanu Kumar
kumar.shant...@gmail.com wrote:
My motivation is need to construct list of Java objects and I would
like to have some concise syntax to write them. So I decided
These were the four major features which first got me interested in GWT:
* tooling in GWT - being able to debug compiled javascript step by step
whilst working in an eclipse java debugger is what stood out for me (and
seemed to help it scale to large applications)
I've got stacks of respect
Petr,
I do not know of a function in clojure core or clojure contrib that does
what you request. I wrote a function called set-bean for that purpose:
https://github.com/billsmith/clojure-code/blob/master/clj/billsmith/util.clj
.
Here is an example of how to use set-bean:
What's the application supposed to do?
On Jul 26, 6:27 pm, Peter Penzov peter.pen...@gmail.com wrote:
Hi,
I'm starting a open source project which involves web based Java,
JBoss application server and JBoss Seam 3. I'm a student and I work on
the project in my free time for training.
I'm unhappy with ClojureScript but not in anyway like it seems you are.
My unhappiness with it is more akin to my unhappiness with ANY language that
tries to target multiple VM platforms, and that's mostly due to the -potential-
to break the community.
One of the main reasons Clojure made it
I think there is a lot still to do to get to that point. Closure Inspector
[1] provides the ability to map back to JavaScript source, but then you
still need to map from that back to the Clojure source, and as you noted,
existing Clojure stack traces leave much to be desired. And IDE integration
I have no opinion to add to mainline of this thread, but I could
answer one question.
Before the NYC meetup, there are two [1] Clojure: Clojure on JVM and
Clojure on CLI/CLR.
Is Clojure on JVM the true Clojure and that on CLI/CLR is an poor imitation?
(in Ruby: Is MRI the true Ruby and JRuby,
Oops, I wrote a footnote not to forget giving a supplement but I forgot it.
The number two was the number of Rich's Clojure implementations AFAIK.
--
Name: OGINO Masanori (荻野 雅紀)
E-mail: masanori.og...@gmail.com
--
You received this message because you are subscribed to the Google
Groups
Hi,
experimenting with clojure API i had this:
user= (take-while #(= (mod 20 %) 0) (apply (fn [x y] (rest (range
(max x y [10 20]))
(1 2)
but i expect to have (1 2 5 10) because of (apply (fn [x y] (rest
(range (max x y [10 20]) returns (1 2 3 4 5 6 7 8 9 10 11 12 13 14
15 16 17 18 19)
user= (take-while #(= (mod 20 %) 0) (apply (fn [x y] (rest (range
(max x y [10 20]))
(1 2)
but i expect to have (1 2 5 10) because of (apply (fn [x y] (rest
(range (max x y [10 20]) returns (1 2 3 4 5 6 7 8 9 10 11 12 13 14
15 16 17 18 19) and (mod 20 5) and (mod 20 10) should
On Tue, Jul 26, 2011 at 8:27 PM, Stephen C. Gilardi squee...@mac.com wrote:
user= (take-while #(= (mod 20 %) 0) (apply (fn [x y] (rest (range
(max x y [10 20]))
(1 2)
but i expect to have (1 2 5 10) because of (apply (fn [x y] (rest
(range (max x y [10 20]) returns (1 2 3 4 5 6 7 8
Because take-while takes while (= (mod 20 %) 0) and (= (mod 20 3) 0)
returns false.
Use filter, but be careful filter will hung up with infinite sequences.
--
Name: OGINO Masanori (荻野 雅紀)
E-mail: masanori.og...@gmail.com
--
You received this message because you are subscribed to the Google
On Jul 26, 9:27 am, Peter Penzov peter.pen...@gmail.com wrote:
Hi,
I'm starting a open source project which involves web based Java,
JBoss application server and JBoss Seam 3. I'm a student and I work on
the project in my free time for training. Every one who want to take a
part in this
Clojure-control is an open source clojure DSL for system admin and
deployment with many remote machines via ssh.
You can define clusters and tasks to execute repeatly,an example:
(ns samples
(:use [control.core :only [task cluster scp ssh begin]]))
(cluster :mycluster
:clients [
filter will hung up with infinite sequences. is incorrect. Sorry.
filter may hung if you request something impossible.
For (silly) example, (second (filter even? (range))) returns 2.
However (second (filter zero? (range))) goes in search of the second
zero in natural numbers...
--
Name: OGINO
...and Clojure Inspector itself only works with out-of-date versions
of Firefox and Firebug.
--
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 -
s/Clojure/Closure/
On Jul 26, 7:35 pm, Mark Hamstra markhams...@gmail.com wrote:
...and Clojure Inspector itself only works with out-of-date versions
of Firefox and Firebug.
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send
These unhappy threads need to die a horrible death.
--
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.
No need to wait in desperation for this, just add a filter rule in your email
client
to send these to trash directly. I have a couple of these and it saves me a
significant
# of frustrating hours :)
Luc P.
On Tue, 26 Jul 2011 21:30:25 -0700 (PDT)
pmbauer paul.michael.ba...@gmail.com wrote:
Dear Brenton, James, et al.,
The problem what the (wrap-reload) function that I was using in my code,
which isn't necessary anymore as ring, by default, includes
the functionality now (I think???).
http://mmcgrana.github.com/ring/middleware.reload-api.html
Brenton, I was wondering if there's
I knew there was something I was forgetting! Yeah, that's been
immensely useful from the beginning and it's only gotten better!
So, it looks like Clojurescript just falls short on two features
mentioned here: Resource bundling live debugging/profiling.
I'll watch the announcements for updates.
74 matches
Mail list logo