> So, it appears the (read-line) consumes the Clojure form (in-ns
> 'test.readln) probably stacked by CCW (at least I didn't type that!)
Yup you're right, CCW "typed" that, you may disable that feature from
the Windows > Preferences > Clojure > Editor.
Thanks
--
You received this message becaus
> For the program, I know that when processing a character, I do not
> need the previous result. All I need is the current character, and I
> can return a function that acts on the result. I'm not sure if this is
> simple to implement in a functional way.
Actually my understanding says that you ne
Thanks for your reply,Ulrich
I knew that comute would rerun before the commit,but my problem is
that if we allow ref-set ref after commuting,it seems there is no bad
thing would happen.What's the purpose of this limitation except alter
or ref-set have no lasting result?
On Jul 25, 7:01 pm, Moritz
Hey Dennis,
I suggested some of the same ideas here (http://tech.puredanger.com/
2010/06/08/clojure-agent-thread-pools/) and Rich said that these
seemed like good suggestions post-1.2. I think allowing you to modify
the agent thread pools after construction seems possibly dangerous
from a concurr
On Sun, Jul 25, 2010 at 00:16, samnardoni wrote:
> I have a simple string (or list of characters to be precise) in a form
> of: "1234<5678<<9".
>
> I want to parse this string and end up with: "123569".
>
> The "<" is essentially the same as a "backspace".
>
> I managed to implement this fairly si
Hi,
when I "Run as Clojure Repl" the next little source file:
(ns test.readln)
(defn -main []
(println "Enter some text for the first time:")
(println (read-line))
(println "Enter some text for the second time:")
(println (read-line)))
(-main)
I get the follo
On Sat, Jul 24, 2010 at 9:07 AM, Gary Fredericks
wrote:
> (defn remove-first
> [syb lst]
> (let [[before after]
> (loop [b [] a lst]
> (if (empty? lst)
> [b a]
> (if (= syb (first a))
> [b (rest a)]
> (recur (con
How are you accessing the authorization url? If by hand you mean you
manually go to the url, this is what you're supposed to do. I don't
think
you can visit the authorization url via a browser agent unless the
agent is logged in to dropbox antecedently and you change the browser
agent
so it looks l
Hmmm, can you privately send me some more details about what you did?
Did you go to the authorization
site and get an "ok" from dropbox before calling the request-callback;
that error typically means the user didn't
authorize your app? I know its a straightforward
question, but just checking. Dropb
Randy, thanks for the reply. This has certainly cleared things up for
me.
I was only concerned about performance for an order of magnitude or
more; just checking I was on the right track, so to speak.
It seems I'll have to do a little research on transients now.
On Jul 25, 4:23 pm, Randy Hudson
Thx guys!
I used double-buffering like in Ryan's code and it worked like a
charm!
M
On Jul 25, 4:01 am, Ryan Sattler wrote:
> I've been working on a game with Clojure/Swing lately and the simplest
> way to avoid flashing is to draw to a bufferedImage first, then draw
> that bufferedImage all at
This is a wholly appropriate use of reduce; it's the obvious function
to use when you want to "accumulate" some calculation over a sequence.
As you say, you can just produce a function that acts on the result,
something like
(defn fstep [c] (if (= c \<) pop #(conj % c))
However, the obvious way
On Sun, Jul 25, 2010 at 12:55 PM, Ryan Twitchell wrote:
> You'd be best served overriding the JPanel's paint or paintComponent
> method (I'm fuzzy on the difference), and then calling repaint
> periodically (at your desired frame rate). IIRC, repaint is safe to
> call from any thread, and it will
On Sat, Jul 24, 2010 at 3:11 PM, Mate Toth wrote:
> Hi,
>
> my problem is that during execution my presentation java applet is
> flashing. There are many components which paint to a JPanel using it's
> Graphics (.getGraphics). I think maybe the problem is that I don't
> have any "paint everything
Even the "TEST" Problem will TLE!!!
My code is here:
(ns spoj-test)
(defn read-int
[]
(let [s (read-line)]
(Integer/parseInt s)))
(defn main
[] (let [n (read-int)]
(when (not (== 42 n))
(println n)
(recur
(main)
the sample input is OK.
On Jul 25, 3:51
HI,
You'd be best served overriding the JPanel's paint or paintComponent
method (I'm fuzzy on the difference), and then calling repaint
periodically (at your desired frame rate). IIRC, repaint is safe to
call from any thread, and it will cause the paint methods to be called
in the swing thread.
I've been working on a game with Clojure/Swing lately and the simplest
way to avoid flashing is to draw to a bufferedImage first, then draw
that bufferedImage all at once. This means that parts of the screen
that don't change won't be briefly overwritten by the background
color, avoiding flashing.
I have a simple string (or list of characters to be precise) in a form
of: "1234<5678<<9".
I want to parse this string and end up with: "123569".
The "<" is essentially the same as a "backspace".
I managed to implement this fairly simply using the reduce function -
source: http://gist.github.com
Looks realy nice
i Tried it, and i cant get the example oath dance to work. i get:
Bad Response: 403
{"error": "Token is not an authorized request token."}
[Thrown class java.lang.RuntimeException]
i used "" or nil as a callback-url. i assume thats where the problem is.
if i do the dance by han
Well obviously if you can get something to be tail-recursive you won't have
the stack overflows, and the thing in your code that prevents tail recursion
is having to cons the result of the recursive call. So let's try this:
(defn remove-first
[syb lst]
(let [[before after]
(loop [b [
@Randy Hudson
Really like that solution.
@Mark Engelberg
Thanks for the explanation
On Jul 25, 4:33 am, ataggart wrote:
> To add one small addendum to Mark's excellent comment, if you use lazy-
> seq then you don't need to worry about the nil from when
>
> On Jul 24, 12:01 pm, Mark Engelberg w
Read the documentation of commute carefully:
http://richhickey.github.com/clojure/clojure.core-api.html#clojure.core/commute
commute acts at the end of the current dosync-block, regardless of
when commute was applied inside it. That's the reason why you can't
ref-set it after a commute; the commut
Agent use two thread pools to execute actions,send use a fixed thread
pool (2+cpus threads),and send-off use a cached thread pool.These
pools are global in clojure system.
I think the Agent should allow users to customize the thread pool,
if no custom, then use the global thread pool.
Why
Alter or ref-set a ref after commute would throw a
IllegalStateException:Can't set after commute
for example:
user=> (def counter (ref 0))
#'user/counter
(dosync (commute counter inc) (ref-set counter 3))
java.lang.IllegalStateException: Can't set after commute
(NO_SOURCE_FILE:0)
I want to know
Hi,
now, you can solve problems/submit problems in Clojure on SPOJ,
good luck,
regards,
SPOJ Team
ps.
We are very happy to announce that users' accounts have finally
appeared on Ideone :)
If you liked Ideone as it has been so far, you will like the new one
even more. The most important new fea
25 matches
Mail list logo