Wow! It looks really cool! I was unable to install the Chrome extension
from the site though. I wish you good luck!
суббота, 1 декабря 2012 г., 10:45:24 UTC+7 пользователь Jeremy Kross
написал:
Hi all,
I wrote a little thing in Clojurescript. Hopefully someone here will find
it
+1 for Warren's proposal. I thought about the same thing earlier, but
haven't shared it with community because I believed it'd be rejected.
Though, I don't see how OOP relates to the topic of this discussion.
Records are not objects; they are rather typed maps. Everyone writes that
constructor
I agree with puzzler and Alex.
Also, I have a huge number of literal vectors with expressions inside
(typical example: (let [[x y] coll] ...) is an equvalent to [(coll 0) (coll
1)]).
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this
, Aug 5, 2012 at 3:33 AM, Vinzent ru.vinz...@gmail.com wrote:
Also, I have a huge number of literal vectors with expressions inside
(typical example: (let [[x y] coll] ...) is an equvalent to [(coll 0)
(coll
1)]).
A destructuring vector is not the same thing as is being discussed
here
in this case.
суббота, 28 июля 2012 г., 9:37:57 UTC+6 пользователь George Oliver написал:
On Friday, July 27, 2012 12:06:33 PM UTC-7, Vinzent wrote:
robert-hooke actualy doesn't work with multimethods afaik. You can try my
new library (https://github.com/dnaumov/hooks), but it's alpha (no docs
You can implement the clojure.lang.IPersistentMap interface if you want to
create your own map type.
суббота, 28 июля 2012 г., 8:09:05 UTC+6 пользователь JvJ написал:
Is there a way to extend whatever protocol is used by Clojure maps (struct
maps, array maps, hash maps, etc.)?
--
You
nth is used by the clojure printer (see print-method). Try the following
code: (do (ConsCell. 1 nil) :ok)
It looks like you have to implement Sequential in order to get nth working
on your datasctructure.
суббота, 28 июля 2012 г., 10:33:48 UTC+6 пользователь JvJ написал:
I'm trying to create
robert.hooke works fine with multimethods:
user= (defmulti foo class)
nil
user= (defmethod foo :default [x] (str x))
#MultiFn clojure.lang.MultiFn@7539f0bb
user= (require '[robert.hooke :refer (add-hook)])
nil
user= (add-hook #'foo (fn [f [x]] (str K: (f x
robert-hooke actualy doesn't work with multimethods afaik. You can try my
new library (https://github.com/dnaumov/hooks), but it's alpha (no docs
yet, sorry).
Any suggestions about API is welcome.
пятница, 27 июля 2012 г., 3:15:44 UTC+6 пользователь George Oliver написал:
hi, I'm wondering
Very cool! Thanks for sharing. It's interesting to read such a detailed
report about experience with the language.
Unfortunately, I can't access your site: http://kodefund.com/ gives me The
domain name you have requested isn't available. The idea sounds good
though, and I'll definitely try
?
On Friday, July 27, 2012 2:37:51 PM UTC-5, Vinzent wrote:
Very cool! Thanks for sharing. It's interesting to read such a detailed
report about experience with the language.
Unfortunately, I can't access your site: http://kodefund.com/ gives me
The domain name you have requested isn't
I believe the protocol's analogue for get-method would be enough.
вторник, 3 июля 2012 г., 2:58:49 UTC+6 пользователь Warren Lynn написал:
When I re-read the thread defrecord with inheritance
I fully support Warren's point of view. I'm also unhappy with current
behaviour of sequence functions (more accurate: I think it can be made even
better).
In my mind, protocols (interfaces?) based, polymorphic core functions is
just what we need. Moreover, similar request has been done
Just an idea: predicate dispatch can be combined with protocols into one
thing, eliminating the need for defrecord-like things at all. Low level
types defined with deftype, higher-level abstractions defined with that
dynamic protocols thing. It'd be fun to play with it :)
Don't you think the
Extend on nil, IIndexed and default (I realize that
it's currently impossible in cljs).
воскресенье, 1 июля 2012 г., 18:39:27 UTC+6 пользователь David Nolen
написал:
How do you think the conditionals can be removed?
On Sunday, July 1, 2012, Vinzent wrote:
Just an idea: predicate dispatch
It's better to use ^:private metadata on the symbol naming the var, since
there is also defmacro, defmulti, etc, which not have hyphened versions too.
суббота, 30 июня 2012 г., 17:49:36 UTC+6 пользователь Goldritter написал:
For functions I have a defn macro to create public functions and a
One thing I forgot to mention: it'd be nice to have Marginalia support,
since it can be used not only for annotated source code, but also for
documentation with embedded tests (although, two-column layout doesn't fit
very well for this purpose, but it's another question).
That's true. The
I think versions with `for` is a hell more readable.
I vote for this:
(def cc
(for [i (range 256)]
(.GetColor ctf (/ i 255.0
воскресенье, 24 июня 2012 г., 16:15:14 UTC+6 пользователь Michael Klishin
написал:
Antonio Recio:
And I would know if this is correct conversion in
I guess you should use vectors, since you can't effectively add an element
to the end of list.
понедельник, 25 июня 2012 г., 0:46:24 UTC+6 пользователь Andy C написал:
Hi,
I am looking for two seemingly simple operations which require adding
to the list:
(( 1 2 ) ( 20 30) (40)) 50
It's a great initiative indeed, but I found the project pretty useless in
its current state. Forking the repo and sending a pull request just to add
an example is painful. Also, I can read rendered readme on github (and have
the source code at hand), so why go to another site?
I think what
Our web stack is built on small libraries building on eachother's
strengths, could we do the same here ?
Yeah, that's exactly what I had in mind. Just like Ring, c.j.jdbc could
accept maps and generate corresponding sql code, thus eliminating the need
to write a compiler for each sql DSL.
You're passing one argument, a list contaning 3 elements, instead of 3
arguments. Try this (by the way, you can omit nth call):
(.SetOrigin cone (v 0) (v 2) (v 3))
Another option (not really relevant in this particular case) is to use
memfn:
(apply (memfn SetOrigin) cone [2 4 6])
суббота, 23
Well, yes, you've written it right:
(doto sphere
(.SetColor red)
(.SetPosition 5 5 0))
... or what the question was about?
суббота, 23 июня 2012 г., 19:21:18 UTC+6 пользователь Antonio Recio написал:
I create a white sphere at the beginning of my code, and later, after some
lines of
given java.jdbc's position as the sort of lower level glue all these
libraries are built on, maybe better then including a DSL in java.jdbc
would be including an AST (some data representation of sql) and a
compiler for same.
Yeah, that's exactly what I wanted to suggest too. Seems like
Actually, jsql looks very much like clojureql\korma. Honetly, I wish see
better support for clojureql rather than new similar DSLs coming up.
четверг, 21 июня 2012 г., 11:36:24 UTC+6 пользователь Sean Corfield написал:
Just two changes in this release:
* as-str now treats a.b as two
Why it has to be reader macro? I don't see any reason.
среда, 20 июня 2012 г., 0:56:15 UTC+6 пользователь Jay Fields написал:
I'd actually like to see %(...) become (partial ...), as I think
people associate % with anonymous functions. Which is why I chose (%
...), as it's close to what I
Yeah, I'm waiting for concrete example too.
By the way, if you really need to change :area from value to deferred
computation then you can just change your data structure implementation
from hash-map to lazy map (i.e. a map whose values are delays deref'd on
access). This would require
Never heard of it before, but it seems interesting. Thank you for pointing
to it.
воскресенье, 17 июня 2012 г., 5:51:33 UTC+6 пользователь Christian
Guimaraes написал:
Hi,
Anybody here already used catnip (https://github.com/bodil/catnip) to
do some web developement? I saw this video
Forget about .method thing. It's an interop form and, strictly speaking,
has nothing to do with protocols. The fact that defining record with
protocol implementation inline will create class with corresponding methods
is just an implementation detail.
Protocol functions are just functions; you
You're welcome :)
--
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 - please be patient with your
first post.
To unsubscribe from this group,
Well, if those assertions are violated, you can't do anything with it
anyway - you program is written wrong and you have to release new version
which'll fix it.
воскресенье, 17 июня 2012 г., 1:41:17 UTC+6 пользователь Alex Baranosky
написал:
To test for violations of those assertions,
This still requires changing your code to @(:emails contact). If you use
(emails contact) you need change your code in only one place.
The name emails implies that it's a sequence. Lazy sequence.
Property is just the OO word for function, semantically they are the same.
OO doesn't
A really good clojure specific example of data vs api is the discussion
regarding if the clojurescript analyzer should contain children or if
children should be a multimethod
https://groups.google.com/forum/m/?fromgroups#!topic/clojure-dev/vZLVKmKX0oc
By the way, I have read the whole
Yes it is... emails was not the best example in this case.. think the
area example instead as this is single value rather than collection.
Well, I thought we've already came to the agreement that area is a
(polymorphic) function and it has nothing to do with structure of your
data, no?
Data structure is an implementation detail...
It's not. Not in clojure. It is in OO, but clojure is not an OO language,
so it's not an implementation detail in clojure.
interfaces are contracts, if the data representation changes in OO you
need only change one class...
Well, but if
I still hope we'll get rid of those ugly -Foo constructors some day. Also,
protocols aren't fully implemented yet (no way to get implementation of a
protocol for the given type, no way to resolve confilcts (like
prefer-method), etc)
суббота, 16 июня 2012 г., 13:24:04 UTC+6 пользователь Las
That is my point, representations SHOULD be considered implementation
details, because representations change... if you treat them as contracts
your code will break everywhere, if you wrap them with abstractions your
code will only need to change in one place...
As I mentioned above,
I agree, an explicit type field makes dispatching easy. However this data
structure returned by (http/get ... :as json) so if I want to add type
information I need to walk the tree and rewrite it. Not necessarily a bad
idea, but in some cases the only thing I need is the eTag and so the
I actually think assertions should stay _on_ in production
Why? Could you please elaborate more on it?
--
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
TL;DR: I want to know best practices for designing functions with multiple
optional arguments.
Use destructing:
(defn f [required {:keys [foo bar] :or {foo :default}}]
[required foo bar])
(f 3 :bar 1 :foo 2) ;= [3 2 1]
(f 3 :bar 1) ;= [3 :default 1]
--
You received this
Seems very interesting!
--
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 - please be patient with your
first post.
To unsubscribe from this
I do use pre-conditions where the test condition is simple, ie is this a
string? does the map have a :field-type? however I get a lot of my input
data from http requests as json which have similar structures but different
semantics, so I often do not have preconditions where type is not
Very impressive. Thank you!
--
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 - please be patient with your
first post.
To unsubscribe from this
Actually, it's kinda the same (Fogus and me decided to merge trammel and
clojure-contracts into one library)
воскресенье, 3 июня 2012 г., 6:31:50 UTC+6 пользователь Sean Corfield
написал:
On Sat, Jun 2, 2012 at 5:22 PM, Vinzent ru.vinz...@gmail.com wrote:
BTW, you may want to use clojure
BTW, you may want to use clojure-contracts (
https://github.com/dnaumov/clojure-contracts) instead of asserts or
:pre\:post in order to get much nicer and informative error reporting.
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this
You can reuse methods by putting them in a map and then just merging it
with the new methods:
(extend Employee
AProtocol
(merge default-implementation {:new-function (fn ...)}))
The problem is that you can't reuse methods defined inline, i.e. you can't
say my record implements
It'd be interesting to ressurect clojure-refactoring project and merge it
with kibit-mode.
суббота, 19 мая 2012 г., 0:05:29 UTC+6 пользователь Alex Redinton написал:
Hello friends,
Today I decided to hack together a simple learning tool that mashes
Jonas Enlund's sweet kibit tool
As the logical AND of all of the multiple forms? The OR? Only use the
first expression? Only the last?
It should be AND.
--
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
Just a side note: you'd easily find the problem if you'd use contract
programming facilities of clojure (via pre- and post-conditions, or better
clojure-contracts https://github.com/dnaumov/clojure-contracts (shameless
plug)).
среда, 16 мая 2012 г., 22:34:08 UTC+6 пользователь Jim foo.bar
Or maybe if-let and when-let should support multiple bindings, like the doc
states.
воскресенье, 13 мая 2012 г., 4:55:40 UTC+6 пользователь Borkdude написал:
The docstring of if-let is as follows:
bindings = binding-form test
If test is true, evaluates then with binding-form bound to the
Thank you, I was looking for something exactly like that! I'll give it a
try.
четверг, 19 апреля 2012 г., 7:34:10 UTC+6 пользователь Dmitri написал:
I poked around and noticed that there aren't any libraries for
creating PDFs, and as I needed to make one for work I decided to open
source
So 'false?' doesn't help you here.
It does, actually (see earlier responses for details)
So if anyone runs into this problem _in real world code_ it's because
they are calling a Java API that somehow returns a Java Boolean object
embedded in the result. If you are working with a Java
http://clojuredocs.org/clojure_core/clojure.core/if
It's great, Andy, thank you! I haven't even thought about clojuredocs at
all. Since it still doesn't eliminates the problem completely, I believe
many clojure newcomers will find it incredibly useful.
Stefan Kamphausen
^{:platform :jvm} (load jvm/lib)
^{:platform :python} (load python/lib)
or platform metadata attached to the 'ns' form should be trated as this
whole file is for this platform. This way, in src/py/blah.clj you'd have
^{:platform :python}
(ns blah)
...
(your code)
...
without relying on
But my own programs already use :platform and :version metadata
with completely different semantics. (Well, no, they don't, but it could
be.)
That's not a problem, since the same is true for :doc, :macro, :arglists,
etc, etc. Also, meta on expressions is probably not used so often.
First thing which comes to mind is to use metadata for this purpose.
Something like
(defn ^{:platform :jvm} to-string [x] ...)
This doesn't force the user to create a separate file for each platform
(although it's still possible to do so) and feels very naturally for
clojure.
Another option
Well, changing the behaviour of 'if' is not the only way to fix the problem
(and it's impossible because of backward compatibility anyway). In my mind,
more realistic solution would be:
1. Clearly state in the section on interop that clojure, unlike java,
doesn't treat 'false' and (Boolean.
What we need is even more defined then that, however, Consider this
snippet from core.match:
(ns clojure.core.match
(:refer-clojure :exclude [compile])
(:require [clojure.set :as set])
(:import [java.io Writer]))
how do we use metadata to restrict/include java.io.Writer vs CLR's
I don't think that's too practical. The reader sees the metadata only
after it already started to read the form it should then ignore, if the
platform doesn't match.
As I understand it happens before compilation (lein plugin extracts the
appropriate forms and then compiles it), so it
I understand the points you've described, but as I written earlier the
thing which is really confuses me is that for 2 equal objects, one
considered truthy and the other considered falsey. In terms of clojure, if
2 objects are equal they represents the same value, right? As I've
mentioned
It should be
(ns app.one.a
(:require [app.two.b])
(:import [app.two.b Book]))
i.e. 'app.two.b' instead of 'ns.app.two.b'
пятница, 13 апреля 2012 г., 0:03:49 UTC+6 пользователь Adam Markham написал:
I have two namespaces as follows:
(ns app.one.a
(:require [ns.app.two.b])
Such a feature shouldn't depend on a specific tool, it should be part of
the language.
Yeah, you're right - I haven't thought about the fact that leiningen isn't
available on the platforms other than jvm and js.
Given that reader macros are already used for this purpose extensively in
the
Hello,
I'd like to announce
clojure-contractshttps://github.com/dnaumov/clojure-contracts -
a library for contract programming with emphasis on good error messages.
In short, it allows you to specify pre- and postconditions for an existing
function, and then uses this information to improve
false and true are JVM built-ins.
Yes, but clojure uses this booleans as a basic type, in the same way as it
does for lists and symbols.
You could argue the same way that since (1 2 3) and [1 2 3] are equal,
they represent the same value, and thus you should be able to call
`subvec' on
And even if it was, why shouldn't I be allowed to build my clojure
projects with ant (like clojure itself) or maven?
Well, theoretically you could be able to do so, but yes, the problem is
more fundamental and probably should be solved on a language level rather
than one a tooling's one (of
So I agree: you cannot make it work for each and every JVM language, so
the current simplistic behavior is just fine.
Yeah, but my question about 'if' and equality remains open.
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this
But interop is not the main goal in the design of the language...
It's a nice feature.
That's not true. Clojure is a hosted language. Easy interop with the host
platform is one of the main goals of the language. See
http://clojure.org/jvm_hosted.
They are not the same
I've said same
I'll answer only C, since other letters are either irrelevant or do not
contradict my points.
C) ... By which universal law these two things should be considered equal
?
Um, that's what my complaint is all about, no? I have no idea by which law
these two things are considered equal, and
That's interesting, thanks for your investigation! Then such decision was
clearly made because Java is not the only JVM language, just as Luc said.
For example, JRuby has its own class which wraps false:
http://jruby.org/apidocs/org/jruby/RubyBoolean.False.html
Obviously, it's impossible to
Hello,
First of all, I'm also very interested in increasing support for contract
programming in clojure. In my mind, it's perfectly complements dynamic
nature of clojure by providing that type of in-code documentation which
people coming from statically-typed language often feel lack of. So, I
I fully support Steve Obua in his complains (although, I've never ran into
such issues myself). Also, I believe that most of answers for this topic
are slightly irrelevant; the problem is not java vs. clojure behaviour or
something, the problem is (at least for me) that
(= (Boolean. false)
Another idea is to put :indentation metadata on vars, so user-defined
macros could be indented properly. Currently I have (define-clojure-indent
...) with a number of forms in my emacs config file, and it seems to be
pretty common solution. It'd be nice to replace this hack with an
I'm not sure how I feel about indentation rules
changing depending on whether slime is active or not.
What I was thinking, is that there'd be some function which would collect
and save indentation metadata, so it can be used later. Thus, active slime
connection required only the first time
the same data, so library maintainers only
have to add {:indent :defn} to their defmacros.
суббота, 31 марта 2012 г. 2:32:35 UTC+6 пользователь Phil Hagelberg написал:
Vinzent ru.vinz...@gmail.com writes:
I'm not sure how I feel about indentation rules
changing depending on whether
Counter-example: one could write if-authenticated macro, which will take
fixed number of args, but should be indented as normal if.
суббота, 31 марта 2012 г. 3:07:23 UTC+6 пользователь Cedric Greevey написал:
On Fri, Mar 30, 2012 at 1:26 PM, Vinzent ru.vinz...@gmail.com wrote:
Another idea
Corrected url (without whitespace) is
http://groups.google.com/group/clojure-android
--
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 - please
Hiccup https://github.com/weavejester/hiccup?
--
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 - please be patient with your
first post.
To
Great! Thank you so much for 1.3 support!
--
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 - please be patient with your
first post.
To
BTW, http://www.clojureql.org/ is down, do you know what happened?
--
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 - please be patient with
Good to hear it.
One more thing: Shantanu Kumar have proposed to create a clojureql google
group, and I also think it's a good idea. Would you please create it?
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to
Hello, I'm interested in this kind of thing too. Do you have any progress?
--
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 - please be patient
On 2 авг, 04:47, Brad b...@beaconhill.com wrote:
I wanted to take a Map and convert it to a string suitable for use as
parameters in a URL. I have got it working below two different ways
but wondered if there was a better or more idiomatic way to do this.
;; My test input map
(def input
Hello,
in clojure.core we have assoc and assoc-in, dissoc and dissoc-in (in
the incubator), but there is only update-in, without update.
Implementation might look like this:
(defn update [m kfs]
(let [coll (partition 2 kfs)]
(reduce (fn [m [k f]] (update-in m [k] f))
m coll)))
83 matches
Mail list logo