On Dec 9, 9:46 pm, Mark Engelberg wrote:
> There are only 9 items that satisfy your predicate. (take 10 ...)
> demands a 10th, and it keeps searching the (iterate inc 1) stream
> forever, endlessly searching for that 10th item it will never find.
Aww. You make it sound so sad.
--
You receive
> Neither filter nor take know to abandon their attempt. That's how this
> works.
Ah, of course. Thanks Mark and Richard!
Mike
--
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 t
> But shouldn't it give me 9 items without hanging when I ask for 10 or
> more as in the first case?
No.
take returns a lazy sequence. The printer is trying to realize it in
order to print it. It can't be completely realized until it's taken
ten elements (at which point it's done, by definiti
There are only 9 items that satisfy your predicate. (take 10 ...)
demands a 10th, and it keeps searching the (iterate inc 1) stream
forever, endlessly searching for that 10th item it will never find.
On Wed, Dec 9, 2009 at 9:41 PM, Mike K wrote:
> On Dec 9, 10:35 pm, Mike K wrote:
>
>> The firs
On Dec 9, 10:35 pm, Mike K wrote:
> The first two work but the third one hangs. Why?
user> (take 5 (filter #(< % 10) (iterate inc 1)))
(1 2 3 4 5)
OK, I figured out that it won't hang with taking <= 9 elements, which
is the total that pass the filter.
But shouldn't it give me 9 items without
I'm working my way through "Programming Clojure" and got an unexpected
result with sequences:
user> (take 10 (filter even? (iterate inc 1)))
(2 4 6 8 10 12 14 16 18 20)
user> (take-while #(< % 10) (iterate inc 1))
(1 2 3 4 5 6 7 8 9)
user> (take 10 (filter #(< % 10) (iterate inc 1)))
; Evaluation
You don't have the locals clearing changes Richard.
Rich Hickey, I confirm that this also causes an NPE on my setup.
Clojure new branch 6d40a76e8a012909f2d2a594ce66a78318889799
OS X 10.6 JDK 1.6 64bit
David
On Wed, Dec 9, 2009 at 10:46 PM, Richard Newman wrote:
> Does not happen for me throug
Does not happen for me through Slime or raw REPL.
user> (ns test.letfn)
(defn debug [n]
(letfn [(even [n]
(if (== n 0)
true
(odd (- n 1
(odd [n]
(if (== n 0)
false
(even (- n 1
On Dec 7, 9:39 pm, David Nolen wrote:
> http://github.com/jochu/swank-clojure/blob/master/src/main/clojure/sw...
>
> Is the offending line.
It's really hard to reason about it in clojure source code. I see, in
jswat debbuger, the root cause of NPE appears around byte code
(putfield ...) for a m
On Wed, Dec 9, 2009 at 5:24 PM, CuppoJava wrote:
> I've run into this problem before also actually. Basically from what I
> read, self-recursive data-structures are hard to do in an eager
> functional programming language. I think you have to resort to
> mutation to handle it nicely. But I would b
Thanks to everyone who replied, this makes sense (methods with args
need separation).
I'll check out -> too.
I appreciate it!!!
Mike
On Dec 9, 5:02 pm, Meikel Brandmeyer wrote:
> Hi,
>
> Am 09.12.2009 um 20:04 schrieb Mike:
>
> > If I write:
>
> > (.setMessage (.getMonitor this) "Counting...")
Hi,
Am 09.12.2009 um 20:04 schrieb Mike:
> If I write:
>
> (.setMessage (.getMonitor this) "Counting...")
>
> and it works, why would
>
> (.. this getMonitor setMessage "Counting...")
>
> give me an IllegalArgumentException: Malformed member expression
> (count-script.clj:11)?
Because your .
I've run into this problem before also actually. Basically from what I
read, self-recursive data-structures are hard to do in an eager
functional programming language. I think you have to resort to
mutation to handle it nicely. But I would be very happy to be proven
wrong.
-Patrick
--
You recei
i'm dreaming of having free time to investigate the Lagoona
programming language's thoughts wrt good component-orientation in
light of Clojure's Protocols et. al.; thought this paper might be of
general interest.
http://www.cs.jhu.edu/~phf/pub/tr-ics-2003-22.pdf
--
You received this message beca
This is exactly what I need!
Unfortunately, I'm getting the following exception when I run the
compile-java task.
$ lein compile-java
Exception in thread "main" java.lang.IllegalArgumentException: No
method in multimethod 'as-file' for dispatch value: null
at clojure.lang.MultiFn.getFn(Mu
Thanks. That is a good solution.
There's also some work in dev being done on trans and trans*
functions, as Sean Devlin pointed out.
see:
explanation of trans:
http://groups.google.com/group/clojure-dev/browse_thread/thread/4b20e40d83095c67#
Chouser commenting on trans:
http://groups.google.com/
Java Advanced Imaging is one possibility:
libs for each platform here: https://jai.dev.java.net/binary-builds.html
Mac OS X ships with it's own version.
On Wed, Dec 9, 2009 at 5:11 PM, Joost wrote:
> Hi there.
>
> I'm working on a project using compojure and I will need some way of
> processin
On Dec 9, 10:14 pm, Joost wrote:
> I think you meant
>
> (.. this (getMonitor) (setMessage "Counting"))
>
> Every method call should be encloded in parentheses. Unless I've
> misread the docs for ..
You don't seem to need parentheses for methods with no arguments. e.g.
(.. " Foo " trim toLowe
On 9 dec, 17:03, Jeff Dik wrote:
> The part "Running code at read-time lets users reprogram Lisp's
> syntax" caught my attention. Is this talking about reader macros? I
> believe I read that clojure doesn't have reader macros, so would it be
> more accurate to say "The whole language is there, _
Duck-streams does good job supporting character based readers and
writers, but doesn't do such a complete job with byte-oriented I/O
using InputStream and OutputStream. (The to-byte-array and copy
mutli-methods offer some support, but there's no equivalent to the
reader and writer multi-methods.)
On 9 dec, 22:53, James Reeves wrote:
> It should be: (.. this getMonitor (setMessage "Counting"))
I think you meant
(.. this (getMonitor) (setMessage "Counting"))
Every method call should be encloded in parentheses. Unless I've
misread the docs for ..
--
You received this message because yo
Hi there.
I'm working on a project using compojure and I will need some way of
processing uploaded images, mainly to produce thumbnails etc. I need
the results to be of reasonable quality, and accept a decent range of
input formats as found among "standard" windows users. That means
decent anti-al
On Dec 9, 7:04 pm, Mike wrote:
> If I write:
>
> (.setMessage (.getMonitor this) "Counting...")
>
> and it works, why would
>
> (.. this getMonitor setMessage "Counting...")
>
> give me an IllegalArgumentException: Malformed member expression
> (count-script.clj:11)?
It should be: (.. this getMon
As I was preparing the post a message requesting help for
an error (see below) generated when I entered the quick start
suggest, I realized that suggestion is generic, and not technically
accurate.
java -cp clojure.jar clojure.lang.Repl
Many people may give up without realizing that the VERSI
If I write:
(.setMessage (.getMonitor this) "Counting...")
and it works, why would
(.. this getMonitor setMessage "Counting...")
give me an IllegalArgumentException: Malformed member expression
(count-script.clj:11)?
I'm using 1.0.0, if that makes a difference.
Sorry if this is a newb questio
I see one issue with this approach. If we get rid of "locking" then some
transactions occur reordered in journal files. So simple backuping of
journal files can be dangerous. Imagine the case when two transactions are
reordered and got into different files:
1.journal:
(tr1) ;1
(tr3) ;3
4.journal
> However, if you would want to do something like an evolvable trade-off
> between epitopes and mutations in viruses, you would like to be able
> to store the functions inside each virus.
And you can do that if you change how you retrieve values.
(defn get-fn
"Like `get`, but handles returned
> Clojure IDEs will integrate similar tools into their debuggers. I'd
> love to be able to single-step through my code and have a REPL in the
> current environment at any time!
yes, catching up with what i assume CL can do would rock :-)
--
You received this message because you are subscribed to
anybody working on something like erlang's dialyzer static checking
tool? a guy can hope...
--
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 -
I expect that each time I call :viral_load, it takes whatever
value :epitopes or :mutations has at that point in time,
I can indeed write a function outside of the map that does the
calculation, but I found the idea of an embedded function neat. Also
writing a function only works as long as there
I expect that each time I call :viral_load, it takes whatever
value :epitopes or :mutations has at that point in time, so I can
indeed write a function outside of the map that does the calculation,
but I found the idea of an embedded function neat.
This works as long as there is just one function
On Dec 9, 10:20 am, bOR_ wrote:
> Hi all,
>
> I want to make a hash-map where the value of one key depends on the
> values of other keys in the hash-map. Is there a way to do this,
> without needing an external reference to the hash-map?
>
> {:a 1 :b 2 :c #(+ :a :b)}
>
> Similarly, when filling
I found a solution to this problem and patched my own fork of Leiningen:
http://github.com/swannodette/leiningen/commit/9d79d631a9faa870a9347992f50a4312170fdf97
The important thing to do if you want this to work is to closely follow the
instructions for hacking on Leiningen that's currently avail
On 9 Dec 2009, at 18:59, George Jahad wrote:
> Brilliant. With such a simple change, I think we just revolutionized
> the way people debug Clojure. (They just don't realize it yet.)
I for one do - this is an excellent improvement, and I hope that
Clojure IDEs will integrate similar tools into
Hi all,
I want to make a hash-map where the value of one key depends on the
values of other keys in the hash-map. Is there a way to do this,
without needing an external reference to the hash-map?
{:a 1 :b 2 :c #(+ :a :b)}
Similarly, when filling a struct, I often want to refer to the bits I
alre
Brilliant. With such a simple change, I think we just revolutionized
the way
people debug Clojure. (They just don't realize it yet.)
On Dec 9, 3:46 am, "Alex Osborne" wrote:
> Neat idea.
>
> Unless I'm misunderstanding what your modifications do, I've come up
> with a simple pure macro versi
On Wed, Dec 9, 2009 at 11:15 AM, Jarkko Oranen wrote:
> Jeff Dik wrote:
>> The part "Running code at read-time lets users reprogram Lisp's
>> syntax" caught my attention. Is this talking about reader macros? I
>> believe I read that clojure doesn't have reader macros, so would it be
>> more accu
Jeff Dik wrote:
> The part "Running code at read-time lets users reprogram Lisp's
> syntax" caught my attention. Is this talking about reader macros? I
> believe I read that clojure doesn't have reader macros, so would it be
> more accurate to say "The whole language is there, _most_ of the
> tim
It (or something similar) is present in some of Sun's Javadocs, if I
recall correctly, and I frequently found it useful, because I kept a
bookmark on the 1.6 javadocs but sometimes had to write for 1.5 JVMs.
Mark
On Dec 9, 10:10 am, Tom Faulhaber wrote:
> Enhancing the doc tool so that we have v
I would say it depends how strongly you feel about reader macros,
since they are purely (very useful) shorthand.
On Dec 9, 11:03 am, Jeff Dik wrote:
> Hi,
>
> I've been rereading "Programming Clojure" and on page 25 it says
>
> The whole language is there, all the time. Paul Graham's essay
>
Hi,
I've been rereading "Programming Clojure" and on page 25 it says
The whole language is there, all the time. Paul Graham's essay
"Revenge of the Nerds" explains why this is so powerful.
So, I read Paul Graham's essay, and the relevant section seems to be
The whole language there
On Mon, 07 Dec 2009 12:07:12 -0500, Laurent PETIT
wrote:
> 2009/12/7 Hugo Duncan
>
>> On Mon, 07 Dec 2009 06:53:38 -0500, Rich Hickey
>> wrote:
>>
>> > Yes, methods are not really functions. Thinking about them as closures
>> > over the object is a good way to go - you can see that analogy in
Hey thanks to everyone who replied to this thread; I appreciate all
the ideas.
I managed to get my version working by closing *in*...but I had to use
my own code to start the repl, because main uses code that calls
System/exit after the repl completes (bad).
It turns out my (our...I didn't do it!
Enhancing the doc tool so that we have versions for the multiple
branches (1.0, 1.1, master, new) is on my agenda.
Maybe there's a way that Rich could add a link to the old 1.0 doc in
the meantime.
I think that the "added in version" metadata tag is a good idea, at
least for clojure itself. Pytho
I second this - since many of the IDE plugins bundle the clojure-1.0
jar, new users trying out Clojure (and IDEs) can't use all the
features listed in the docs, and it's hard to tell which is which.
Maybe we could at least add a 'added in version' to the new method
metadata?
On Dec 9, 4:48 am, Jar
George Jahad writes:
> Every time I stick a println into some Clojure code to debug it, I
> think to myself, "This is Lisp! I should be able to insert a repl
> here!"
>
> The problem is of course that Clojure's eval function doesn't know
> about the surrounding lexical scope. So I started asking
Awesome! I've googled high and low for exactly this functionality in
the past. +1 for getting this into core or contrib if it could work
there. Can you wrap a require to make a whole library debuggable?
(with-lexical-frames (require 'foo.bar))
It would be very handy to have a debug mode wh
I just noticed that the API link on the clojure web site brings up
documentation for the master branch of Clojure instead of 1.0.0. I
can't find the 1.0.0 docs anywhere either.
This is obviously a problem for 1.0.0 users, since the docs refer to
features that don't exist.
I think it would be good
Please also note the existence of (future-call), which takes a no-arg
fn instead of a body,
HTH,
--
Laurent
On 25 nov, 17:21, David Brown wrote:
> On Tue, Nov 24, 2009 at 09:04:38PM -0800, Hong Jiang wrote:
> >Hi all,
>
> >I'm new to Clojure and playing with small programs. Today I wrote a
> >s
49 matches
Mail list logo