Thanks Las, much appreciated! Just shout if there's anything I can assist
with.
- Peter
--
--
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 -
Hi,
I want to write a macro that introduces new variables from data.
The data is a vector and looks like this for example: [a b c]
I want to use the macro like this:
(def-names [a b c] (str a b))
What code I want the macro to produce from the above is the following:
(let [a a
b b
c
Since the bindings are a function of the data that's passed in, IMO
you don't need a anaphoric macro for this.
For example -
(defmacro def-names [names body]
(let [bindings* (vec (mapcat (juxt symbol identity) names))]
`(let ~bindings*
~@body)))
As to whether it's a good idea or
Hi Anders,
(defmacro def-name [name-vec body]
`(let ~(vec (interleave (map symbol name-vec)
name-vec))
~@body))
user= (macroexpand '(def-name [a b c] 1 2 3))
(let* [a a b b c c] 1 2 3)
user= (def-name [a b c] a)
a
user= (def-name [a b c] b)
b
user= (def-name
Good point BG,
I think it is almost certainly not a good idea :) But educational,
definitely.
On Tue, Jul 23, 2013 at 12:48 AM, Baishampayan Ghose b.gh...@gmail.comwrote:
Since the bindings are a function of the data that's passed in, IMO
you don't need a anaphoric macro for this.
For
Il giorno martedì 23 luglio 2013 03:32:52 UTC+2, frye ha scritto:
On Sun, Jul 21, 2013 at 5:16 PM, Manuel Paccagnella
manuel.pa...@gmail.com javascript: wrote:
- what I should use to model workflow; possibly
laminahttps://github.com/ztellman/lamina
?
I'm not sure Lamina
Il giorno martedì 23 luglio 2013 04:11:48 UTC+2, frye ha scritto:
Hey all,
*A)* Thanks for all the feedback on this topic. There's a few interesting
things here. Notably that there are at least these existing blog engines:
- http://github.com/bitemyapp/neubite (apparently needs a
I use a similar macro in my music
codehttps://github.com/ctford/leipzig/blob/master/src/leipzig/scale.clj,
because I want to take a sequence and explicitly give parts of it names.
(defmacro defs [names docstring values]
`(do ~@(map
(fn [name value] `(def ~name ~docstring ~value))
A bit off-topic, but in some situations where bidirectional communication
is
not necessary, one might consider EventSource instead of Websockets
to push data from server to the client. For some reason, EventSource is not
as well known as Websockets.
It has some advantages like being more
Hi,
I'm using Shoreleave in one of our projects and it works fine for us. I
followed the same tutorial and everything was OK.
I've seen something similar when I was using the autogeneration of the js
file. For some reason after updating the cljs the continuous compilation
breaks the
There is an example in the book The Joy of Clojure on p.262 that uses
futures that I evaluated in the REPL.
user (time
(let [x (future (do (Thread/sleep 2000)
(+ 1 1)))]
[@x @x]))
Elapsed time: 2000.809 msecs
[2 2]
I figured that taking out the future would cause the execution to
It's definitely got to do with the code, the right way to test it out
will be to wrap the form in a function and then calling it twice. Like
so -
(time
(let [x (fn [] (Thread/sleep 2000)
(+ 1 1))]
[(x) (x)]))
;= Elapsed time: 4002.0 msecs
;= [2 2]
Hope that helps.
On Tue, Jul 23, 2013 at 11:12 AM, Baishampayan Ghose b.gh...@gmail.com wrote:
It's definitely got to do with the code, the right way to test it out
will be to wrap the form in a function and then calling it twice. Like
so -
(time
(let [x (fn [] (Thread/sleep 2000)
(+ 1
I think I read somewhere that :use is no longer encouraged, but I could be
mistaken.
From what I've read, it seems like most people agree that Clojure has too many
ways of including/importing/referencing/requiring/using things:
I can confirm this behavior. It's not the fault of the `ns`
macro, however. This works just fine:
user= (ns ^{:doc This is foo} foo)
nil
foo= (in-ns 'user)
#Namespace user
user= (meta (the-ns 'foo))
{:doc This is foo}
AOT-compilation appears to be the culprit (as usual).
Thank you for confirming this, Stuart. Hopefully this will be fixed someday.
On Tuesday, July 23, 2013 7:06:18 PM UTC+3, Stuart Sierra wrote:
I can confirm this behavior. It's not the fault of the `ns`
macro, however. This works just fine:
user= (ns ^{:doc This is foo} foo)
nil
+1, :use is IMO an antipattern.
I hate it mainly in blogs, where they explain some new API. They :use like
3 namespaces and you have to guess which fn is from which ns :)
JW
On Tuesday, July 23, 2013 5:50:50 PM UTC+2, Greg Slepak wrote:
I think I read somewhere that :use is no longer
We should scour clojuresphere for uses of 'use' and automatically post
github issues to the projects of interest, and redefine the ns macro to
issue a warning with use.
Does anyone actually like 'use'?
Require is always more evident.
On Tue, Jul 23, 2013 at 2:17 PM, Jozef Wagner
On Jul 23, 2013, at 2:27 PM, Gary Trakhman wrote:
We should scour clojuresphere for uses of 'use' and automatically post github
issues to the projects of interest, and redefine the ns macro to issue a
warning with use.
Does anyone actually like 'use'?
Require is always more
We have production code using it.
It's easy to say that it's a bad pattern after the fact.
We have been using it in a disciplined way.
It simplifies our life in the REPL we have some tools we want to see included
automatically each time we switch to a name space.
Anything else aside from
For much the same reason, I've been using :require with :as and a
one-or-two-letter alias, so I can do x/whatever. Generally works well.
On Tue, Jul 23, 2013 at 1:38 PM, Lee Spector lspec...@hampshire.edu wrote:
On Jul 23, 2013, at 2:27 PM, Gary Trakhman wrote:
We should scour
We only have :use in a couple of legacy tests and two scratch
projects. We've switched from :use to :require .. :refer :all for
situations where :use used to make sense (primarily in a test ns where
we want to just refer in all of the ns being tested). We have a
handful of places where we :refer
:use...:only doesn't strike me as especially problematic, since it
documents the specific symbols it's importing and from where.
On Tue, Jul 23, 2013 at 3:04 PM, Sean Corfield seancorfi...@gmail.comwrote:
We only have :use in a couple of legacy tests and two scratch
projects. We've switched
Yea, I have a single namespace with project-specific common utilities which
I refer to as u/some-util-function. For me, it's a bit scary to have
implicit symbols in scope. A typo can make a local binding refer to
something that might not exist in production, or at least not what's
intended.
What's problematic about it is that it's slightly easier to do the wrong
thing. It seems insignificant, but 98% of times you use use, it's going to
be wrong. Also, 'use only' means I have to change my calling NS twice in
different parts of the emacs buffer any time I change a function name in
One of the main issues I have faced with :use is, understanding a
non-trivial codebase becomes very difficult and almost always requires
Emacs Meta-dot.
I'd vote for deprecating :use.
Shantanu
--
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To
On Jul 23, 2013, at 3:06 PM, Gary Trakhman wrote:
Yea, I have a single namespace with project-specific common utilities which I
refer to as u/some-util-function. For me, it's a bit scary to have implicit
symbols in scope. A typo can make a local binding refer to something that
might not
On Tue, Jul 23, 2013 at 3:26 PM, Gary Trakhman gary.trakh...@gmail.comwrote:
What's problematic about it is that it's slightly easier to do the wrong
thing. It seems insignificant, but 98% of times you use use, it's going to
be wrong. Also, 'use only' means I have to change my calling NS
On Tue, Jul 23, 2013 at 12:57 PM, Lee Spector lspec...@hampshire.edu wrote:
I'm sure I'm coming from a minority perspective on this, but for the kind of
work I do it's often more important to be able to quickly sketch out and test
ideas, without any ceremony about which functions come from
None of what has been said so far makes me believe that our usage of
use is bad. It's like a rope, you can use it for useful purposes or you can
hang yourself. You use it at your own taste and will.
Lack of discipline does not constitute for me a reason to trash a feature as
scarce
as his
I think what we're proposing is not about removing the capability to do
'use'. That will remain, it's clojure after all. You could also implement
it yourself easily enough. The issue is whether it's worthwhile to have it
as a core function, without some kind of notice that better things exist.
On Tuesday, July 23, 2013 9:42:39 PM UTC+2, Shantanu Kumar wrote:
One of the main issues I have faced with :use is, understanding a
non-trivial codebase becomes very difficult and almost always requires
Emacs Meta-dot.
which is particularly annoying when you read code on a blog (as
On Tue, Jul 23, 2013 at 1:50 PM, Stefan Kamphausen ska2...@gmail.comwrote:
It complects require and refer ;-)
How so?
--
Ben Wolfson
Human kind has used its intelligence to vary the flavour of drinks, which
may be sweet, aromatic, fermented or spirit-based. ... Family and social
life also
On Tue, Jul 23, 2013 at 1:53 PM, Ben Wolfson wolf...@gmail.com wrote:
On Tue, Jul 23, 2013 at 1:50 PM, Stefan Kamphausen ska2...@gmail.com
wrote:
It complects require and refer ;-)
How so?
Because use = require + refer (essentially).
--
Sean A Corfield -- (904) 302-SEAN
An Architect's View --
On Jul 23, 2013, at 4:43 PM, Gary Trakhman wrote:
For instance, we have defrecords now, no one's going to reach for defstruct
because records are documented and promoted more thoroughly.
FWIW I'm even a contrarian on defstruct :-! although I've switched to records
anyway on account of
It's not as if *some* (cough cough) parts of Clojure were'nt
opinionated, right? :-)
Having in the (ns) macro the possibility to use :use, to use :require,
to use :refer-clojure, to use :require-macros can be daunting, and not
only for newcomers!
And not to mention that the vast majority of the
Thanks a lot guys, I'll try it out tomorrow.
Anders
--
--
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
On Tue, Jul 23, 2013 at 1:55 PM, Sean Corfield seancorfi...@gmail.comwrote:
On Tue, Jul 23, 2013 at 1:53 PM, Ben Wolfson wolf...@gmail.com wrote:
On Tue, Jul 23, 2013 at 1:50 PM, Stefan Kamphausen ska2...@gmail.com
wrote:
It complects require and refer ;-)
How so?
Because use = require
Maybe we need an simpler alternative to the ns macro without all
these complex options :)
With a short name like ns-stop-banging-your-head-on-the-wall :)
Or the reverse, ns-make-your-life-more-chaotic...
:)
Luc P.
It's not as if *some* (cough cough) parts of Clojure were'nt
opinionated,
2013/7/23 Softaddicts lprefonta...@softaddicts.ca:
Maybe we need an simpler alternative to the ns macro without all
these complex options :)
With a short name like ns-stop-banging-your-head-on-the-wall :)
would violate the rule use often = short name ;-)
Or the reverse,
On Tuesday, July 23, 2013 11:13:11 PM UTC+2, Ben wrote:
On Tue, Jul 23, 2013 at 1:55 PM, Sean Corfield
seanco...@gmail.comjavascript:
wrote:
On Tue, Jul 23, 2013 at 1:53 PM, Ben Wolfson wol...@gmail.comjavascript:
wrote:
On Tue, Jul 23, 2013 at 1:50 PM, Stefan Kamphausen
On Tue, Jul 23, 2013 at 2:13 PM, Ben Wolfson wolf...@gmail.com wrote:
If that's all that's required for one thing to complect two others,
clojure's rife with the stuff. if-let complects if and let. Destructuring
assignment complects assignment and getting values from a data structure (as
the
As an aside from this, how problematic is AOT compilation? It seems to be
the source of many bugs (for example, my own
CLJ-1227http://dev.clojure.org/jira/browse/CLJ-1227).
Is there a list anywhere of things to watch out for when AOT compiling?
On 24 July 2013 04:06, Stuart Sierra
Please spam the list!!! I am sure anyone who receives that message is
probably running Mac OS X 10.7.x or later and trying to unravel the mess
between Java 6 and Java 7. Please post recommendations. I finally got
Eclipse to see the jdl1.7.0_25.jdk now how do I get the OS to replace the
Apple
On Tuesday, July 23, 2013 11:50:50 AM UTC-4, Greg Slepak wrote:
I think I read somewhere that :use is no longer encouraged, but I could be
mistaken.
From what I've read, it seems like most people agree that Clojure has too
many ways of including/importing/referencing/requiring/using
https://github.com/evanescence/verily
Verily is a new testing lib with a few goals:
- Build off existing Clojure concepts (functions, vars, etc)
- Be as functional/immutable as possible
- Be easy to use from terminal or REPL
- Have composable pieces that are easy to swap out
-
Hi,
I hope I can get a lightbulb on what's happening here:
https://github.com/nodename/async-plgd/blob/master/src/hoare/problem.clj
Testing fan-in on a pair of processes and getting nutty results.
Thanks,
-A
--
--
You received this message because you are subscribed to the Google
Groups
Whoops. Looks like I didn't check the namespace well enough, there's
already a lib called verily. (Sorry Justin.)
Will think up a new name soon.
On Tue, Jul 23, 2013 at 11:55 PM, Steven Degutis sbdegu...@gmail.comwrote:
https://github.com/evanescence/verily
Verily is a new testing lib with
48 matches
Mail list logo