Hi Rob,
map is lazy, count and butlast are not lazy. Does adding a doall
around your call to map fix this problem?
Stu
(map handler (iterator-seq result-set)) always throws a
NoSuchElementException
(map handler (butlast (iterator-seq result-set))) always works.
(count (iterator-seq
Hi,
On Feb 16, 9:55 am, Stuart Halloway stuart.hallo...@gmail.com wrote:
map is lazy, count and butlast are not lazy. Does adding a doall
around your call to map fix this problem?
Argh. butlast is only unlazy of degree one, so to say.
Is there a reason why not to provide a lazy version:
Hello,
the current state of Conway's Prime Machine is at http://paste.lisp.org/+21BR
I'l go on learning. The next state should be seperation of print and
produce. Currently (conway-pm) doesnt return stuff. I dont know if
Clojure can produce infinite lists, like Haskell, and print the items
as
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
On Feb 16, 12:26 pm, alux alu...@googlemail.com wrote:
Hello,
the current state of Conway's Prime Machine is athttp://paste.lisp.org/+21BR
Instead of using a quoted list, a vector is more idiomatic in Clojure.
I'l go on learning. The next state should be seperation of print and
produce.
Hello all
I have question about send-off, agents threads - I'm trying to use
send-off to dispatch tasks, that stores some data into central agent.
Tasks could be long running. I found following situation:
- when I explicitly create threads and run tasks in them, I have more load
on machine,
I think it's preferable to use the sequence functions when possible.
This way you get laziness without having to construct lazy-seqs by
hand, you get automatic chunking for better performance, and you
create code that is easier for other Clojure users to parse. On the
other hand, if you find
Alux,
This is good progress, keep up the good work. Here's my
implementation w/Jarkko's suggestions built in. Take a look at this
AFTER you complete your next iteration :)
http://gist.github.com/305521
I've changed the following
* Imported java.math.BigInteger
* Used the instance? predicate
Thanks for catching that!
care...@thortech-solutions.com
On Feb 7, 5:18 am, Michael Kohl citizen...@gmail.com wrote:
On Thu, Feb 4, 2010 at 10:29 PM, Eric Thorsen ethor...@enclojure.org wrote:
ThorTech Solutions
care...@thotech-solutions.com
Is the missing 'r' in the mail address a kind of
I'm curious, but as you told me, I pasted my solution (with a lazy
stream), as annotation of my former program.
http://paste.lisp.org/+21BR/1
So, now I'll have a look at yours.
Thanks, and read you sn.
alux
On 16 Feb., 14:32, Sean Devlin francoisdev...@gmail.com wrote:
Alux,
This is
Hi all,
I'm looking for approaches to learn about VM's, the JVM in particular.
I noticed some local university courses use Virtual Machines (Smith,
Nair) [1]. I'm planning on getting it, but would rather query you guys
for opinions first, and recommendations on other books/resources?
Cheers,
Interesting... could you add a few test cases? I want to make sure
my implementation does what you expect.
Thanks,
Sean
On Feb 16, 11:18 am, alux alu...@googlemail.com wrote:
I'm curious, but as you told me, I pasted my solution (with a lazy
stream), as annotation of my former program.
On Tue, Feb 16, 2010 at 7:24 AM, Alex Ott alex...@gmail.com wrote:
Hello all
I have question about send-off, agents threads - I'm trying to use
send-off to dispatch tasks, that stores some data into central agent.
Tasks could be long running. I found following situation:
- when I
;-)
It didnt exactly do what I did, it just produced the numers I needed
in between, I had to add the filtering.
Then I compared the time, and yours is almost 40% quicker. Cool!
(First time I saw type hints in Clojure. :)
Now the main difference was the call to step. You did it tail call
Mike Meyer wrote:
Is there any way to tell if inside a .clj file if it was invoked as a
script by clojure.main, vs. being loaded for use elsewhere?
Use a shebang line that calls a wrapper script, e.g. clj-script, that
passes a command-line arg to tell the code it's being run as a script.
$
On Feb 16, 2:12 am, Mike Meyer mwm-keyword-googlegroups.
620...@mired.org wrote:
Wouldn't be hard to do, either. Just bind *script-name* (or some such)
to the path in script-opt, and let the client decide if it's the same
as *file*.
It would indeed be helpful if clojure.main bound a Var to the
Hello
Chouser at Tue, 16 Feb 2010 12:02:17 -0500 wrote:
C On Tue, Feb 16, 2010 at 7:24 AM, Alex Ott alex...@gmail.com wrote:
Hello all
I have question about send-off, agents threads - I'm trying to use
send-off to dispatch tasks, that stores some data into central agent.
Tasks could
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
Inside
Sean and Richard perhaps I can address both of your mails in a single
go. Here is an example of one of the functions from my calculator:
(defn tax_deductible_expenses
The total expenses incurred in business month m that are deductible
from federal income tax
[m]
(let
Hello Group,
I'm writing a web server in Clojure and I'd love to have a bit of help
on a function I have.
This function (and at http://gist.github.com/305909) is used to read
the HTTP request from a client and to then act on it:
(defn handle-request
[in out]
(binding [*in*
On Feb 16, 8:27 pm, Yaron ygol...@gmail.com wrote:
Sean and Richard perhaps I can address both of your mails in a single
go. Here is an example of one of the functions from my calculator:
(defn tax_deductible_expenses
The total expenses incurred in business month m that are
Hi Matt,
I think what you're looking for is line-seq:
http://richhickey.github.com/clojure/clojure.core-api.html#clojure.core/line-seq
In your code, if you pass *in* to line-seq, you'll get back a seq of lines
(the request headers). Incidentally, I first ran into line-seq in the
course of
assuming you are doing this using java servlet.
you may want to look at how compojure does this.
http://github.com/weavejester/compojure/blob/master/src/compojure/http/servlet.clj
it turns the request into a map.
and then various other parts of compojure can do different things
based on the
On 17 February 2010 06:18, Alex Ott alex...@gmail.com wrote:
send-off to dispatch tasks, that stores some data into central agent.
Tasks could be long running.
Yes, all send-off are sent to one agent, that accumulate information about
different documents
As Chouser pointed out, agents execute
Dear Meikel and Michal,
Thanks for your replies.
Meikel is right in observing that my question makes very little sense out of
context.
The reason I'm asking which Java classes can hold Clojure expressions is
that Clojuratica includes a Clojure s-expression reader, and I'm trying to
refine it.
Hello,
M-x slime
is failing on Emacs 23.1 under Cygwin as follows below.
My suspicion is that Unix paths are not being converted to Windows via
cygpath http://www.inonit.com/cygwin/faq/
before calling java -jar
===
(require 'swank.swank)
Hi,
I found this old post:
http://groups.google.com/group/clojure/browse_thread/thread/45e118a638a5af8e/02eab5ae0d9023ff?lnk=gstq=binding+destructuring#02eab5ae0d9023ff
And was wondering what is the status of Stephen's patch?
Is there a reason why clojure/binding does not support destructuring
What do you think of the following style?
(defmacro in-environment [env body]
`(binding [*months-to-find-tenant* (:months-to-find-tenant env)
*months-in-lease* (:months-in-lease env)
*lease-cycles* (:lease-cycles env)
etc...]
~...@body))
So env is a
On Tue, 16 Feb 2010 11:13:28 -0800 (PST)
Daniel Werner daniel.d.wer...@googlemail.com wrote:
On Feb 16, 2:12 am, Mike Meyer mwm-keyword-googlegroups.
620...@mired.org wrote:
Wouldn't be hard to do, either. Just bind *script-name* (or some such)
to the path in script-opt, and let the client
On Tue, 16 Feb 2010 02:35:03 +0100
Michał Marczyk michal.marc...@gmail.com wrote:
On 16 February 2010 02:12, Mike Meyer
mwm-keyword-googlegroups.620...@mired.org wrote:
To bad. It's really handy, especially as it starts trickling into
system modules. You get one file that provides the
For the method tax_deductible_expenses to run it ends up requiring 19
user defined values. That's a whole lot of arguments to pass into a
function. Obviously I could wrap them up in a StructMap but then I get
expressions like (+ 1 (args :B)) which doesn't seem much better than
(+1 (B)).
Pass
i'm interested in seeing how this progresses ... like how you'd spawn
handlers asynchronously to service the requests. was thinking about doing
this exercise myself at some point.
On Tue, Feb 16, 2010 at 4:30 PM, Alan Dipert alan.dip...@gmail.com wrote:
Hi Matt,
I think what you're looking
Hi All,
I am struggling with inserting items into a map.
I would like to create a function that would create a map that would
look like
{ 0 [ 01 2 3] ,
1 [0 1 2 3] ,
2 [0 1 2 3] }
and want to do something like
(defn create-map []
(into {} (dotimes [x 2] (assoc x (range 4)
but
On 17 February 2010 13:55, Base basselh...@gmail.com wrote:
{ 0 [ 01 2 3] ,
1 [0 1 2 3] ,
2 [0 1 2 3] }
and want to do something like
(defn create-map []
(into {} (dotimes [x 2] (assoc x (range 4)
(zipmap (range 3) (repeat 3 (range 4)))
--
You received this message because
dotimes is for side effects. What you want is to use a for loop that
produces a sequence of key-value pairs.
(into {} (for [i (range 3)] [i (range 4)]))
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to
2 things about Clojure
1. It amazes me how easy it is to get things done
2. The Clojure Group members are fantastic!
Thanks guys!!
On Feb 16, 10:19 pm, Mark Engelberg mark.engelb...@gmail.com wrote:
dotimes is for side effects. What you want is to use a for loop that
produces a sequence
Hi,
I was wondering if irc #clojure is open to anyone and if it is, what is
the protocol?
I get cannot send to channel error. I'm not familiar with irc.
Thanks
Brian
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send
On Wed, Feb 17, 2010 at 6:10 AM, Brian Wolf brw...@gmail.com wrote:
Hi,
I was wondering if irc #clojure is open to anyone and if it is, what is the
protocol?
I get cannot send to channel error. I'm not familiar with irc.
Thanks
Brian
--
You received this message because you are
Thank you Phil. I appreciate your help. Unfortunately I'm still having
issues. Sorry for being a newbie.
Do I still have to do manual edits to my .emacs file for swank-
classpath and whatnot? I started with a blank .emacs file
and .emacs.d directory and followed the recommend use of ELPA. When
Hi Steve. Thanks for your help. I tried the up to date instructions
per the readme file on swank-clojure homepage (using ELPA) and now
the problem is that slime never loads. The expression you gave me does
eval in the *inferior-lisp* buffer but I do not get a slime connection
at all now. It is
I'm having an issue compiling clojure-contrib on Windows.
I downloaded the code from the git repository and when I run Maven,
after compilation it runs through the test suite fails in test-io:
FAIL in (test-as-url) (run-test5405918110152723544.clj:47)
expected: (= (URL. file:/foo) (as-url (File.
After installing swank-clojure via ELPA on emacs23, and type M-x slime, I
get this error:
(require 'swank.swank)
(swank.swank/ignore-protocol-version nil)
(do (.. java.net.InetAddress getLocalHost getHostAddress)
nil)(swank.swank/start-server /tmp/slime.29897 :encoding
iso-latin-1-unix)
I have posted a file (http://www.goland.org/sellorrent.pdf) which
explains the math behind the calculator. The file gives all the
algebra needed to implement the calculator. At the moment I'm just
taking the boneheaded approach and implementing all the logic in
Clojure as more or less a one to one
On Tue, Feb 16, 2010 at 10:34 PM, joseph hirn joseph.h...@gmail.com wrote:
Hi Steve. Thanks for your help. I tried the up to date instructions
per the readme file on swank-clojure homepage (using ELPA) and now
the problem is that slime never loads. The expression you gave me does
eval in the
On Tue, Feb 16, 2010 at 2:55 PM, Terrence Brannon scheme...@gmail.com wrote:
After installing swank-clojure via ELPA on emacs23, and type M-x slime, I
get this error:
(require 'swank.swank)
(swank.swank/ignore-protocol-version nil)
(do (.. java.net.InetAddress getLocalHost getHostAddress)
Hi,
On Feb 17, 4:19 am, Mark Engelberg mark.engelb...@gmail.com wrote:
dotimes is for side effects.
As a rule of thumb: everything starting with do is related to side
effects.
Sincerely
Meikel
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To
It seems however that the consensus of the group based on what I've
said so far is to pass around state in a structmap.
Not necessarily a struct-map. Just a map.
This is nice in
that it makes each function completely self contained (e.g. no
external references). It's unfortunate in that it
Hi,
On Feb 16, 11:26 pm, Garth Sheldon-Coulson g...@mit.edu wrote:
The reason I'm asking which Java classes can hold Clojure expressions is
--context snipped---
list.
Ok. I understand your problem. You have maction - a mix between macro
and function - and you are not sure when to evaluate
Thanks again Phil.
The message above where I get FileNotFoundException Could not locate
swank is from my *inferior-lisp* buffer.
I am using emacs 23. I've tried with this and the gtk-snapshot
versions togging using update-alternative --config emacs.
I do not have a ~/.swank-clojure directory. I
I often find myself creating one line helper functions that i use very
often just because it is easier to write them than try to find them in
contrib.
Here's one:
(defn- to-list [x] (if (vector? x) x [x]))
This one is often needed when working with html form fields.
Is there such a function in
50 matches
Mail list logo