> (vm)
>> {(first (find-classes #"clojure.lang.Compiler\$DefExpr\$Parser"))
>> (to-byte-array
>> (java.io.File.
>> "/Users/georgejahad/incoming/clojure/classes/clojure/lang/Compiler
>> $DefExpr$Parser.class"))})
>>
>> is th
Back in January I found myself writing some gen-class to connect my
Clojure library to my Java project. Until now I'd been spoiled by
Clojure's dynamic, interactive nature, so running up against the whole
"stub class signature can't change w/out jvm reboot" thing hurt a bit.
I found a partial solu
s this conclusion
> derived ("Clojure - being a Lisp dialect - has a steeper learning
> curve due to its syntax and more purely functional nature.")? Scala
> has more syntax/semantics than Clojure AFAICT. Was it familiarity with
> the Java syntax?
>
> Regards,
>
Hey guys,
This past summer I gave a presentation on JVM langauges at our
company's worldwide developer summit. I tried to get approval for
Clojure but had to settle for Scala because its syntax didn't frighten
management. I figured I'd share it in case any of the slides can be of
use elsewhere.
o
't seem to actually matter since at the end of
the day the compiled bytecode is twi identical invokevirtuals.
Rob
On Sun, Jan 16, 2011 at 7:22 PM, Rasmus Svensson wrote:
> 2011/1/16 Robert Campbell :
>> The second form - (.foo bar), expanded to (. bar foo) - eventually
>> call
I've been trying to understand exactly how these two statements are
evaluated by tracing execution through Compiler.java, Reflector.java,
etc of tag 1.2.0.
The second form - (.foo bar), expanded to (. bar foo) - eventually
calls Reflector.invokeNoArgInstanceMember.
The first form - (.foo (new Bar
I'd like to resurrect this thread, because I have the exact same
requirement Laurent had and I'm hoping there's been some additional
progress in this area.
I'm set to give a Clojure presentation to our company's Java
developers, and I'm looking for a way to excite the audience about FP
concepts in
I love the Little/Seasoned Schemer books. They feel lightweight, both
physically and in content, and I managed to work through them fairly
quickly. It was surprisingly fun. SICP/HTDP/PAIP, on the other hand,
have more of the textbook feel which has so far kept me from working
through them.
The onl
"Some good books that we recommend to get you on your way [to
understanding the JVM/runtime] are: "Java Reflection in Action"
by Ira R. Forman and Nate Forman. "The Java Virtual Machine
Specification" 2nd edition by Tim Lindholm.
"Effective Java" 2nd edition and "Java Puzzlers" by Joshua Bloch. And
Hi Stuart,
That fixes the problem, thank you.
When I ran the result-set through (type), it showed me that the
instance was actually a ResultSetStream. While the Jena ResultSet
interface doesn't act as a closable resource, perhaps the stream was
being closed once the owning QueryExecution obj was
(map handler (iterator-seq result-set)) always throws a NoSuchElementException
(map handler (butlast (iterator-seq result-set))) always works.
(count (iterator-seq result-set)) is returning the correct number of
elements. Calls to first, second, nth, also work correctly.
When I manually test a r
Hi Michał,
That works perfectly and is much simpler, thank you.
On Sun, Feb 7, 2010 at 4:23 PM, Michał Marczyk wrote:
> Ouch, sorry, I misread your specs... Use this instead:
>
> (map #(zipmap (keys coordinates) %)
> (apply cartesian-product (vals coordinates)))
>
> With coordinates bound to y
I'm only 1.5hr flight away in Prague. I'd be happy to host any Clojure
users to trade notes over our famous beer.
On Sat, Feb 6, 2010 at 12:26 PM, Joop Kiefte wrote:
> Hello folks!
> I am from the Netherlands and I am learning Clojure now, using it at work,
> and loving it so far. Are there any
Imagine a map m {
"foo" [1 2 3 4]
"bar" [\a \b \c]
"baz" [true false]
}
How could I transform that into a seq s (
{"foo" 1 "bar" \a "baz" true}
{"foo" 1 "bar" \a "baz" false}
{"foo" 1 "bar" \b "baz" true}
{"foo" 1 "bar" \b "baz" false}
{"foo" 1 "bar" \c "baz" true}
{"foo
I think anything which lowers the impedance mismatch between Clojure
data structures and a persistent store is worth investigating. I'd
love to find an ACID, transactional store which accepts native
structures. Right now I'm using CouchDB, and while JSON is close
enough, it still requires a mapping
e and the candidates, I will just return [].
Rob
On Mon, Dec 28, 2009 at 6:28 PM, ajuc wrote:
>
>
> On 28 Gru, 20:57, Robert Campbell wrote:
>> How might I add a third and final condition, where those candidates
>> with equal scores AND equal counts are all returned toget
hould be getting [[1 2 \a] [1 2 \b] [1 2 \c]] since each of
them is equally close to [1 2 3]
On Mon, Dec 28, 2009 at 5:20 PM, Robert Campbell wrote:
> Thanks ajuc.
>
> I updated the implementation to match your algorithm:
>
> (defn closest-match
> "Searches the haystack v
Thanks ajuc.
I updated the implementation to match your algorithm:
(defn closest-match
"Searches the haystack vecs for the closest match to the needle vec"
[#^IPersistentVector needle #^IPersistentVector haystack]
(letfn [(matching [candidate]
(reduce + (map #(if (= %1 %
When given the following set of vecs
#{[1 2 3] [9 8 3] [1 2] [1] [1 0 3 4] [1 2 3 4 5]}
find the closest match to [1 2 3]
(defn closest-match
"Searches the haystack vecs for the closest match to the needle vec"
[#^IPersistentVector needle #^IPersistentVector haystack]
(second
>> We have talked about adding a run task;
>> if you're interested we could even get it in for the 1.0.0 release.
I'd definitely like to see that. Right now my deployment sequence looks like:
lein compile
lein uberjar
java -jar myapp-standalone.jar
I imagine "lein run" should be able to execute
ies like "myproj.clj" don't throw an error.
I suppose that's being excessively safe for what's meant to be a
simple example.
On Thu, Nov 26, 2009 at 9:43 AM, Rob Wolfe wrote:
>
>
> Robert Campbell napisał(a):
>> I'm trying to write a file scanner very s
If you have this:
user> (def f (future (Thread/sleep 2) :done))
#'user/f
user> @f ; this immediate deref blocks for 20 sec, finally returning :block
:done
user> @f ; returns immediately
:done
What is actually happening when you call the first @f? You are waiting
for the function to finish e
Forgot to mention: running Clojure 1.0.0- and Clojure-Contrib
1.0-SNAPSHOT according to the pom..
On Thu, Nov 26, 2009 at 7:38 AM, Robert Campbell wrote:
> I'm trying to write a file scanner very similar to the one on page 131
> of Stuart's book:
>
> (ns user
> (:
I'm trying to write a file scanner very similar to the one on page 131
of Stuart's book:
(ns user
(:use [clojure.contrib.duck-streams :only [reader]]))
(defn scan [dir]
(for [file (file-seq dir)]
(with-open [rdr (reader file)]
(count (filter #(re-find #"foobar" %) (line-seq rdr)
I've deployed two small mashup apps which combine OpenCalais and our
content repository to annotate documents with metadata (named
entities, relationships, etc) and expose the results over the web.
Good experiences all around, including with the clojure-http-client
and saxon wrapper libs + Compojur
Hey guys,
I'm having some trouble finding a nice way to perform a map
transformation I need. I need to transform this:
[ {:a 1 :b 2 :c 3} {:a 4 :b 5 :c 6} {:a 7 :b 8 :c 9} ]
into this:
{ {:a 1 :b 2} 3 {:a 4 :b 5} 6 {:a 7 :b 8} 9 }
I wanted to use map, but each f in map only returns one value,
Oh, that's pretty neat. Thanks!
On Thu, Nov 12, 2009 at 2:36 PM, Fogus wrote:
>> Why does Clojure hate 8's? :-)
>
> It doesn't. By adding a leading zero you're telling Clojure that you
> want octal numbers. There is no number 08 in octal, instead to write
> the base-10 number 8 you would use 0
C:\dev\clojure>java -cp clojure.jar clojure.lang.Repl
Clojure 1.1.0-alpha-SNAPSHOT
user=> (def grid1 [01 02 03 04 05 06 07])
#'user/grid1
user=> grid1
[1 2 3 4 5 6 7]
user=> (def grid2 [01 02 03 04 05 06 07 08])
java.lang.NumberFormatException: Invalid number: 08
java.lang.Exception: Unmatched deli
Mark: that looks a lot like the "collector" I learned about in The
Little Schemer. I actually do have How to Design Programs, but I
wanted to finish Seasoned Schemer first. I was poking around in SICP
because of a Project Euler problem. Thanks for the tip!
John: good catch. Can you confirm the di
One correction: after playing with the functions a bit I noticed I
screwed up, putting sqrt where I needed square.
On Sun, Nov 8, 2009 at 4:43 PM, Robert Campbell wrote:
> I've started reading SICP and I came across the Fermat primality test
> implemented an Scheme. I reimplem
I've started reading SICP and I came across the Fermat primality test
implemented an Scheme. I reimplemented it in Clojure and was able to
switch the recursive call in fast-prime to TCO/recur, but I was unable
to do the same for the exp-mod function.
(defn exp-mod [base exp m]
(cond
(zero?
the server for each request. The
purpose of sessions are to avoid exactly this hairy situation.
I wrapped cart in a Ref in case multiple browser windows are open and
there is a concurrent "add to cart" click.
On Tue, Oct 27, 2009 at 12:41 PM, Timothy Pratley
wrote:
>
> Hi Robert
>
Hey guys, I'm looking for _any_ feedback/thoughts on this Clojure code
I wrote. I just feel like the entire thing is way too complex, but I'm
not sure about how to simplify it. I wanted to try something "real
world" so I made a simple shopping cart ref to put in a session:
(defstruct cart :line-
I am using clojure.contrib.sql which gives me the typical Clojure
ResultSet: a set of maps. Are there any tricks you've used in the past
to transform this into XML? I was looking at Enlive since I've used it
- and loved it - for HTML transformations in the past, but examples
are few and I don't se
the past.
Rob
On Mon, Jul 13, 2009 at 12:37 AM, Christophe Grand wrote:
> Hi !
>
> On Sat, Jul 11, 2009 at 7:31 PM, Jarkko Oranen wrote:
>>
>> On Jul 11, 6:01 pm, Robert Campbell wrote:
>> > Hey guys,
>> >
>> > I'm just curious why Christoph
Hey guys,
I'm just curious why Christophe chose to return seq instead of a str
for Enlive for his template functions.
Example:
(deftemplate my-page-transformation "index.html" [message style]
[:style] (content style)
[:h1] (content message))
orchid> (my-page-transformation "my wonderful he
> Wherever the files goes after C-x C-f ~/.emacs and then C-x C-s is where
> emacs thinks your home directory is. I would just go with that. It's
> normally in %appdata%, but it won't be there until you create it and save
> it.
yes, this is better than my #2
> Robert? Is that all you have in you
1. Here is my .emacs I use for Clojure Box to load the Jars and add
the proper paths to your classpath:
(setq swank-clojure-extra-classpaths
'())
(add-to-list 'swank-clojure-extra-classpaths
"C:/Dev/clojure/clojure.jar")
(add-to-list 'swank-clojure-extra-classpaths
Phil - got it. It wouldn't be hard at all to write a script to monitor
a directory, and any jar you throw in there gets exploded to the
classpath dir like you use. That would make it pretty painless.
> For the record, this is usually termed "dribbling" in the Lisp world.
> It's very handy for deb
That's it, that's exactly what I needed to complete this example. I'm
pretty pumped because you guys have shown me a way to do it without
macros and without manually managing a quoted tree structure.
If it's okay, could somebody explain the difference between what's
happening here:
user> (def my
x27;s the problem with adding urls to the current ClassLoader ?
>
> i've seen remarks to the effect that it doesn't work well, but i don't
> understand why...
>
> c
>
> On 8 Jul 2009, at 17:37, Phil Hagelberg wrote:
>
>>
>> Robert Campbell writes
ution.
Having said that, it's better than nothing. There are certainly times
when I need to backtrack to previous definitions when I've down down
the wrong path. Having a transcript is better than where I'm at today.
On Wed, Jul 8, 2009 at 12:00 PM, John Harrop wrote:
> On Wed
u.
>
> I think once it is compiled a function is not easy to examine... so as
> you alluded to the best alternative would be to keep the AST?
>
> Regards,
> Tim.
>
> On Jul 7, 10:18 pm, Robert Campbell wrote:
>> I'm trying to write the first basic GP example in thi
ded that as much.
>
> Incidentally, I find the easiest way to port my code around is to
> print it to the repl, then cut-and-paste it to etherpad, which I can
> then access from anywhere (without having to save). Now if only there
> was a hosted REPL that integrated an IDE nic
spath without rebooting. Then I wouldn't be
rebooting so often and I wouldn't need to be making images to save
I'm-in-the-middle-of-a-thought state
On Wed, Jul 8, 2009 at 10:57 AM, Daniel Lyons wrote:
>
> Robert,
>
> On Jul 8, 2009, at 2:13 AM, Robert Campbell wrote:
>
&
Hello,
Sometimes I have pretty long REPL sessions where I'm trying to flesh
out some ideas. When I close my instance of Clojure Box (Emacs based)
I lose all the definitions I had worked out over time. Is there any
way to dump namespace(s) to an image? It would be great to be able to
load up some
I'm trying to write the first basic GP example in this free book:
http://www.lulu.com/items/volume_63/2167000/2167025/2/print/book.pdf
I've gotten a lot of the suppor methods working correctly (like
fitness) but I'm having problem convering the pseudocode on page 14
for generating random expressi
r this specific list
Paul Stadig: Concepts of Programming Languages by Sebesta, suggested
as more general than SICP
On Sat, Jun 6, 2009 at 1:12 PM, Robert Campbell wrote:
> Going beyond the language-specific Programming Clojure book, what
> other books have best helped you make the (s
Going beyond the language-specific Programming Clojure book, what
other books have best helped you make the (sometimes mind-bending)
transition from OOP thinking to FP thinking? My bookshelf is piled
high with OOP books like Design Patterns, Domain Driven Design,
Analysis Patterns, etc. I've recen
I've been looking at using the clojure.set functions to create a
simple in-memory database cache. Basically when the app boost up, load
entire db into memory, work with it through the basic relational
algebra functions provided. Any mutations (create/update/delete) would
be wrapped in a simple fun
If you're on Windows, please take a look at Clojure Box:
http://clojure.bighugh.com/
It comes with an installer which sets you up with an Emac environment
running Clojure + contrib.
It's everything you need to get up in running in minutes. This is the
path I took when I faced similar difficulti
Is there any way you could record the presentation and post it on your site?
On Mon, Apr 27, 2009 at 1:36 PM, slc wrote:
>
> If you are interested in Google AppEngine and live in the Atlanta
> area ...
>
> Tuesday - Clojure
>
> * Who: John Hum
52 matches
Mail list logo