In Haskell, it's simple to explicitly state what names should be
exported by a module. Is there a way to do this in Clojure?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
Clojure group.
To post to this group, send
For whatever reason I just can't seem to put this problem down.
I have rewritten the code substantially. A major bottleneck was using
Java's MD5 classes. The Fast MD5 library really is, and that helped
a lot. I did get the - notation to work and I have a reasonable HOF
now for doing the
On Fri, May 29, 2009 at 8:44 AM, kinghajj kingh...@gmail.com wrote:
In Haskell, it's simple to explicitly state what names should be
exported by a module. Is there a way to do this in Clojure?
I think this is what you're looking for:
user= (doc defn-)
-
Here are two functions the do roughly the same thing --
return a list with a single gensym'ed symbol in it:
(defn f-auto []
`(foo#))
Think about it this way: everything that is not unquoted in the body
of syntax-quote stays the same. In other words, syntax-quote is like
regular quote,
Hi.
I'm a n00b so bare with me. I have just started playing with Clojure
and the first thing I thought I'd try is storing and retrieving a list
of structs, like in Suart Halloway's example here:
Macros and, more specifically, syntax-quotes are not conceptually
hard. Nested syntax-quotes though are certainly more complicated to
follow, but not any harder from a conceptual point of view. I've
written about what the expansion algorithm does in the wiki. You can
find some info here:
Hi.
I'm a newbie so bare with me. I have just started playing with Clojure
and the first thing I thought I'd try is storing and retrieving a seq
of structs, like in Suart Halloway's example here:
On Thu, May 28, 2009 at 4:23 PM, Perttu perttu.aur...@gmail.com wrote:
I use a store-function like this:
(defn store-customer-db [customer-db filename]
(spit filename (with-out-str (print customer-db
I believe this is your problem. The print/println functions print in a
format
On 29 mai, 05:55, Perttu perttu.aur...@gmail.com wrote:
I use a store-function like this:
(defn store-customer-db [customer-db filename]
(spit filename (with-out-str (print customer-db
From the output file of spit I can see that the print doesn't give
double quotes to the strings
Hi,
As you mentioned in another thread, your version of defblockfn cannot
create more than one macro due to the problem with defn.
I also didn't see whether it was interesting to have the explicit
defn, I thought that an anonymous function could do the trick.
And as I, too, wanted to understand
Hi everyone,
I am a newbie in clojure world, so I have some newbie's questions :) To
learn about clojure, I am trying to do the thread ring problem of clgb in
clojure. The rules of problem are
herehttp://shootout.alioth.debian.org/u64q/benchmark.php?test=threadringlang=all#about,
and my attempt
I keep reading this thread when I should be going to bed :) Sadly,
this stuff is in what I call my 0.2% time so I'm not working very
hard on it right now.
The ruby code, which basically works (but is rather ugly in parts)
relies on reading the whole file tree into memory, and then traversing
For kicks, I made an implementation* using agents:
http://gist.github.com/119946
I think that you may not want to use the STM so much and instead
figure out a different approach to sending the token around the ring.
*it may be a bit liberal in its interpretation of the rules... didn't
read
Have you seen the example on the agents page of the main clojure site?
http://clojure.org/agents
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to
By the way, here's the link:
http://en.wikibooks.org/wiki/Learning_Clojure#Reader_Macros
On May 29, 4:14 pm, Rock rocco.ro...@gmail.com wrote:
Hi,
I've just finished updating the Reader Macros section of the Wiki
(especially the syntax-quote part), and I would like to know if it's
By the way, here's the link:
http://en.wikibooks.org/w/index.php?title=Learning_Clojurestable=0#Reader_Macros
On May 29, 4:14 pm, Rock rocco.ro...@gmail.com wrote:
Hi,
I've just finished updating the Reader Macros section of the Wiki
(especially the syntax-quote part), and I would like to
Hi,
didn't take time to analyse why, but your solution sends a
java.util.concurrent.RejectedExecutionException
when I try it with the 50,000,000 number of times the token is
exchanged (which is the number to be used for the benchmark)
2009/5/29 Christian Vest Hansen karmazi...@gmail.com:
Thanks, seems that I misunderstood Agents :)
The solution of Christian works well with full load, but maybe slow for the
benchmark. In my core2duo, with full load, takes about 28mins to compute the
result.
user= (do (println (System/nanoTime)) (start 5000))
22651751153117
#ag...@27a897a9: 1
On May 29, 10:18 am, Rock rocco.ro...@gmail.com wrote:
By the way, here's the link:
http://en.wikibooks.org/w/index.php?title=Learning_Clojurestable=0#R...
On May 29, 4:14 pm, Rock rocco.ro...@gmail.com wrote:
Hi,
I've just finished updating the Reader Macros section of the Wiki
Robert Stehwien rstehw...@gmail.com writes:
* I needed to do a M-x load-file path/clojure-mode.el before being able to
call clojure-install
* I needed to add the following to my ~/.emacs.d/username.el so that M-x
slime was available on starting emacs
(Load-file
Ok. I'll try to correct that. It was already there when I started
working on that section. My main concern is the part where I describe
the rules for the syntax-quote expansion. Does it seem correct to you?
Thanks so much for helping :)
Rock
On May 29, 5:47 pm, Rich Hickey
Thanks Rock and Laurent for the explanation.
I haven't thought of using an anonymous function. That cleans things
up a bit. Meikel points out that it is sometimes desirable to have
access to the original function though. I haven't had a need for it
before, but it seems useful.
And thanks Rock
Hi,
Am 29.05.2009 um 18:28 schrieb CuppoJava:
I haven't thought of using an anonymous function. That cleans things
up a bit. Meikel points out that it is sometimes desirable to have
access to the original function though. I haven't had a need for it
before, but it seems useful.
There are
On May 28, 9:23 pm, CuppoJava patrickli_2...@hotmail.com wrote:
(defblockfn with_surrounding_text [text func]
(println text)
(func)
(println text))
Okay, but it doesn't seem that much neater than just writing the macro
manually:
(defmacro with-surrounding-text [text body]
`(do
Would type hints help at all?
On May 29, 11:40 am, Laurent PETIT laurent.pe...@gmail.com wrote:
Hi,
Here is my attempt, for the real benchmark test, it has an honorable
result of 62 sec. (if there is no flaw in my algorithm, of course).
;; file shootout/ring.clj
(ns shootout.ring
You meant to type disclosure, but instead you typed disclojure.
Paul
--~--~-~--~~~---~--~~
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
The failure to detect the integer overflow is not the fault of the
multiply function itself. The integer argument has already overflown
by the time it reaches the multiply function. Maybe adding overflow
detection to the coercion functions would be a solution?
On May 29, 1:51 pm, Dex Wood
Bleh, I've been completely wrong about what currying does. Here's a
correct definition:
(defn curry [f]
(fn [a]
(fn [b] (f a b))
So curry basically takes a fn f that normally operates on a pair, and
creates an fn that partially applies f to an argument. That function
in turn will complete
Macros are harder to write than functions.
For example, the macro you just wrote won't work on:
(with-surrounding-text (read_string_from_stream *standard-in*)
(println within surrounding text))
I personally really don't like writing macros. I try to stay away from
it when I can.
-Patrick
On Fri, May 29, 2009 at 10:12 AM, Phil Hagelberg p...@hagelb.org wrote:
Robert Stehwien rstehw...@gmail.com writes:
* I needed to do a M-x load-file path/clojure-mode.el before being
able to
call clojure-install
* I needed to add the following to my ~/.emacs.d/username.el so that
M-x
Does anyone know if you can interrupt the repl with clojure/slime? In
the plain clojure repl from a terminal I can C-d to break. If I do
that in slime the clojure process seems to shut down.
user= (read-line)
C-d
nil
user=
Process inferior-lisp finished
This is with clojure 1.0, and the latest
Hi,
here is a second attempt, partly inspired by clojure's agents page,
that looks better (true direct ring of agents, not just indirect ring
via vector), and that performs similarly to my first attempt.
Still room for progress, though.
(ns shootout.ring2
(:gen-class))
(def n-threads 503)
http://gist.github.com/120289 using queues and Threads instead of agents
On Fri, May 29, 2009 at 4:11 PM, Laurent PETIT laurent.pe...@gmail.com wrote:
Hi,
here is a second attempt, partly inspired by clojure's agents page,
that looks better (true direct ring of agents, not just indirect
As I understand it, generics aren't real types in the JVM. They
don't even exist in the compiled bytecode instructions. They're more
like casting hints to the compiler. When you write ListLong in
Java, what you get is more like a ListObject that automatically
casts elements to Long when you
Can anyone explain this?
user (def x {:foo :bar :foo :baz :foo :quux})
#'user/x
user x
{:foo :bar, :foo :baz, :foo :quux}
user (count (keys x))
3
user (map x (keys x))
(:bar :bar :bar)
It's understandable that a literal map which includes the same key
twice with different values could return
On Tue, May 26, 2009 at 4:24 AM, hoeck i_am_wea...@kittymail.com wrote:
On 20 Mai, 14:25, Shawn Hoover shawn.hoo...@gmail.com wrote:
I can't help with COM, but this patch might help slime automatically
connect
to the REPL on Windows XP:
On May 27, 11:57 pm, kinghajj kingh...@gmail.com wrote:
Example:
(def add5 ($ + 5))
(add5 3)
I love partial application in haskell. But do not see the need for it
in clojure with its succinct syntax for anonymous functions:
(def add5 #(+ 5 %1))
(add5 3)
Besides clojure's anonymous
I personally have used the -lang qualifier in my own POM work so as to
have an (unspoken) consensus with Howard's POM work.
However, I would rather clojure proper just be named
org.clojure:clojure in maven/ivy-land myself and I have heard that
from quite a few others.
On May 10, 1:17 pm,
38 matches
Mail list logo