Re: symbol is not a symbol in (def (symbol "x") ...) ???

2020-10-05 Thread Peter Hull
On Friday, 2 October 2020 at 20:38:50 UTC+1 Bost wrote:

> I have a problem with `def` in macros. I'd like to create a bunch of 
> following definitions:
>
> Also possible to do without macros:
(defn def-stuff [xs] (for [x xs] (intern *ns* (symbol x) (upper-case x
This seems to work for me, if anyone knows why it's not right, I'd love to 
hear.

-- 
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/8446fc8c-4f41-4718-a9ce-deeea9f16d18n%40googlegroups.com.


Re: Using :clojure.spec.alpha/invalid inside clojure.core macros throw exception

2019-09-18 Thread Peter Hull


On Wednesday, 18 September 2019 20:48:39 UTC+1, David Bürgin wrote:
>
> This is a known issue, see 
> https://clojure.atlassian.net/projects/CLJ/issues/CLJ-1966 
>
2016!

-- 
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/6bfbcf08-eaf2-4bd4-ba96-f16f627f4380%40googlegroups.com.


Re: Using :clojure.spec.alpha/invalid inside clojure.core macros throw exception

2019-09-18 Thread Peter Hull

On Tuesday, 17 September 2019 22:34:04 UTC+1, Daniel Dinnyes wrote:
>
> (let [x 42] :clojure.spec.alpha/invalid)
>
> That's an interesting one. It's failing the spec on the let's body, which 
is just 'any?' , so this is initially surprising.  
However s/valid? is implemented as, approximately, (not (invalid? (conform 
spec value)))
and (conform any? value) evaluates to value
(invalid? v) is implemented as (identical? ::invalid v)
so 
(valid? any? ::invalid)
(not (invalid? (conform any? ::invalid)))
(not (identical? ::invalid (conform any? ::invalid)))
(not (identical? ::invalid ::invalid))
(not true)
false

Whether this is a bug or not I can't say - it seems to be an inevitable 
consequence of the way spec is implemented.
Pete

-- 
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/48c0feca-9169-49e5-887c-8f4590985f43%40googlegroups.com.


Re: questionable result of Clojure code execution in org babel

2019-08-12 Thread Peter Hull
On Monday, 12 August 2019 18:47:48 UTC+1, Alex Miller wrote:
>
> You can’t wrap ns and forms into a single do like that. If you google 
> around you can find this issue referred to as the Gilardi scenario.

OK, thanks, Alex.
Is this not covered in https://technomancy.us/143 by the para that starts 
"In Clojure 1.1, the compiler introduced special handling..."?

Anyway I assumed it was OK because the current code already wraps an ns and 
some forms in a do, here: 
https://github.com/bzg/org-mode/blob/d7e12d1df7091563c5f0fe0bd8b2db634d3e87ba/lisp/ob-clojure.el#L118

stardiviner, please could you explain a bit more about your patch? Before 
it (if I understand it) we had the namespace separately and passed it to 
`nrepl-sync-request:eval` 
as the last param. 

Thanks,
Pete


-- 
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/3fabc0cb-69b9-4525-b561-0812870937e7%40googlegroups.com.


Re: questionable result of Clojure code execution in org babel

2019-08-12 Thread Peter Hull
On Friday, 9 August 2019 11:52:32 UTC+1, Johannes wrote:
>
> I posted the problem there. 
>

Not a great response so far, I see! 
I had another little play and it may be possible to solve by a small change 
to ob-clojure.el. Basically we just wrap the forms and the ns into a single 
(do ...) form.
$ diff --unified  ~/.emacs.d/elpa/org-9.2.5/ob-clojure.el ~/ob-clojure.el
--- /home/peter/.emacs.d/elpa/org-9.2.5/ob-clojure.el   2019-08-12 12:22:
52.323068180 +0100
+++ /home/peter/ob-clojure.el   2019-08-12 12:21:00.647317946 +0100
@@ -101,7 +101,7 @@
 (print-length nil)
 (body
  (org-trim
-  (format "(ns %s)\n%s"
+  (format "(do (ns %s)\n%s)"
   ;; Source block specified namespace :ns.
   ns
   ;; Variables binding.
@@ -115,7 +115,7 @@
 body))
 (if (or (member "code" result-params)
(member "pp" result-params))
-   (format "(clojure.pprint/pprint (do %s))" body)
+   (format "(clojure.pprint/pprint %s)" body)
   body)))
 
 (defun org-babel-execute:clojure (body params)



However I have not really used this feature before so may be missing 
something.

Maybe you could give it a try and see if it helps?

Pete


-- 
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/69a1302c-e960-41ca-a52b-6b8ce86b6575%40googlegroups.com.


Re: questionable result of Clojure code execution in org babel

2019-08-09 Thread Peter Hull
On Thursday, 8 August 2019 17:00:43 UTC+1, Johannes wrote:
>
> Thank you, Pete, for your investigation. 
>
 
OK, I would be interested to hear if you get this sorted out!

-- 
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/ffdf3960-283f-4957-af04-8a02288dbd38%40googlegroups.com.


Re: questionable result of Clojure code execution in org babel

2019-08-07 Thread Peter Hull
On Wednesday, 7 August 2019 12:42:07 UTC+1, Peter Hull wrote:


The connection returns two values, first 'nil' then '24', and function 
nrepl--merge concats these into the incorrect response that org-mode pastes 
into your doc.

Wait, might be on to something here. In org-mode 9.1.9 the sent message 
looks like:
(-->
 id "8"
 op "eval"
 session "a34917da-541a-4d4a-b790-af8e11020c96"
 time-stamp "2019-08-07 13:18:00.307045105"
 code "(* 1 2 3 4)"
 ns "org-babel-clojure.core"
)


in 9.2.5 it's
(-->
 id "18"
 op "eval"
 session "86281560-e467-47c4-869d-043b03f5c546"
 time-stamp "2019-08-07 12:23:33.769213028"
 code "(ns org-babel-clojure.core)
(* 1 2 3 4)"
)



In the latter we're sending two forms (ns ...) and (* ...) so we get two 
responses. Previously it sent only one and used the ns key in the message 
to set the message.

This relates to this change last year: 
https://github.com/bzg/org-mode/commit/d7e12d1df7091563c5f0fe0bd8b2db634d3e87ba

So, I think you should bug the ob-clojure people at org-mode about this!

Hope that helps,
Pete



-- 
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/ac4eeb01-f29b-4f6c-bf0b-86029202dae9%40googlegroups.com.


Re: questionable result of Clojure code execution in org babel

2019-08-07 Thread Peter Hull
I poked around at this a bit.
If you enable nrepl's logging (use nrepl-toggle-message-logging) you will 
see something like this:
(-->
  id "18"
  op "eval"
  session"86281560-e467-47c4-869d-043b03f5c546"
  time-stamp "2019-08-07 12:23:33.769213028"
  code   "(ns org-babel-clojure.core)
(* 1 2 3 4)"
)
(<--
  id "18"
  session"86281560-e467-47c4-869d-043b03f5c546"
  time-stamp "2019-08-07 12:23:33.775780419"
  ns "org-babel-clojure.core"
  value  "nil"
)
(<--
  id "18"
  session"86281560-e467-47c4-869d-043b03f5c546"
  time-stamp "2019-08-07 12:23:33.776704332"
  ns "org-babel-clojure.core"
  value  "24"
)
(<--
  id "18"
  session"86281560-e467-47c4-869d-043b03f5c546"
  time-stamp "2019-08-07 12:23:33.777133786"
  status ("done")
)
(<--
  id "18"
  session"86281560-e467-47c4-869d-043b03f5c546"
  time-stamp "2019-08-07 12:23:33.780311930"
  changed-namespaces (dict)
  repl-type  "clj"
  status ("state")
)

The connection returns two values,  first 'nil' then '24', and function 
nrepl--merge concats these into the incorrect response that org-mode pastes 
into your doc.

So I am not sure where to ask - it doesn't look like org-mode's ob-clojure 
code is doing the wrong thing, but it does seem like something changed 
between 9.1.x and 9.2.x.

If you're on clojurians slack there is a cider channel where I think they 
might be able to clear up what's happening with that double return.

-- 
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/30366ca6-b909-4847-ba39-24d41a07df98%40googlegroups.com.


Re: questionable result of Clojure code execution in org babel

2019-08-06 Thread Peter Hull
On Monday, 5 August 2019 17:12:41 UTC+1, Johannes wrote:
>
> What is going wrong?
>
I tried Emacs 'built-in' org mode (9.1.9) and it gave the correct result, I 
then installed 9.2.5 and that did give the incorrect result that you 
reported.
So, I assume something changed in org-mode between 9.1.9 and 9.2.5.
Not an answer I know, but may be helpful to pin it down
Pete

;; Emacs 26.2 (MacOS)
;; CIDER 0.22.0snapshot (package: 20190805.1619), nREPL 0.6.0
;; Clojure 1.10.0, Java 11

-- 
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/890bf74d-8f5a-431d-b6cd-3f4f952ff6fa%40googlegroups.com.


Re: Compiler error message misses the target

2019-05-08 Thread Peter Hull
I tried just with the output of 'lein new app' - put an extra 'd' somewhere 
at the top level in core.clj, say below (defn- main ...), and then 'lein 
run' will give a strange location for the error (e.g. line 1 column 113)
Is the same as what Alan is reporting?

On Wednesday, 8 May 2019 12:24:23 UTC+1, Alex Miller wrote:
>
> I would definitely be interested in understanding and improving that error 
> reporting. What was the command you ran to produce the error and can you 
> make a smaller self contained repro? 

-- 
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/94b06677-ebd4-4833-878d-ae12550137f9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ANN] Clojure 1.10.0-alpha7

2018-09-06 Thread Peter Hull
On Thursday, 6 September 2018 19:11:14 UTC+1, Andy Fingerhut wrote:
>
> Doing a little bit more digging, I just did a Google search for:
>
> clojure "expects more than one argument"
>
> Nice one, thanks. I did a similar search but didn't find that - instead a 
repo called "venantius/ultra" which has the same text in, which I assumed 
must be a dependency of cider somehow. 

-- 
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] Clojure 1.10.0-alpha7

2018-09-06 Thread Peter Hull

On Thursday, 6 September 2018 15:09:15 UTC+1, Andy Fingerhut wrote:
>
>
> If you have a few minutes to try out the tests in my repo to see if you 
> get different results than I did, I'd be curious to hear if your results 
> are different.  I'd be more curious to learn of a way to write a unit test 
> that gives the exception you see with Clojure 1.10.0-alpha7.
>
> Thanks for your help. I think I've made a mistake somewhere. I use emacs + 
CIDER  and run the tests from there. With 'lein test' I don't see that 
error, but I do from emacs. So it may be something that's been updated in 
CIDER rather than clojure itself. I didn't realise they were different.
The offending test was in a work project which has been put on 
hold/abandoned, but every time a new clojure comes out, I test it again to 
check it still works (ever hopeful it might be reinstated!). So, more had 
changed than just alpha6 to alpha7 when I tested this time.

Does that make sense?

Peter

-- 
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] Clojure 1.10.0-alpha7

2018-09-06 Thread Peter Hull
On Wednesday, 5 September 2018 13:39:36 UTC+1, stuart@gmail.com wrote:
>
> 1.10.0-alpha7 includes the following changes since 1.10.0-alpha6:
>

I was pleased to see that going from alpha 6 to 7 found an error in one of 
my tests. I had something like
(is (= (x (func y
and the new version reports

>  error: java.lang.Exception: = expects more than one argument
>

But (purely for my own interest) I tried to discover which change in 
clojure source made the difference and I couldn't.

-- 
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: Atom/Clojure N00b - dependency issue

2018-07-28 Thread Peter Hull
On Saturday, 28 July 2018 13:21:14 UTC+1, Nando Breiter wrote:
>
> I've installed proto-repl as a package within Atom, and it works. I've 
> never listed it as a dependency within a project. 
>

It's in the docs (https://atom.io/packages/proto-repl) under Dependencies:

Add a dependency to the Clojure proto-repl-lib in your project's 
dependencies. 
   
   - This is an optional Clojure library that adds support for some of the 
   advanced Proto REPL features.
   - Required for: 
  - Saving and displaying local binding values
  - Autocompleting Clojure code
   

-- 
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 test has 10 failures

2018-07-24 Thread Peter Hull
On Tuesday, 24 July 2018 05:53:03 UTC+1, 冯忠孝 wrote:
>
>  [java] Ran 635 tests containing 17442 assertions.
>  [java] 10 failures, 0 errors.
>
> I see Throwable->map is involved in all of these; but I can't see how it 
could give the results it seems to here.
If you do
(Throwable->map (Exception. "text"))

at the REPL, what do you see?

-- 
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: Plain clojure 1.9 fails with Could not locate ... clojure/spec/alpha.clj on classpath. in Kubuntu 18.04

2018-05-21 Thread Peter Hull
On Monday, 21 May 2018 20:22:21 UTC+1, Andy Fingerhut wrote:
>
> Is there some other command you would recommend to force reinstall of 
> ca-certs that might work?
>
> Specifically on the ca-certs thing, there is a bug filed with Ubuntu, and 
it looks like it should be fixed fairly soon;
https://bugs.launchpad.net/ubuntu/+source/ca-certificates-java/+bug/1739631
(apologies if you already knew this)
Peter

-- 
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 the vector a sequence?

2018-04-28 Thread Peter Hull
On Friday, 20 April 2018 22:39:41 UTC+1, Rick Moynihan wrote:
>
> It's also worth mentioning vectors are sequential:
>
I'd be interested to know what is the purpose of sequential. The docs for 
sequential?  just say it 
implements Sequential, and clojure.lang.Sequential 

 
is an interface with no behaviour of its own. So what extra could you do if 
you knew something was sequential? Is it something to do with Java interop? 

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

2018-04-16 Thread Peter Hull
What was the question? I am on tenterhooks now...

-- 
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: The Reasoned Schemer chpt 4: "Please pass the aspirin"

2018-02-25 Thread Peter Hull
On Sunday, 25 February 2018 17:46:26 UTC, Calvin Sauer wrote:
>
> I'm currently struggling with the same question. Did you ever happen to 
> reach a satisfying conclusion?
>

https://groups.google.com/forum/#!topic/minikanren/JCKJV7k7lGU

-- 
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: Problem with lazy seqs in macros

2018-02-05 Thread Peter Hull
You could (I think) simplify to:
(defmacro hmap [& kvs]
  "Returns an immutable hashmap.
   Keys must be compile-time constants."
  (if (even? (count kvs))
  (let [keys (into [] (take-nth 2) kvs)]
`(fn [k#]
 (case k# ~@kvs ::keys ~keys)))
(throw (Exception. "hmap takes an EVEN number of args"


-- 
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: Problem with lazy seqs in macros

2018-02-05 Thread Peter Hull

On Monday, 5 February 2018 09:22:58 UTC, Divyansh Prakash wrote:
You see what's happening with macroexpand

 (macroexpand '(hmap :a 1 :b 2))

(fn* ([k__4009__auto__] (clojure.core/case k__4009__auto__ :a 1 :b 2 
:user/keys [:a :b])))

versus

(fn* ([k__4146__auto__] (clojure.core/case k__4146__auto__ :a 1 :b 2 
:user/keys (:a :b

So the value of :user/keys becomes a function call (:a :b) which is 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: Cider - emacs lisp errors reported

2017-12-10 Thread Peter Hull
On Sunday, 10 December 2017 14:14:05 UTC, Bozhidar Batsov wrote:
>
> It might have been changed upstream. Not sure what's your Emacs version. A 
> while ago we backported this macro in whatever its current form was for 
> compatibility with older Emacsen.
>
> File a ticket on GitHub and we'll investigate. 
>

OK, now I can't reproduce it. My guess is that some other elisp code was 
interfering, not sure how.

Anyway, thanks for the advice.

Peter

 

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


Cider - emacs lisp errors reported

2017-12-10 Thread Peter Hull
I noticed this when updating cider via melpa, and I wasn't sure if it's 
already known about or whether it is even an problem. I thought I'd ask 
here before submitting an issue to github.

Compiling file 
/Users/peterhull/.emacs.d/elpa/cider-20171209.1602/cider-browse-spec.el at 
Sun Dec 10 11:29:29 2017
cider-browse-spec.el:277:1:Error: Wrong number of arguments: when-let, 1

Compiling file 
/Users/peterhull/.emacs.d/elpa/cider-20171209.1602/cider-classpath.el at 
Sun Dec 10 11:29:29 2017
cider-classpath.el:102:1:Error: Wrong number of arguments: when-let, 1

Compiling file 
/Users/peterhull/.emacs.d/elpa/cider-20171209.1602/cider-client.el at Sun 
Dec 10 11:29:29 2017
cider-client.el:143:1:Error: Wrong number of arguments: when-let, 1

Compiling file 
/Users/peterhull/.emacs.d/elpa/cider-20171209.1602/cider-common.el at Sun 
Dec 10 11:29:29 2017
cider-common.el:186:1:Error: Wrong number of arguments: when-let, 4

Compiling file 
/Users/peterhull/.emacs.d/elpa/cider-20171209.1602/cider-compat.el at Sun 
Dec 10 11:29:29 2017

Compiling file 
/Users/peterhull/.emacs.d/elpa/cider-20171209.1602/cider-debug.el at Sun 
Dec 10 11:29:29 2017
cider-debug.el:226:1:Error: Wrong number of arguments: when-let, 1

Compiling file 
/Users/peterhull/.emacs.d/elpa/cider-20171209.1602/cider-doc.el at Sun Dec 
10 11:29:29 2017
cider-doc.el:263:1:Error: Wrong number of arguments: when-let, 1

And for example, the first instance looks like this

(defun cider-browse-spec--browse-at ( pos)
  "View the definition of a spec.

Optional argument POS is the position of a spec, defaulting to point.  POS
may also be a button, so this function can be used a the button's `action'
property."
  (interactive)
  (let ((pos (or pos (point
(when-let ((spec (button-get pos 'spec-name)))
  (cider-browse-spec--browse spec

I am not an elisp expert but I think the syntax of when-let is (when-let 
(var value) body) rather than (when-let ((var value)) body)

-- 
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: spec for an agent

2017-11-17 Thread Peter Hull
On Friday, 17 November 2017 16:53:57 UTC, Didier wrote:
>
> Why do you return an agent from a function? Can't you just return the map 
> it conatains instead? And spec that?

I want to write a function spec (s/fdef) for  a function make-agent that 
takes some initialisers and returns a new agent with its state set up. So I 
need the agent to come out of the function, not just its state.
Having said which, I could have a function make-agent-state and spec that, 
then the body of make-agent is just (agent (make-agent-state 
...initialisers...)) Is that what you're suggesting?

tbc++ - good point, I was only looking for something in the spec namespace.

Thanks all.


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


spec for an agent

2017-11-17 Thread Peter Hull
I am using agents whose state is a map. I have a spec for this map, 
::agent-state. What's the best way to validate the agent?

I have:
(s/valid? #(s/valid? ::agent-state (deref %)) myagent)



Is this there a neater way to do this? (I actually want the spec to apply 
to the ret value of an s/fdef)

-- 
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.data.xml with newline / return in attribute values

2017-11-09 Thread Peter Hull
On Thursday, 9 November 2017 11:21:36 UTC, Jochen wrote:
>
> hmmm, that is unfortunately not the reality. In fact any newlines/returns 
> in attributes are collapsed to a single space (saw mentioned somewhere that 
> this is officially so). 
>
It's 'attribute value normalisation' - see 
https://www.w3.org/TR/REC-xml/#AVNormalize
(I must admit the more times I read that section, the less I understand 
it...)

Anyway, if you use  entities instead of \n literals, does that do the 
round trip properly?

 

-- 
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] Clojure 1.9.0-beta4

2017-11-02 Thread Peter Hull
On Thursday, 2 November 2017 19:46:35 UTC, Alex Miller wrote:
>
> I think this is an issue with Leiningen with Java 1.9 (re things in 
> dynapath and the changes in classloader details in Java 1.9), and not 
> Clojure itself. 
>
> Yes this was leiningen issue #2331 now fixed:
https://github.com/technomancy/leiningen/issues/2331

-- 
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 a better way to get to `Classname[].class` ?

2017-10-10 Thread Peter Hull
I actually preferred your solution, pericles, because it doesn't require 
memorising the "[L...;" syntax, and works if you don't know the class at 
compile time. By the way you can use make-array to create a zero size array 
which might be (ever so slightly) more efficient.

For reference (apologies if you already knew this), the class name syntax 
is outlined here:
https://docs.oracle.com/javase/9/docs/api/java/lang/Class.html#getName--
and for the full details
https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.7.9.1

-- 
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: The performance of plain map vs. defrecord

2017-10-09 Thread Peter Hull
Slightly off-topic, but why doesn't using the 'incorrect' alphabet-macro 
give an error? If I try and define a Record with keyword keys it tells me 
very clearly not to:

user=> (defrecord Wrong [:a])
CompilerException java.lang.AssertionError: defrecord and deftype fields 
must be  symbols, user.Wrong had: :a, compiling:(C:\Users\Peter\AppData\
Local\Temp\form-init3187870874322021043.clj:1:1)


-- 
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 properly spec this simple structure

2017-10-05 Thread Peter Hull
I will just point out that, in the suggested answer,

(gen/return (make-channel))
calls make-channel once, and creates a generator whose output is that same 
object repeatedly, not a new instance of the class each time. That may not 
matter, but it's not what (I think) you intended in your original code.


-- 
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 properly spec this simple structure

2017-10-05 Thread Peter Hull
On Thursday, 5 October 2017 20:52:10 UTC+1, Alex Bezhan wrote:
>
> Can someone explain what I've done wrong and how to do it the right way?


As I understand it, you will need to code the generator equivalent of 
(repeatedly make-channel) but I don't know how to do that, sorry.

Then I think you just need 
(s/def ::channel (s/with-gen ::channel-type ))

where  is a function that returns this mystery generator. Hopefully 
someone else will know what  is!

 

-- 
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 properly spec this simple structure

2017-10-05 Thread Peter Hull
On Thursday, 5 October 2017 19:52:47 UTC+1, Alex Bezhan wrote:
>
>
>
> (s/def ::channel (s/spec (::channel-type)
>  :gen channel-gen))
>
> Don't think it's the answer, but should ::channel-type be in parens here? 

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


spec for a multi-arity function

2017-10-05 Thread Peter Hull
Is there any guidance on how to do the fdef for a function with more than 
one arity? As an example, this one which takes one or two arguments:

(defn report
  "Report an error code, optionally with a message"
  ([errno] ...)
  ([errno msg] ...))

Could be:
(s/fdef report
:args (s/alt :brief (s/cat :errno integer?)
 :full (s/cat :errno integer? :msg string?)))

or:
(s/fdef report
:args (s/cat :errno integer? :msg (s/? string?)))


Some options make more sense than others, depending on the function. For 
example clojure.core/map is defined with five separate arities but I don't 
think it would be right to spec it as an alt with five alternatives, since 
they are all covered by "function followed by zero or more colls"

So, has a convention been established on how best to do 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: Reading file to list as char array

2017-10-03 Thread Peter Hull
On Tuesday, 3 October 2017 12:39:47 UTC+1, Furkan Yıldız wrote:
>
> I am reading a txt file containing words. I need to add these words to the 
> list as char. For example
>
>  
>
> I think you need to split into words first using a regex then seq each word

(def words (clojure.string/split allstring #"\W"))


then 

(map seq words)

and of course you can put these together to avoid the intermediate 
definition(s)

(map seq (clojure.string/split (slurp fname) #"\W"))






-- 
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: [core.spec] Stricter map validations?

2017-10-03 Thread Peter Hull
I have found, as an application evolves, some extra data is required which 
comes from elsewhere. 

For example, I have an application where data is read from a network 
socket, transformed and stored. For auditing, I later decided it was useful 
to capture the remote address from the socket right at the start, and 
finally to log it. With restrictive specs, I would have had to re-spec all 
the intermediate functions. As it was, they didn't know or need to know 
about the extra key/value in the map, just pass it along.

On puzzler's database example, I would have thought that restricting the 
keys that go into the DB should not be the job of spec (since functions may 
not be instrumented anyway), but the job of the 'core logic'. Maybe I am 
misunderstanding though.

-- 
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: read-line is limited to 4095 chars

2017-09-28 Thread Peter Hull
On Tuesday, 26 September 2017 12:28:26 UTC+1, baptiste...@oscaro.com wrote:
>
> I was using read-line to read a large line and found it limits its input 
> to 4095 chars. I tested this on both Clojure 1.8.0 and 1.9.0-beta1. 
>
> I tested this on Windows. I found that piping from the CMD.EXE command 
line into a compiled uberjar was OK (I tested up to 32K and gave up) but 
pasting into the prompt of a repl was not. (I could get up to approx 8K of 
ASCII) This was true of lein repl and clojure's own repl.

I got similar on Linux (Fedora LXQT) - 'unlimited' for piping but 4096 for 
pasting into a repl prompt.

I looked at the source code, can't see why.

Hope that helps someone.

-- 
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: transducers and eduction

2017-09-05 Thread Peter Hull
On Tuesday, 5 September 2017 12:11:04 UTC+1, Christophe Grand wrote:
>
>
> Hope this helps.
>

That is very helpful to me. It would be great if those tips could be added 
to the official documentation.

Pete

-- 
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: transducers and eduction

2017-09-05 Thread Peter Hull
On Tuesday, 5 September 2017 00:07:07 UTC+1, Alex Miller wrote:
>
> When you say "the" answer here, that doesn't make sense to me. 
>
Nor me. But, I think I've got it now, thanks for your help. The question I 
should have asked was "what is the purpose of the ([x] ...) arity in an 
eduction?"  I wish I could phrase my questions as clearly as you phrase 
your answers!
 

> The termination value in an eduction is just a nil, so x is nil in the 
> ([x] ...) arity. 
>

 I couldn't understand why, in eduction, the function was being called with 
arity 1 at all if the result was not being used. Is this so that stateful 
transducers can 'clean up' their state in some way at the end?


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


transducers and eduction

2017-09-04 Thread Peter Hull
I am trying to understand transducers and am reading through 
https://clojure.org/reference/transducers I think I am missing something, 
please can someone help?

I read the part about the 'shape' of a transducer-creating-function (
https://clojure.org/reference/transducers#_creating_transducers) and made 
this function

(defn no-op [rf]
  (fn ([] (rf))
([x] (rf x))
([x r] (rf x r

which I call with

(pprint (eduction no-op (range 5)))

and get 

(0 1 2 3 4)

This is OK. If I now define 

(defn nearly-no-op [rf]
  (fn ([] (rf))
([x] (let [tmp (rf x)] (* x 2)))
([x r] (rf x r

(I want the 'finishing' function to double the answer)

Then (pprint (eduction nearly-no-op (range 5))) gives me a null pointer 
exception in multiply. Where does this come from? 

If I try

(defn nearly-no-op [rf]
  (fn ([] (rf))
([x] (count (rf x)))
([x r] (rf x r

then I get (0 1 2 3 4) again, i.e. the count doesn't play any part in the 
final result.

Thanks in advance!

Complete program:
(ns ttry.core
  (:require [clojure.pprint :refer [pprint]])
  (:gen-class))

(defn no-op [rf]
  (fn ([] (rf))
([x] (rf x))
([x r] (rf x r

(defn nearly-no-op [rf]
  (fn ([] (rf))
([x] (let [tmp (rf x)] (* x 2)))
([x r] (rf x r

(defn -main
  [& args]
  (pprint (eduction (map identity) (range 5)))
  (pprint (eduction no-op (range 5)))
  (pprint (eduction nearly-no-op (range 5






-- 
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: spec/conform: + vs * differ sometimes, not sure why

2017-08-10 Thread Peter Hull


> On Sunday, July 30, 2017 at 6:55:04 AM UTC-6, Alex Miller wrote:
>>
>> This is a bug, similar to https://dev.clojure.org/jira/browse/CLJ-2105 
>> and http://dev.clojure.org/jira/browse/CLJ-2003. I've spent a little 
>> time on it but have not figured out the exact problem. If you'd like to 
>> file it and reference those and/or drop it as a comment on one of those, 
>> would be happy to have more cases to verify when it's fixed.
>>
>
I notice that Tyler Tallman has posted a patch for CLJ-2003 recently (
https://dev.clojure.org/jira/browse/CLJ-2003). Would be worth a look to see 
if this solves your problem and also CLJ-2105. 
Pete

-- 
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: "GC overhead limit exceeded": Deceptive message?

2017-08-08 Thread Peter Hull

On Tuesday, 8 August 2017 06:20:56 UTC+1, Nathan Smutz wrote:

> Does this message sometimes present because the non-garbage data is 
> getting too big?
>
Yes, it's when most of your heap is non-garbage, so the GC has to keep 
running but doesn't succeed in freeing much memory each time.
See 
https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/memleaks002.html
 
You can increases the heap but that might only defer the problem.

As you process all your files, are you holding on to references to objects 
that you don't need any more?

-- 
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: Converting json to work with clojure.spec

2017-08-07 Thread Peter Hull

On Sunday, 4 December 2016 15:11:55 UTC, Jonathon McKitrick wrote:
>
> That being said, I see the benefits in moving to namespace qualified keys. 
> Currently, I'm returning structures directly in Compojure handlers, and the 
> JSON conversion is implicitly handled. I checked Cheshire and didn't 
> immediately see a way to generate namespaced keys. What's the best way to 
> do this?
>
parse-string takes a second argument that converts from a JSON string key 
to whatever you want for your clojure key - see 3rd example in 
https://github.com/dakrone/cheshire#decoding
So you could have something like:
 
(ns chtst.core
  (:require [cheshire.core :refer [parse-string]]
[clojure.pprint :refer [pprint]])
  (:gen-class))

(def fields { "name" ::name, "age" ::age})

(defn -main
  [& args]
  (let [example (parse-string "{\"name\":\"fred\", \"age\":29}" fields)]
(pprint example)))



However this doesn't produce good results if your JSON contains a key you 
haven't listed in fields - so you'd probably have to write an actual 
function to do the mapping.

Does that help?
Pete

-- 
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: Unnamed Types - What Am I Doing Wrong?

2017-07-26 Thread Peter Hull

On Wednesday, 26 July 2017 03:03:45 UTC+1, Daniel Compton wrote:

> For something like an account, a more idiomatic way to model this in 
> Clojure might be with maps:
>
> If I understand Kevin's post correctly, he's already planning to replace 
his vectors with maps, and he is asking if there's a way to make the change 
without too much pain and without missing anything.
 
I wouldn't count myself as 'experienced' so I don't know if there is an 
answer, but I have definitely felt that pain. If you had a good test 
coverage you could just make the first pass change and then keep iterating 
until the tests pass. Once Clojure 1.9 is out then (I believe) specs will 
be a better way to verify that all your data types are consistent and 
correct. 

Hopefully someone else will have a better answer...

Pete

-- 
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: Bizzarre cond-> behavior

2017-07-21 Thread Peter Hull
That was quick! So, if I understand it, the problem is not with cond->, 
it's the chain of let-bindings it expands to?
Pete
 

-- 
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: Bizzarre cond-> behavior

2017-07-21 Thread Peter Hull
On Friday, 21 July 2017 00:35:00 UTC+1, Milt Reder wrote:
>
> Here's a simplified example:
>
> I can confirm that pasting that defn into a CIDER repl does take a long 
time before the prompt comes back. I tried doing a "macro expand all" and 
it was pretty much instantaneous. The resulting expansion is quite long but 
not unreasonable (see below). Beyond that, I'm not sure how to analyse what 
Clojure's doing or time it. I'm using 1.9 alpha by the way.
Pete

(def wat
 (fn*
   ([& p__9335]
 (let*
   [map__9336
p__9335
map__9336
(if (seq? map__9336)
  (. clojure.lang.PersistentHashMap create (seq map__9336))
  map__9336)
a
(get map__9336 :a)
b
(get map__9336 :b)
c
(get map__9336 :c)
d
(get map__9336 :d)
e
(get map__9336 :e)
f
(get map__9336 :f)
map-0
(get map__9336 :map-0)
map-1
(get map__9336 :map-1)
map-2
(get map__9336 :map-2)]
   (let*
 [G__9337
  "foo"
  G__9337
  (if a (str G__9337 a) G__9337)
  G__9337
  (if b (str G__9337 b) G__9337)
  G__9337
  (if c (str G__9337 c) G__9337)
  G__9337
  (if d (str G__9337 d) G__9337)
  G__9337
  (if e (str G__9337 e) G__9337)
  G__9337
  (if f (str G__9337 f) G__9337)
  G__9337
  (if map-0
(let*
  [G__9338
   G__9337
   G__9338
   (if (:a map-0) (str G__9338 (:a map-0)) G__9338)
   G__9338
   (if (:b map-0) (str G__9338 (:b map-0)) G__9338)
   G__9338
   (if (:c map-0) (str G__9338 (:c map-0)) G__9338)]
  (if (:d map-0) (str G__9338 (:d map-0)) G__9338))
G__9337)
  G__9337
  (if map-1
(let*
  [G__9339
   G__9337
   G__9339
   (if (:a map-1) (str G__9339 (:a map-1)) G__9339)
   G__9339
   (if (:b map-1) (str G__9339 (:b map-1)) G__9339)
   G__9339
   (if (:c map-1) (str G__9339 (:c map-1)) G__9339)]
  (if (:d map-1) (str G__9339 (:d map-1)) G__9339))
G__9337)]
 (if map-2
   (let*
 [G__9340
  G__9337
  G__9340
  (if (:a map-2) (str G__9340 (:a map-2)) G__9340)
  G__9340
  (if (:b map-2) (str G__9340 (:b map-2)) G__9340)
  G__9340
  (if (:c map-2) (str G__9340 (:c map-2)) G__9340)]
 (if (:d map-2) (str G__9340 (:d map-2)) G__9340))
   G__9337))


-- 
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: error in nrepl

2017-06-24 Thread Peter Hull
On Friday, 23 June 2017 23:14:55 UTC+1, lawrence...@gmail.com wrote:
>
>
> I'm curious if folks think it is easier to work with Emacs on a Linux 
> machine, or on a Mac? 
>
> I use Emacs on Mac, Linux and Windows. I disagree that it's more difficult 
to use on the Mac vs Linux. On Windows I get my emacs from cygwin so there 
is a bit of 'mental gear shifting' required between path names and line 
endings. 

On the Mac I installed homebrew and installed Emacs that way. Once in 
Emacs, I did exactly the same for all three platforms - added MELPA to the 
packages list and then installed cider (and paredit). I can post more 
details if you want but it sounds like you're an Emacs veteran already!

I've used Atom+protorepl on Windows. It gives you a more modern/better 
integrated system but IMO it doesn't have all the features/reliability of 
Emacs+cider. (this might just be down to my unfamiliarity with Atom)

Hope that helps.
 

-- 
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: Use of s/keys with 'and' , 'or'

2017-06-22 Thread Peter Hull
On Thursday, 22 June 2017 11:17:33 UTC+1, Peter Hull wrote:
>
> That's interesting. Is there anything I can help with to get that patch 
> accepted? I couldn't get it to apply to the current code in 
> https://github.com/clojure/spec.alpha because the filenames have changed, 
> but I copied across the changes manually so I could try it out (I can send 
> you the patch I now have against the github repo if that helps)
>
Sorry, ignore that bit about the patch not applying, I didn't see the 
updated -3 version on the JIRA page. 

-- 
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: Use of s/keys with 'and' , 'or'

2017-06-22 Thread Peter Hull
On Wednesday, 21 June 2017 16:30:33 UTC+1, Alex Miller wrote:
>
> Yes, that's actually something that we have a pending patch to correct at 
> https://dev.clojure.org/jira/browse/CLJ-2046
>
That's interesting. Is there anything I can help with to get that patch 
accepted? I couldn't get it to apply to the current code in 
https://github.com/clojure/spec.alpha because the filenames have changed, 
but I copied across the changes manually so I could try it out (I can send 
you the patch I now have against the github repo if that helps)

The only thing I've seen so far is that you can use any function (not just 
'or' and 'and'). It seems to work for conforming but gives an error with 
s/gen. The error is "AssertionError Assert failed: Args to tuple must be 
generators" which I don't think pinpoints the cause very effectively.

-- 
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: Use of s/keys with 'and' , 'or'

2017-06-21 Thread Peter Hull
On Wednesday, 21 June 2017 14:33:02 UTC+1, Alex Miller wrote:
>
> This is correct. This is or, not xor.

Oops. OK. It's been one of those days.

But, am I correct to say that gen/generate only ever makes values where all 
the 'or' alternatives are present? i.e. they always conform to:

(s/keys :req [::x ::y ::secret ::user ::pwd]
:opt [::z]))

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


Use of s/keys with 'and' , 'or'

2017-06-21 Thread Peter Hull
According to the docs  
it's
 
possible to use 'and' and 'or' for the required keywords. The example given 
is:

(s/keys :req [::x ::y (or ::secret (and ::user ::pwd))] :opt [::z])

I assume this means the conforming value has to have an ::x, a ::y, and either 
just ::secret or both of ::user and ::pwd. 

But it doesn't seem to work that way, for example:

(ns mod.core
 (:require [clojure.spec.alpha :as s]
   [clojure.spec.gen.alpha :as g]
   [clojure.test.check])
 (:gen-class))

(s/def ::example (s/keys :req [::x ::y (or ::secret (and ::user ::pwd))]
 :opt [::z]))
(s/def ::x double?)
(s/def ::y double?)
(s/def ::z double?)
(s/def ::secret boolean?)
(s/def ::user string?)
(s/def ::pwd string?)

(defn -main
 [& args]
 (println (g/generate (s/gen ::example

generates values like:
#:mod.core{:x 0.011776449391618371, :y -0.004638671875, :secret true, :user 
mxmoyS5x1wK322Ee, :pwd 4wqYc9t3G2ZAZ4zNNHbIHA}

Is this correct/expected? I am using 1.9.0-alpha17.


-- 
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] Eastwood, the Clojure lint tool, version 0.2.4 released

2017-06-02 Thread Peter Hull
On Thursday, 1 June 2017 22:49:56 UTC+1, Andy Fingerhut wrote:
>
> I do not know whether you (Peter) are the same as the user pedro-w on 
> Github, 
>
Indeed I am the same. 
I've suggested something on the GH issue which is just a hack but may be 
helpful. I hope you'll appreciate that, coming to it fresh, the interaction 
of eastwood and leiningen and the target code takes a bit of pondering, so 
it will take me a while to get up to speed.

Pete

-- 
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] Eastwood, the Clojure lint tool, version 0.2.4 released

2017-06-01 Thread Peter Hull
I had a quick look at this. As I understand it, the clojure.core reader 
processes data_readers.clj, but Eastwood uses tools.reader (or a version of 
it, copied into the Eastwood project?) which does not. 

I thought that, for linting, we don't need to actually run the data reader 
functions, so it should be possible to use the *default-data-reader-fn* 
mechanism to swallow the tag + value, returning 'something' (doesn't matter 
what, I used (gensym) ).

I tried editing leiningen.eastwood/eastwood, but unfortunately couldn't 
find a way to set *default-data-reader-fn* such that tools.reader could 
pick it up. I am now at the limits of my clojur e knowledge!

Does this sound reasonable? Any ideas what I am doing wrong?

Pete


On Thursday, 1 June 2017 07:19:04 UTC+1, Peter Hull wrote:
>
> On Thursday, 1 June 2017 06:55:52 UTC+1, Andy Fingerhut wrote:
>>
>> Sounds like a limitation/bug in the current Eastwood implementation that 
>> it doesn't handle this.  You are welcome to file an issue on Github: 
>> https://github.com/jonase/eastwood/issues
>>
>> Thanks for getting back to me. I've filed #222 (
> https://github.com/jonase/eastwood/issues/222)
> Pete
>  
>

-- 
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] Eastwood, the Clojure lint tool, version 0.2.4 released

2017-06-01 Thread Peter Hull
On Thursday, 1 June 2017 06:55:52 UTC+1, Andy Fingerhut wrote:
>
> Sounds like a limitation/bug in the current Eastwood implementation that 
> it doesn't handle this.  You are welcome to file an issue on Github: 
> https://github.com/jonase/eastwood/issues
>
> Thanks for getting back to me. I've filed #222 
(https://github.com/jonase/eastwood/issues/222)
Pete
 

-- 
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] Eastwood, the Clojure lint tool, version 0.2.4 released

2017-05-31 Thread Peter Hull
On Monday, 22 May 2017 01:51:32 UTC+1, David Cook wrote:
>
> Eastwood, the Clojure lint tool, version 0.2.4 has been released.  See 
> install instructions and complete documentation at [1].
>
Hi David and others,
I tried this for the first time on my code and it found some errors 
(hooray!) but also failed to parse some files using tagged literals. Is 
this expected?

As a minimal example I have

=== src/ewe/core.clj ===
(ns ewe.core
  (:gen-class))

(defn ereader [x] (str "Make my " x ))

(defn -main
  "I don't do a whole lot ... yet."
  [& args]
  (println #ewe/E "day"))
===

=== src/data_readers.clj
{ewe/E ewe.core/ereader}
===

which runs OK with 'lein run' but with 'lein eastwood' gives:

== Linting ewe.core ==
Linting failed:
ExceptionInfo No reader function for tag E
clojure.core/ex-info (core.clj:4617)
...

I am using clojure 1.8.0, fedora 25 (also tried Macos, same result)

Thanks,
Pete
 

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


Learning clojure - comments on my function?

2011-09-29 Thread Peter Hull
Hi All,
I am just learning clojure and I've written a function to split a list (see 
docstring for details). I was wondering if any of you experienced hands 
could take a look at it and comment. I've never used lisp or a functional 
language before so I was wondering if I was doing it right or if there is a 
better way. Anyway here is the function:

(defn split-zero 
  Split a collection at its zero values into a list of lists.
   Multiple zeros are treated as one.
   The order of elements in each inner list is maintained but
   the order of inner lists in the result may be changed.
   e.g. (split-zero '(1 2 3 0 4 5 6 0 7 8 9))
   - ((7 8 9) (4 5 6) (1 2 3))
  [ls] ((fn [ls wip ans] 
(if (empty? ls)
  (if (empty? wip) ans (conj ans (list* wip)))
  (if (zero? (first ls))
(if (empty? wip)
  (recur (next ls) [] ans)
  (recur (next ls) [] (conj ans (list* wip
(recur (next ls) (conj wip (first ls)) ans ls [] nil))

Thanks,
Peter

-- 
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: Learning clojure - comments on my function?

2011-09-29 Thread Peter Hull
Thank you, both!

I guessed there would be a neater solution (I wasn't aware of
partition-by)

Pete

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