I tested the following on clojure 1.2 and clojure 1.2.1 and it
does not seem to work.
(def foo (agent nil))
(def bar (agent nil :error-handler (fn [a e] (do (def called? true)
(send foo (constantly e)
(def called? false)
(send bar inc) ; try incrementing nil
(await error); wait for a
On 27 July 2011 00:03, axyzxp wrote:
> 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]) retur
right sir
--
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.
To unsubscribe from this group, send emai
Hello everyone,
I like to introduce you to cljs-devmode, which is a "development mode" for
ClojureScript. It is really a primitive prototype for a ClojureScript
development mode, but it works for me so far. I only wrote it to get started
with ClojureScript in one of my Clojure web applications.
c
Thanks Max. This is wonderful. I can throw my current hack-job out the
window.
-Alen
PS. Should I encounter any issues, I'll post them via github.
On Jul 27, 12:31 pm, Max Weber wrote:
> Hello everyone,
>
> I like to introduce you to cljs-devmode, which is a "development mode" for
> ClojureScr
If that subject did not scare you off already you might be the right
person to comment.
To set the scene, I'm writing an application with an embedded web
server (using ring and jetty), and my srv.core module has a log
function defined as:
(let [repl-out *out*]
(defn log [msg & vals]
(
Just sharing the stopgap method for "static HTML" (no server)
ClojureScript development I'm using until someone cooks up a REPL that
evals in the browser instead of Rhino.
Nothing particularly exciting here, but really beats restarting the JVM
on every compile. :-)
This will only work on Linux as
Clojure core.clj has a macro when-let,
I am wondering how to write a macro `when-lets`
(when-lets [symbol-1 test-1
symbol-2 test-2
...
]
body
)
body only get evaluated when (and test-1 test-2 )
I am thinking about it, anybody ha
Before getting too far along, I'd like to set up my project the way
I've seen other projects' configurations, like clj-http and clojure-
csv. I can build my project, but it is not set up in the standard way.
I am using cake, but cannot find instructions on configuring and then
creating the project
http://groups.google.com/group/clojure-meta
Big hugs to you all, from a tired old man.
-steven
--
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 moderate
Hi!
I'm making a game with Clojure. And I have a few code structure/design
problems.
I have an atom with characters (a map of maps) in my main file. But
because I don't want to make that file too big I have, for example, a
file called "ai.clj" with AI stuff, that I require from the main file.
For
I've set up my ring/jetty based application to dynamically compile any
updated clojurescript source files, similar to the clojurescript
devenv package recently announced. I'm having some trouble getting the
paths correct though. My toplevel directory looks like this:
mysoft
srv
src
srv
This would be a straightforward solution:
(defmacro when-lets [bindings & body]
`(let ~bindings
(when (and ~@(map first (partition 2 2 bindings)))
~@body)))
It works well in simple cases, but breaks e.g. in case of parameter
destructuring.
If you read `(source when-let)`, you'll see
Hi Oskar,
I just came across this article yesterday, which I thought you may find
useful. It's a 4-part series where the author discusses his experience
implementing games in a functional style:
http://prog21.dadgum.com/23.html
He was using Erlang, but I think many of the same ideas apply her
On Wed, Jul 27, 2011 at 10:51 AM, Dmitry Gutov wrote:
> This would be a straightforward solution:
>
> (defmacro when-lets [bindings & body]
> `(let ~bindings
> (when (and ~@(map first (partition 2 2 bindings)))
> ~@body)))
>
> It works well in simple cases, but breaks e.g. in case of pa
On Wed, Jul 27, 2011 at 10:04 AM, Oskar wrote:
> I have an atom with characters (a map of maps) in my main file. But
> because I don't want to make that file too big I have, for example, a
> file called "ai.clj" with AI stuff, that I require from the main file.
> For the monsters' AI to work, the
I tried to solve this, and, having very litte macro-writing
experience, just looked at when-let and tried to modify it to work
with multiple binds. This is what I ended up with:
(defmacro when-lets
[bindings & body]
(if-not (seq bindings)
`(do ~@body)
(let [form (bindings 0) tst (bindi
Note the following code that works:
(defn ^:export displayPlain [id]
(let [h (.getElementById window/document id)
txt (aget h "innerText")]
(window/alert (str "plain " txt))
(aset h "innerText" "here I am!")))
Here, javascript object "h" is treated as array, and I was able to get
> Note the following code that works:
>
> (defn ^:export displayPlain [id]
> (let [h (.getElementById window/document id)
> txt (aget h "innerText")]
> (window/alert (str "plain " txt))
> (aset h "innerText" "here I am!")))
> Here, javascript object "h" is treated as array, and I
Hello everyone, I am a beginner with clojure and I am playing around
with pcalls (I am using clojure 1.2.1).
I see different behavior if I run some code from inside the REPL or
launching it "form the command line".
I have the following code in a file called "test-pcalls.clj":
(let [waste-time (fn
I found the new command for cake, but I get this error, so I'm a
little confused as to what's going on. cake builds otherwise.
cnorton@steamboy:~/projects/clojure$ cake new addr_verify
unknown task: new
On Jul 27, 8:50 am, octopusgrabbus wrote:
> Before getting too far along, I'd like to set up
On Wed, Jul 27, 2011 at 11:44 AM, mc4924 wrote:
> Hello everyone, I am a beginner with clojure and I am playing around
> with pcalls (I am using clojure 1.2.1).
> I see different behavior if I run some code from inside the REPL or
> launching it "form the command line".
>
> I have the following co
On 7/27/11 11:19 AM, Ken Wesson wrote:
On Wed, Jul 27, 2011 at 11:44 AM, mc4924 wrote:
Hello everyone, I am a beginner with clojure and I am playing around
with pcalls (I am using clojure 1.2.1).
I see different behavior if I run some code from inside the REPL or
launching it "form the command
cake new does work. I had run cake new in the wrong place before, so I
am rebuilding the tree. Problem solved for now.
On Jul 27, 1:13 pm, octopusgrabbus wrote:
> I found the new command for cake, but I get this error, so I'm a
> little confused as to what's going on. cake builds otherwise.
>
> c
I seem to have fixed this by editing
closure/library/closure/goog/base.js and rebuilding lib/goog.jar.
The relevant line is "goog.global = this;" somewhere at the top where
"this" should be replaced by
"(function(){return this})();"; the bootstrap script contains the
command to create the jarfile.
On 27 July 2011 01:43, Mark Derricutt wrote:
> 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.
It may be helpful to approach the issue with the premise that
Clo
thanks guys, now everything is clearer to me.
I really apreciate your help
--
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
On Wed, Jul 27, 2011 at 1:51 PM, axyzxp wrote:
> thanks guys, now everything is clearer to me.
> I really apreciate your help
You're welcome.
--
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 a
On Jul 27, 5:50 am, Feng Shen wrote:
> Clojure core.clj has a macro when-let,
> I am wondering how to write a macro `when-lets`
>
> (when-lets [symbol-1 test-1
> symbol-2 test-2
> ...
> ]
> body
> )
>
> body only get evaluated when (
On Jul 27, 11:11 am, Alan Malloy wrote:
> On Jul 27, 5:50 am, Feng Shen wrote:
>
> > Clojure core.clj has a macro when-let,
> > I am wondering how to write a macro `when-lets`
>
> > (when-lets [symbol-1 test-1
> > symbol-2 test-2
> > ...
> > ]
> >
On Wed, Jul 27, 2011 at 2:13 PM, Alan Malloy wrote:
> On Jul 27, 11:11 am, Alan Malloy wrote:
>> On Jul 27, 5:50 am, Feng Shen wrote:
>>
>> > Clojure core.clj has a macro when-let,
>> > I am wondering how to write a macro `when-lets`
>>
>> > (when-lets [symbol-1 test-1
>> > sy
On Wed, Jul 27, 2011 at 2:15 PM, Ken Wesson wrote:
> On Wed, Jul 27, 2011 at 2:13 PM, Alan Malloy wrote:
> > On Jul 27, 11:11 am, Alan Malloy wrote:
> >> On Jul 27, 5:50 am, Feng Shen wrote:
> >>
>
> (defn foldr
> ([f coll]
>(reduce f (reverse coll)))
> ([f init coll]
>(reduce f init
On Wed, Jul 27, 2011 at 2:35 PM, Aaron Cohen wrote:
> I may be wrong, but don't you need to swap the order of the arguments to f?
You can do that by writing f itself appropriately. Usually either it
will be a closure or it won't matter (core +, etc.).
--
Protege: What is this seething mass of p
I originally had a project set up that built correctly, but the
project directories had not been set up with cake new.
I saved my project and main files; created a new project tree with
cake new addr_verify; and then replaced project.clj and
addr_verify.clj with the working files. Before, addr_ver
Hi everyone,
I don't know where to post about bugs (if this is a bug).
Anyway in clojure 1.3 with the new numerics:
(format "%d" 2N)
throws IllegalFormatConversionException, is it a bug? are there any
workarounds?
--
You received this message because you are subscribed to the Google
Groups "Clo
> First: Why doesn't macroexpand expand the inner when-lets?
It's not supposed to, see the doc. To do full expansion, you can use
`clojure.walk/macroexpand-all`.
> Is the gensym in the two expands the same thing, or do "they" get the
> same name? That was surprising to me. I can't think of any re
On Wed, Jul 27, 2011 at 2:39 PM, Ken Wesson wrote:
> On Wed, Jul 27, 2011 at 2:35 PM, Aaron Cohen wrote:
> > I may be wrong, but don't you need to swap the order of the arguments to
> f?
>
> You can do that by writing f itself appropriately. Usually either it
> will be a closure or it won't matt
Namespace file locations start from the src directory, in your project
directory. So, a file that declares namespace addr-verify should be located
in src/addr_verify.clj. A file that declares namespace
addr-verify.addr-verify would be found in src/addr_verify/addr_verify.clj.
On Wed, Jul 27, 20
Thanks. It appears it was set up correctly all along, but didn't have
the extra directories created by cake new.
On Jul 27, 3:09 pm, Mark Rathwell wrote:
> Namespace file locations start from the src directory, in your project
> directory. So, a file that declares namespace addr-verify should be
On Jul 27, 11:57 am, Aaron Cohen wrote:
> On Wed, Jul 27, 2011 at 2:39 PM, Ken Wesson wrote:
> > On Wed, Jul 27, 2011 at 2:35 PM, Aaron Cohen wrote:
> > > I may be wrong, but don't you need to swap the order of the arguments to
> > f?
>
> > You can do that by writing f itself appropriately. Usua
On Jul 27, 11:56 am, Dmitry Gutov wrote:
> > First: Why doesn't macroexpand expand the inner when-lets?
>
> It's not supposed to, see the doc. To do full expansion, you can use
> `clojure.walk/macroexpand-all`.
>
> > Is the gensym in the two expands the same thing, or do "they" get the
> > same na
On Jul 27, 11:45 am, Andrea Tortorella wrote:
> Hi everyone,
> I don't know where to post about bugs (if this is a bug).
> Anyway in clojure 1.3 with the new numerics:
>
> (format "%d" 2N)
>
> throws IllegalFormatConversionException, is it a bug? are there any
> workarounds?
Unlikely to change an
On Wed, Jul 27, 2011 at 2:57 PM, Aaron Cohen wrote:
> On Wed, Jul 27, 2011 at 2:39 PM, Ken Wesson wrote:
>>
>> On Wed, Jul 27, 2011 at 2:35 PM, Aaron Cohen wrote:
>> > I may be wrong, but don't you need to swap the order of the arguments to
>> > f?
>>
>> You can do that by writing f itself appro
On Wed, Jul 27, 2011 at 3:23 PM, Alan Malloy wrote:
> On Jul 27, 11:56 am, Dmitry Gutov wrote:
>> > First: Why doesn't macroexpand expand the inner when-lets?
>>
>> It's not supposed to, see the doc. To do full expansion, you can use
>> `clojure.walk/macroexpand-all`.
>>
>> > Is the gensym in the
On Wed, Jul 27, 2011 at 4:33 PM, Alan Malloy wrote:
> On Jul 27, 11:45 am, Andrea Tortorella wrote:
>> Hi everyone,
>> I don't know where to post about bugs (if this is a bug).
>> Anyway in clojure 1.3 with the new numerics:
>>
>> (format "%d" 2N)
>>
>> throws IllegalFormatConversionException, is
On Wed, Jul 27, 2011 at 4:32 PM, Ken Wesson wrote:
> => (.format (java.util.Formatter.) "%d" (into-array Object [(bigint 2)]))
> #
>
> (2N isn't recognized as a BigInteger literal by Clojure 1.2, it seems.)
>
> In my copy of Clojure 1.2, format also seems to work:
>
> => (format "%d" (bigint 2))
>
I'm trying to figure out how to send a jodatime date into Postgres, for example
to generate this SQL:
SELECT animals.* FROM animals WHERE removed_from_service = '2001-11-11'
Along the way, I've discovered that the SQL queries ClojureQL prints out can't
be the ones it actually sends. Consider, f
Sorry for the terrible subject line. I couldn't think of an easy way to
describe the problem in a single line.
(def net (node/require "net"))
(defn portal
[port host] (.createConnection net port host))
(defn -main [& args] ; Note that only one of these -main functions is in the
file at any g
"It's odd that it works fine in the first one but no the second."
You'd think with that post button being so small that it'd be difficult
to... yeah.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@google
are you sure you don't have an extra space in there?
(. createConnection net …) vs. (.createConnection net …)
On Wed, Jul 27, 2011 at 5:38 PM, Anthony Grimes wrote:
> Sorry for the terrible subject line. I couldn't think of an easy way to
> describe the problem in a single line.
> (def net (node/
Yep, just double checked. No extra spaces.
--
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.
To unsub
have you looked at the generated javascript?
On Wed, Jul 27, 2011 at 5:44 PM, Anthony Grimes wrote:
> Yep, just double checked. No extra spaces.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@goo
On Wed, Jul 27, 2011 at 8:25 PM, Sean Corfield wrote:
> On Wed, Jul 27, 2011 at 4:32 PM, Ken Wesson wrote:
>> => (.format (java.util.Formatter.) "%d" (into-array Object [(bigint 2)]))
>> #
>>
>> (2N isn't recognized as a BigInteger literal by Clojure 1.2, it seems.)
>>
>> In my copy of Clojure 1.
Yeah. To the extent that I can read Javascript, the calls look exactly the
same and it looks 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 mod
On Wed, Jul 27, 2011 at 8:38 PM, Anthony Grimes wrote:
> Sorry for the terrible subject line. I couldn't think of an easy way to
> describe the problem in a single line.
> (def net (node/require "net"))
> (defn portal
> [port host] (.createConnection net port host))
> (defn -main [& args] ; Note
That's actually what I thought at first, but the node example that ships
with ClojureScript actually does the same thing (uses a node function
outside of -main and then calls that function from -main) I did and it works
fine.
Here is the generated JavaScript for the failing -main and such:
por
On Wed, Jul 27, 2011 at 9:05 PM, Anthony Grimes wrote:
> That's actually what I thought at first, but the node example that ships
> with ClojureScript actually does the same thing (uses a node function
> outside of -main and then calls that function from -main) I did and it works
> fine.
> Here is
The first argument to Javascript's 'call' is a 'this' argument. All
generated functions are called like this.
--
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 membe
On Wed, Jul 27, 2011 at 9:21 PM, Anthony Grimes wrote:
> The first argument to Javascript's 'call' is a 'this' argument. All
> generated functions are called like this.
If portal.core.net is an instance rather than a class variable then a
null "this" would explain it not resolving. Is "_main" cal
It looks like main is called the same way. Like I said, my example is not
much different than the one that comes with cljs.
(ns nodels
(:require [cljs.nodejs :as nodejs]))
(def fs (nodejs/require "fs"))
(def path (nodejs/require "path"))
(defn file-seq [dir]
(tree-seq
(fn [f] (.isDirect
On Wed, Jul 27, 2011 at 9:30 PM, Anthony Grimes wrote:
> It looks like main is called the same way. Like I said, my example is not
> much different than the one that comes with cljs.
>
> (ns nodels
> (:require [cljs.nodejs :as nodejs]))
> (def fs (nodejs/require "fs"))
> (def path (nodejs/requir
Right, I have an ns form. I just didn't post it.
(ns portal.core
(:require [cljs.nodejs :as node]
[clojure.string :as string]
[goog.date.DateTime :as time]))
This is all part of a bigger application. I just pulled stuff out to make a
minimal example (that does fail, by
Is it possible that the new function called portal is overwriting the
namespace called portal? Could you try renaming the function called
portal to something else? Like portal2?
On Wed, Jul 27, 2011 at 6:05 PM, Anthony Grimes wrote:
> That's actually what I thought at first, but the node example
Hah! That was it! You, sir, are one clever fellow. Thank you very much.
--
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 wi
On Jul 27, 2011, at 8:56 PM, Ken Wesson wrote:
>> In Clojure 1.2:
>>
>> (type (bigint 2)) => java.math.BigInteger
>>
>> In Clojure 1.3:
>>
>> (type (bigint 2)) => clojure.lang.BigInt
>> (type 2N) => clojure.lang.BigInt
>
> What the devil? Why was this done? Seems like wheel reinvention to me.
On Wed, Jul 27, 2011 at 9:48 PM, Anthony Grimes wrote:
> Hah! That was it! You, sir, are one clever fellow. Thank you very much.
Damn. I didn't think of that. In normal Clojure, defn'ing x.y/x
doesn't clobber the Java package named x with a function named x. But
it looks like in JS packages and f
This is an odd one. It seems that, when new functions are added to
cljs.core, the code generated when you compile targeting nodejs doesn't
include them. I noticed this initially when I pulled this
commit
https://github.com/clojure/clojurescript/commit/3b3ed7783ebbd07fec6772b6a1bca4ed32924fb8
I guess I should have added that it's not just rand that isn't being
included. It's all of the recently added functions. Check the commit log.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.c
Let's say I have a nested map-like structure:
{ :a
{ :id "foo",
--
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
On Wed, Jul 27, 2011 at 11:07 PM, semperos wrote:
> Let's say I have a nested map-like structure:
> { :a
> { :id "foo",
OK ...
... and then what?
--
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 o
Darn tabbing...apologies for the previous post.
Here's my full question:
I have a map of maps, arbitrarily nested. Every individual map has a
key/value entry that acts as a unique identifier for that map. I need to be
able to write a function that, given the whole map of maps and the value of
On Wed, Jul 27, 2011 at 11:15 PM, semperos wrote:
> Darn tabbing...apologies for the previous post.
> Here's my full question:
> I have a map of maps, arbitrarily nested. Every individual map has a
> key/value entry that acts as a unique identifier for that map. I need to be
> able to write a func
On Jul 27, 8:15 pm, semperos wrote:
> Darn tabbing...apologies for the previous post.
>
> Here's my full question:
>
> I have a map of maps, arbitrarily nested. Every individual map has a
> key/value entry that acts as a unique identifier for that map. I need to be
> able to write a function that,
You're basically building a tree. I find clojure.walk or clojure.zip
are helpful for applying changes to a tree of maps like this.
On Jul 27, 10:15 pm, semperos wrote:
> Darn tabbing...apologies for the previous post.
>
> Here's my full question:
>
> I have a map of maps, arbitrarily nested. Ev
On Jul 27, 8:56 pm, Dmitry Gutov wrote:
> > First: Why doesn't macroexpand expand the inner when-lets?
>
> It's not supposed to, see the doc. To do full expansion, you can use
> `clojure.walk/macroexpand-all`.
Oh, yeah. Thanks!
> > Is the gensym in the two expands the same thing, or do "they"
On Jul 27, 9:23 pm, Alan Malloy wrote:
> On Jul 27, 11:56 am, Dmitry Gutov wrote:
>
> > > First: Why doesn't macroexpand expand the inner when-lets?
>
> > It's not supposed to, see the doc. To do full expansion, you can use
> > `clojure.walk/macroexpand-all`.
>
> > > Is the gensym in the two ex
On Jul 27, 5:07 pm, Benny Tsai wrote:
> Hi Oskar,
>
> I just came across this article yesterday, which I thought you may find
> useful. It's a 4-part series where the author discusses his experience
> implementing games in a functional style:
>
> http://prog21.dadgum.com/23.html
>
> He was using
FWIW, clojure.pprint.cl-format handles this fine in 1.3:
(cl-format nil "~d" 2N)
=> "2"
On Jul 27, 11:45 am, Andrea Tortorella wrote:
> Hi everyone,
> I don't know where to post about bugs (if this is a bug).
> Anyway in clojure 1.3 with the new numerics:
>
> (format "%d" 2N)
>
> throws IllegalF
78 matches
Mail list logo