thanks for the report, fixed
On Wed, Jun 18, 2014 at 1:30 AM, Mike Thompson m.l.thompson...@gmail.com
wrote:
Colin, many thanks. Issue created:
https://github.com/cgrand/sjacket/issues/19
On Wednesday, June 18, 2014 4:08:53 AM UTC+10, Colin Jones wrote:
Yeah the latter version parses as
At the REPL ...
user= (def top% 4) ;; an unusually named var
#'user/top%
But later, it I try to use this var, trouble ...
user= top%
CompilerException java.lang.RuntimeException: Unable to resolve symbol: top
in this context,
I believe this is a problem with the Leiningen REPL. It works fine from the
built-in REPL:
$ java -jar ~/.m2/repository/org/clojure/clojure/1.5.1/clojure-1.5.1.jar
Clojure 1.5.1
user= (def top% 4)
#'user/top%
user= top%
4
Dave
On Tue, Jun 17, 2014 at 1:32 AM, Mike Thompson
Yeah the latter version parses as 2 symbols in sjacket, whereas the defn
version parses as a single list.
user= (p/parser top%)
#net.cgrand.parsley.Node{:tag :net.cgrand.sjacket.parser/root, :content
[#net.cgrand.parsley.Node{:tag :symbol, :content
[#net.cgrand.parsley.Node{:tag :name,
Colin, many thanks. Issue created:
https://github.com/cgrand/sjacket/issues/19
On Wednesday, June 18, 2014 4:08:53 AM UTC+10, Colin Jones wrote:
Yeah the latter version parses as 2 symbols in sjacket, whereas the defn
version parses as a single list.
user= (p/parser top%)
I'd rather see something at the beginning or at the end of the statement.
like ^:toss (def ...)
or (def ...) ;;
On Tue, May 15, 2012 at 6:50 AM, Michał Marczyk
michal.marc...@gmail.com wrote:
Workaround:
(do (def foo (build-something-enormous)) nil)
As for the reason for this behaviour --
That doesn't seem to free one from the need to take special care when
assigning potentially large lazy values to names with def.
If exercising special care on a case-by-case basis is not a problem,
then it's already possible to say
(do (def ...) nil)
or similar, as mentioned above. You can
Clojurescript doesn't have vars, so why not have def return the symbol ?
Le 15 mai 2012 à 06:14, kovas boguta kovas.bog...@gmail.com a écrit :
I think this is a pretty valid feature request.
The main question is, can this be done without having vars in clojurescript.
One way to do it is
Yeah, that is sort of what I was implying in changing the semantics of def
Though I wasn't ready to totally committed to that, since I don't
understand the properties of symbols in clojurescript.
Like, how do go from the symbol to the javascript object we've just
bound to the symbol?
On Tue,
Returning the symbol seems odd at least to me. I think the best we could do
is have a compiler flag so that defs can return nil for REPLs.
On Tuesday, May 15, 2012, kovas boguta wrote:
Yeah, that is sort of what I was implying in changing the semantics of
def
Though I wasn't ready to totally
Workaround:
(do (def foo (build-something-enormous)) nil)
As for the reason for this behaviour -- probably non other than it's
just the easiest thing for def in ClojureScript to do; it being to
inherit the return value from the JavaScript assignment def compiles
to.
Sticking a void () around
In Clojure, when you def a variable, the REPL prints the name of the
variable rather than the value.
In Clojurescript, when you def a variable, the REPL prints the value
assigned to the variable.
This is problematic when working with lazy values. Is there any particular
reason the Clojurescript
Do you have a more specific example of why this is a problem?
On Monday, May 14, 2012, Mark Engelberg wrote:
In Clojure, when you def a variable, the REPL prints the name of the
variable rather than the value.
In Clojurescript, when you def a variable, the REPL prints the value
assigned to
(def tree (function-that-produces-an-enormous-tree 2))
Want do that in Clojurescript, and you'll be treated to tons and tons of
nested tree data printed to the REPL.
Want to time something that's supposed to be lazy, to make sure it's really
lazy, and see how long it takes to produce the eager
On Mon, May 14, 2012 at 7:27 PM, Mark Engelberg mark.engelb...@gmail.comwrote:
(def tree (function-that-produces-an-enormous-tree 2))
Isn't doing this at the top level bad form?
So there are a couple examples of things that are harder to do when your
REPL prints the values that are
On Mon, May 14, 2012 at 4:41 PM, David Nolen dnolen.li...@gmail.com wrote:
On Mon, May 14, 2012 at 7:27 PM, Mark Engelberg
mark.engelb...@gmail.comwrote:
(def tree (function-that-produces-an-enormous-tree 2))
Isn't doing this at the top level bad form?
The purpose of a REPL is for
I think this is a pretty valid feature request.
The main question is, can this be done without having vars in clojurescript.
One way to do it is to surpress output somehow, under certain conditions.
Either as a token at the end of a repl input, or in the semantics of def itself.
I don't have
user= (def foo A foo :foo)
#'user/foo
user= (doc foo)
-
user/foo
A foo
nil
Sincerely
Meikel
--
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
On Tue, Sep 6, 2011 at 9:13 AM, Meikel Brandmeyer (kotarak) m...@kotka.de
wrote:
user= (def foo A foo :foo)
#'user/foo
user= (doc foo)
-
user/foo
A foo
nil
Hrm. Doc on a var not bound to a function or macro doesn't print its
(default) value?
--
Protege: What is
Alan a...@malloys.org writes:
Hi Alan,
And yes, it slows things down a bit, so in 1.3 the default is to not
support rebinding (though re-def'ing is still supported).
What do you mean by doesn't support rebinding? Does that mean, that
things like
(def foo false)
(binding [foo true]
And yes, it slows things down a bit, so in 1.3 the default is to not
support rebinding (though re-def'ing is still supported).
What do you mean by doesn't support rebinding? Does that mean, that
things like
(def foo false)
(binding [foo true] (dostuff))
(let [foo true] (dostuff)
Baishampayan Ghose b.gh...@gmail.com writes:
Hi!
What do you mean by doesn't support rebinding? Does that mean, that
things like
(def foo false)
(binding [foo true] (dostuff))
(let [foo true] (dostuff) (println foo))
Not allowed unless you mark `foo' as dynamic. The syntax looks like
On Mar 8, 6:59 pm, Timothy Baldridge tbaldri...@gmail.com wrote:
If in a namespace I bind a var:
(def foo 3)
And then later on in my program re-bind that var:
(def foo 1)
Will all parts of my program instantly see that update? How is it
possible to have any sort performance when we're
On Mar 9, 12:00 am, Tassilo Horn tass...@member.fsf.org wrote:
Alan a...@malloys.org writes:
Hi Alan,
And yes, it slows things down a bit, so in 1.3 the default is to not
support rebinding (though re-def'ing is still supported).
What do you mean by doesn't support rebinding? Does that
On Mar 9, 7:31 am, Chris Perkins chrisperkin...@gmail.com wrote:
On Mar 8, 6:59 pm, Timothy Baldridge tbaldri...@gmail.com wrote:
If in a namespace I bind a var:
(def foo 3)
And then later on in my program re-bind that var:
(def foo 1)
Will all parts of my program instantly see
If in a namespace I bind a var:
(def foo 3)
And then later on in my program re-bind that var:
(def foo 1)
Will all parts of my program instantly see that update? How is it
possible to have any sort performance when we're basically having a
namespace function lookup for every single function
On Mar 8, 3:59 pm, Timothy Baldridge tbaldri...@gmail.com wrote:
If in a namespace I bind a var:
(def foo 3)
And then later on in my program re-bind that var:
(def foo 1)
Will all parts of my program instantly see that update? How is it
possible to have any sort performance when we're
Typically an atom or a ref is used when you want a variable
On 8 March 2011 23:59, Timothy Baldridge tbaldri...@gmail.com wrote:
If in a namespace I bind a var:
(def foo 3)
And then later on in my program re-bind that var:
(def foo 1)
Will all parts of my program instantly see that
Is there a reason you're using a var rather than an atom or a ref?
I think I over-simplified what I'm doing a bit. What I'm really doing
is writing a prototype port of Clojure to PyPy. I'm planning to make
symbols resolvable at compile-time. It sounds like in most cases, like
for defs, I should
On Sat, Dec 4, 2010 at 7:34 PM, Barry Dahlberg barry.dahlb...@gmail.com wrote:
Hi Clojurians,
I have a macro which creates a function for me and I would like to add
some unit tests using clojure.test. How can I create a temporary scope
so that any functions defined during the test are
On Tue, Oct 6, 2009 at 9:14 PM, Stephen C. Gilardi squee...@mac.com wrote:
`(do (set-validator! (defvar ~name ~init) #{~init}) (var ~name)))
Cute hack. Won't work if init is false or nil, though, unless the validator
does not trigger on the initial assignment of the value.
Hi,
On Oct 7, 7:53 am, John Harrop jharrop...@gmail.com wrote:
On Tue, Oct 6, 2009 at 9:14 PM, Stephen C. Gilardi squee...@mac.com wrote:
`(do (set-validator! (defvar ~name ~init) #{~init}) (var ~name)))
Cute hack. Won't work if init is false or nil, though, unless the validator
does
2009/10/7 Stephen C. Gilardi squee...@mac.com
On Oct 2, 2009, at 10:29 AM, Mark wrote:
Is there a way to make a declaration in Clojure that cannot be rebound
later? Ideally, I'd like something that fails if I try to do this:
(def myname mark)
; ...more code, elided...
(def myname Mark)
2009/10/7 Stephen C. Gilardi squee...@mac.com
On Oct 2, 2009, at 10:29 AM, Mark wrote:
Is there a way to make a declaration in Clojure that cannot be rebound
later? Ideally, I'd like something that fails if I try to do this:
(def myname mark)
; ...more code, elided...
(def myname Mark)
On Oct 7, 2009, at 5:19 AM, Meikel Brandmeyer wrote:
Or is setting the validator calling it on the already set value?
Yes, the validation mechanism calls the validator on the already set
value.
--Steve
smime.p7s
Description: S/MIME cryptographic signature
On Oct 7, 2009, at 12:47 AM, Mark Tomko wrote:
This is pretty much what I'd had in mind.
Thanks for the comments and suggestions all.
I don't see how the text of
the Exception is set by the macro, but it'd be really spectacular if
the message were more clear. Is that message coming from
from the API docs:
(defonce myname Walter)
; ...
(defonce myname Schnell)
= nil
myname
= Walter
hope this helps ;-)
On 2 Okt., 16:29, Mark mjt0...@gmail.com wrote:
Is there a way to make a declaration in Clojure that cannot be rebound
later? Ideally, I'd like something that fails if I try
+1
In my relatively novice opinion, unless there is a reason to make
functions and vars available to code executing in a *different*
namespace, there isn't a lot of reason to def anything at all.
On Oct 2, 11:48 am, Jonathan Smith jonathansmith...@gmail.com wrote:
I use a let at the top of the
On Oct 2, 2009, at 10:29 AM, Mark wrote:
Is there a way to make a declaration in Clojure that cannot be rebound
later? Ideally, I'd like something that fails if I try to do this:
(def myname mark)
; ...more code, elided...
(def myname Mark)
Along these lines, I was thinking of adding
On Oct 2, 11:52 am, Mark Tomko mjt0...@gmail.com wrote:
However, outside the scope of a function, it seems that it's possible
for bindings to be redefined later in a file without causing an
immediate error. This could easily lead to mistakes that would
manifest as silent and potentially
This is pretty much what I'd had in mind. I don't see how the text of
the Exception is set by the macro, but it'd be really spectacular if
the message were more clear. Is that message coming from the defvar
form?
On Oct 6, 6:14 pm, Stephen C. Gilardi squee...@mac.com wrote:
On Oct 2, 2009, at
Is there a way to make a declaration in Clojure that cannot be rebound
later? Ideally, I'd like something that fails if I try to do this:
(def myname mark)
; ...more code, elided...
(def myname Mark)
Perhaps this is obvious, but I see a lot of discussion of immutable
data structures, but I
I can think of 'defvar that comes close to what you're about : it does not
rebind the root value if it is different from nil
(though it doesn't warn you about the problem, it's more to prevent
reinitializing vars when their containing files are reloaded)
2009/10/2 Mark mjt0...@gmail.com
Is
Hi,
On Oct 2, 4:29 pm, Mark mjt0...@gmail.com wrote:
Is there a way to make a declaration in Clojure that cannot be rebound
later? Ideally, I'd like something that fails if I try to do this:
(def myname mark)
; ...more code, elided...
(def myname Mark)
Perhaps this is obvious, but I
When I write code in Java, I declare everything final that's possible
to be declared final, and I deliberately look for solutions that avoid
reassignment to variables, so all my variables are final).
I'm new to Clojure, so I might be wrong, but it seems that within a
function, mutable bindings
On Oct 2, 11:52 am, Mark Tomko mjt0...@gmail.com wrote:
However, outside the scope of a function, it seems that it's possible
for bindings to be redefined later in a file without causing an
immediate error. This could easily lead to mistakes that would
manifest as silent and potentially
From what I've seen, people never redef vars in source code. In general,
you shouldn't have to worry about users of your code redefing your vars as
it's against common convention, non-idiomatic.
The exception, as Stuart Sierra said, is when writing interactively from the
REPL, where you'd like
Also, I'm not sure if your understanding of binding is correct.
because within any lexical scope inside a function, I can
pretty much count on my bindings to never change.
binding is actually like a lexical re-def:
user= (def x 1)
#'user/x
user= (binding [x 2] (pr x) (binding [x 3] (pr x))
I use a let at the top of the file to denote things that I want to
have as captured and constant.
... you can do things like
(let [x 1]
(defn foo-that-uses-x [y]
(function-here x y)))
On Oct 2, 10:29 am, Mark mjt0...@gmail.com wrote:
Is there a way to make a declaration in Clojure that
That's what I meant when I mentioned the 'binding' form above. The
reason that's okay (to me) is that it explicitly calls out that
bindings may be about to change.
On Oct 2, 11:47 am, John Newman john...@gmail.com wrote:
Also, I'm not sure if your understanding of binding is correct.
because
defn- is pretty useful. But wouldn't it be equally useful to have
def-, defmulti-, defmacro-, etc.?
I'm aware that it is possible to add the private tag to the metadata
of the var, but in many code samples I've seen, people routinely get
this wrong (I believe you need to attach the metadata to
On 23/03/2009 9:03, Mark Engelberg wrote:
defn- is pretty useful. But wouldn't it be equally useful to have
def-, defmulti-, defmacro-, etc.?
I'm aware that it is possible to add the private tag to the metadata
of the var, but in many code samples I've seen, people routinely get
this wrong
On option I would like for the Repl is an option such that each
evaluated expression that does not define a new symbol itself, would
(nethertheless) bind a symbol. Many other Repl's for other languages
(such as, I believe, Scala) do this: the Repl identifies the bound
symbol and the value, not
I'm not currently at a repl, so I can't check this, but IIRC, 1*, 2*, and 3*
bind to the last three return values.
Eric
On Fri, Nov 14, 2008 at 9:22 PM, Howard Lewis Ship [EMAIL PROTECTED] wrote:
On option I would like for the Repl is an option such that each
evaluated expression that does
When (if ever) is it good form to call the underlying Java APIs used
by Clojure's special forms?
I was thinking Rich might reply and weigh in on my suggestion to use
an RT method. I'd also like to know if this should be avoided. It
seems like it might be ok, since the var method is public
FWIW, there's also a hack without java calls, which Chouser referred
to:
(binding [*ns* (find-ns 'foo)]
(eval '(def bar 3)))
although you have to create the namespace yourself if it doesn't
exist.
On Nov 11, 3:39 pm, MikeM [EMAIL PROTECTED] wrote:
This may be a horrible hack, but you can do
Guys, thanks for all the answers. I was posting my follow ups to this
thread via Gmail until I realized that Google Groups was bouncing my
posts. @#$! Anyway, I used a ref to store my function instead of
defn'ing it. Macro expands to
(dosync (ref-set fun (fn [] ...)))
Hi!
I'd like to use a macro in a configuration .clj file. This macro is
supposed to def some vars in appropriate namespaces. However, I'm
getting the exception from the subject. Is there a way to write a
macro which temporarily binds *ns* to some namespace so that it can
def things in there?
58 matches
Mail list logo