On 23.11.2008, at 16:28, Rock wrote:
Furthermore, the implementation should, I think, be generic, that
is, we should be capable of creating complex numbers, the real and
imaginary parts of which can be integers, rationals, or reals. For
instance, it sould be possible to
do this:
Help me understand why this isn't written
(defn factorial [n]
(apply * (range 1 (+ n 1)))
instead. That is, I don't get the purpose of the for statement.
Neither do I now ;-),
nice,
Vlad
--~--~-~--~~~---~--~~
You received this message because you are
user= (= (range 10) (for [x (range 10)] x))
true
:-)
Vlad
--~--~-~--~~~---~--~~
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
To unsubscribe from this
Sheffield, UK
--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more
How easy is it to pick up clojure without having any previous java
experience? I have plenty of common lisp experience, but have just
never bothered learning java. I recently got a chance to watch the
boston lisp talk on clojure, and it looks fairly straightforward, but
I feel that not having any
Parth Malwankar wrote:
On Nov 24, 12:34 am, Stuart Sierra [EMAIL PROTECTED]
wrote:
Honestly, for this kind of low-level stuff I always use the Apache
Commons libraries, http://commons.apache.org/, esp. the Lang and IO
components. They've got every imaginable stream function, all
If this is the incorrect forum to post this please point me in the
correct direction...
On http://clojure.org/jvm_hosted
The celsius defn has a doto with incorrect syntax. Shouldn't
(doto frame
(setLayout (new GridLayout 2 2 3 3))
...)
be
(doto frame
As somebody who did only a few hours of Java, but knows object
oriented programming well and had its fair share of fun with Common
Lisp, Scheme and Haskell, Clojure was quite easy to pick up. For all
pure Clojure stuff, I don't think that you need to know anything about
Java. When you work with
Wow, jamais je n'aurais pensé lire des commentaires à propos des
problèmes de prononciation de madame Marois ce matin. Comme on dit au
Québec: Osti qu'j'ai hâte qu'les élections finisse!
Sorry about being offtopic ;-)
On Nov 22, 11:35 am, Luc Prefontaine [EMAIL PROTECTED]
wrote:
Salutations
On Mon, Nov 24, 2008 at 7:24 AM, JonathanMeeks [EMAIL PROTECTED] wrote:
If this is the incorrect forum to post this please point me in the
correct direction...
On http://clojure.org/jvm_hosted
The celsius defn has a doto with incorrect syntax. Shouldn't
(doto frame
On Nov 24, 2:41 am, [EMAIL PROTECTED] [EMAIL PROTECTED]
wrote:
On Nov 24, 12:41 am, Kevin Downey [EMAIL PROTECTED] wrote:
I don't think you understand. clojure data structures are IMMUTABLE.
every call to conj, or anyother function returns a new object. To
optimize there is sharing of
On Nov 23, 9:09 am, James Reeves [EMAIL PROTECTED] wrote:
On Nov 23, 11:38 am, [EMAIL PROTECTED] [EMAIL PROTECTED]
wrote:
Hi,
According tohttp://clojure.org/reader:
Keywords are like symbols, except:
o They can and must begin with a colon, e.g. :fred.
o They
Ok, first you need to add the commons-io.jar to the Java classpath.
You can do this by editing the Clojure startup script. The argument
to -cp is a colon-separated list of directories and/or JAR files to
go on the classpath. So if the command line was this:
java -cp /path/to/clojure.jar
If you're running this at the REPL, in recent versions only the name
of the exception is printed. If you want the full backtrace, do:
(.printStackTrace *e)
-Stuart Sierra
On Nov 24, 2:39 am, Timothy Pratley [EMAIL PROTECTED] wrote:
If you put the following into a file and run it:
(defn
It's useful to know the standard Java libraries, especially for File/
IO stuff. You can pick up nearly all of it from the Sun Java
tutorials:
http://java.sun.com/docs/books/tutorial/
-Stuart Sierra
On Nov 23, 11:34 pm, syamajala [EMAIL PROTECTED] wrote:
How easy is it to pick up clojure
This just a quick reminder about the poll. We've got 22 responses,
but I'm sure there are more than 22 opinionated Clojuristas on this
list. I'll summarize the results in a couple days, so vote now if you
care.
Vote here:
https://spreadsheets.google.com/viewform?key=p1hkQs__fVyaQGEP_bOFRVQ
On Mon, Nov 24, 2008 at 4:45 PM, Stuart Sierra
[EMAIL PROTECTED] wrote:
If you're running this at the REPL, in recent versions only the name
of the exception is printed. If you want the full backtrace, do:
(.printStackTrace *e)
That doesn't explain why the line number is listed as 0.
Is
Hi,
thank you in the name of all noobz who, like me, just want to have a
quick ride with closure.
The installation worked almost perfectly.
The dialog window: outside Emacs, waiting for connection to server ...
(swank) didn`t finish.
The result: no response from server. What is the purpose of the
Any ideas if resources of Pocket PC (Windows Mobile 2.0) will suffice
to run single-threaded Clojure app?
What JVM for Pocket PC will do the job?
What porting efforts will be required, if any?
Thanks!
--~--~-~--~~~---~--~~
You received this message because you
Any ideas if resources of Pocket PC (Windows Mobile 2.0) will suffice
to run single-threaded Clojure app?
What JVM for Pocket PC will do the job?
What porting efforts will be required, if any?
Thanks!
--~--~-~--~~~---~--~~
You received this message because you
Johannesburg, South Africa.
--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to [EMAIL PROTECTED]
Boston MA
--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more
On Mon, Nov 24, 2008 at 9:50 AM, mosi [EMAIL PROTECTED] wrote:
Hi,
thank you in the name of all noobz who, like me, just want to have a
quick ride with closure.
The installation worked almost perfectly.
The dialog window: outside Emacs, waiting for connection to server ...
(swank) didn`t
On Nov 23, 2008, at 2:30 PM, Stuart Sierra wrote:
Hmm, you mean write the REPL in Clojure? I hadn't though of that.
Intriguing idea. It would be neat if the REPL were just a function,
so you could start it from within a program using arbitrary input/
output streams. Something to think
On Nov 24, 3:03 pm, Rich Hickey [EMAIL PROTECTED] wrote:
Speculating about inefficiency without a concrete counter-proposal is
not productive. While there could no doubt be some higher-performance
vector constructor/reducers, producing vector-returning versions of
the sequence ops is not
On Thursday 18 September 2008 15:28, falcon wrote:
Looks like the FrTime dissertation was published this year:
Integrating Dataflow Evaluation into a Practical Higher-Order
Call-by- Value Language
By Gregory Cooper
http://dl.lib.brown.edu/pdfs/etd67.20080429180432.pdf
This document
On Nov 23, 9:56 pm, James Reeves [EMAIL PROTECTED] wrote:
On Nov 23, 11:58 pm, Justin Giancola [EMAIL PROTECTED]
wrote:
Neat. I noticed that you're forcing the arg lists into vectors in both
make-maps and in stubfn. Since they're not being manipulated at all,
you could just as easily
This looks great :)
A couple of comments below:
On Mon, Nov 24, 2008 at 6:57 PM, Stephen C. Gilardi [EMAIL PROTECTED] wrote:
[...]
Here are some examples of using the proposed clojure.main via java -
jar clojure.jar:
Display usage info:
% java -jar clojure.jar --help
Usage: java -jar
An interesting idea: hacking the Java compiler to perform source-code
transformations:
http://www.iam.unibe.ch/~akuhn/blog/2008/11/roman-numerals-in-your-java/
Based on ideas in Smalltalk:
http://smallwiki.unibe.ch/diesel/
-Stuart Sierra
--~--~-~--~~~---~--~~
You
On Nov 24, 2008, at 2:17 PM, J. McConnell wrote:
On Mon, Nov 24, 2008 at 1:49 PM, Michael Wood [EMAIL PROTECTED]
wrote:
This looks great :)
Yes, it does!
:-)
I was going to suggest something similar:
Usage: java -jar clojure.jar [option*] [file-arg*] [-- [arg*]]
That looks
On Nov 24, 2008, at 2:28 PM, Stephen C. Gilardi wrote:
Usage: java -jar clojure.jar [option*] [file-arg*] [-- [arg*]]
That looks exactly right to me. I'll be adopting that.
On further review, I think this is better:
Usage: java -jar clojure.jar [option*] [file-arg*] [-- arg*]
Very cool. The two main use cases work well (REPL, script), the
others -- loaded files, evaluation -- are real bonuses. (It's also
really nice to have an extensible REPL implemented in Clojure).
I think a flag for file loading (-l, --load) to make clear the
distinction b/w the file that's a
I am parsing a file and to compare the current line
with the previous line of the file. I am using line-seq
to go thru the file and I thought I would create a
ref to store the previous line. When I want to update
the previous line value I can't seem to do it. I've
never used refs before so I'm
Michael Wood wrote:
On Mon, Nov 24, 2008 at 10:34 PM, James G. Sack (jim) [EMAIL PROTECTED]
wrote:
[...]
== FYI add_classpath works fine.
As a curiosity, I notice that (System/getProperty java.class.path)
does not reflect any change after add-classpath.
== I wonder if this is as it should
I know you are asking about refs, but you might want to think about
using reduce to walk the line-seq. the nature of reduce lets you have
access to the line-seq, two lines at a time no need for a ref.
On Mon, Nov 24, 2008 at 2:17 PM, Brian Doyle [EMAIL PROTECTED] wrote:
I am parsing a file and
Thanks Kevin, I will try using reduce instead. I would like to know what
I'm doing wrong with updating the ref for future reference. Thanks.
On Mon, Nov 24, 2008 at 3:23 PM, Kevin Downey [EMAIL PROTECTED] wrote:
I know you are asking about refs, but you might want to think about
using
ref-set needs its one set of parens, and the last thing in the ref-set
call needs to be a function either (fn [x] ...) or a symbol for a var
that holds a function
On Mon, Nov 24, 2008 at 2:30 PM, Brian Doyle [EMAIL PROTECTED] wrote:
Thanks Kevin, I will try using reduce instead. I would like
How can I write the following examples in Clojure that in Haskell will
be:
-- 1) Curried function:
Prelude let f = (+) 1
Prelude f 1
2
-- 2) Anonymous function:
Prelude let f2 = \x - x * 2
Prelude f2 2
4
-- 3) Function composition:
Prelude (f2 . f) 3
8
Prelude
-- 2) Anonymous function:
Prelude let f2 = \x - x * 2
Prelude f2 2
4
(def f2 (fn [x] (* x 2))) ; = #'user/f2
(f2 2); = 4
Or even
(def f2 #(* % 2))
Stuart
--~--~-~--~~~---~--~~
You received this message because you are subscribed to
On Mon, Nov 24, 2008 at 2:34 PM, Kevin Downey [EMAIL PROTECTED] wrote:
ref-set needs its one set of parens, and the last thing in the ref-set
call needs to be a function either (fn [x] ...) or a symbol for a var
that holds a function
I made a mistake here. I was thinking of alter, not
1 is actually an example of partial application of functions more than
it is currying. Haskell's currying makes partial application far more
natural though. In Clojure you can use the (partial ...) macro to do
this:
user= (def f (partial + 1))
user= (f 1)
2
2 is done using the (fn ...) special
comp composes functions just like the dot operator
On Nov 24, 6:14 pm, dokondr [EMAIL PROTECTED] wrote:
On Nov 25, 2:06 am, Jarkko Oranen [EMAIL PROTECTED] wrote:
...
-- 3) Function composition:
Prelude (f2 . f) 3
8
Prelude
1) (def fn1 (partial + 1))
2) (def fn2 #(* % 2)) or
Another possible approach. Key idea here is to use partition to create
a sliding window over the lines, plus a sentinel value (I picked )
before the first line. Pretty sure I like partition over reduce for
this particular example.
(ns examples.convert
(:use
Any ideas how Clojure can be used for distributed concurrent
applications ?
To my mind it should be possible to implement in Clojure mechanism
similar to Erlang light-weight processes running on distributed
'nodes' that can be addressed by 'ports' to send them 'commands'.
How this can be done
On Monday 24 November 2008 15:14, dokondr wrote:
On Nov 25, 2:06 am, Jarkko Oranen [EMAIL PROTECTED] wrote:
...
-- 3) Function composition:
Prelude (f2 . f) 3
8
Prelude
1) (def fn1 (partial + 1))
2) (def fn2 #(* % 2)) or (fn [x] (* x 2)))
3) ((comp fn2 fn1) 3)
--
Providing that Clojure is NOT a pure functional language like Haskell,
yet how can I isolate imperative-style computational structures from
the main body of the functional program?
How can I ensure referential transparency in Clojure?
What I/O primitives Clojure provides?
Thanks!
I hope folks here don't mind this post. The following article
explains how to do reactive programming in F#:
http://tomasp.net/blog/reactive-i-fsevents.aspx (the bottom of the
article has links to rest of the articles in the series)
There has been some recent discussion on CELLs in Clojure.
What is the best way of accessing Java Messaging Service though
Clojure?
Sounds like Rich has already experimented, with good results:
rhickey: I did some playing (in Clojure) with JMS and OpenMQ and it was
awesome, easy, fun and vert fast, with pro level docs from Sun
On Nov 24, 7:22 pm, dokondr [EMAIL PROTECTED] wrote:
Providing that Clojure is NOT a pure functional language like Haskell,
yet how can I isolate imperative-style computational structures from
the main body of the functional program?
You can't, other than manually.
How can I ensure
On Nov 24, 4:03 pm, Stuart Sierra [EMAIL PROTECTED] wrote:
Hi Perry, Stephen,
I like the convention over configuration-ness of defaulting to ./
classes. One thought: Weird errors might result if ./classes is not
on classpath. Is there an easy way to check that, and display a
helpful error
Yep, that's just a typo in the email. Something was wrong with my browser
and I
couldn't just paste the code in :(
On Mon, Nov 24, 2008 at 3:33 PM, Shawn Hoover [EMAIL PROTECTED]wrote:
On Mon, Nov 24, 2008 at 5:17 PM, Brian Doyle [EMAIL PROTECTED]wrote:
I am parsing a file and to compare the
I've written a preliminary cljc script -- a shell script for compiling
Clojure libs -- against Stephen's patched Clojure (specifically using
the clojure.lang.Compile class).
Configure the script with the locations of the clojure.jar clojure-
contrib.jar running cljc w/o options calls
We use a synchronous layer to JMS queues implemented in Java to hook our
Clojure code to the messaging world.
Two Java classes to implement a consumer and a producer with some common
inheritance are used.
We had already some Java implementation so we just beefed it up a bit to
make more robust.
On Nov 24, 4:44 pm, Rich Hickey [EMAIL PROTECTED] wrote:
On Nov 24, 7:22 pm, dokondr [EMAIL PROTECTED] wrote:
Providing that Clojure is NOT a pure functional language like Haskell,
yet how can I isolate imperative-style computational structures from
the main body of the functional
Is there anyway to assert that code does have side effects should
never be called in a transaction?
(dosync
(assert (not (in-transaction - Assert: Can't call this code in
a transaction
That could be useful for debug builds of IO libraries.
I don't know that there's anything
For the File / IO things, skip the Java libs - they are pretty low
level. Go with the Jakarta Commons libs:
http://commons.apache.org/io/description.html , as Stuart has
recommended elsewhere.
On Mon, Nov 24, 2008 at 6:48 AM, Stuart Sierra
[EMAIL PROTECTED] wrote:
It's useful to know the
On Nov 24, 8:17 pm, Chouser [EMAIL PROTECTED] wrote:
One option: You could use a seq instead of all the various structs.
I took your advice and uploaded the rewrite to the files section in
Google Groups, filename is pretty-printer.clj. It doesn't get a stack
overflow anymore, but it runs out
On Nov 25, 12:50 am, [EMAIL PROTECTED] [EMAIL PROTECTED]
wrote:
On Nov 25, 12:22 am, [EMAIL PROTECTED] [EMAIL PROTECTED]
wrote:
This approach might just be too inefficient -- perhaps it would be
best to implement the pretty-printer in an imperative style after all.
OTOH it is pretty
Hi Jarkko,
Good changes, the main page was getting hellishly long.
(I wiped the old examples subpage as it was just an unorganised
collection showing usage of standard library functions. If someone is
feeling up to it, you can salvage it from the page history and
incorporate it into the
59 matches
Mail list logo