On Sep 22, 2:23 am, Jung Ko wrote:
> Hi,
>
> Can someone teach me how I can override the "toString" method for a struct ?
>
> Here's a code snippet that shows what I'm trying to do:
>
> user> (defstruct bookinfo :book :filename)
> user> (struct bookinfo "hello" "world") => {:book "hello", :file
On Sep 21, 11:35 pm, pmf wrote:
> On Sep 21, 11:22 pm, sross wrote:
>
> > I'm looking for a bit of advice for calling a java method which has a
> > few different signatures (such as Connection.prepareStatement).
> > Is there a cleaner way of passing a variable number of arguments to
> > the me
Hi there!
Lets assume I have this map:
user=> (def person {:name "Father" :childs [{:name "Son" :age 10}]})
Testing:
user=> (-> person :childs first)
{:name "Son", :age 10}
Now lets filter the child map:
user=> (def only-name (fn [m] (select-keys m [:name])))
user=> (-> person :childs first
Hi Roman!
On Tue, Sep 22, 2009 at 2:58 PM, Roman Roelofsen <
roman.roelof...@googlemail.com> wrote:
>
> Hi there!
>
> Lets assume I have this map:
>
> user=> (def person {:name "Father" :childs [{:name "Son" :age 10}]})
>
> Testing:
>
> user=> (-> person :childs first)
> {:name "Son", :age 10}
>
On Sep 22, 3:58 pm, Roman Roelofsen
wrote:
> Hi there!
>
> Lets assume I have this map:
>
> user=> (def person {:name "Father" :childs [{:name "Son" :age 10}]})
>
> Testing:
>
> user=> (-> person :childs first)
> {:name "Son", :age 10}
>
> Now lets filter the child map:
>
> user=> (def only-nam
On Mon, Sep 21, 2009 at 5:22 PM, sross wrote:
>
> Hi All,
>
> I'm looking for a bit of advice for calling a java method which has a
> few different signatures (such as Connection.prepareStatement).
> Is there a cleaner way of passing a variable number of arguments to
> the method, such as
>
> (
Thanks for the explanation!
So the solution is much simpler:
user=> (-> person :childs first (select-keys [:name]))
{:name "Son"}
Cool :-)
On Sep 22, 3:26 pm, Jarkko Oranen wrote:
> On Sep 22, 3:58 pm, Roman Roelofsen
> wrote:
>
>
>
> > Hi there!
>
> > Lets assume I have this map:
>
> > us
Hi,
thanks a lot. Your code looks much better than mine. But there is one
part that I don't understand:
(defn producer []
(if (dosync (if (not @consuming)
(alter data conj 1)))
(recur)))
How can I be sure that no more data is added to data after @consuming
was set to
Hello All,
Please make out time and check the below link. And if you consider the code
there useful, I encourage you to use it.
I would appreciate your comments and reviews.
http://emekamicro.blogspot.com/2009/09/managing-clojure-project-files.html
Regards,
Emeka
--~--~-~--~~--
Thanks for the link. It's a good start and it has prodded me to start
analyzing clojure core and contrib code - which I'm finding are
incredibly good examples of how to do 'stuff'.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Go
Clojure data structures can be printed to a string, and the string can
be read back in as a data structure.
user> (def a {:key1 "string" :key2 #{"set" "of" "strings"}})
#'user/a
user> a
{:key1 "string", :key2 #{"set" "strings" "of"}}
user> (def b (str a))
#'user/b
user> b
"{:key1 \"string\", :key
Sweet! I'd like to try it out. Wondering, though, might blogspot
have a feature of some sort to render the code in something more
palatable? I'd like to review it but it's a pain.
Thanks,
On 9/22/09, Emeka wrote:
> Hello All,
>
> Please make out time and check the below link. And if you cons
On Tue, Sep 22, 2009 at 1:31 AM, Jarkko Oranen wrote:
> As Mike said, it's done by adding a method to print-method, but you
> will need metadata... "structs" in clojure are nothing but an
> optimisation of maps... That is, in all situations structmaps are (at
> least, should be) interchangeable
Hi, I gave it a try to find a solution to your problem. I ended up
using a single atom to hold the produced data and as means to detect
that consuming started (by swapping in a fn wrapping the produced
value). Don't know wether this fits your problem better than the one
already posted.
(def data
> thanks a lot. Your code looks much better than mine. But there is one
> part that I don't understand:
>
> (defn producer []
> (if (dosync (if (not @consuming)
>(alter data conj 1)))
>(recur)))
>
>
After rereading the docs several times It seems that I begin to
understand h
On Tue, Sep 22, 2009 at 3:18 PM, Roger Gilliar wrote:
>
>> thanks a lot. Your code looks much better than mine. But there is one
>> part that I don't understand:
>>
>> (defn producer []
>> (if (dosync (if (not @consuming)
>> (alter data conj 1)))
>> (recur)))
>>
> After rereadi
> How can I be sure that no more data is added to data after @consuming
> was set to true ?
You need to prevent the modification of consuming by using ensure
rather than deref (@).
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the
Thanks for the note about read-string and the example.
If I only had to consider Clojure I'd probably use that.
The Clojure structures are going to be persisted to/from a DB, and
then also read back (and maybe updated) later using other languages.
The tools I prefer to use for this are based on XM
An article about Clojure on IBM DeveloperWoks
http://www.ibm.com/developerworks/opensource/library/os-eclipse-clojure/index.html
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, s
Thanks for the links, we - Counterclockwise / clojure-dev devs - were not
aware that some publicity was made for Counterclockwise on IBM
DeveloperWorks !
That's cool !
Regards,
--
Laurent
2009/9/23 Alpinweis
>
> An article about Clojure on IBM DeveloperWoks
>
> http://www.ibm.com/developerwo
I'm trying to create an HTTP server that is essentially a clojure REPL
with some integration into some classes on the server's classpath.
I've got something working, but I noticed some things that made me
realize I don't quite understand the scope of namespaces/imports in
clojure when eval'ing. I
New release of the Enclojure plugin for Netbeans has been released!
I have moved Enclojure to github and greatly simplified the build
process. See readme in the root directory of the repo for more
details.
http://github.com/EricThorsen/enclojure
You can download the release at:
http://github.com
any chance the enclojure plugin can be made available to download
from the NetBeans repo? It would mean much easier for netbeans
users to find and install it by simply bringing up the plugin menu
from within NetBeans.
Just a thought.
On Tue, Sep 22, 2009 at 8:53 PM, Eric Thorsen wrote:
>
> New
Did you mean this?
http://clojure.googlegroups.com/web/manual.pdf
On Sep 20, 4:59 am, cej38 wrote:
> I was just looking through the main web page of clojure-contrib and
> came across this:
>
> "If you wish to have a version for off-line use you can use the
> download button on the page at GitHu
On Tue, Sep 22, 2009 at 6:46 PM, Eric Tschetter wrote:
> If I do just
>
> curl 'http://localhost:43034/1.0/cloj' -H 'content-type:
> application/clojure' -d '(json-str {:howdy ["hi" 1 2 3]})'
>
> I get this exception
>
> java.lang.Exception: Unable to resolve symbol: json-str in this
> context (N
>> .. It waits until the value is actually needed. For
> more details on this, see http://ociweb.com/mark/stm/article.html.
.
Great article.Thanks !
Roger
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Clojur
> You need to prevent the modification of consuming by using ensure
> rather than deref (@).
Oh - excellent point! I didn't think of that.
When it useful to be able to deref inside a dosync without ensuring?
Ensure seems like a more safe default of what I'd expect from a
transaction. So why not
hi,
is there perchance some way Clojure's REPL might be able to print out
more information in such situations? i don't know what precisely the
situations are. it is frustrating to not get more information to help
debug something. seems like it might be about anonymous fns or some
such?
thanks fo
There could be a verbose flag which would print the form in which the
error occurs. This shouldn't be default though as the forms can be
quite large.
On Sep 23, 3:37 pm, Raoul Duke wrote:
> hi,
>
> is there perchance some way Clojure's REPL might be able to print out
> more information in such
Dear Clojurians,
Are lazy-seqs good for streaming data that arrives at indeterminate
intervals? if not any pointers about which approach to take?
I'm working on a simple serial port library for Clojure and I'm trying to
understand how to best model a solution. Basically serial events will happe
Hello,
I'm having trouble unit testing clojure code. To be sure I'm just
testing clojure.test, I'm trying to test clojure.contrib.json.read.
test.clj states:
;; RUNNING TESTS
;;
;; Run tests with the function "(run-tests namespaces...)":
(run-tests 'your.namespace 'some.other.namespace)
31 matches
Mail list logo