Re: No :out in my nREPL responses

2017-03-18 Thread Colin Fleming
Sure, but it might be worth trying the bare nREPL option in Cursive to rule
out something that lein could be doing.

On 18 March 2017 at 21:44, Terje Dahl  wrote:

> Hey, Collin.
>
> By "standard" REPL I mean "clojure.main REPL in JVM" - which worked fine.
> I don't think my issue has anything to do with Cursive's way of connecting
> to nREPL, but rather with nREPL itself, seeing as had the same problem in a
> terminal window running `lein repl`.
>
> Terje
>
>
> On Friday, March 17, 2017 at 2:11:11 AM UTC+1, Colin Fleming wrote:
>>
>> Hi Terje,
>>
>> When you say the "standard" REPL in Cursive, are you referring to the
>> "Use nREPL in normal JVM process" option, or the "Use clojure.main in
>> normal JVM process" option? Obviously the first does use nREPL, but doesn't
>> go through lein - Cursive just runs a JVM process, starts a bare-bones
>> nREPL server in it and connects to it. If you haven't tried that option, it
>> might be worth trying to see if the issue is in nREPL or in lein.
>>
>> Cheers,
>> Colin
>>
>> On 17 March 2017 at 11:05, Terje Dahl  wrote:
>>
>>> UPDATE:
>>> I only just discovered:
>>> It *does* work as expected when I run it from the "standard" REPL in JVM
>>> (in IntelliJ/Cursive),
>>> And it *does* work as expected when I run it in my own "home grown" REPL
>>> stack.
>>> It does *not* work as expected when running it in any variant of nREPL -
>>> including:
>>>  - Through IntelliJ/Cursive
>>>  - In command-line via `lein repl` (which is simply nREPL)
>>>
>>> So I have a potential solution, (and a possible nREPL bug), but it would
>>> be valuable to understand the cause of the issue.
>>>
>>>
>>>
>>> On Thursday, March 16, 2017 at 10:24:21 PM UTC+1, Terje Dahl wrote:

 I am attempting to embed an nREPL server in my application (version
 0.2.12).  Everything seems to work nicely, except I am not able to get any
 out from print statements et al.  Even the basic example on the README
 "(time (reduce + (range 1e6)))" doesn't work for me: I do not get back the
 map containing the :out, but I get the two remaining.

 After two days of studying the source code of tools.nrepl (including
 the testing code),  leiningen.repl, reply, and a myriad of things online, I
 am getting rather frustrated.

 It seems to maybe have something to do with *out*, but I can't figure
 it out. Any hints at debugging it will be much appreciated.

 Also, any resources for "tool makers" would be of interest.

>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To post to this group, send email to clo...@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+u...@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+u...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> 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.
>

-- 
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: invokePrim(J)Ljava/lang/Object

2017-03-18 Thread Matching Socks

What did you mean by the ^long before the function name?  If it is a hint 
of the return type, see https://clojure.org/reference/java_interop for the 
proper location. 

user> (defn integer-sum-to' ^long [^long n] (loop [i 1 sum 0] (if (<= i n) 
(recur (inc i) (+ i sum)) sum)))
#'user/integer-sum-to'
user> (integer-sum-to' 3)
6


-- 
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: [beginner] help understand this function

2017-03-18 Thread Walter van der Laan
The value of 'maps' can be, for example; [{:lat 1 :lng 4} {:lat 2 :lng 3}].

If you enter (min [{:lat 1 :lng 4} {:lat 2 :lng 3}]) in the repl the result 
will be {:lat 1 :lng 3}

If you replace 'min' by its definition you get;
(min [{:lat 1 :lng 4} {:lat 2 :lng 3}])
=>
(zipmap [:lat :lng]
(map (fn [k] (apply clojure.core/min
  (map k [{:lat 1 :lng 4} {:lat 2 :lng 
3}])))
 [:lat :lng]))

I hope this helps. Succes!

-- 
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.


invokePrim(J)Ljava/lang/Object

2017-03-18 Thread Thalys Aguiar Gomes
Someone could explain me why i'm having this problem?


MBP-de-Thalys:~ thalys$ lein repl
nREPL server started on port 61763 on host 127.0.0.1 - 
nrepl://127.0.0.1:61763
REPL-y 0.3.7, nREPL 0.2.12
Clojure 1.8.0
Java HotSpot(TM) 64-Bit Server VM 1.8.0_102-b14
Docs: (doc function-name-here)
  (find-doc "part-of-name-here")
  Source: (source function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
Exit: Control+D or (exit) or (quit)
 Results: Stored in vars *1, *2, *3, an exception in *e
user=> (defn ^long integer-sum-to [^long n]
  #_=> (loop [i 1 sum 0]
  #_=> (if (<= i n)
  #_=> (recur (inc i) (+ i sum))
  #_=> sum)))
#'user/integer-sum-to
user=> (dotimes [_ 5] (time (integer-sum-to 1)))
AbstractMethodError Method 
user$integer_sum_to.invokePrim(J)Ljava/lang/Object; is abstract 
 user/integer-sum-to (form-init3907513459711515269.clj:-1)
user=>

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 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.


[beginner] help understand this function

2017-03-18 Thread Luis P. Mendes
Hi,


I'm reading `Clojure for the Brave and True` book, at chapter 6 
.

I don't completely understand this function:

(defn comparator-over-maps
  [comparison-fn ks]
  (fn [maps]
(zipmap ks
(map (fn [k] (apply comparison-fn (map k maps)))
 ks

comparison-fn is min for example.
ks are the keys: [:lat :lng]

As far as I understand, the function returns a function `fn [maps]...` and 
`maps` will be an argument that will be passed later on.  Correct?

(map (fn [k] (apply comparison-fn (map k maps)))
 ks)
should return the values for zipmap, ks being the keys.

What should be the value of `maps`?  for example {:lat 5 :lng 5}? I don't 
understand this inner part.

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 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: Dependency issue? "No such namespace: clojure.edn"

2017-03-18 Thread Herwig Hochleitner
2017-03-18 16:15 GMT+01:00 Jennifer Parsons :
> No such namespace: clojure.edn, could not locate clojure/edn.cljs,
> clojure/edn.cljc, or Closure namespace “

The error message indicates, that a ClojureScript file tries to load
clojure.edn, when that namespace is Clojure only. See
http://stackoverflow.com/questions/36208287/stringify-parse-edn-in-clojure-clojurescript
for a solution.

Also, consider using transit, as that will yield faster parsing /
serialization times for ClojureScript.

-- 
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.


Dependency issue? "No such namespace: clojure.edn"

2017-03-18 Thread Jennifer Parsons
hi all.  i’m working on an app that has a clojurescript frontend AND 
clojure backend.

i’m having a problem with a dependency, i think. i’m getting this message:

No such namespace: clojure.edn, could not locate clojure/edn.cljs, clojure/
edn.cljc, or Closure namespace “


 
i did `lein deps :tree` and this was the first thing in the result (there 
were quite a few):

Possibly confusing dependencies found:
[lein-cljsbuild "1.1.1"] -> [lein-cljsbuild/cljs-compat "1.0.0-SNAPSHOT"] -> 
[org.clojure/clojure "1.5.1"]
 overrides
[lein-figwheel "0.5.8"] -> [simple-lein-profile-merge "0.1.4"] -> [org.
clojure/clojure "1.6.0"]

Consider using these exclusions:
[lein-figwheel "0.5.8" :exclusions [org.clojure/clojure]]


i tried adding that exclusion, but it didn’t seem to resolve anything. i 
did quite a few other things as well (`lein clean`, ran `lein ancient` and 
did the suggested upgrades) but i’m still getting this error.

any help is much appreciated!

-- 
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: [ANN] tentacles fork on clojars - raynes' legacy lives on!

2017-03-18 Thread James Laver
Oops, that went out with a boot-test dependency (thanks for the spot, coda 
hale!)

Please find [irresponsible/tentacles "0.6.1"] on clojars.

And this time I'll spell 'github' correctly: 
https://github.com/irresponsible/tentacles

/j

On Saturday, March 18, 2017 at 9:19:08 AM UTC+1, James Laver wrote:
>
> Hi all,
>
> Further to previous discussions, we (the irresponsible clojure guild) have 
> forked tentacles and intend to keep it maintained and improved.
>
> This is our first release of tentacles under the irresponsible group and 
> we have resumed versioning from Raynes' versions.
>
> github: https://gthub.com/irresponsible/tentacles/
> dep coord: [irresponsible/tentacles "0.6.0"]
>
> Changelog:
>
>- Reviewed every open bug and pull request
>- Merged the majority of PRs, did the rest ourselves
>- Bumped deps and updated docs
>- Started keeping changelog
>- Fixed reported documentation issues
>- Moved to boot so we can ship it like any other irresponsible lib
>
> Bugs fixed:
>
>- Requests error out when the body is not json 
>
>- Update to new watch endpoint 
>
>- Conditional request and :all-pages true option didn't play nicely 
>
>- Collection responses have an extra empty map as the last element 
>
>
> Features added:
>
>- Notifications api 
>- Reactions api  (GET 
>only at present)
>
>
> Finally, a massive shout out to the other main contributor of the ICG, 
> Kent Fredric, who managed to get this release out despite tripping over a 
> bunch of boot failure in the process.
>
>
> Cheers,
>
> James
>

-- 
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: Defrecord Conflict

2017-03-18 Thread tmountain
Thank you. Stupid typo on my part. This works!

On Friday, March 17, 2017 at 7:35:07 PM UTC-4, Francis Avila wrote:
>
> Import does not demand name mapping. You can import a full path without 
> aliasing.  This will work fine:
>
> (ns multi.core
>   (:require [multi.ns1]
> [multi.ns2])
>   (:import [multi.ns1.Animal]
>[multi.ns2.Animal]))
>
> (multi.ns1.Animal. "hi")
>
> (But remember to use the keyword :import, not the symbol. This will be 
> tightened up in the future.)
>
>
> On Friday, March 17, 2017 at 4:28:09 PM UTC-5, tmountain wrote:
>>
>> Say that I have the following:
>>
>> -- ns1.clj --
>> (ns multi.ns1)
>> (defrecord Animal [name])
>>
>>
>> -- ns2.clj --
>> (ns multi.ns2)
>> (defrecord Animal [name])
>>
>> -- core.clj --
>> (ns multi.core
>>   (:require [multi.ns1]
>> [multi.ns2])
>>   (import [multi.ns1 Animal]
>>   [multi.ns2 Animal]))
>>
>>
>> My intent is to have a multimethod with target such as:
>>
>> (defmethod stringify multi.ns1.Animal ...)
>> (defmethod stringify multi.ns2.Animal ...)
>>
>> My problem is that I'm forced to use import to bring in the records 
>> defined in ns1 and ns2, but once I do this, I lose the ability to refer to 
>> these classes by their fully-qualified names and the following conflict 
>> occurs.
>>
>> java.lang.IllegalStateException: Animal already refers to: class 
>> multi.ns1.Animal
>>
>> This actually works from the repl, which tells me it's getting the 
>> records onto the classpath ahead of time.
>>
>>
>>
>> multi.core=> (require 'multi.ns1)
>> nil
>> multi.core=> (require 'multi.ns2)
>> nil
>> multi.core=> multi.ns1.Animal
>> multi.ns1.Animal
>>
>> I bumped into this in the process of exploring the expression problem. Is 
>> there a way around 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 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: No :out in my nREPL responses

2017-03-18 Thread Terje Dahl
Hey, Collin.

By "standard" REPL I mean "clojure.main REPL in JVM" - which worked fine.
I don't think my issue has anything to do with Cursive's way of connecting 
to nREPL, but rather with nREPL itself, seeing as had the same problem in a 
terminal window running `lein repl`.

Terje 


On Friday, March 17, 2017 at 2:11:11 AM UTC+1, Colin Fleming wrote:
>
> Hi Terje,
>
> When you say the "standard" REPL in Cursive, are you referring to the "Use 
> nREPL in normal JVM process" option, or the "Use clojure.main in normal JVM 
> process" option? Obviously the first does use nREPL, but doesn't go through 
> lein - Cursive just runs a JVM process, starts a bare-bones nREPL server in 
> it and connects to it. If you haven't tried that option, it might be worth 
> trying to see if the issue is in nREPL or in lein.
>
> Cheers,
> Colin
>
> On 17 March 2017 at 11:05, Terje Dahl > 
> wrote:
>
>> UPDATE:
>> I only just discovered: 
>> It *does* work as expected when I run it from the "standard" REPL in JVM 
>> (in IntelliJ/Cursive),
>> And it *does* work as expected when I run it in my own "home grown" REPL 
>> stack.
>> It does *not* work as expected when running it in any variant of nREPL - 
>> including:
>>  - Through IntelliJ/Cursive
>>  - In command-line via `lein repl` (which is simply nREPL)
>>
>> So I have a potential solution, (and a possible nREPL bug), but it would 
>> be valuable to understand the cause of the issue.
>>
>>
>>
>> On Thursday, March 16, 2017 at 10:24:21 PM UTC+1, Terje Dahl wrote:
>>>
>>> I am attempting to embed an nREPL server in my application (version 
>>> 0.2.12).  Everything seems to work nicely, except I am not able to get any 
>>> out from print statements et al.  Even the basic example on the README 
>>> "(time (reduce + (range 1e6)))" doesn't work for me: I do not get back the 
>>> map containing the :out, but I get the two remaining.
>>>
>>> After two days of studying the source code of tools.nrepl (including the 
>>> testing code),  leiningen.repl, reply, and a myriad of things online, I am 
>>> getting rather frustrated.
>>>
>>> It seems to maybe have something to do with *out*, but I can't figure it 
>>> out. Any hints at debugging it will be much appreciated.
>>>
>>> Also, any resources for "tool makers" would be of interest.
>>>
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@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+u...@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+u...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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.


[ANN] tentacles fork on clojars - raynes' legacy lives on!

2017-03-18 Thread James Laver
Hi all,

Further to previous discussions, we (the irresponsible clojure guild) have 
forked tentacles and intend to keep it maintained and improved.

This is our first release of tentacles under the irresponsible group and we 
have resumed versioning from Raynes' versions.

github: https://gthub.com/irresponsible/tentacles/
dep coord: [irresponsible/tentacles "0.6.0"]

Changelog:

   - Reviewed every open bug and pull request
   - Merged the majority of PRs, did the rest ourselves
   - Bumped deps and updated docs
   - Started keeping changelog
   - Fixed reported documentation issues
   - Moved to boot so we can ship it like any other irresponsible lib

Bugs fixed:

   - Requests error out when the body is not json 
   
   - Update to new watch endpoint 
   
   - Conditional request and :all-pages true option didn't play nicely 
   
   - Collection responses have an extra empty map as the last element 
   

Features added:

   - Notifications api 
   - Reactions api  (GET 
   only at present)


Finally, a massive shout out to the other main contributor of the ICG, Kent 
Fredric, who managed to get this release out despite tripping over a bunch 
of boot failure in the process.


Cheers,

James

-- 
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.