On Mar 20, 10:48 pm, blais wrote:
> really valuable, because it is unlikely to break between versions, and
> it's already good enough for a lot of users via stdin/stdout pipes
> (i.e., inferior lisp).
Like being able to just telnet to a running VM and type "(+ 2 2)" and
see "4" printed on stdout.
On Mar 20, 12:16 pm, Chas Emerick wrote:
> Martin,
>
> Thank you for the pushback. :-)
I'm not pushing back, I'm really just trying to understand...
> On Mar 19, 2011, at 8:30 PM, Martin Blais wrote:
> > I think this is wrong, because every single IDE client
> > will have to adapt itself to
No worries, always a pleasure :)
On 21/03/2011, at 12:43 PM, Brett Morgan wrote:
> Ahh, got it. Thank you Andreas.
>
> On Sun, Mar 20, 2011 at 6:55 PM, Andreas Kostler
> wrote:
> Hi Brett,
> A :while clause continues the evaluation ONLY while it's expression is true
>
> (for [x (range 10) y (r
Ahh, got it. Thank you Andreas.
On Sun, Mar 20, 2011 at 6:55 PM, Andreas Kostler <
andreas.koestler.le...@gmail.com> wrote:
> Hi Brett,
> A :while clause continues the evaluation ONLY while it's expression is true
>
> (for [x (range 10) y (range 10) :while (< x y)] [x y]) will terminate as
> soon
Hi Brett,
A :while clause continues the evaluation ONLY while it's expression is true
(for [x (range 10) y (range 10) :while (< x y)] [x y]) will terminate as soon
as (< x y) is false. Since (< 0 0) is the first expr to evaluate, evaluation
stops right there.
What you want is
(for [x (range 10
Hey all,
I'm not understanding why the following examples don't line up. In my mind
they should be identical. What am i not getting?
(user=> (filter (fn [[x y]] (< x y)) (for [x (range 10) y (range 10)] [x
y]))
([0 1] [0 2] [0 3] [0 4] [0 5] [0 6] [0 7] [0 8] [0 9] [1 2] [1 3] [1 4] [1
5] [1 6] [
On 21 March 2011 00:18, Chas Emerick wrote:
> In any case, my objective with nREPL was to get something working well that
> had what I thought were the right semantics for the use cases I was concerned
> with (i.e. point-to-point Clojure tooling backends). Lifting those semantics
> onto other
The number indicates the number of entries in the following message; and yes,
you're right that a sentinel would have been sufficient to terminate each
message, though I wasn't attempting to follow in other protocols' footsteps.
I'm sure the protocol is lacking in a variety of ways; as I said,
On Mar 20, 2011, at 12:47 PM, Kevin Downey wrote:
> I am no python programmer, but if you look at
> http://docs.python.org/library/socket.html you see it passes in the
> number of bytes you wish to receive on a call to the receiv method on
> a socket. With that in mind parsing nrepl messages becom
Hi,
Depending on your level of Lisp expertise, I'd suggest digging into Clojure
frameworks like Ring or Compojure.
You might find the books on Clojure interesting ("Practical Clojure",
"Programming Clojure", "The Joy of Clojure", "Clojure in Action").
The latter two are work in progress (however,
Hi,
Am 20.03.2011 um 22:41 schrieb Tassilo Horn:
> Oh, yes. That was the exact issue. But clearly forcing realization is
> not a good solution. Is there some better way to do what I want?
> Maybe my macro should expand to something like that?
>
> ((fn [] (binding [...as before...] body)))
S
Hi,
I would like to learn Clojure from a practical project approach. Where can I
find resources?
Thanks.
--
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 memb
Well, get-with-exception attempts to model a restriction on a relation (e.g.
select in sql) so I believe a missing key indeed indicates an error.
On 21/03/2011, at 9:25 AM, Daniel Werner wrote:
> On 20 March 2011 22:02, Andreas Kostler
> wrote:
>> Would that be flow control though? I see this e
On 20 March 2011 22:02, Andreas Kostler
wrote:
> Would that be flow control though? I see this exception as a rather
> exceptional circumstance for this application...
If a missing key signifies an error, then yes, it should probably
throw an exception. It seems reading your code wrongly reminde
On Sun, Mar 20, 2011 at 5:41 PM, Tassilo Horn wrote:
> Ken Wesson writes:
>
> Hi Ken,
>
Does the resolving function run on, or use, another thread?
>>>
>>> No, it runs in the same thread. But some functions like `vseq' in
>>> the example produce LazySeqs. So if LazySeq-realization computat
Ken Wesson writes:
Hi Ken,
>>> Does the resolving function run on, or use, another thread?
>>
>> No, it runs in the same thread. But some functions like `vseq' in
>> the example produce LazySeqs. So if LazySeq-realization computations
>> are run in a different thread by default, that would exp
My objection has nothing to do with string vs. byte.
Messages used in wire protocols exist on a continuum between fixed
width and variable width. The happy medium there, which almost all
protocols follow is a fixed width header that also provides the bye
count of the following variable width body.
On Sun, Mar 20, 2011 at 5:17 PM, Tassilo Horn wrote:
> Ken Wesson writes:
>
>>> the println prints {Locality localities.Locality}, which is correct.
>>> However, my resolving function errors because there is no class
>>> Locality. In the error message, I also print the value of
>>> *schema-impor
Ken Wesson writes:
>> the println prints {Locality localities.Locality}, which is correct.
>> However, my resolving function errors because there is no class
>> Locality. In the error message, I also print the value of
>> *schema-imports*, and in fact, it is {}.
>
> Does the resolving function r
>> Do you have any resources or books that help with such things? (Taking
>> a problem and solving it the way you did)
>
> I think, my suggestions are not specific to clojure, but they apply to
> any functional language. All of them have functions for filtering
> sequences, applying a function t
Would that be flow control though? I see this exception as a rather exceptional
circumstance for this application...
On 20/03/2011, at 10:53 PM, Daniel Werner wrote:
> On Mar 20, 10:50 am, Andreas Kostler
> wrote:
>> I would like to throw an exception when I'm trying to retrieve a value in a
>>
On Sun, Mar 20, 2011 at 4:16 PM, Tassilo Horn wrote:
> the println prints {Locality localities.Locality}, which is correct.
> However, my resolving function errors because there is no class
> Locality. In the error message, I also print the value of
> *schema-imports*, and in fact, it is {}.
Doe
Hi all,
I have a problem with a var that I want to be dynamically scoped. In my
DSL, I state types using symbols like 'localities.Locality, and at some
point some function resolves these types in some Java lib.
For convenience, I wanted to add a macro that binds simple names to
qualified names,
Yes, as a heavy Emacs/SLIME user who does not work with Common Lisp any
more, I'd rather have a Clojure-specific Emacs environment, especially
something that can do more introspection of the JVM, e.g., look up JavaDocs
and examine classes through reflection.
In my not-terribly-well-informed opi
Christian writes:
Hi Christian,
> I would like to thank you for this suggestion and the way you
> translated the problem statement into code!
Thanks for the compliment. :-)
> Do you have any resources or books that help with such things? (Taking
> a problem and solving it the way you did)
I t
Hi
On 20 March 2011 17:47, Christian wrote:
> Hello Tassilo!
>
> I've tested your code and looked at the Clojure Documentation for
> 'for'. Given that, I have written
>
> (reduce +(filter even? (for [fib (fib-seq) :while (< fib 400)]
> fib)))
Or using Daniel's suggestion:
(reduce + (filter
I am no python programmer, but if you look at
http://docs.python.org/library/socket.html you see it passes in the
number of bytes you wish to receive on a call to the receiv method on
a socket. With that in mind parsing nrepl messages becomes a huge
pain. At no time when parsing a nrepl message do
On Mar 20, 2011, at 3:13 AM, Kevin Downey wrote:
> nrepl's protocol is also very line reader centric, which is a drag,
> and the "integer" that prefixes messages is really just a variable
> length string and is not useful for allocating buffers to receive data
> in a client because it is a lines
Hi,
Please bump up my JIRA membership level to make edits and I will fix
this bug.
I have an account named Takahiro Hozumi on dev.clojure.org already.
CA is also already sent.
Thanks.
On 3月11日, 午後10:55, Stuart Sierra wrote:
> > (require '[clojure.string :as str])
> > (str/replace-first "abc def"
Martin,
Thank you for the pushback. :-)
On Mar 19, 2011, at 8:30 PM, Martin Blais wrote:
> Hi,
>
> After Rich's suggestion at the recent NYC meetup, I had a
> detailed look at inferior-lisp vs. Slime, and nREPL, read
> Chas' document, wrote a bit of code, tried to figure out the
> issues for m
Hello Tassilo!
I've tested your code and looked at the Clojure Documentation for
'for'. Given that, I have written
(reduce +(filter even? (for [fib (fib-seq) :while (< fib 400)]
fib)))
This gives me the error 'clojure.lang.LazySeq cannot be cast to
clojure.lang.IFn'.
I think this is because
On Mar 20, 10:22 am, Christian wrote:
> valued fibonacci terms under four million. (I did not know how to
> specify a predicate depending on the value of (fib-seq) to check if
> the value is under 4 million.)
For this there is #'take-while:
(take-while #(< % 400) ...)
Daniel
--
You receiv
Thanks for the latest changes, Saul. Your implementation is a little
different from mine:
(defn bind-connection
"Change the identity of an existing connection."
[connection bind-dn password]
(let [bind-result (.bind connection (bind-request {:bind-dn bind-
dn :password password}))]
(if (
On Mar 20, 10:50 am, Andreas Kostler
wrote:
> I would like to throw an exception when I'm trying to retrieve a value in a
> map for a key that doesn't exist.
Another concise solution (thanks, Conj Labs):
(defn get-or-exc [map key]
(if-let [[_ v] (find map key)]
v
(throw (Excepti
Maybe something along these lines:
(def ^{:private true} EMPTY (reify))
(defn get-with-empty-check [map key]
(get map key EMPTY))
(defn key-exists? [value]
(not= EMPTY value))
=> (def res (get-with-empty-check {:asdf 1} :ss))
EMPTY
=> (key-exists? res)
false
The basic idea being that it's
Hi Ambrose,
No java interop. I do a selection based on map keys. Suppose I have a set of
maps:
(def rel #{{:a "a" :b "b"}{:a "c" :b "d"}{:a "e" :b "f"}})
And I do a select-like query
(select rel [[:a :eq "a"]])
=> #{{:a "a" :b "b"}}
Now, I want to distinguish between a value that doesn't match an
This is slower but is a bit clearer.
(defn get-with-exception [map key]
(if (contains? map key)
(get map key)
(throw (Exception. "oops"
Curious, why do you want to do this? Are you working with Java interop?
Ambrose
On Sun, Mar 20, 2011 at 5:50 PM, Andreas Kostler <
andreas.koestl
On 20/03/2011, at 8:25 PM, Christian wrote:
> Hello Andreas!
>
> Thanks for your swift reply. I'll try to explain the reasoning behind
> my code.
>
> In the Clojure Reference I found the function into, which is described
> like so:
>
> Usage: (into to from)
> "Returns a new coll consisting of
On Mar 16, 9:30 am, Ray Miller wrote:
> On 15 March 2011 08:46, Saul Hazledine wrote:
>
> > On Mar 15, 1:30 am, Paul Dorman wrote:
> > One thought though is that it may be quicker simply do a lookup on the
> > directory server, obtain the password and then do a compare. In
> > OpenLDAP, posixUse
Hello Andreas!
Thanks for your swift reply. I'll try to explain the reasoning behind
my code.
In the Clojure Reference I found the function into, which is described
like so:
Usage: (into to from)
"Returns a new coll consisting of to-coll with all of the items of
from-coll conjoined."
I'm curren
Christian writes:
Hi Christian,
> For those unfamiliar, Project Euler Problem 2 states:
> find the sum of all
Sounds like (reduce + ...).
> even-valued fibonacci terms
Sounds like (filter even? ...)
> that are less than four million.
Hm, that's a bit more challenging. I think, you could go
Hi all,
I would like to throw an exception when I'm trying to retrieve a value in a map
for a key that doesn't exist.
The obvious first shot was:
(get {:foo "bar"} :foo (throw (new Exception "Oh no!")))
However, this doesn't work because the exception always throws since get
apparently eagerly e
Hi Christian,
What you're trying to do is to build up a vector with the last element of the
vector being the answer to your problem:
(last answer)
=> 4613732
You're trying to use cons (conj) to build up that list.
Now, your function below never terminates because you're:
a) Not actually buildin
I've tried Project Euler 2 now.
For those unfamiliar, Project Euler Problem 2 states: find the sum of
all even-valued fibonacci terms that are less than four million.
Let's assume that I have the code to fill the vector:
(def fib-seq
((fn rfib [a b]
(lazy-seq (cons a (rfib b (+ a b)
nrepl's protocol is also very line reader centric, which is a drag,
and the "integer" that prefixes messages is really just a variable
length string and is not useful for allocating buffers to receive data
in a client because it is a lines / 2 instead of a byte count. this
makes writing a client th
On Mar 19, 7:30 pm, Martin Blais wrote:
> (*) Please note: I am aware that only Emacs supports the
> Swank protocol right now but I don't see why other IDEs
> couldn't support it too--it's just made up of LISP forms
> after all; in other words, if someone wants to replace
> the
46 matches
Mail list logo