Re: Mexico City Clojureists?

2020-10-22 Thread Mauricio Aldazosa
On Tue, Oct 20, 2020 at 2:19 PM Scott Klarenbach 
wrote:

> Wondering who is living/working in Mexico City?
>
>
o/  Hey there!

Cheers,
Mauricio

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/CAB-Kg9Z62QY67zHHY6vd-T%2BDQOsRkwBv2pc5_QEKDHAYSk90Fg%40mail.gmail.com.


Re: doall

2018-05-16 Thread Mauricio Aldazosa
Hi Renata,

The problem with your code is that it is using *map* at the top level,
which is a function that returns a lazy sequence. You are asking clojure to
do something like:

*Take each number n in inviteds and create a sequence of hash maps, where
each hash map has n as a key and 1 as it's value.*

But what you really want is a function at the top level that returns a hash
map. As Colin shows, you can use *into* (here is a slightly different way
than the one he used):

*Take each number in inviteds and create a sequence of pairs. Each pair
should have the number as it's first value, and 1 as the second. Then take
those pairs, and "pour" them into a hash map.*

(->> inviteds
 (map (fn [number] (vector number 1)))
 (into {}))

You could also do it via *reduce*:

*Start with an empty hash map, then assoc each number in inviteds with 1 as
it's value*:

(reduce (fn [m number] (assoc m number 1))
{}
inviteds)

Cheers,
Mauricio

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to Programmatically Create Unqualified Keywords?

2018-03-21 Thread Mauricio Aldazosa
On Wed, Mar 21, 2018 at 7:48 AM, Nick Mudge  wrote:

> I see what you mean.  All keywords are namespaced, so there really is no
> such thing as a no-namespaced keyword. Thank you.
>

You can have keywords without a namespace:

user> (clojure-version)
1.9.0
user> (keyword "bar" "foo")
:bar/foo
user> (namespace (keyword "bar" "foo"))
bar
user> (keyword "foo")
:foo
user> (namespace (keyword "foo"))
nil

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Slides for my talk at EuroClojure 2016

2016-10-21 Thread Mauricio Aldazosa
On Fri, Oct 21, 2016 at 3:36 AM, Colin Yates  wrote:

> +1.
>
> Remind my old befuddled brain of the JS library used to produce those
> 3d-like presentations?
>

Looks like reveal.js 

Cheers,
Mauricio

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Guidelines/Recommendations for namespaces and qualified keywords

2016-10-17 Thread Mauricio Aldazosa
On Mon, Oct 17, 2016 at 9:46 PM, James Gatannah 
wrote:

>
>
> On Saturday, October 15, 2016 at 10:17:15 PM UTC-5, Josh Tilles wrote:
>>
>> I’ve got a couple questions for Alex Miller and/or the other Cognitect
>> folks.
>>
>
> That isn't me. I'm just chiming in from the peanut gallery. Must of my
> "experience" so far stems from converting
> my toy projects from prismatic schema to spec.
>
>>
>>1. *Are single-segment namespaces still “bad” when it comes to
>>registering specs under qualified keywords?*
>>In the past, single-segment namespaces have been discouraged in the
>>Clojure community—both because of Java interop concerns and because of the
>>possibility of name-collision when combining projects. However, many of 
>> the
>>spec examples I’ve seen have demonstrated registering specs under keywords
>>qualified by a single-segment namespace. For example, the guide’s
>>section on multi-spec 
>>defines :search/url and :error/message. Is that because
>>namespace-qualifiers of specs shouldn’t be under the same constraints as
>>namespaces used to organize code?
>>
>> This part of the question interests me a lot.
>
> I've found myself defining a lot of specs in, say, the
> com.foo.project.schemas namespace.
>
> This used to be extremely convenient, due to ns aliases.
>
> I think the docs say that I should be able to set up the same kind of
> basic aliasing so that I can
> just refer to those specs as (for example) :c.f.p.s/whatever. But I
> haven't been able to actually
> get that to work yet.
>

You can use the alias to do that, if you have a ns declaration like this:

(ns test.core
  (:require [com.foo.project.schemas :as sch]))

Then you can use the alias to get to the specs in that namespace

::sch/bar => :com.foo.project.schemas/bar

Cheers,
Mauricio

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is there an easy way for s/keys spec to work against both qualified/unqualiffied keys at the same time?

2016-10-17 Thread Mauricio Aldazosa
On Sun, Oct 16, 2016 at 11:40 PM, Ikuru Kanuma  wrote:

> Mauricio, thanks for the response!
> I agree that that gets what I asked for done, but that solution is in
> essence writing the same
> qualified/unqualified version of the spec twice and sounded redundant,
> which lead to my question.
> I guess it is what it is in that case...
>

Oh I see, maybe the reduncancy can be removed by creating a macro.
Something like:

(defmacro qualified-or-unqualified
  [k & specs]
  `(s/def ~k
 (s/or :qualified (s/keys :req ~specs)
   :unqualified (s/keys :req-un ~specs

And then defining the new specs would be something like:

(qualified-or-unqualified ::map-with-numbers ::some-number)
(s/valid? ::map-with-numbers {::some-number 3}) => true
(s/valid? ::map-with-numbers {:some-number 3})  => true

I'm sure the proposed macro is by no means complete, but I hope it points
you to one possible solution.

Cheers,
Mauricio

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is there an easy way for s/keys spec to work against both qualified/unqualiffied keys at the same time?

2016-10-14 Thread Mauricio Aldazosa
Hi,

You can achieve that using *spec/or*:

(s/def ::map-with-numbers
  (s/or :qualified ::map-with-numbers1
:unqualified ::map-with-numbers2))

(s/valid? ::map-with-numbers {::some-number 3}) => true
(s/valid? ::map-with-numbers {:some-number 3}) => true
​
Cheers,
Mauricio

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: cider-nrepl not installed (emacs24)

2015-09-19 Thread Mauricio Aldazosa
Hi,

cider-nrepl is some middleware that sits outside emacs. You can use it via
leiningen or boot. Take a look at the instructions here:
https://github.com/clojure-emacs/cider#cider-nrepl-middleware

Happy hacking,
Mauricio

​

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: a simple question about Arrays.asList

2015-05-21 Thread Mauricio Aldazosa
There are many things that need to be understood in a call like this.

First of all, that method receives an array as its argument:
https://docs.oracle.com/javase/7/docs/api/java/util/Arrays.html#asList(T...)

From your first example I think you are trying to translate to clojure the
following java call:

java.util.Arrays.asList(1, 2, 3);

In java this is a varargs call, which means java will change the call to
one using an array as the parameter
(http://docs.oracle.com/javase/8/docs/technotes/guides/language/varargs.html).

So, in order to make that call we need to wrap those arguments in an array.
The easiest way to do this would be to wrap the arguments in a vector an
turn that into an array:

user (java.util.Arrays/asList (into-array [1 2 3]))
[1 2 3]

If you don't already have a sequence (the vector in the previous example)
then you can use a function to do the work:

user (defn as-list [ args] (java.util.Arrays/asList (into-array args)))
 #'user/as-list
user (as-list 1 2 3)
[1 2 3]
user (type (as-list 1 2 3))
java.util.Arrays$ArrayList


Cheers,
Mauricio

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: What is happening in this code?

2014-08-27 Thread Mauricio Aldazosa
You can use a linter to find out this cases:
https://github.com/jonase/eastwood#redefd-vars---redefinitions-of-the-same-name-in-the-same-namespace
​
Cheers,
Mauricio

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: When to prefer keywords as functions?

2014-07-03 Thread Mauricio Aldazosa
Keywords can be used as a function with a map, so the keyword will search
for itself in the map. Take a look at
http://clojure.org/data_structures#Data%20Structures-Keywords

In the case of the ns form, as James pointed out, what is happening is
not a function call. ns is a macro and as such that form will be
transformed before actual evaluation occurs. If you want, you can see the
actual call that will be made when evaluating ns, you can do so by
expanding the macro with:

(macroexpand-1 '(ns org.currylogic.damages.http.expenses
  (:require [clojure.data.json :as json-lib]
[clojure.xml :as xml-core])))

Be aware though that the resulting form may be a little daunting :-)
​

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to add elements to a vector that is the value of a map key?

2014-06-17 Thread Mauricio Aldazosa
For updating the value of a map given a key you can use update-in:

user (update-in {1 [11]} [1] conj 22)
{1 [11 22]}

Now, to handle the case when the key is not present, you can use fnil:

user (update-in {} [1] (fnil conj []) 22)
{1 [22]}
​
Cheers,
Mauricio

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: lein2 - lein version fails due to org.apache.http.impl.client.DefaultRequestDirector

2014-03-31 Thread Mauricio Aldazosa
Yep, there seems to be something wrong with clojars. If you already have
all the dependencies you need, running lein with the -o flag might solve
the issue.

Mauricio

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: updating the last member

2014-03-27 Thread Mauricio Aldazosa
Try something like this:

(let [xs [1 2 3]]
(conj (pop xs) 4))

Cheers,
Mauricio

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: split maps contained in a file

2014-03-27 Thread Mauricio Aldazosa
Slurp returns one big string, in this case (assuming you have one map for
each line) you can use line-seq:

user (with-open [rdr (clojure.java.io/reader file-with-maps)]
(doall
 (map read-string (line-seq rdr

({:a 1, :b 2} {:c 3, :d 4})

Cheers,
Mauricio

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Clojure/West 2014 Videos

2014-03-25 Thread Mauricio Aldazosa
Wow, that was fast!

Thanks for al the effort,
Mauricio

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Problems getting function metadata

2014-03-14 Thread Mauricio Aldazosa
With your first example you obtain the metadata of the var (that's the
place where defn stores the
metadatahttp://clojure.github.io/clojure/clojure.core-api.html#clojure.core/defn).
In the second one, take a look at the value that is stored in the map:

user (:function fun-map)
#user$my_fun user$my_fun@2d8e9b8e

Thats the function, not the var. You can ask it for its metadata, but it
will be nil:

user (meta (:function fun-map))
nil

--
Mauricio

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: range-sum

2014-02-13 Thread Mauricio Aldazosa
My guess is that when using a rest-param a call to next is involved thus
realizing two elements of the sequence. A call to rest only realizes the
first element:

user (defn f [x] (println x) x)
#'user/f
user (defn s [n] (lazy-seq (cons (f n) (s (inc n)
#'user/s
user (def t (rest (s 0)))
0
#'user/t
user (def u (next (s 0)))
0
1
#'user/u

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: When should I use non-blocking ! / threads and blocking !! / goroutines with clojure core.async

2014-01-30 Thread Mauricio Aldazosa
On Thu, Jan 30, 2014 at 12:48 PM, Jozef Wagner jozef.wag...@gmail.comwrote:


 go blocks, together with !, !, alt!, etc... do not create any new
 threads and are not run in separate thread. There is no thread pool for go
 blocks.


I thought that go blocks do run in a thread pool of size 42 + (2 * Num of
processors). In the definition of the go macro there is a
dispatch/runhttps://github.com/clojure/core.async/blob/master/src/main/clojure/clojure/core/async.clj#L369whose
docstringhttps://github.com/clojure/core.async/blob/master/src/main/clojure/clojure/core/async/impl/dispatch.clj#L19says
it uses a thread pool.

Am I misunderstanding something?

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: MyType cannot be cast to MyType?

2014-01-22 Thread Mauricio Aldazosa
Take a look at Stuart's tools.namespace (
https://github.com/clojure/tools.namespace), although be wary of the
protocol issue as it is something that is pointed out in the warnings
section of that project.

Mauricio

-- 
-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: A question about lazy seq with io

2014-01-13 Thread Mauricio Aldazosa
On Mon, Jan 13, 2014 at 8:49 AM, Kashyap CK ckkash...@gmail.com wrote:


 I'd really appreciate it if someone could tell me what's going on when I
 do the following -

 user (defn xx [] (map println [1 2 3 4 5 6]))
 #'user/xx
 user (take 2 (xx))
 (1
 2
 3
 4
 5
 6
 nil nil)
 user


There are many things that you need to be aware of here:

   1. Lazy seqs are chunked. As an optimization they are realized 32
   elementes at a time. There are ways to go around this:
   http://blog.fogus.me/2010/01/22/de-chunkifying-sequences-in-clojure/
   2. map returns a lazy seq of the return value of the function it uses,
   and println returns nil as a result.
   3. Lazy seqs and IO usually are a confusing mix.

So, as a result of chunking a println for all six elements is made. Each of
this calls, as a side effect prints the number and, returns nil. Then you
ask for the first two return values of that sequence, hence the nil nil.
Everything is getting mixed up at the repl so it seems confusing, but the
result of xx is (nil nil) and the side-effect of it is the printing of 1 2
3 4 5 6.
Cheers,
Mauricio

-- 
-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Why isn't a docstring allowed for defrecord?

2013-10-31 Thread Mauricio Aldazosa
On Thu, Oct 31, 2013 at 9:15 AM, Mars0i marsh...@logical.net wrote:

 Excellent.  Thanks Tassilo.  I had attempted to do the same sort of thing
 using
 Point.
 rather than
 -Point
 which didn't work:
 user = (doc Point.)
 nil
 user= Point.
 CompilerException java.lang.ClassNotFoundException: Point.,
 compiling:(NO_SOURCE_PATH:0:0)
 user= -Point
 #user$eval254$__GT_Point__269 user$eval254$__GT_Point__269@3c90fa05

 I had assumed that Point. and -Point were the same thing, but they are
 apparently not.  -Point names something real, while Point. is just some
 kind of magic, I guess.


The thing to remember here is that by defining a record you are creating a
new Java class. As a convenience a factory function (Point-) is created
for you, but you can always create instances of your record via the
constructor (Point.). Point. is a macro that expands to (new Point).

Take a look at http://clojure.org/datatypes for an introduction of what is
going on when you use defrecord and
http://clojure.org/java_interop#Java%20Interop-The%20Dot%20special%20form-(new%20Classname%20args*)for
the constructor documentation.

Mauricio

-- 
-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: What role does a semicolon play in this case?

2013-03-04 Thread Mauricio Aldazosa
I'm assuming you are talking about the colon :, it means that you are
working with a keyword:
http://clojure.org/data_structures#Data%20Structures-Keywords

-- 
-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Create map from vector of keywords and other items

2013-02-20 Thread Mauricio Aldazosa
Don't know if it's better, but:

(apply hash-map (map-indexed #(if (= 0 (mod %1 2)) (first %2) (vec %2))
  (partition-by keyword? [:key1 1 2 3 :key2 4
:key3 5 6 7])))

Seems to work.

Mauricio

-- 
-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Clojure turns 5

2012-10-18 Thread Mauricio Aldazosa
Congrats!

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Bug: incorrect stack trace for function names containing -

2012-10-09 Thread Mauricio Aldazosa
Hi there.

According to the reader documentation (http://clojure.org/reader), it seems
that '' is not a valid character for a symbol name:

Symbols begin with a non-numeric character and can contain alphanumeric
characters and *, +, !, -, _, and ? (other characters will be allowed
eventually, but not all macro characters have been determined)

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en