Here you can peek at the source code of clojure.
http://code.google.com/p/clojure/source/browse/trunk/src/clj/clojure/core.clj
It is about 3700 lines, and although you have to get used to a few new
functions and names that are normally not exposed when you use
clojure, it looks fairly simple.
Do you suggest that I read "Programming Clojure" first and then trying
to study the source code?
What is the best place (file, package or what ever) to start reading
the source code?
On Jan 13, 10:01 am, bOR_ wrote:
> Here you can peek at the source code of clojure.
>
> http://code.google.com/p/
On Jan 13, 2:59 pm, Chouser wrote:
>
> It raises a question, though -- how much functionality should a
> function provide to be worth making everyone who reads the code learn
> the new vocabulary? I've written each of these inline when I've
> needed them. Are they better as idioms or functions?
seq returns nil when a collection has no items. According to the
documentation for empty?, empty? is the same as (not (seq coll)) so you
should use seq for expressing the opposite of empty?
On Tue, Jan 13, 2009 at 3:12 AM, GS wrote:
>
> On Jan 13, 2:59 pm, Chouser wrote:
> >
> > It raises a qu
Not sure what you want to achieve by studying the source code. I think
the answer that I can give to what works best for you will depend on
what you want to study the source code for.
I'm also not sure what you mean by 'what is the best place to start
reading..' The link that I gave before is a d
For posterity: got it working! Here is how (just ignore all the gene
amino window size like words, they are specific for my code)
(add-classpath "file:///linuxhome/tmp/boris/automaton.jar")
(import '(brics.automaton.RegExp))
(import '(brics.automaton.Automaton))
(import '(brics.automaton.RunAutom
On 13.01.2009, at 05:35, Mark P wrote:
> I know that there are other functional approaches where
> the compiler automatically finds ways to parallelize. Is there
> much scope for this in Clojure? Or is it all pretty much
> manually added concurrency?
I am not aware of any auto-parallelizing co
>Not sure what you want to achieve by studying the source code. I think
>the answer that I can give to what works best for you will depend on
>what you want to study the source code for.
I want to be familiar with a language design in general and how it
integrates with Java Platform.
>I'm also no
Thanks for the answer. I think you'll need a reply from Chouser or
Rich (or someone alike) when they wake up. The best I can give you is
this part of the source, where (I think) it is defined how clojure is
build upon java.
http://code.google.com/p/clojure/source/browse/trunk/src/?r=1205#src/jvm/
Hi,
I searched the archives and saw that this has been raised once before,
although it wasn't really a suggestion, didn't raise any real
discussion and didn't reach any conclusion.
I just think it's worth proposing that a function set that includes
every? and not-every? but does not include any?
I've added some info regarding the backquote expansion mechanism in
the Reader section here:
http://en.wikibooks.org/wiki/Learning_Clojure#The_Reader
I tried to answer the author's question regarding the possible
expansion order in nested backquotes and the general algorithm Clojure
apparently e
For what's it worth, I think the "Programming Clojure" book is
excellent (Okay Stuart, make the check payable to ). My only
complaint is that the I wish there were another largish example
besides the two in there (mc simulation and the lancelet thing).
Cheers, Aria
On Jan 13, 12:58 am, bOR_
And I would like to kindly ask from Mr. Stu to make the new book as
extensive as possible (just like Programming Ruby book) and we will
have a title like "The pickaxe book" :)
On Jan 13, 12:38 pm, aria42 wrote:
> For what's it worth, I think the "Programming Clojure" book is
> excellent (Okay St
This looks really cool. I've actually been experimenting with exactly
the same thing. One thing I thought about (but didn't implement), was
using some kind of lazy hash map, for the request, so that it only
calls the methods (like getServerPort) if you need them. I don't
really know how hard or ea
> I am not aware of any auto-parallelizing compiler that is actually
> useful in practice.
Good to know - thanks.
> > And this leads to another question I have about Lisp-style
> > languages in general. I get the impression that in Lisp
> > much of the "compiler" is Lisp code itself. Ie, lay
On Jan 13, 2009, at 12:30, Mark P wrote:
>> Macros are handled at compile time, so they add no run-time overhead.
>
> But isn't "compile time" sometimes _at_ runtime? Ie, if
> a macro is dependent on runtime information, then isn't
> it passed to "the compiler" which is included as part of
> the
On Jan 13, 5:49 pm, Zak Wilson wrote:
> You're probably thinking of
> this:http://www.flownet.com/gat/papers/lisp-java.pdf
Thanks for the link.
> There's also the (in)famous language benchmark
> site:http://shootout.alioth.debian.org/
This is primarily what I was going on. I realize no
bench
>
>
> > There's also the (in)famous language benchmark
> > site:http://shootout.alioth.debian.org/
>
> This is primarily what I was going on. I realize no
> benchmarking approach is going to be perfect, but
> this attempt doesn't seem too bad. Is there any
> reason to be particularly sceptical ab
On Tue, Jan 13, 2009 at 3:03 AM, GS wrote:
>
> Hi,
>
> I searched the archives and saw that this has been raised once before,
> although it wasn't really a suggestion, didn't raise any real
> discussion and didn't reach any conclusion.
>
> I just think it's worth proposing that a function set tha
> A macro cannot depend on runtime information. A macro is a function
> that is called at compile time, its argument is an expression (as
> written by the programmer, or as returned by another macro), and its
> result is a modified expression. There is no way a macro could access
> runtime
On Tue, Jan 13, 2009 at 3:12 AM, GS wrote:
>
> Should that "seq" be "seq?". If not, why not?
Nick nailed that one.
> The general question it raises for _me_ is this: why is such a basic,
> useful and generally applicable function like 'chunk not included in
> the core? Or 'random-element?
'c
On Jan 13, 2009, at 14:04, Mark P wrote:
> Then what do people mean when they say that lisp blurs
> the distinction between compile-time and run-time?
I don't know. I can only guess that they may be referring to the fact
that many Lisp dialects have both an interpreter and a compiler. Or
to
On Jan 13, 1:26 am, Allen Rohner wrote:
> Keys in a map that are of type long can't be looked up in a map using
> int literal syntax:
>
> user=> (def my_map { (java.lang.Long. "42") "foo"})
> #'user/my_map
>
> user=> my_map
> {42 "foo"}
>
> user=> (my_map 42)
> nil
>
> user=> (my_map (long 42))
On Jan 12, 9:58 pm, e wrote:
> thanks. I think this will be useful, but I have to figure out how to get it
> to build in enclojure. Right now I get, "Exception in thread "main"
> java.util.MissingResourceException: Can't find bundle for base name
> octane_main, locale en_US (octane_main.clj:1
I've written small wiki article which dives right into the look and
meaning of common Clojure constructs with examples. Personally I find
I learn best by examples and when starting out they were hard to find,
whereas formal descriptions were there but rather cryptic when you
don't understand the c
On Tue, Jan 13, 2009 at 7:46 AM, Mark Volkmann
wrote:
>
> On Tue, Jan 13, 2009 at 3:03 AM, GS wrote:
>
>> or none?
>
> Hmm ... I'm not sure if an equivalent for that exists.
user=> (doc not-any?)
-
clojure.core/not-any?
([pred coll])
Returns false if (pred x) is logica
On Jan 13, 7:38 am, Luc Prefontaine
wrote:
> as of yesterday pm, Clojure is running in a live system in a big
> veterinarian hospital.
Awesome, congratulations!!! :-D
mfh
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Gro
I still find this confusing, but thanks for the quick response.
> In general, you should use uniform types for hash keys.
I thought I was using all ints, but it turns out that a java API
returned a long when I thought it returned an int. So then my map had
some keys that were ints and some that
Hi,
After (are-friends bill bob) they should be friends,
so I tried @bob
and don't see bill as a friend. why?
@bob
{:friends #{#}, :name "Bob"}
-sun
On Jan 10, 9:44 pm, Stuart Sierra wrote:
> Hi Patrick,
>
> Here's one way to do it:
>
> (defn new-person [name]
> (ref {:name name, :frien
2009/1/13 Luc Prefontaine
> Hi everyone,
>
> as of yesterday pm, Clojure is running in a live system in a big
> veterinarian hospital.
>
>
Congratulations, its always a real buzz to get something out and running in
the wild, building it on something really new like Clojure must make it even
bett
On Jan 11, 9:41 pm, Mark P wrote:
> The programs I write perform applied mathematical
> optimization (using mainly integer arithmetic)
> and often take hours (occasionally even days)
> to run. So even small percentage improvements
> in execution speed can make a significant
> practical differenc
http://blog.thinkrelevance.com/2009/1/13/programming-clojure-beta-5-is-out
Cheers,
Stu
--~--~-~--~~~---~--~~
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
T
Recently, I asked how to make a function evaluate its arguments lazily
(http://groups.google.com/group/clojure/browse_thread/thread/
cd01ef39c2b62530), and I was given a good solution: use Delay objects
(with the delay and force functions).
I wanted to do this for the efficiency of a functional p
Some comments:
1- If you think that HotSpot/Java is slower than C++ by any
interesting amount, I'd love to see the test case. Being the
architect of HotSpot "-server" I've a keen interest in where
performance isn't on par with C. Except for a handful of specialized
uses (e.g. high-level interpr
On Tue, Jan 13, 2009 at 3:04 AM, HB wrote:
>
> Do you suggest that I read "Programming Clojure" first and then trying
> to study the source code?
That's a fine option. The book may be a shorter path to *practical*
knowledge.
> What is the best place (file, package or what ever) to start readin
sure . . . I'm just impressed with how many things "just work", and this
could be one more. Not enough args, but you know what I wanted it to mean.
There's no ambiguity.
On Tue, Jan 13, 2009 at 2:07 AM, Timothy Pratley
wrote:
>
>
>
> On Jan 13, 5:57 pm, e wrote:
> > Instead of that being an err
Hi Aria,
Today's drop of the book has two new "mediumish" examples:
* a Compojure web app for that uses clojure.contrib.sql for its
backing store
* the Clojure snake we have been beating to death on the list
Let me know you think this is a decent stable of examples. I'm still
contemplating
As this is a commercial project, I imagine you are quite limited in
what you can tell us, but I'd love to hear about the issues you faced
during development.
On Jan 13, 10:38 am, Luc Prefontaine
wrote:
> Hi everyone,
>
> as of yesterday pm, Clojure is running in a live system in a big
> veterina
On Tue, Jan 13, 2009 at 2:18 AM, Timothy Pratley
wrote:
>
> BTW Rich,
>
> The documentation http://clojure.org/data_structures hints that
> accessors are faster than regular map lookups and provides the
> following example:
> (reduce (fn [n y] (+ n (:fred y))) 0 x)
> -> 45
> (reduce (fn
On Tue, Jan 13, 2009 at 2:23 PM, CuppoJava wrote:
>
> Do struct-maps also have boxing and unboxing overhead? Or does the JVM
> optimize that away?
Clojure collections currently store Objects, so they'll be boxed.
To store primitive values I think you'll have to use a Java array (but
only if all
Hi sampii,
The problem, as I see it (& as Konrad suggested above), is that you're
not passing *functions* to (alt); you're passing values returned from
function calls, even though in the case of the sub-functions you
define those returned values are functions. Functions evaluate to
themselves, so
Hi Kees-Jochem,
Am 13.01.2009 um 12:41 schrieb Kees-Jochem Wehrmeijer:
This looks really cool. I've actually been experimenting with exactly
the same thing. One thing I thought about (but didn't implement), was
using some kind of lazy hash map, for the request, so that it only
calls the methods
Do struct-maps also have boxing and unboxing overhead? Or does the JVM
optimize that away?
--~--~-~--~~~---~--~~
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
Why is Clojure slower than Java? And, can it be fixed? Is it just the
dynamic lookups?
I also want to use Clojure in my work to implement the inner loops, but
I was disappointed by a previous discussion looking at the speed of
Clojure. As I recall Clojure seems to be about 1/4 the speed of
On Jan 13, 10:07 am, cliffc wrote:
> Some comments:
>
> 1- If you think that HotSpot/Java is slower than C++ by any
> interesting amount, I'd love to see the test case. Being the
> architect of HotSpot "-server" I've a keen interest in where
> performance isn't on par with C.
-snip-
> 5- T
> > (defn map-when "Like map but discards logically false entries"
> > [fn & seqs]
> > (filter identity (apply map fn seqs)))
>
> I'd use map-when.
>
> > (defn iterate-while [f x]
> > (take-while identity (iterate f x)))
>
> This one too.
>
> It raises a question, though -- how much functionali
On Jan 13, 4:45 am, Mark McGranaghan wrote:
> In terms of Clojure web frameworks, I think that there is a lot to be
> gained by leveraging the Ring interface, especially from the modular
> functionality provided by Ring middleware. I'd like in particular to
> be able to run Compojure apps in Ring
On Tue, Jan 13, 2009 at 4:05 PM, Jason Wolfe wrote:
>>
>> It raises a question, though -- how much functionality should a
>> function provide to be worth making everyone who reads the code learn
>> the new vocabulary? I've written each of these inline when I've
>> needed them. Are they better a
I've got Clojure profiling working fairly easily using the free pre-
release build of YourKit [1], and it's already been a big help in
speeding up my application (I'll post on my blog about this soon).
The main difficulty has been figuring out which functions are which in
the output, since the onl
On Jan 13, 6:45 pm, e wrote:
> sure . . . I'm just impressed with how many things "just work", and this
> could be one more. Not enough args, but you know what I wanted it to mean.
> There's no ambiguity.
This is a bad idea. It just adds confusion with no real benefit.
Reading the code would be
Hello everybody,
this patch implements a pipe-delimited syntax for symbols. The Reader
parses |this symbol| and one symbol. Symbols containing clojure syntax
are printed in this form, so they can be printed and read in again.
example: (.toString (symbol "()")) => "|()|"
What do you think?
Rober
Hi James,
Thanks for taking the time to check out Ring.
> The HttpServlet API provides methods for
> parameters, cookies and sessions, but these are absent from Ring. I
> notice that in your weld framework, you implement these pieces of
> functionality in Clojure, but why? I can understand keepi
On Jan 13, 4:30 am, Mark P wrote:
> On Jan 13, 5:49 pm, Zak Wilson wrote:
>
> > You're probably thinking of
> > this:http://www.flownet.com/gat/papers/lisp-java.pdf
>
> Thanks for the link.
>
> > There's also the (in)famous language benchmark
> > site:http://shootout.alioth.debian.org/
>
> Th
On Tue, 2009-01-13 at 10:56 -0800, Vincent Foley wrote:
> As this is a commercial project, I imagine you are quite limited in
> what you can tell us, but I'd love to hear about the issues you faced
> during development.
Mostly integration problems with the work flow in the radiology system.
Th
On Jan 13, 1:42 pm, Chouser wrote:
> One of the things I found difficult with CL was the extremely large
> number of builtin functions -- a large vocabulary with subtle
> differences between nearly synonymous-sounding words. It meant that
> at first glance, a particular block of could would look
On Jan 13, 4:41 am, "Eric Lavigne" wrote:
> > > There's also the (in)famous language benchmark
> > > site:http://shootout.alioth.debian.org/
>
> > This is primarily what I was going on. I realize no
> > benchmarking approach is going to be perfect, but
> > this attempt doesn't seem too bad. I
> With repeated runs, and my cpu frequency set to not change, I get very
> little speed improvement. I increased the size of the example range
> times 10 for these runs:
For me there is a very clear speed improvement of at least 40%, doing
quite a lot of repeated runs. I can't run with range tim
> user=> (defstruct desilu :fred :ricky)
> #'user/desilu
> user=> (def x (map (fn [n]
> (struct-map desilu
>:fred n
>:ricky 2
>:lucy 3
>:ethel 4))
> (range 100)))
> #'user/x
> user=> (time (reduce (fn [n y
On Jan 13, 9:56 pm, "Mark McGranaghan" wrote:
> I choose not include the parameters, cookies, and sessions features
> from the Servlet API because I'm not confident that the interfaces
> presented by Servlets in these cases will be acceptable to all Ring
> applications. For example, different Rin
Thank you for the explanation; I understand it a lot better now. The
reason that I decided to use Delays was that I thought I would need to
change less. Now that I've actually changed everything to Delays, it
seems that they take much more time (the opposite of what I was trying
to do :(. But when
> ;; I defined my own access method so that an accessor is not required,
> ;; however then you need to type hint which makes it too clumsy
> ;; performs very similar to an accessor, in theory slightly faster
Actually there is a very simple way to make "by index" quite usable
without user type hin
Did you ever get around to posting the notes on getting the IntelliJ
plugin to work? I sorely would love IDE support for Clojure in either
Eclipse or IntelliJ. Is the IntelliJ one in a usable state, or is it
not ready for some alpha-level testers?
Cheers, Aria
On Dec 29 2008, 10:36 am, "Justin
> It seems to me that Ring's approach works well if there's the
> possibility of implementing Ring using technology other than Servlets.
> In this case, it makes sense for Ring to act as a minimum common
> interface. But if this isn't your goal, then you're just removing
> functionality for aesthe
On Jan 14, 9:13 am, Jason Wolfe wrote:
>
> One thing worth pointing out is that, if a utility is really useful
> many people will independently recreate it with slightly different
> names and functionality, and use it in their code. It seems that this
> results in code that's much more difficult
Hi Chouser & list,
I like clojure.contrib.command-line -- thanks for it! -- but I wanted
to be able to specify multiple forms for an option, e.g. --help, -h,
-?, etc. Here (in the Files section)
http://bit.ly/fIVH
is a patch to enable it (the values are bound only to the first form
given --
On Jan 12, 10:21 am, Stuart Sierra
wrote:
> If you have
> highly-optimized, custom-designed numerical algorithms written in a
> low-level language like C++, you will never be able to write a version
> that is equally fast in a dynamic, virtual-machine language.
I wouldn't say "never"; clearly Cl
Well, I've gone ahead and finally bought it. Here I thought I would
have time to read a fiction novel or something :)
On Jan 13, 12:02 pm, Stuart Halloway
wrote:
> http://blog.thinkrelevance.com/2009/1/13/programming-clojure-beta-5-i...
>
> Cheers,
> Stu
--~--~-~--~~~---
On Jan 14, 12:35 am, "Mark McGranaghan" wrote:
> For Ring, the HttpServlet API is a means to an end, not an end in
> itself. The interface that Servlets present for parameter parsing and
> session handling are too flawed to merit their inclusion as default
> choices for Ring apps and the binding
On Dec 5 2008, Luc Prefontaine wrote:
> I feel we will start before Xmas to put together a prototype.
>
> I really want this to come to life because we could use cooperative
> Clojure instances on our bus. This would also
> provide us another form of persistance. Presently we rely on ActiveMq
> qu
On Jan 14, 9:07 am, Luc Prefontaine
wrote:
> > As this is a commercial project, I imagine you are quite limited in
> > what you can tell us, but I'd love to hear about the issues you faced
> > during development.
>
> Mostly integration problems with the work flow in the radiology system.
> [..
On Jan 14, 1:12 am, Timothy Pratley wrote:
> I've written small wiki article which dives right into the look and
> meaning of common Clojure constructs with examples. Personally I find
> I learn best by examples and when starting out they were hard to find,
> whereas formal descriptions were ther
Aha! I notice that this problem goes away if I run the JVM the way
I'm supposed to (with -cp lucene-core.xxx.jar) instead of using (add-
classpath ...) to load the jar in the first place. This probably
isn't a big deal, then :o)
Thanks,
Mark
On Jan 13, 11:06 am, Mark Triggs wrote:
> Hi all,
On Jan 13, 4:42 pm, Chouser wrote:
> One of the things I found difficult with CL was the extremely large
> number of builtin functions -- a large vocabulary with subtle
> differences between nearly synonymous-sounding words.
I've had the same experience with Common Lisp code. On the other
han
I also find the choice of some/not-any? as opposites to be hard to
remember. I'd rather it be some/not-some? or any/not-any?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, se
On Jan 13, 11:18 am, Allen Rohner wrote:
> I thought I was using all ints, but it turns out that a java API
> returned a long when I thought it returned an int.
FYI, You can coerce to specific types with the functions int, long,
short, etc. You could use that when creating your map to ensure th
It might be nice if there were a function that automatically converted
the number to the type that Clojure uses for that number if typed in
as a literal.
On Tue, Jan 13, 2009 at 7:27 PM, Stuart Sierra
wrote:
>
> FYI, You can coerce to specific types with the functions int, long,
> short, etc. Y
ok ok. . . .but yall made lists functions . .. so I could ask the same
question of
if foo(3): bar(3). if foo a function or a list? It looks like a function.
but it's a list, too. . . .because in clojure lists are functions . . . .but
only if they take one argument. I didn't start the confusion.
i know that will be awesome for me. I just wish clojure.org was the only
place I had to go to get stuff like that. Why not wikify it all there?
On Tue, Jan 13, 2009 at 9:12 PM, GS wrote:
>
> On Jan 14, 1:12 am, Timothy Pratley wrote:
> > I've written small wiki article which dives right into
I humbly propose that folks shouldn't complain about Clojure being
slow for their apps until they have at least one of the following:
1. A targeted benchmark for an important bottleneck in their
application, implemented in both Clojure and the current
implementation language, with performance res
It is, that article is part of the wiki linked to directly from clojure.org.
On Tue, Jan 13, 2009 at 11:12 PM, e wrote:
> i know that will be awesome for me. I just wish clojure.org was the only
> place I had to go to get stuff like that. Why not wikify it all there?
>
>
> On Tue, Jan 13, 2009
I've checked in updates to clojure.contrib.sql. The theme is providing
update and delete functions and a move to pervasive support of
parameterization in queries and selection criteria. Please see the doc
strings for detailed changes.
Here's a summary of the changes:
sql.clj
- Add "updat
On Jan 14, 2:27 pm, "Mark Engelberg" wrote:
> I also find the choice of some/not-any? as opposites to be hard to
> remember. I'd rather it be some/not-some? or any/not-any?
I think some and any? both have their place.
(let [foo (some prime? numseq)]
(do something with foo))
(if (any? com
On Jan 12, 2009, at 4:57 PM, Greg Harman wrote:
I couldn't figure out how to do this with the included functions/
macros in clojure.contrib.sql so I massaged with-results and do-
prepared together to get this macro (with supporting fn), which seems
to work. Useful addition for contrib.sql?
Hi
> > > (defn chunk "Lazily break s into chunks of length n (or less, for the
> > > final chunk)."
> > > [n s]
> > > (when (seq s)
> > > (lazy-cons (take n s)
> > > (chunk n (drop n s)
>
> > Should that "seq" be "seq?". If not, why not?
On Jan 13, 7:17 pm, "Nick Vogel" wrot
On Jan 11, 2009, at 10:42 AM, Stephen C. Gilardi wrote:
I'd like to include something like this in clojure.contrib.sql. That
will go smoothest if I can base it directly on what you've written
and that's only possible if you send in a contributor agreement.
Would you please send one in?
define "directly" I clicked on clojure.org. I don't see the link. I
stared at the page for a good 30 seconds. I don't see a "links" section. .
. . maybe it's there and I'm bad at reading. Ah it's inline in the getting
started dialog. In my opinion, that wiki link ought to be prominently
displ
. . . that person being me if it wasn't clear :)
On Wed, Jan 14, 2009 at 12:35 AM, e wrote:
> define "directly" I clicked on clojure.org. I don't see the link. I
> stared at the page for a good 30 seconds. I don't see a "links" section. .
> . . maybe it's there and I'm bad at reading. Ah i
actually I think I've seen that page before. I guess I new the way to get
there once.
On Wed, Jan 14, 2009 at 12:35 AM, e wrote:
> . . . that person being me if it wasn't clear :)
>
>
> On Wed, Jan 14, 2009 at 12:35 AM, e wrote:
>
>> define "directly" I clicked on clojure.org. I don't see t
Perhaps this thread is dead, but have you looked at CUDA?
A modern GPU has around 100 times the FPU firepower compared to a
modern core duo. Whether you can structure your algorithm to suite
the hardware is another question and I could help you with that. CUDA
isn't as strong on integer but the
It's in the upper right hand corner of the main page. The stuff on the left
seems to be about the language itself, while the links in the upper right
reference the various external sources. I'm the kind of person who explores
every nook and cranny of a webpage though so I can't speak for how easi
90 matches
Mail list logo