In Clojure, if I have a function call that asks for return of a
function, for example
user ((fn [a] (fn [b] (+ (inc a) (* b b 5)
I get the function name
#user$eval4164$fn__4165$fn__4166 user$eval4164$fn__4165$fn__4166@29770daa
But what I would like to get is an expression that defines
available.
--Larry
On 2/23/13 5:50 PM, Michael Klishin wrote:
2013/2/24 Larry Travis tra...@cs.wisc.edu mailto:tra...@cs.wisc.edu
Is there some way that I can suppress the evaluation of this
expression?
((fn [a]
'(fn [b] (+ (inc a) (* b b 5)
--
MK
On 2/23/13 4:50 PM, Larry
?
On Mon, Jan 21, 2013 at 7:27 AM, Larry Travis
tra...@cs.wisc.edu javascript: wrote:
One of the neat things about Clojure (maybe all functional
languages) is that functions can be defined either
extensionally or intensionally. How can one create
One of the neat things about Clojure (maybe all functional languages) is
that functions can be defined either extensionally or intensionally. How
can one create a Clojure structure that mixes these two types of
definition?
That is, I would like to define a function f that saves its result the
It almost certainly has something to do with my abysmal ignorance about
things Java, but I don't understand this difference:
(1)
user (map Math/sqrt [5 6 16])
Unable to find static field: sqrt in class java.lang.Math
[Thrown class java.lang.RuntimeException]
(2)
user (map #(Math/sqrt
Thank you, gentlemen. Jim and Luc, your answers are both helpful. Luc's
answer illustrates why a Java tyro often has problems understanding
Clojure. Somebody like me who is trying to master Clojure, having come
to it via a language path that doesn't include Java, needs a
prerequisite crash
As participants in this googlegroup have often observed, an excellent
way to learn Clojure is to study the source definitions of its API
functions. This advice works better for learners who know Java, which
I don't. I sometimes think that, if I were to teach a Clojure
Programming course, I
Mark, Andy, Tassilo:
Very helpful, gentlemen. You are kind and skillful tutors. Thank you much.
--Larry
--
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
Pursuing the thinking behind my original comment, I challenged myself to
see how many ways I could write a function equivalent to list* without
using _spread_ (assuming I had the full Clojure API available to me --
which, of course, the author of list* did not have). Here are four ways:
What is the rationale for this?
user (= [1 2 3 4] '(1 2 3 4))
true
I was quite surprised when this turned out to be the cause of a bug in a
function I am constructing. Vectors and lists differ so substantially in
their implementation and in their behavior that a vector and a list
should
Something like this will give you what you want:
(defn subseqx
[s start end]
(cond
(instance? clojure.lang.IPersistentVector s)
(subvec s start end)
(instance? java.lang.String s)
(subs s start end)
:else
(let [slice
I should be switching over to Leiningen 2 shortly in any case, but I am
curious. How does one set JVM_OPTS as an environment variable?
--Larry
On 5/21/12 11:42 AM, Phil Hagelberg wrote:
On Mon, May 21, 2012 at 5:28 AM, Raju Bitterrajubit...@googlemail.com wrote:
How do I set jvm options
It took me a while to figure out how to put multiple entries into an
environment variable (that is, settings for both min and max heap sizes,
to wit, export JVM_OPTS=\ -Xms4G\ -Xmx4G) but, once I did, Phil's and
Luc's suggestions have worked well and things have gone swimmingly. They
work for
How do I set jvm options for a /lein repl/ initiated independently of a
project? In particular, I want the heap expansion that results from
doing M-x clojure-jack-in in an emacs /project.clj/ buffer with
:jvm-opts [ -Xms4G -Xmx4G] in its defproject form.
--Larry
--
You received this
Sean and Lee:
In general, I have considered the difference between Aquamacs and GNU
Emacs to be that the former prioritizes computer-user interaction via
mouse, command-bars and menus (which requires a lot of hand movement
between keyboard and mouse, but enables the user to dispense with
Lee's comments ring true for me so let me extend them.
Before I discovered Clojure, my experience as a programmer had been
mainly in the area of artificial-intelligence experimental programming.
I was once a reasonably proficient Lisp programmer, but pre-CL and
pre-CLOS, that is, mainly
A command like
user (doc hash-map)
in the slime-repl created by clojure-jack-in
results in
Unable to resolve symbol: doc in this context
[Thrown class java.lang.RuntimeException]
Can this be fixed or do I have to do my doc requests someplace else?
--Larry
--
You received this message
Thank you, Roberto. Works like a charm.
--Larry
On 5/4/12 2:32 PM, Roberto Mannai wrote:
You should use it:
user (use 'clojure.repl)
nil
user (doc doc)
...
On Fri, May 4, 2012 at 9:27 PM, Larry Travis tra...@cs.wisc.edu
mailto:tra...@cs.wisc.edu wrote:
A command like
user (doc
Roberto:
This indeed looks like it will be useful. Thanks.
Your require-all-snippet.clj script loaded OK except for:
Attempting to require clojure.parallel : couldn't require
clojure.parallel
Exception
#RuntimeException java.lang.RuntimeException:
java.lang.ClassNotFoundException:
Phil:
Thanks. I obviously need to start doing my Clojure programming with a
Slime cheatsheet in front of me!
--Larry
On 5/4/12 4:00 PM, Phil Hagelberg wrote:
Another way to do it is just use C-c C-d C-d for docs lookup.
-Phil
--
You received this message because you are subscribed to
Phil:
I now can't get the behavior to reproduce either. I have no idea what
kind of dumb mistake I was making in the first place, and I'm very sorry
to have wasted your time. (For what it's worth, both dependency-vector
versions work in my reproduction attempts -- but you probably already
Phil, Neale, Sean:
You guys are all way ahead of me as to why I am getting the results I am
getting, but it is only Neale's advice that works. That is
[prjctOne/prjctOne 1.0.0-SNAPSHOT] works, but
[prjctOne 1.0.0-SNAPSHOT] does not.
--Larry
On 4/30/12 11:14 AM, Phil Hagelberg wrote:
I have installed Leiningen not so much to manage projects but to enable
use of /clojure-jack-in/ as a means of getting Swank and Slime to work.
And they do work for me. But now I have a question that I can't find an
answer for in any Leiningen documentation I know about. I have a
largish,
Sean,
Your advice makes good sense, but I can't make it work. Per that advice,
I paste some of my function definitions into the core.clj file of the
project prjctOne and proceed thusly:
larrytravis$ lein install
Copying 1 file to /Users/larrytravis/prjctOne/lib
No namespaces to :aot compile
Sean:
Your suggestion doesn't work. The Slime REPL comes up fine when I use
the dependency vector you suggest (some of the vectors I have tried
prevent the Swank server from starting), but the REPL doesn't know
anything about the functions defined in prjctOne or about the name-space
in which
://sw1nn.com/ }
On Sun, Apr 29, 2012 at 12:42 AM, Larry Travis tra...@cs.wisc.edu
mailto:tra...@cs.wisc.edu wrote:
Sean:
Your suggestion doesn't work. The Slime REPL comes up fine when I
use the dependency vector you suggest (some of the vectors I have
tried prevent the Swank
I too think this is interesting because because it serves to illustrate
some important general aspects of Clojure with a very simple problem.
I wrote four Clojure programs contrasting different ways of solving the
problem, and then timed the application of each ten times to a
million-item
I have been solving Clojure problems now for many months and can no
longer exactly be considered a Clojure NOOB, but I still have an awful
lot to learn about Clojure. One thing that has caused difficulties from
the beginning is that I don't know Java and don't know how to exploit
the Java
David and Meikel:
Thanks for your responses, but it appears to me that what you say
applies only to error messages referring to evaluation of defn
expressions. Constructing my function definitions in a file separate
from the REPL and then recompiling the entire file with a load-file
whenever
Thanks, Sergey. The problem was indeed a classpath problem. The part of
my ignorance about Java that seems to cause me the most trouble is my
ignorance about Java classpaths. I think some Clojurians underestimate
the difficulties involved in learning Clojure without knowing Java
first. I
Phil:
You ask whether, if I had found it, the following web page would have
helped:
http://dev.clojure.org/display/doc/Getting+Started+with+Emacs
The answer: Definitely yes.
The page advises me to use for bringing up a Clojure REPL
java -cp path/to/clojure.jar clojure.main
whereas the page
I need to upgrade from the older version of Clojure I have been using so
I downloaded Version 1.2.1 and followed these instructions from
http://clojure.org/getting_started:
In the directory in which you expanded clojure.zip, run:
java -cp clojure.jar clojure.main
This will bring up a simple
Jonathan:
Thanks. When the instructions said the directory in which you expanded
clojure.zip I took that to mean the directory I was in when I expanded
clojure.zip, not the directory that was created to hold the zip-file
contents.
--Larry
On 7/14/11 10:05 PM, Jonathan Cardoso wrote:
Kasim:
I just discovered ClojureW, and it looks promising. I will report my
reaction after I get time to thoroughly test it for the kinds of things
I am doing.
In the meantime, a request:
When you work 'on a Just Works emacs setup' for Mac Os X consider
whether you can create such a setup
Ken:
There are a lot of things to like about Aquamacs, and its creator David
Reitter deserves high praise as of course do the Emacs creators on whose
shoulders he stands. The problem we have raised here is, for the present
at least, the only complaint I have about Aquamacs. And there is
that the changed name is an unresolvable symbol?
Thanks for any advice any of you might have. I hope the question isn't
impossibly dumb.
--Larry Travis
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure
Ken:
The cause of my difficulty indeed was a corrupted file. I was looking
for it in a completely different direction, and I clearly don't know how
to correctly parse Java error messages!
Thank you very much for sharing your cleverness and your expertise.
--Larry
On 3/12/11 7:39 PM, Ken
and Emacs, but I am having a lot of problems getting clojure to run
conveniently in that environment.
Thanks for your help.
--Larry Travis
--
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
You guys are great! As my dad used to say when he had been greatly
helped: Each of you is a scholar and a gentleman.
I admire your expertise. You each had knowledgeable and quite helpful
suggestions. I ended up using Alex's ideas for getting the Leiningen
installation process to avoid
what to do with it if I could! I am a Java tyro (who knows
some other lisps reasonably well) trying to use clojure under Mac Os X
and Emacs, but I am having a lot of problems getting clojure to run
conveniently in that environment.
Thanks for your help.
--Larry Travis
--
You received
Thanks again. I have to be away from home and my iMac for the next ten
days so it will be some time before I can work through your suggestions,
but I will certainly give them a try. I'll let you know what kind of
success I have. I very much appreciate your help.
--Larry Travis
Joost wrote
exploration.
--Larry Travis
--
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
if I can.
--Larry Travis
--
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
43 matches
Mail list logo