Re: [ANN] Leiningen 2.6.0

2016-02-11 Thread Jean Niklas L'orange
On Wednesday, February 10, 2016 at 9:18:04 PM UTC+1, Avi Flax wrote:
>
> Does this mean that those who manually installed will not experience these 
> improvements? If so, I’m curious as to why? 
>

Ah, good question: People who installed manually will already have the
performance improvements that Homebrew users now get. So installing via
Homebrew or manually should not yield any performance differences.

As to the reason why: The manual installation uses the default `lein`
script, whereas Homebrew uses a stripped down version named `lein-pkg`.
We tweaked `lein` to speed up the Leiningen JVM startup times, but this
was not ported over to `lein-pkg`. Thanks to Thu Trang Pham, `lein` and
`lein-pkg` are now in sync.

I'll be sure to verify that changes to `lein` is properly ported over to
`lein-pkg`, so that we can avoid the mismatch in the future.

-- Jean Niklas

-- 
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] Ticket - an encrypted ticket/cookie library

2016-02-11 Thread Andrey Antukh
Hi Michael!

Firstly: nice work!

Do you know about JWE? It does just the same thing but in a
standarized/interoperable way:
https://funcool.github.io/buddy-sign/latest/#introduction

Andrey

On Thu, Feb 11, 2016 at 8:21 AM, Michael Ball  wrote:

> Ticket helps create and read encrypted tickets/cookies with expiration
> dates packaged inside. Feedback and security reviews are welcomed.
>
> https://github.com/mikeball/ticket
>
> Mike
>
> --
> 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.
>



-- 
Andrey Antukh - Андрей Антух - 
http://www.niwi.nz
https://github.com/niwinz

-- 
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: Reduce + merge-with error on lazy sequence of maps

2016-02-11 Thread James Reeves
There are a couple of errors in your code:

1. You have no initial value for the reduce, yet your output seems
different to your input
2. prioritized-courses returns a seq, but merge-demand expects a map

My guess is that you only get the error when you hit data in your input
sequence with the same student ID. So if you shorten your input with (take
5 ...) you don't hit the conflict, and you never get the error.

- James

On 12 February 2016 at 04:46, Nathan Smutz  wrote:

> Hi all,
>
> I've had a case where reduce with merging operations throws errors on lazy
> sequences.  I thought I should check in for insight before logging a bug.
> Maybe using maps as keys has something to do with it. too  (I've since
> refactored)
>
> (reduce merge-student-demand everybody)
>
> Throws:
>
> IllegalArgumentException contains? not supported on type:clojure.lang.LazySeq
>  clojure.lang.RT.contains (RT.java:814)
>
> However:
>
> (reduce merge-student-demand (take 5 everybody))
>
> works just fine.
>
> As does:
>
> (merge-student-demand {} (first everybody))
>
> None of my code uses contains? directly, neither does reduce, so I figure
> it must be one of the invocations of merge-with in my code.
> Here are the relevant chunks of code:
>
> ;; I can see how this would produce a LazySeq of hash-maps
> (defn prioritized-courses [needed-courses]
>   (->
> (for [course-set needed-courses
>   :let [demand (course-demand course-set)]]
>   (map #(assoc % :demand demand) (:courses course-set)))
> flatten))
>
> ;; There are two merge-with instances here.  This one is used inside the
> next one.
> (defn merge-demand [acc m]
>   ;; I was admittedly doing something corny here, using a map as a key.
>   (merge-with + acc {{:prefix (:prefix m) :number (:number m)} (:demand
> m)})) ;; Sum demand by course
>
> ;; Merging again here:
> (defn merge-student-demand [acc student]
>   (merge-with merge-demand acc {(:id student) (prioritized-courses
> (:needed-courses student))}))
>
> (reduce merge-student-demand everybody)
>
> => IllegalArgumentException contains? not supported on 
> type:clojure.lang.LazySeq
>  clojure.lang.RT.contains (RT.java:814)
>
> I figure it's likely the Clojure core (1.8.0) merge-with function, being
> the first instance of contains? I could find:
>
> text-mining.core=> (source merge-with)
> (defn merge-with
>   "Returns a map that consists of the rest of the maps conj-ed onto
>   the first.  If a key occurs in more than one map, the mapping(s)
>   from the latter (left-to-right) will be combined with the mapping in
>   the result by calling (f val-in-result val-in-latter)."
>   {:added "1.0"
>:static true}
>   [f & maps]
>   (when (some identity maps)
> (let [merge-entry (fn [m e]
> (let [k (key e) v (val e)]
>   (if (contains? m k);; contains? invoked here
> (assoc m k (f (get m k) v))
> (assoc m k v
>   merge2 (fn [m1 m2]
>(reduce1 merge-entry (or m1 {}) (seq m2)))]
>   (reduce1 merge2 maps
>
> Well that's my mystery.  I should get around to fiddling and seeing if I
> can reproduce this with a more straighforward program.
>
> Best,
> Nathan
>
> --
> 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: [ANN] Ticket - an encrypted ticket/cookie library

2016-02-11 Thread Ghadi Shayban
Btw, ever looked at Macaroons?  Apparently Google uses them internally.

http://research.google.com/pubs/pub41892.html
http://hackingdistributed.com/2014/05/21/my-first-macaroon/

Ghadi

On Thursday, February 11, 2016 at 1:29:56 PM UTC-5, Michael Ball wrote:
>
> Thanks! Yes I looked at JWE, but it just seemed a bit heavy for the need 
> to only store a simple identifier. Interoperability isn't a concern, as 
> tickets rarely if ever shared. I just wanted a simple self contained and 
> easy to use way to package and retrieve identifiers with appropriately 
> chosen encryption and signing algorithms for the common web-app case.
>
>
> On Thursday, February 11, 2016 at 1:36:53 AM UTC-8, Andrey Antukh wrote:
>>
>> Hi Michael!
>>
>> Firstly: nice work!
>>
>> Do you know about JWE? It does just the same thing but in a 
>> standarized/interoperable way: 
>> https://funcool.github.io/buddy-sign/latest/#introduction
>>
>> Andrey
>>
>> On Thu, Feb 11, 2016 at 8:21 AM, Michael Ball  wrote:
>>
>>> Ticket helps create and read encrypted tickets/cookies with expiration 
>>> dates packaged inside. Feedback and security reviews are welcomed.
>>>
>>> https://github.com/mikeball/ticket
>>>
>>> Mike
>>>
>>> -- 
>>> 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.
>>>
>>
>>
>>
>> -- 
>> Andrey Antukh - Андрей Антух - 
>> http://www.niwi.nz
>> https://github.com/niwinz
>>
>

-- 
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: Scripting with Clojure / "slow" boot time

2016-02-11 Thread Ryan Fowler
On Tue, Feb 9, 2016 at 12:36 PM, Alex Miller  wrote:

> I'm doing some research on slow Clojure boot time and would be interested
> in collecting info about example use cases where it's been a problem for
> people.
>

​The following snippet helps me visualize load times. It might be helpful
to others.​ The output is a bit long, so I just added the code and
usage/output in a gist at https://gist.github.com/ryfow/4283b64b4dd205d610e8

​​(def ^:dynamic *indent* 0)
(alter-var-root
 #'clojure.core/load
 (fn [orig]
   (fn [& paths]
 (let [t (System/nanoTime)
   r (binding [*indent* (inc *indent*)]
   (apply orig paths))]
   (binding [*out* *err*]
 (println (apply str (repeat *indent* " ")) (/ (- (System/nanoTime)
t) 100.0)  paths)
 (flush))
   r

;; Require namespace in question here
(require 'clojure.core.async)

-- 
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] Ticket - an encrypted ticket/cookie library

2016-02-11 Thread Michael Ball
I haven't, but definitely will look into macaroon for ideas.


On Thursday, February 11, 2016 at 11:44:42 AM UTC-8, Ghadi Shayban wrote:
>
> Btw, ever looked at Macaroons?  Apparently Google uses them internally.
>
> http://research.google.com/pubs/pub41892.html
> http://hackingdistributed.com/2014/05/21/my-first-macaroon/
>
> Ghadi
>
> On Thursday, February 11, 2016 at 1:29:56 PM UTC-5, Michael Ball wrote:
>>
>> Thanks! Yes I looked at JWE, but it just seemed a bit heavy for the need 
>> to only store a simple identifier. Interoperability isn't a concern, as 
>> tickets rarely if ever shared. I just wanted a simple self contained and 
>> easy to use way to package and retrieve identifiers with appropriately 
>> chosen encryption and signing algorithms for the common web-app case.
>>
>>
>> On Thursday, February 11, 2016 at 1:36:53 AM UTC-8, Andrey Antukh wrote:
>>>
>>> Hi Michael!
>>>
>>> Firstly: nice work!
>>>
>>> Do you know about JWE? It does just the same thing but in a 
>>> standarized/interoperable way: 
>>> https://funcool.github.io/buddy-sign/latest/#introduction
>>>
>>> Andrey
>>>
>>> On Thu, Feb 11, 2016 at 8:21 AM, Michael Ball  wrote:
>>>
 Ticket helps create and read encrypted tickets/cookies with expiration 
 dates packaged inside. Feedback and security reviews are welcomed.

 https://github.com/mikeball/ticket

 Mike

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

>>>
>>>
>>>
>>> -- 
>>> Andrey Antukh - Андрей Антух - 
>>> http://www.niwi.nz
>>> https://github.com/niwinz
>>>
>>

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


conditional logic implemented as pattern-matching and restructuring in the signature of the function

2016-02-11 Thread Colin Taylor
Defm does this too though I've never got round to fully finishing it.

(defm file-or-string-fn []
  ([File] (println "It's a file"))
  ([s :- String] (println "It's a string " s))
  (["magic"] (println "It's magic"))
  ([_] (println "It's a " (type _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: “compiling” stacktrace error

2016-02-11 Thread Sean Corfield
Scaramaccai wrote on Thursday, February 11, 2016 at 8:32 AM:
>I'm learning Clojure, and I find difficult to understand where a specific 
>compiler error happens:

The stacktraces can be pretty daunting at first, unfortunately.

How are you compiling / running the code? That will have some bearing on how 
errors are reported.

The exception you are seeing is a runtime failure so part of the stacktrace 
will show the line that initiated the call — line 100 — but other parts of the 
stacktrace should provide the path to the actual exception.

>java.lang.ClassCastException: java.lang.Long cannot be cast to 
>clojure.lang.IPersistentCollection, compiling:(fwpd/core.clj:100:1)

I created a new Clojure app with this as the main namespace:

(ns fib3.core
  (:gen-class))

(defn fib-seq3
  ([to]
   (fib-seq3 [] 0 1 0 to))
  ([coll a b k to]
   (if (= k to)
 coll
 (fib-seq3 (conj b coll) b (+ a b) (inc k) to

(defn -main
  "I don't do a whole lot ... yet."
  [& args]
  (println (fib-seq3 5)))

When I run this (via Boot — see below for Leiningen), I get:

 clojure.lang.ExceptionInfo: java.lang.ClassCastException: 
java.lang.Long cannot be cast to clojure.lang.IPersistentCollection
...
clojure.core/conj/invokeStatic  core.clj:   82
  clojure.core/conj  core.clj:   82
fib3.core/fib-seq3/invokeStatic  core.clj:   10
 fib3.core/fib-seq3  core.clj:4
fib3.core/fib-seq3/invokeStatic  core.clj:6
 fib3.core/fib-seq3  core.clj:4
   fib3.core/-main/invokeStatic  core.clj:   15
fib3.core/-main  core.clj:   12


Line 10 is (fib-seq3 (conj b coll) b (+ a b) (inc k) to)

Reading bottom to top for lines reported in our code we see:

-main is defined on line 12
-main makes a call on line 15 to…
fib-seq3 which is defined on line 4…
…which makes a call on line 6 to…
fib-seq3 which is defined on line 4…
…which makes a call on line 10 to…
clojure.core/conj which is where the failure occurs.

Since I have direct linking enabled with Boot, I wanted to check whether 
running the code via Leiningen was different (where I do not have direct 
linking enabled):

Exception in thread "main" java.lang.ClassCastException: java.lang.Long cannot 
be cast to clojure.lang.IPersistentCollection, 
compiling:(/private/var/folders/p1/30gnjddx6p193frh670pl8nhgn/T/form-init8259964769198669862.clj:1:125)
…
Caused by: java.lang.ClassCastException: java.lang.Long cannot be cast to 
clojure.lang.IPersistentCollection
at clojure.core$conj__4345.invokeStatic(core.clj:82)
at clojure.core$conj__4345.invoke(core.clj:82)
at fib3.core$fib_seq3.invokeStatic(core.clj:10)
at fib3.core$fib_seq3.invoke(core.clj:4)
at fib3.core$fib_seq3.invokeStatic(core.clj:6)
at fib3.core$fib_seq3.invoke(core.clj:4)
at fib3.core$_main.invokeStatic(core.clj:15)
at fib3.core$_main.doInvoke(core.clj:12)

I omitted the top-level stacktrace (because it relates to clojure.main which is 
in turn running the actual code above) but in the cause we see the same 
sequence of line numbers as with Boot above.


Does that help?

Sean Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood




-- 
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: Scripting with Clojure / "slow" boot time

2016-02-11 Thread Alex Miller
Nice! I have some stuff similar to this I use, but this is nicely packaged.

On Thu, Feb 11, 2016 at 2:30 PM, Ryan Fowler 
wrote:

> On Tue, Feb 9, 2016 at 12:36 PM, Alex Miller  wrote:
>
>> I'm doing some research on slow Clojure boot time and would be interested
>> in collecting info about example use cases where it's been a problem for
>> people.
>>
>
> ​The following snippet helps me visualize load times. It might be helpful
> to others.​ The output is a bit long, so I just added the code and
> usage/output in a gist at
> https://gist.github.com/ryfow/4283b64b4dd205d610e8
>
> ​​(def ^:dynamic *indent* 0)
> (alter-var-root
>  #'clojure.core/load
>  (fn [orig]
>(fn [& paths]
>  (let [t (System/nanoTime)
>r (binding [*indent* (inc *indent*)]
>(apply orig paths))]
>(binding [*out* *err*]
>  (println (apply str (repeat *indent* " ")) (/ (-
> (System/nanoTime) t) 100.0)  paths)
>  (flush))
>r
>
> ;; Require namespace in question here
> (require 'clojure.core.async)
>
>
>
>

-- 
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: Suchwow 5.0.0

2016-02-11 Thread Brian Marick
Suchwow is my grab-bag library of Clojure functions. 5.0.0 is a major 
version bump because I dropped support of Clojure 1.5.


Otherwise, it adds a few new functions plus one potentially significant 
new namespace.


In two jobs, I've wanted to slurp in tabular data (CSV or relational 
queries) and get fast-ish access to parts of it. This basically means 
building indexes to allow quick'n'easy access into (implicit) 
hierarchical structures represented as flat collections of maps.


`such.relational` has some functions to help with that. It also adds new 
doc strings to the relational parts of `clojure.set`, as the existing 
doc strings are perhaps not as clear as the impartial observer might wish.


API: http://marick.github.io/suchwow/such.relational.html
Narrative description: 
https://github.com/marick/suchwow/wiki/such.relational


Enjoy.

Comments welcome.

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, 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.


Reduce + merge-with error on lazy sequence of maps

2016-02-11 Thread Nathan Smutz
Hi all,

I've had a case where reduce with merging operations throws errors on lazy 
sequences.  I thought I should check in for insight before logging a bug. 
 Maybe using maps as keys has something to do with it. too  (I've since 
refactored)

(reduce merge-student-demand everybody)

Throws: 

IllegalArgumentException contains? not supported on type:clojure.lang.LazySeq 
 clojure.lang.RT.contains (RT.java:814)

However: 

(reduce merge-student-demand (take 5 everybody)) 

works just fine.  

As does:
 
(merge-student-demand {} (first everybody))

None of my code uses contains? directly, neither does reduce, so I figure 
it must be one of the invocations of merge-with in my code.
Here are the relevant chunks of code:

;; I can see how this would produce a LazySeq of hash-maps
(defn prioritized-courses [needed-courses]
  (-> 
(for [course-set needed-courses
  :let [demand (course-demand course-set)]]  
  (map #(assoc % :demand demand) (:courses course-set))) 
flatten))

;; There are two merge-with instances here.  This one is used inside the 
next one.
(defn merge-demand [acc m]
  ;; I was admittedly doing something corny here, using a map as a key.
  (merge-with + acc {{:prefix (:prefix m) :number (:number m)} (:demand 
m)})) ;; Sum demand by course

;; Merging again here:
(defn merge-student-demand [acc student]
  (merge-with merge-demand acc {(:id student) (prioritized-courses 
(:needed-courses student))})) 

(reduce merge-student-demand everybody)

=> IllegalArgumentException contains? not supported on 
type:clojure.lang.LazySeq 
 clojure.lang.RT.contains (RT.java:814)

I figure it's likely the Clojure core (1.8.0) merge-with function, being 
the first instance of contains? I could find:

text-mining.core=> (source merge-with)
(defn merge-with
  "Returns a map that consists of the rest of the maps conj-ed onto
  the first.  If a key occurs in more than one map, the mapping(s)
  from the latter (left-to-right) will be combined with the mapping in
  the result by calling (f val-in-result val-in-latter)."
  {:added "1.0"
   :static true}
  [f & maps]
  (when (some identity maps)
(let [merge-entry (fn [m e]
(let [k (key e) v (val e)]
  (if (contains? m k);; contains? invoked here
(assoc m k (f (get m k) v))
(assoc m k v
  merge2 (fn [m1 m2]
   (reduce1 merge-entry (or m1 {}) (seq m2)))]
  (reduce1 merge2 maps

Well that's my mystery.  I should get around to fiddling and seeing if I 
can reproduce this with a more straighforward program.

Best,
Nathan

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


“compiling” stacktrace error

2016-02-11 Thread Scaramaccai


I'm learning Clojure, and I find difficult to understand *where* a specific 
compiler error happens:


java.lang.ClassCastException: java.lang.Long cannot be cast to 
clojure.lang.IPersistentCollection, compiling:(fwpd/core.clj:100:1)


Line 100 is just:


(fib-seq3 5)


So it says nothing, because in fact the error is in the fib-seq3 function 
(parameters to a "conj" call are inverted, see below).


Is this normal? No way to know where an error is???


Just for reference, here's the code (again, *I know where the error is*; I 
just don't understand how was I supposed to find it, given that the message 
doesn't tell me at which line it happens):


(defn fib-seq3
  ([to]
   (fib-seq3 [] 0 1 0 to))
  ([coll a b k to]
(if (= k to)
  coll
  (fib-seq3 (conj b coll) b (+ a b) (inc k) to)))
(fib-seq3 5)



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.


Welcome the new maintainer of Loom: Paul Snyder

2016-02-11 Thread Aysylu Greenberg
I'm pleased to announce that Paul Snyder (@pataprogramming, pataprogramming 
on Github ) has joined me in 
maintaining Loom. I'm excited for the coming year for Loom 
, with more excellent contributions 
accepted faster.

Cheers,
Aysylu

https://twitter.com/aysylu22/status/697751663642284032

-- 
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] Ticket - an encrypted ticket/cookie library

2016-02-11 Thread Michael Ball
Thanks! Yes I looked at JWE, but it just seemed a bit heavy for the need to 
only store a simple identifier. Interoperability isn't a concern, as 
tickets rarely if ever shared. I just wanted a simple self contained and 
easy to use way to package and retrieve identifiers with appropriately 
chosen encryption and signing algorithms for the common web-app case.


On Thursday, February 11, 2016 at 1:36:53 AM UTC-8, Andrey Antukh wrote:
>
> Hi Michael!
>
> Firstly: nice work!
>
> Do you know about JWE? It does just the same thing but in a 
> standarized/interoperable way: 
> https://funcool.github.io/buddy-sign/latest/#introduction
>
> Andrey
>
> On Thu, Feb 11, 2016 at 8:21 AM, Michael Ball  > wrote:
>
>> Ticket helps create and read encrypted tickets/cookies with expiration 
>> dates packaged inside. Feedback and security reviews are welcomed.
>>
>> https://github.com/mikeball/ticket
>>
>> Mike
>>
>> -- 
>> 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.
>>
>
>
>
> -- 
> Andrey Antukh - Андрей Антух - 
> http://www.niwi.nz
> https://github.com/niwinz
>

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