Pretty sure it's just a typo / bug. I think it should read:
{servlet ::servlet
type ::type
:or {type :jetty}
:as service-map}
On Tue, Mar 19, 2013 at 10:09 PM, Matching Socks wrote:
> I'm puzzled by two :or syntaxes that are used in io.pedestal.service.http,
> from [io.pedestal/pe
I'm puzzled by two :or syntaxes that are used in io.pedestal.service.http,
from [io.pedestal/pedestal.service "0.1.1-SNAPSHOT"], which is where
following along with the Getting Started got me.
In one place, it pairs :or with a map whose keys are symbols being bound in
the outer form:
{routes
One argument against using exceptions for commonplace occurrences (like
invalid user input) is that the structure of the code may make it difficult
to see where those things can pop up, which can lead to misunderstanding
and introduction of bugs.
Even with Java's checked exceptions, where a certai
That should have been "why is 1 preferable over 2"...
On Wednesday, 20 March 2013 12:24:12 UTC+11, Dave Sann wrote:
>
> I am interested in this view that exceptions are an anti pattern. I have
> heard it voiced before.
>
> I am not sure that I understand why.
>
> As I see it you have a choices:
I am interested in this view that exceptions are an anti pattern. I have
heard it voiced before.
I am not sure that I understand why.
As I see it you have a choices:
1. Handle in the result - and test this result repeatedly all the way back
to the caller
2. Handle "out of band" - Throw an exc
I am interested in this view that exceptions are an anti pattern. I have
heard it voiced before.
I am not sure that I understand why.
As I see it you have a choices:
1. Handle in the result - and test this result repeatedly all the way back
to the caller
2. Handle "out of band" - Throw an exc
On Tue, Mar 19, 2013 at 3:02 PM, John D. Hume wrote:
> It looks like you're missing (ns ...) forms at the top of each file.
> That tutorial doesn't show them, but lein would have generated them
> for you when it generated the project. The key element is that your
> test file should have a (:use cl
Hi I don't have much time to write a comprehensive answer, but if you want
to follow the control via exceptions route, there's nothing preventing you
from doing so.
You can (throw (ex-info msg map)), and then write a ring middle ware to
handle exceptions globally, for instance.
HTH,
Laurent
Hi a
I'd argue that using exceptions for control flow is something of an
anti-pattern, even in Java.
In this case a better mechanism might be to use polymorphism. For instance:
(defprotocol Validatable
(validation-errors [x] "Return the validation errors for x."))
(defn valid? [x]
(empty? (valida
>
>
> I have made experiments with compiling ClojureScript to .NET code using
the Microsoft.JScript JavaScript compiler and for a Hello World application
it had a few hiccups in relation to compiling the Google closure-library
(the use of future reserved keywords like "require" and "namespace"
It looks like you're missing (ns ...) forms at the top of each file.
That tutorial doesn't show them, but lein would have generated them
for you when it generated the project. The key element is that your
test file should have a (:use clojure.test) in the (ns) form, which is
what allows you to use
That's hilarious :)
As I said, there's usually not much need to increase stack sizes..
On Tuesday, March 19, 2013 4:09:37 PM UTC+1, larry google groups wrote:
>
> Ah, I figured out at least part of what was happening. I have a web app,
> with Ring and Jetty and Compojure, and I have a form where
I'm going through clojure & emacs tutorial from clojure-doc.org, and
when compiling
the test as suggested, i get following output in emacs nrepl:
clojure.lang.Compiler$CompilerException:
java.lang.RuntimeException: Unable to resolve symbol: deftest in this
context, compiling:(/home/jakov/
nice one...when thinking like there is literally no confusion.
thank you thank you thank you :)
Jim
On 19/03/13 20:05, Marko Topolnik wrote:
Think of it in layers, like this---layer 1:
{w :weigths, u :uni-probs, b :bi-probs, t :tri-probs}
Then, instead of an atomic w, recursively subst
Think of it in layers, like this---layer 1:
{w :weigths, u :uni-probs, b :bi-probs, t :tri-probs}
Then, instead of an atomic w, recursively substitute another destructuring
form, which will destructure the value of that w (which is also a map).
This form is {:keys [w1 w2 w3]}. That gives you co
On 19/03/13 19:49, Marko Topolnik wrote:
{{:keys [w1 w2 w3]} :weights}
awsome!...the full thing actually is {{:keys [w1 w2 w3]} :weights u
:uni-probs b :bi-probs t :tri-probs}
I always get confused when the order changes like that...thanks for
unblocking me Marko :)
Jim
--
--
You receiv
On Tuesday, March 19, 2013 8:39:26 PM UTC+1, Jim foo.bar wrote:
>
> Hello all,
>
> can anyone help me destructure the following map in order to access
> directly w1 w2 & w3 ? I've been trying for 20 minutes now! (how useless
> am I? :( )
>
> {:weights {:w1 0.2 :w2 0.3 :w3 0.5}
> :uni-probs
Hello all,
can anyone help me destructure the following map in order to access
directly w1 w2 & w3 ? I've been trying for 20 minutes now! (how useless
am I? :( )
{:weights {:w1 0.2 :w2 0.3 :w3 0.5}
:uni-probs {...} :bi-probs {...} :tri-probs {...}}
thanks,
Jim
--
--
You received this mes
Since there seems to be interest in the exact mechanics:
For every special form there exists a subclass of Expr in the clojure
compiler, which represents the special form in the analysis result. Every
such class directly implements the behavior of the special form in terms of
compiler infrastructu
Hi all,
Coming from a Java background, I am having a hard time understanding how
validation error propagation should work in clojure web APIs.
To be clear, this is similar to how my Java web service would be setup:
/** Method that validates the model, accesses the DB. If something went
wrong,
Ummm... Jean, I don't understand.
Recapitulation. As Herwig showed, the symbol has its metadata WITHOUT
evaluation:
user=> (meta (second (read-string "(def ^{:key (+ 1 1)} foo)")))
{:key (+ 1 1)}
"second", in the above expression, retrieves the symbol "foo", and reader
already set its metadata W
On Mar 19, 2013, at 7:19 AM, Murtaza Husain
wrote:
> Brain I would also like to use it to test my cljs code, is that possible ?
If https://github.com/clojure/clojurescript/wiki/Differences-from-Clojure is up
to date, it would be moderately hard and tedious to port Midje to
Clojurescript.
D
On Mar 19, 2013, at 8:47 AM, Murtaza Husain
wrote:
> I am having trouble using midje repl-tools. I am using the facts intermingled
> in my source code.
Can you give a transcript of the failure? I can't reproduce the problem. I have
a project with this source:
> (ns scratch.core
> (:use scr
I've pushed to Clojars the release 0.6.1 of Kern, a text-parsing library,
with some fixes and enhancements.
https://github.com/blancas/kern
There's updated Codox API docs and a change log.
Documentation and samples: https://github.com/blancas/kern/wiki
For feedback, bug reports,
etc.: https://
On Tuesday, March 19, 2013 11:49:45 AM UTC+1, ajlopez wrote:
>
> Thanks Jean!
>
> Yes, I did that test before my email.
>
> But my doubt is:
>
> What part is in charge of metadata evaluation?
>
As Herwig commented: The part which evaluates metadata is without doubt the
lisp evaluator's work, th
Ah, I figured out at least part of what was happening. I have a web app,
with Ring and Jetty and Compojure, and I have a form where people can
upload images. The Ring has middleware that lets the uploaded images appear
as a map with a pointer to a File:
{:size 3874, :tempfile #,
:content-type
Hi,
I am having trouble using midje repl-tools. I am using the facts
intermingled in my source code.
In my source file abc/core.clj file, I have included (:use [midje.sweet]).
After I start my repl, when I type this - (use 'midje.repl), I get the
following error -
IllegalStateException => a
I remember finding out about it a few months ago.
I don't know whether or not there is a jira ticket for it, I'll check out.
If nobody can get a patch for this, I'll try and see if I can work out one
in the next days
Il giorno 19/mar/2013 09.02, "Mark Engelberg" ha
scritto:
> On Tue, Mar 19, 201
Brian thanks for the effort, its a wonderful framework !
Brain I would also like to use it to test my cljs code, is that possible ?
On Tuesday, March 19, 2013 8:22:12 AM UTC+5:30, Evan Mezeske wrote:
>
> Thanks for your continued work on this, Brian. I can't wait to upgrade!
>
> On Monday, Mar
So, is that a bug in ClojureScript?
> Does anybody have an idea for a workaround (I have little experience with
> all of this, including classloaders)?
>
>
> Stacktrace:
> 23:06:01,247 ERROR [stderr] (http-/127.0.0.1:8080-1) Exception:
> java.lang.IllegalArgumentException: No matching method fo
The evaluation of meta data happens when the def form is evaluated:
user=> (meta (second (read-string "(def ^{:key (+ 1 1)} foo)")))
{:key (+ 1 1)}
vis a vis
user=> (meta (eval (read-string "(def ^{:key (+ 1 1)} foo)")))
{:ns #, :name foo, :file "NO_SOURCE_PATH", :line 1, :key 2}
The reader doe
On Tuesday, March 19, 2013 9:49:09 AM UTC+1, ajlopez wrote:
>
> Hi everyone!
Hi!
The easiest thing to find out of this would be to check it out:
(def ^{:a (+ 1 1)} two 2)
;=> user/two
(meta #'two)
;=> { :a 2}
So indeed, the forms within metadata is evaluated.
-- Jean Niklas L'orange
On Tue, Mar 19, 2013 at 12:57 AM, Bronsa wrote:
> If I remember correctly, this is a bug due to the fact that constant empty
> literals are handled in a special way from the compiler.
>
>
Interesting. I see you are correct that the problem only occurs on
metadata attached to an empty literal. S
Indeed:
(def ecr (with-meta [1] {:amazing true}))
(def ^:const c ecr)
(meta ecr) -> {:amazing true}
(meta c) -> {:amazing true}
On Tuesday, March 19, 2013 8:57:28 AM UTC+1, Nicola Mometto wrote:
>
> If I remember correctly, this is a bug due to the fact that constant empty
> literals are handle
--On 18 mars 2013 19:32:57 + "Jim - FooBar();"
wrote:
I just hit this and I thought I'd share... 2 min ago I specified
clojure-contrib 1.2.0 as a dependency only to use 2 functions from the
probabilities namespace. However that namepsace depends on the
contrib.monads namespace which immedi
If I remember correctly, this is a bug due to the fact that constant empty
literals are handled in a special way from the compiler.
Il giorno 19/mar/2013 08.49, "Marko Topolnik" ha
scritto:
> The way speed is achieved for :const is that it is given the same
>> treatment as Java's *compile-time co
>
> The way speed is achieved for :const is that it is given the same
> treatment as Java's *compile-time constants*, so you're not even touching
> the var when you refer to it by name. Now, *meta* could be accepted as a
> special case, explicitly detected by the compiler, but that mechanism wo
On Tuesday, March 19, 2013 4:41:33 AM UTC+1, puzzler wrote:
> On Mon, Mar 18, 2013 at 8:31 PM, Kemar >wrote:
>
>> Explicitly derefing the var and calling meta on it works:
>>
>> (meta @#'c) -> {:amazing true}
>>
>> No idea as to why though...
>>
>
> Quirky. I assume that explicitly derefing the v
38 matches
Mail list logo