George, I don't know what time zone you live in, but you are one crazy
person!
I'm on vacation in NYC for a couple more days, then back home to
Silicon Valley. Still jet lagged which explains my odd hours. (Not
to mention that being in New York is such a rush it's pretty hard to
sleep!)
I want to define and use a map that is private to a namespace and used
by several functions in that namespace. Is the idiomatic way simply
to def it within the namespace? Is there another way to hide it?
--
You received this message because you are subscribed to the Google
Groups Clojure
jim jim.d...@gmail.com writes:
Due to popular demand*, I resuscitated my code to generate javascript
from s-expressions. This was what I coded to learn about logic
programming in Clojure.
Github: http://github.com/jduey/js-gen
Clojars: http://clojars.org/net.intensivesystems/js-gen
;; some_ns/internal.clj
(ns some-ns.internal)
(def private-map {:k1 10 :k2 20})
;;end-of-file
;; some_ns.clj
(ns some-ns
(:use some-ns.internal))
;; ..functions..
(defn foo
[]
;; do something with private-map
..)
;;end-of-file
This is how
Hi,
On 11 Okt., 09:22, HiHeelHottie hiheelhot...@gmail.com wrote:
I want to define and use a map that is private to a namespace and used
by several functions in that namespace. Is the idiomatic way simply
to def it within the namespace? Is there another way to hide it?
(def ^{:private
Hi,
I'm sure this has been asked before (although I couldn't find anything
other than this StackOverflow thread
http://stackoverflow.com/questions/2320348/symbols-in-clojure) and, in
addition to that thread, I have a clarifying question:
Am I right if I say that when I do (def foo 1) I'm
you are right (at least as far as I know)
--
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
2010/10/11 Ulises ulises.cerv...@gmail.com
Hi,
I'm sure this has been asked before (although I couldn't find anything
other than this StackOverflow thread
http://stackoverflow.com/questions/2320348/symbols-in-clojure) and, in
addition to that thread, I have a clarifying question:
Am I
I guess one should use mapping instead of binding. The var is mapped to
the symbol foo in the namespace *ns*.
I'm saying that because functions for inspecting namespaces are (ns-map),
Ah! Excellent, thanks.
U
--
You received this message because you are subscribed to the Google
Groups
Hi,
On 11 Okt., 11:44, Laurent PETIT laurent.pe...@gmail.com wrote:
I guess one should use mapping instead of binding. The var is mapped to
the symbol foo in the namespace *ns*.
I'm saying that because functions for inspecting namespaces are (ns-map),
etc.
In a determined attempt to
So I would say: Unqualified symbols in the namespace the def happened
in will resolve to the def'd Var. (of course only after the def
happened!)
so in theory one could have a symbol foo bound to a var bar?
U
--
You received this message because you are subscribed to the Google
Groups
Hi,
On 11 Okt., 12:26, Ulises ulises.cerv...@gmail.com wrote:
so in theory one could have a symbol foo bound to a var bar?
Eh. No. I don't think so. The Var has a name and the symbol has a
name. And an unqualified symbol is resolved to the closest Var with
the same name (conveniently derefing
Eh. No. I don't think so. The Var has a name and the symbol has a
name. And an unqualified symbol is resolved to the closest Var with
the same name (conveniently derefing the var to get its contents).
This might be in the same namespace or in a different namespace which
was :use'd. I'm still
Hi,
On 11 Okt., 12:45, Ulises ulises.cerv...@gmail.com wrote:
user (def foo)
#'user/foo
user foo
;Var user/foo is unbound.
; [Thrown class java.lang.IllegalStateException]
user
I guess this means there's no var named user/foo and hence the symbol
cannot get its closest match in name?
Hi,
or a maybe clearer example, which shows the different states:
; No Var, yet.
user= (var foo)
java.lang.Exception: Unable to resolve var: foo in this context
(NO_SOURCE_FILE:1)
; Var is now defined. Hence it can be resolved. But it has to root
value, ie. it is unbound, yet.
user= (def foo)
Hi,
I'm afraid I'm new to Clojure, so I'm not even going to attempt a
patch, but I get a NullPointerException when I pass an empty map
(e.g., {} or {:something {}}) to lazy-xml/emit.
The stacktrace is below, if anyone's interested.
Regards,
Ed O'Loughlin
-
2010-10-10
Hope, that helps.
It does indeed.
So, def either creates or looks up a var of the name of the symbol
given and then every time eval comes across a symbol it tries to
lookup a var of the same name?
(just read http://clojure.org/special_forms#def which I should've read
before posting)
Cheers
Hi,
On 11 Okt., 13:29, Ulises ulises.cerv...@gmail.com wrote:
sorry for the confusion and the silly questions,
Ehm. Nope. To cite the (german) sesame street:
Wer? Wie? Was?
Wieso? Weshalb? Warum?
Wer nicht fragt bleibt dumm!
Just keep asking. :)
Sincerely
Meikel
--
You received this
I've heard of scriptjure but never used it or looked at it. My
interests took me in another direction and I've never circled back. I
would be interested to know how the differ.
Thanks,
Jim
On Oct 11, 3:21 am, Steve Purcell st...@sanityinc.com wrote:
jim jim.d...@gmail.com writes:
Due to
On Oct 10, 2010, at 3:05 PM, HiHeelHottie wrote:
I'm running lein swank and using slime-connect from emacs. When I use
lein compile after making changes to a method, they don't appear to
get picked up unless I bring down lein swank, bring it up again, slime-
connect, etc.
Is there a way
Well, taking a brief look over your code, it seems like the main
difference is that scriptjure is macro-based, so all the code generation
gets done at compile-time.
That makes scriptjure faster, but at the expense of needing an unquote
form - (clj ...) - to splice clojure expressions into the
Thanks this does seem to solve the problem of the servlet being
reinitialized on every run.
On Oct 10, 11:10 pm, Adrian Cuthbertson adrian.cuthbert...@gmail.com
wrote:
Hi Dmitri,
The problem is probably related to calling init with args. It requires
that super() gets called - I can't remember
(:use [clojure.contrib.def])
(defvar- x ...)
A bit shorter than writing the meta-data by hand.
Def provides a number of other interesting shortcuts. Have a look at
def.clj in contrib.
I prefer to keep things private and avoid cluttering the use
clause with a long :only list. I use :only only
On Mon, Oct 11, 2010 at 10:02 AM, Steve Purcell st...@sanityinc.com wrote:
Well, taking a brief look over your code, it seems like the main
difference is that scriptjure is macro-based, so all the code generation
gets done at compile-time.
js-gen generates js at compile time.
That makes
You going to do some speech recognition in Clojure?
Unfortunately, no. I just have some hand RSI problems, and I use
Dragon NaturallySpeaking for writing e-mails and documenting Clojure
code. You can see an example of the notes I've taken while going
through the labrepl exercises at
It's fairly common to let over a function, e.g.:
(let [a (atom 0)]
(defn next-id []
(swap! a inc)))
In the above, the atom can only be referenced from within the lexical
scope of the let, hence essentially private to the next-id function.
On Oct 11, 8:03 am, lprefonta...@softaddicts.ca
David Nolen dnolen.li...@gmail.com writes:
On Mon, Oct 11, 2010 at 10:02 AM, Steve Purcell st...@sanityinc.com
wrote:
Well, taking a brief look over your code, it seems like the main
difference is that scriptjure is macro-based, so all the code
generation
gets done at
Hi list,
I often run into this issue where I am follow a Java documentation where
they developers fail to explain where they import packages from. In most
Java IDE's you can search your classpath for reference types. It would be
great is if was possible to do the same in slime. I looked around
Hi,
I tried experimenting with lazy sequences and wrote this program
(def nums (cons 2 (lazy-seq (map inc nums
(def primes (cons (first nums)
(lazy-seq (-
(rest nums)
(remove
(fn [x]
(let [dividors (take-while
On Mon, Oct 11, 2010 at 12:21 PM, Ivan Willig iwil...@gmail.com wrote:
I often run into this issue where I am follow a Java documentation where
they developers fail to explain where they import packages from. In most
Java IDE's you can search your classpath for reference types. It would be
I confess I'm a bit baffled by this too, but I have a couple
suggestions that don't address your problem :)
(drop 2 (range)) is the same as (iterate inc 2), and the same as your
convoluted lazy-seq, except that the iterate works here, while for
some reason the range doesn't.
You might consider
Check out the downloads area on http://github.com/richhickey/clojure-clr.
Grab clojure-clr-1.2.0.zip. Unzip, start up Clojure.Main.exe and you
should be running. The zip also contains Clojure.Compile.exe, which
you can invoke with command line arguments indicating files to
compile. The support
Hi folks and congrats to George Jahad for this great work.
Hoewer the cdt dont work on my windows vista. After some changes on my
own i get the same error of Greg Willams:
java.lang.ClassNotFoundException: com.sun.jdi.Bootstrap (cdt.clj:28)
i've tried add-classpath of tool.jar (where is the
On Oct 12, 12:48 am, atreyu atreyu@gmail.com wrote:
Hi folks and congrats to George Jahad for this great work.
Hoewer the cdt dont work on my windows vista. After some changes on my
own i get the same error of Greg Willams:
java.lang.ClassNotFoundException: com.sun.jdi.Bootstrap
ok i have made a (ugly) trick to make it work, copying tools.jar in
cdt/lib and changing cdt.el:
(defun cdt-query-cmdline ()
(let ((path (strip-trail cdt-dir)))
(format java -classpath%s/lib/clojure-1.2.0.jar;%s/lib/clojure-
ok i have made a (ugly) trick to make it work, copying tools.jar in
cdt/lib and changing cdt.el:
(defun cdt-query-cmdline ()
(let ((path (strip-trail cdt-dir)))
(format java -classpath%s/lib/clojure-1.2.0.jar;%s/lib/clojure-
Hi,
I'm new to Clojure, using it for a reasonably sized project for the
first time, and I'm trying to do test-driven development.
While it does work well technically - clojure.test is very nice to use
and feels a lot like JUnit 4's assertThat() - I'm wondering if I'm
trying to program Java in
(def nums (cons 2 (lazy-seq (map inc nums
(def primes (cons (first nums)
(lazy-seq (-
(rest nums)
(remove
(fn [x]
(let [dividors (take-while #(= (* % %) x)
primes)]
(some #(= 0 (rem x
When a var's definition has a lazy reference to itself, as primes does below,
then your results will be dependent on the lazy/chunky/strict-ness of the calls
leading to the lazy reference.
The functions range, rest, and remove are chunk-aware, so the range-based
version of primes consumes a
On Mon, Oct 11, 2010 at 6:06 PM, Felix H. Dahlke f...@ubercode.de wrote:
This made me wonder if test-driven development was desirable in Clojure
at all, or even in functional programming in general.
For another point of view: take a look at what Brian Marick's been
doing with a framework called
hello,
i've started a new lein project. it's my project.clj:
(defproject test-processing 0.1.0-SNAPSHOT
:description Test Processing
:dependencies [[org.clojure/clojure 1.2.0-master-SNAPSHOT]
[org.clojure/clojure-contrib 1.2.0-SNAPSHOT]
Fantastic! Great job David and everyone else who contributed.
Mike
--
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
Fantastic! Great job David and everyone else who contributed.
Mike
--
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
Fantastic! Great job David and everyone else who contributed.
Mike
--
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 Oct 11, 2010, at 8:53 PM, John Stoneham wrote:
For another point of view: take a look at what Brian Marick's been
doing with a framework called Midje to do outside-in TDD. It helps you
mock out function dependencies and might get you where you want to go.
It's just maturing now but I found
On Oct 11, 2010, at 10:28 PM, Vilson Vieira wrote:
i've started a new lein project. it's my project.clj:
(defproject test-processing 0.1.0-SNAPSHOT
:description Test Processing
:dependencies [[org.clojure/clojure 1.2.0-master-SNAPSHOT]
[org.clojure/clojure-contrib
I'm playing around with couchdb. I'm using the version that lein gets
with the following command:
[clojure-couchdb 0.4.4]
which as far as I can tell is the most recently maintained version.
When I do a bunch of rapid calls to document-create in a tight loop,
after about 3000 or so documents
I'm working on the chapter on continuations in On Lisp (Chapter 20)
and am trying to translate the code to clojure
However, I am running into some issues.
With the following definitions:
(def *cont* identity)
(defmacro =values [ retvals]
`(*cont* ~...@retvals))
why would the following two
On Tue, Oct 12, 2010 at 12:45 AM, Mark Engelberg
mark.engelb...@gmail.comwrote:
I'm playing around with couchdb. I'm using the version that lein gets
with the following command:
[clojure-couchdb 0.4.4]
which as far as I can tell is the most recently maintained version.
When I do a bunch
Hi,
On 12 Okt., 07:05, Aravindh Johendran ajohend...@gmail.com wrote:
(def *cont* identity)
(defmacro =values [ retvals]
`(*cont* ~...@retvals))
why would the following two expressions throw errors???
(binding [*cont* (fn [m n] (=values (list m n)))] (*cont* 'a 'b))
So what happens
50 matches
Mail list logo