On Mar 27, 11:51 pm, Nathan Sorenson wrote:
> When trawling the ClojureScript source, I was a little puzzled when I first
> noticed that cljs.core/apply respects the laziness of the seq its provided.
> Fogus mentioned this feature in his Clojure/west talk and it reminded me of
> my earlier puzzlem
Hi,
clj-browserchannel-demo demonstrates cross-browser compatible, real-
time, bi-directional communication between ClojureScript and Clojure
using Google Closure BrowserChannel.
>From the Google Closure API: "A BrowserChannel simulates a
bidirectional socket over HTTP. It is the basis of the Gma
Here is the chat app on Heroku:
http://cold-stream-6156.herokuapp.com/index.html
-Gijs
On Mar 28, 1:39 pm, "Gijs S." wrote:
> Hi,
>
> clj-browserchannel-demo demonstrates cross-browser compatible, real-
> time, bi-directional communication between ClojureScript and Clojure
> using Google Closur
Rich Hickey holds the copyright on the Clojure logo design, and it's not
under an open-source license.
He has asked that the logo not be used to refer to anything except the
language itself.
-S
On Monday, March 26, 2012 10:33:39 AM UTC-4, Marco Dalla Stella wrote:
>
> Hi,
>
> We would like to
On 28/03/12 13:12, Stuart Sierra wrote:
Rich Hickey holds the copyright on the Clojure logo design, and it's
not under an open-source license.
He has asked that the logo not be used to refer to anything except the
language itself.
Does that mean it can be used freely by anyone (presentations
There is a jquery plugin called "hoverintent" which accomplishes this.
http://cherne.net/brian/resources/jquery.hoverIntent.html
-Dave
On Tue, Mar 27, 2012 at 3:41 PM, Andy Fingerhut wrote:
> I would be happy to, if someone could teach me how to do it. I didn't
> write the JavaScript that does
I never saw an appcache file automatically generated in ClojureScript
One, but if you want an example of how to implement serving the cache
manifest for offline use of your webapp, this repo of mine (branched
from one master) has one:
https://github.com/pandeiro/multiedit/blob/multi-edit/src/app/c
Hi,
Is it possible to write a macro that when used in a top-level function
(created using defn) can find out the name of the immediate top-level
function? I know *ns* returns the namespace and it's possible to walk
the current thread's stack trace to find out the function name, but I
am looking fo
Did you just need the name of the function? something like this?
>88<
(def ^{:dynamic true} *myself* nil)
(defmacro defn* [name args & body]
`(defn ~name ~args
(binding [*myself* '~name]
~@body)))
(defn* foo [a b] [*myself* (+ a b)])
--
On Mar 28, 8:57 pm, Ram Krishnan wrote:
> Did you just need the name of the function? something like this?
Sorry, I should explained using code what I am looking for:
(defmacro find-name []
;; some magic here
..)
(defn foo []
..
(println (find-name)) ; should print "foo"
..)
I am l
> Sorry, I should explained using code what I am looking for:
Oh yea!!!
> (defmacro find-name []
> ;; some magic here
> ..)
>
> (defn foo []
> ..
> (println (find-name)) ; should print "foo"
> ..)
>
> I am looking for a way to write the `find-name` macro. So, you can see
> I want to use it w
I don't know how to get the fn name at runtime, except by looking at the
stacktrace which is going to expensive as you mentioned.
;; original:
;;
http://groups.google.com/group/clojure/browse_thread/thread/234ac3ff0a4b6b80?pli=1
;; but slightly changed for Clojure updates since 1.0
(defn unmang
'(Devin Walters)
On Tuesday, March 27, 2012 at 8:54 PM, Cedric Greevey wrote:
> On Tue, Mar 27, 2012 at 3:05 PM, Herwig Hochleitner
> mailto:hhochleit...@gmail.com)> wrote:
> > 2012/3/26 Cedric Greevey mailto:cgree...@gmail.com)>:
> > > (comp <{:k1 5 :k2 6}), that is not used in production whe
On Wednesday, March 28, 2012 at 9:15 AM, Shantanu Kumar wrote:
>
>
> On Mar 28, 8:57 pm, Ram Krishnan http://gmail.com)>
> wrote:
> > Did you just need the name of the function? something like this?
>
>
> Sorry, I should explained using code what I am looking for:
>
> (defmacro find-name []
>
Your right the core apply is lazy too. The same question still remains: is
there a use case behind apply being lazy when Clojure is otherwise a
strictly evaluating language? Perhaps is this the intended mechanism to
smuggle non-strictness into evaluation?
--
You received this message because y
I was also intending on using the logo in such a way to communicate that
a site I'm building is "powered by clojure" or something to that effect
with a link to clojure.org. Is that frowned upon?
Chip
On 3/28/12 5:37 AM, Dimitrios wrote:
> On 28/03/12 13:12, Stuart Sierra wrote:
>> Rich Hickey ho
Actually now that I've thought about it, you couldn't mimic non-strict
evaluation with lazy apply, so that's not a use-case. All you could provide
is left-to-right argument non-strictness which is not sufficient. W.r.t.
your example, you can force evaluation the first 3 args, but you can't,
sa
Let's take a step back and look at this idea from a new user's view.
The way I see it, whatever we do, we'll have to explain to users how
to create sets. Hashmaps, and vectors follow (roughly) the JSON/Python
syntax:
vector = [1 2 3 4]
map = {1 2 3 4}
So how to these languages represent sets?
Py
I was wondering how dependency injection is done in Clojure since functions
live in static namespaces. It seems like this could be achieved by having a
macro that can use runtime information to determine the mapping between a
namespace and its implementation. Does this make sense? Is there a bet
>>is there a use case behind apply being lazy when Clojure is otherwise a
>>strictly evaluating language
In clojure-py we have to pass vararg arguments as tuples. So it ends
up a lot like
(to-tuple (concat args seqarg))
I always saw the seq argument in IFn as a crutch to get around the "we
have
On Wed, Mar 28, 2012 at 1:40 PM, Chip Collier wrote:
> I was also intending on using the logo in such a way to communicate that
> a site I'm building is "powered by clojure" or something to that effect
> with a link to clojure.org. Is that frowned upon?
>
> Chip
Unfortunately, trademark laws ar
On Tue, Mar 27, 2012 at 9:41 PM, Julien Chastang
wrote:
> I have Clojure project artifacts that are not in a public Maven repository,
> but simply in a local repository (so-called unmanaged dependencies). When
> pushing a project to Heroku, Heroku will attempt to install the local
> dependencies f
Just to follow up quickly, two possible ways have been suggested for doing
this, but one way seems to require increasing the distance between words on the
page, which I'd prefer not to do. The other I haven't looked into in enough
detail to see whether it will work, but I may do that soon.
As
Nice work! I have been looking into this also. I think I have found
something to keep me busy this weekend.
On Mar 28, 7:45 am, "Gijs S." wrote:
> Here is the chat app on Heroku:
>
> http://cold-stream-6156.herokuapp.com/index.html
>
> -Gijs
>
> On Mar 28, 1:39 pm, "Gijs S." wrote:
>
>
>
>
>
>
Thanks all for responding.
Ram – Appreciate both versions, but I need to use it with regular
functions created with `defn`.
Rostislav – I need to do this in a regular function created using
`defn`; not sure how can I use named let in this case. Am I missing
something?
Steve – Your example is alr
On 28/03/2012 18:15, Shantanu Kumar wrote:
On Mar 28, 8:57 pm, Ram Krishnan wrote:
> Did you just need the name of the function? something like this?
Sorry, I should explained using code what I am looking for:
(defmacro find-name []
;; some magic here
..)
(defn foo []
..
(println (fi
Hi everyone,
On Gregg's suggestion, I want to share a writeup about how total beginners
can learn Clojure in a minimally painful way. I'd welcome any comments,
suggestions, etc.
http://www.elangocheran.com/blog/2012/03/the-newbies-guide-learning-clojure/
Thanks.
Elango
--
You received this me
> Steve – Your example is already compact, but maybe it can be made even
> cheaper by specifying maxDepth of 1:
> http://docs.oracle.com/javase/6/docs/api/java/lang/management/ThreadMXBean.html#getThreadInfo(long,
> int)
@Shantanu: What about the defn0 macro from Steve:
(defmacro defn0 [name & fd
I wanted to aks if it is possible to get only the passed milliseconds
from the function 'time' without the sentence "Elapsed time: 0.119
msecs". I would only need the 0.119 and best as a number and not as a
String.
Or have I to write a function which extracts the number out of the
String?
--
You
You should use java interop for this:
(java.lang.System/currentTimeMillis)
On Wed, Mar 28, 2012 at 21:32, Goldritter
wrote:
> I wanted to aks if it is possible to get only the passed milliseconds
> from the function 'time' without the sentence "Elapsed time: 0.119
> msecs". I would only need the
Something like this?
(tracktime [f]
let [start (System/currentTimeMillis)
result (f)
end (System/currentTimeMillis)]
(vector result (- end start)))
Am 28.03.2012 21:34, schrieb Moritz Ulrich:
You should use java interop for this:
(java.lang.System/curren
Looks like it could work. If you want to track even short times, use
System/nanoTime. If you're interested, take a look at the
implementation of `time':
https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L3424
On Wed, Mar 28, 2012 at 21:40, Marcus Lindner
wrote:
> Something l
Thanks.
I will try it.
Am 28.03.2012 21:45, schrieb Moritz Ulrich:
Looks like it could work. If you want to track even short times, use
System/nanoTime. If you're interested, take a look at the
implementation of `time':
https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L342
On Wednesday, March 28, 2012 at 12:58 PM, Timothy Baldridge wrote:
> Let's take a step back and look at this idea from a new user's view.
> The way I see it, whatever we do, we'll have to explain to users how
> to create sets. Hashmaps, and vectors follow (roughly) the JSON/Python
> syntax:
>
> v
> That's surprising to me. You never use something like this?
> (map #{:fred :bob :ted} [:fred :bob])
I think it's more that most of what I work with is either seq like,
vectors, or has some sort of key->value relationship. Most of the time
if I need a set of unique keys, I also need sets of data
On Mar 28, 2012, at 1:13 PM, Chris McBride wrote:
> I was wondering how dependency injection is done in Clojure since functions
> live in static namespaces. It seems like this could be achieved by having a
> macro that can use runtime information to determine the mapping between a
> namespace
I would ask why you would want to do dependency injection? If it is to
swap out functions for testing, just use 'with-redefs'. I have
personally found it (DI) completely unnecessary...
On Wed, Mar 28, 2012 at 1:13 PM, Chris McBride wrote:
> I was wondering how dependency injection is done in Cloj
I've been bitten a couple of times now by the following scenario:
- Use fully qualified names in the code
- Forget to add (require…) for the associated namspace
- But one other file already require'ed the same namespace, and the
compiler&runtime is happy - all works fine.
- Then you include th
On Wed, Mar 28, 2012 at 3:13 PM, Frank Siebenlist
wrote:
> I've been bitten a couple of times now by the following scenario:
Slamhound won't help you catch those issues as they arise, but it can
catch them after they've happened:
https://github.com/technomancy/slamhound/
In general though I rec
On Mar 28, 2012, at 3:15 PM, Phil Hagelberg wrote:
> ...
> In general though I recommend simply using :require :as for
> everything; if your code won't compile without the :as alias in place
> then you'll be safe.
I realize that's a pragmatic way to force compilation errors.
However, I thought
Frank Siebenlist writes:
> Wouldn't it be better to have the compiler or (load-file) generate an
> error/warning, as it should be able to detect a missing require?
It's been proposed in the past. I don't recall Rich's argument against
it, but I only use fully-qualified vars when debugging.
-Phi
On Wed, Mar 28, 2012 at 2:13 PM, Timothy Baldridge wrote:
>>>is there a use case behind apply being lazy when Clojure is otherwise a
>>>strictly evaluating language
>
> In clojure-py we have to pass vararg arguments as tuples. So it ends
> up a lot like
>
> (to-tuple (concat args seqarg))
>
> I a
On Wed, Mar 28, 2012 at 2:32 PM, Daniel Gagnon wrote:
> On Wed, Mar 28, 2012 at 1:40 PM, Chip Collier wrote:
>>
>> I was also intending on using the logo in such a way to communicate that
>> a site I'm building is "powered by clojure" or something to that effect
>> with a link to clojure.org. Is
My fork of cd-client has code to create a local snapshot of all examples,
see-alsos, and comments in clojuredocs.org, save it to a file, and switch to
"local mode", which pulls all results from the snapshot file instead of
clojuredocs.org.
https://github.com/jafingerhut/cd-client
Andy
On Mar
"May be delayed"
But I don't think they ever are:
user=> (def oddseq (map #(do (print %) %) (range 30)))
#'user/oddseq
user=> (defn foo [& args] 'd)
#'user/foo
user=> (apply foo oddseq)
01234567891011121314151617181920212223242526272829d
user=> (def oddseq (map #(do (print %) %) (range 1)))
#'
On Wed, Mar 28, 2012 at 3:30 PM, Rostislav Svoboda
wrote:
>> Steve – Your example is already compact, but maybe it can be made even
>> cheaper by specifying maxDepth of 1:
>> http://docs.oracle.com/javase/6/docs/api/java/lang/management/ThreadMXBean.html#getThreadInfo(long,
>> int)
>
> @Shantanu:
On Wed, Mar 28, 2012 at 3:56 PM, Devin Walters wrote:
> We have: '(), [], {}, #{}
Not quite. '() isn't strictly analogous to #{}, because quote
suppresses evaluation of what's inside.
user=> (def foo 42)
#'user/foo
user=> (for [x ['(foo) [foo] {:a foo} #{foo}]]
(println x))
(foo)
[42]
"not-unreasonable because otherwise people
will acquire a negative opinion of me."
On the contrary...I find that people who admit that their "cool idea
after further thought probably isn't so cool" garner better respect
from the community at large.
Just my $0.02...
Timothy
--
You received this
On Wed, Mar 28, 2012 at 7:36 PM, Timothy Baldridge wrote:
> "not-unreasonable because otherwise people
> will acquire a negative opinion of me."
>
> On the contrary...I find that people who admit that their "cool idea
> after further thought probably isn't so cool" garner better respect
> from the
> I don't think it's possible to ever have apply not evaluate all its
> arguments? I think this is what Nathan was saying.
>
Cedric is right that apply, itself, is strict and evaluates its arguments
as one might expect. But I'm not referring to manual thunking/delaying your
arguments to mimic
An example of "lazy" apply, with your foo fn:
> (apply foo (iterate inc 0))
d
--
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 pat
I'm not trying to do anything in particular. I do OO programming at work and
it's been pounded in my head that loose coupling is better than gift coupling.
I've found it useful on a few occasions. One example, in the frontend we wrap
all the database calls in a caching layer but we don't need th
How are you able to make the tooltips extend beyond the browser window. I
have not seen this before.
Dave
On Saturday, 24 March 2012 21:15:20 UTC+11, Andy Fingerhut wrote:
>
> There are still some problems with this, but it is ready for experimental
> use, at least. Alex, please don't put this
On Wed, Mar 28, 2012 at 8:32 PM, Nathan Sorenson wrote:
>
>> I don't think it's possible to ever have apply not evaluate all its
>> arguments? I think this is what Nathan was saying.
>
> Cedric is right that apply, itself, is strict and evaluates its arguments as
> one might expect. But I'm not re
On Wed, Mar 28, 2012 at 7:16 PM, Timothy Baldridge wrote:
> "May be delayed"
>
> But I don't think they ever are:
>
> user=> (def oddseq (map #(do (print %) %) (range 30)))
> #'user/oddseq
>
> user=> (defn foo [& args] 'd)
> #'user/foo
>
> user=> (apply foo oddseq)
> 012345678910111213141516171819
> One example, in the frontend we wrap all the database calls in a caching
> layer but we don't need that when the same code runs in the backend.
>
One option for something like this (a configuration option that doesn't
change much between function calls/expected to largely remain the same fo
> > Put another way: why does apply need to promise not to realize its seq
> > argument?
>
> (apply + some-lazy-seq-too-big-to-fit-in-main-memory)
>
> Not "avoid evaluating some of its arguments" but "avoid holding onto
> the head" in that case.
>
I'd reach for 'reduce' in this case but that's st
On Wed, Mar 28, 2012 at 8:46 PM, Chris McBride wrote:
> I'm not trying to do anything in particular. I do OO programming at work and
> it's been pounded in my head that loose coupling is better than gift
> coupling. I've found it useful on a few occasions. One example, in the
> frontend we wrap
On Tuesday, March 27, 2012 2:51:41 PM UTC-4, Jay Fields wrote:
>
> I recently ran into some code** that was in Java, and ran in single
> digit microseconds (not millis). I converted it to clojure, and got it
> running at about the same speed... though it did take me a day to
> figure out all the tw
>
> Is there a way to capture those kind of bugs earlier?
>
For each namespace I get a fresh repl and (use) the one in turn, then try
the whole program.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@go
Rostislav and Cedric – I cannot supply my own version of defn; the
macro should work with the regular clojure.core/defn.
Thomas – Your example works well with Clojure 1.2.x but doesn't with
Clojure 1.3 and 1.4. As you rightly said, &env should not be relied
upon. :)
Shantanu
On Mar 29, 4:17 am,
Not sure if that would work for all cases…
For example, if you have a lein plugin that require's clojure.set, and you use
any fqn in that ns without require'ing it in your file, then your fresh repl
will not catch that (… if I understand your setup).
However, if you then run it outside of the d
On Wed, Mar 28, 2012 at 8:03 PM, Frank Siebenlist
wrote:
> For example, if you have a lein plugin that require's clojure.set, and you
> use any fqn in that ns without require'ing it in your file, then your fresh
> repl will not catch that (… if I understand your setup).
The lein check task curr
On Wed, Mar 28, 2012 at 10:58 PM, Shantanu Kumar
wrote:
> Rostislav and Cedric – I cannot supply my own version of defn; the
> macro should work with the regular clojure.core/defn.
If you control the third line of:
(defn foo [x y]
(let [z (bar y (next x))]
(println "Done in " (find-name) "
"slow mode"…
Is that a setup where you would bring-up a new jvm-instance for each file such
that you can truly compile/test in isolation?
Or is it possible to create a sandbox in an existing jvm that would give you
similar isolation? (which would be far less slow)
-FrankS.
On Mar 28, 2012,
> If you control the third line of:
>
> (defn foo [x y]
> (let [z (bar y (next x))]
> (println "Done in " (find-name) ".")
> (* 4 z (count x
>
> then don't you control the first?
Cedric – Unfortunately, no. The target is pre-written code that may
have been created using (1) clojure.c
On Wed, Mar 28, 2012 at 8:30 PM, Frank Siebenlist
wrote:
> Or is it possible to create a sandbox in an existing jvm that would give you
> similar isolation? (which would be far less slow)
You could probably do this with isolated classloaders in most cases.
-Phil
--
You received this message b
leiningen v3.0 ? ;-)
On Mar 28, 2012, at 8:48 PM, Phil Hagelberg wrote:
> On Wed, Mar 28, 2012 at 8:30 PM, Frank Siebenlist
> wrote:
>> Or is it possible to create a sandbox in an existing jvm that would give you
>> similar isolation? (which would be far less slow)
>
> You could probably do
On Wed, Mar 28, 2012 at 9:05 PM, Frank Siebenlist
wrote:
> leiningen v3.0 ? ;-)
2.0 isn't done yet; there's still a chance!
Seriously, if you'd like to add it I can give you details; maybe best
to find me on IRC.
-Phil
--
You received this message because you are subscribed to the Google
Gro
sim, I don't think it is possible right now. I am not an expert, but...
On Fri, Mar 2, 2012 at 5:04 AM, Daniel Solano Gomez wrote:
> Yes, it is possible. At the byte-code level there is (at least at
> run-time) no difference between a generic and a non-generic class. All
> methods take/return
On Wed, Mar 28, 2012 at 12:56 PM, Devin Walters wrote:
> The set literal also seem fairly abundant in test code.
Yup, I have a bunch of tests where success is to get back any of a
known set of values.
> We have: '(), [], {}, #{}
Well... (), [], {}, #{} - the ' isn't needed on the empty list, ri
71 matches
Mail list logo