Re: :npm-deps and transitive dependencies

2018-01-16 Thread Lucas Wiener
I now realise that this question might belong to the ClojureScript group, 
so I'm posting it there as well. Feel free to remove this thread if you 
want.

Den måndag 15 januari 2018 kl. 09:01:55 UTC+1 skrev Lucas Wiener:
>
> Hi,
>
> I have the following clojurescript project dependency setup: X -> Y (X has 
> stated Y in :dependencies). Now, I would like Y to depend on a npm 
> javascript library Z. Following the guides, I added :npm-deps to one of the 
> builds specified in Y. When I build and run Y, everything works fine with 
> the new Z dependency. However, building/running project X now fails since 
> the dependency Z cannot be found. From what I currently know, there are two 
> approaches to get X running again:
>
> 1) Specify Z as an :npm-deps also in the project X builds. This is not 
> very elegant since the union of all dependencies now cascade to the top 
> level projects. Also, this approach would fail when transitive dependencies 
> need different versions of the same dependency.
> 2) Compile Y into a bundle. Then X would depend on the prebuilt bundle of 
> Y (which already includes Z). This is not perfect since it requires an 
> extra processing step in Y, making lein checkouts a bit more troublesome 
> etc. Also, my intuition tells me that this might affect code splitting, 
> compilation optimizations, dead code elimination, etc. in a negative way.
>
> Am I missing something?
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


:npm-deps and transitive dependencies

2018-01-15 Thread Lucas Wiener
Hi,

I have the following clojurescript project dependency setup: X -> Y (X has 
stated Y in :dependencies). Now, I would like Y to depend on a npm 
javascript library Z. Following the guides, I added :npm-deps to one of the 
builds specified in Y. When I build and run Y, everything works fine with 
the new Z dependency. However, building/running project X now fails since 
the dependency Z cannot be found. From what I currently know, there are two 
approaches to get X running again:

1) Specify Z as an :npm-deps also in the project X builds. This is not very 
elegant since the union of all dependencies now cascade to the top level 
projects. Also, this approach would fail when transitive dependencies need 
different versions of the same dependency.
2) Compile Y into a bundle. Then X would depend on the prebuilt bundle of Y 
(which already includes Z). This is not perfect since it requires an extra 
processing step in Y, making lein checkouts a bit more troublesome etc. 
Also, my intuition tells me that this might affect code splitting, 
compilation optimizations, dead code elimination, etc. in a negative way.

Am I missing something?

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Spec - is there any way to tell which keys are not described by a spec?

2018-01-14 Thread Lucas Wiener

>
> Turns out it does not do what I thought it would when I initially looked 
> at it. I would like something that does similar to possible-keyspec-typos 
> but kinda the reverse. Instead of reporting missing keys found in the spec, 
> I would like it to report keys that are present in the data but not in the 
> spec. I'm going to try to make some kind of gist with functions that does 
> this, surely the resources you linked to will be helpful as a base for that.


Den fredag 5 januari 2018 kl. 23:16:11 UTC+1 skrev Lucas Wiener:
>
> Ah, yes that seems to be what I want exactly.
>
> Thank you, I'll give it a shot.
>
> Den fredag 5 januari 2018 kl. 20:53:55 UTC+1 skrev Josh Tilles:
>>
>> I think Stu Halloway’s proof-of-concept is at least close to what you 
>> want: 
>> https://gist.github.com/stuarthalloway/f4c4297d344651c99827769e1c3d34e9.
>>
>> (Here’s the context 
>> <https://groups.google.com/forum/#!topic/clojure/i8Rz-AnCoa8> for that 
>> code, in case you were curious.)
>>
>> btw, you might want to take a look at the spec-provider 
>> <https://github.com/stathissideris/spec-provider> library, too. It’s not 
>> exactly what you were asking for, but I think it could help you quickly 
>> create (rough, approximate) specs that incorporate all witnessed keys.
>>
>> On Friday, January 5, 2018 at 11:49:15 AM UTC-5, Lucas Wiener wrote:
>>>
>>> Hi,
>>>
>>> I'm writing a spec for a fairly complex data structure. One thing that I 
>>> have identified troublesome is that I currently have no clue how "well" my 
>>> spec describes my data. I keep iterating the spec, thinking that I have 
>>> described all fields but then it turns out later that I've missed 
>>> something. I would love some kind of functionality that tells me which keys 
>>> are present in my data that are not described in my spec. I'm aware of the 
>>> design principle that a spec should not be limiting to having extra data 
>>> and I totally support that. However, at development time I think it would 
>>> be useful to have something that tells me "keys :x, :y, :z are not in the 
>>> spec" or "the spec describes a subset of the given data". Is this possible?
>>>
>>> Kind Regards
>>> Lucas Wiener
>>>
>>

-- 
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 - is there any way to tell which keys are not described by a spec?

2018-01-05 Thread Lucas Wiener
Ah, yes that seems to be what I want exactly.

Thank you, I'll give it a shot.

Den fredag 5 januari 2018 kl. 20:53:55 UTC+1 skrev Josh Tilles:
>
> I think Stu Halloway’s proof-of-concept is at least close to what you 
> want: 
> https://gist.github.com/stuarthalloway/f4c4297d344651c99827769e1c3d34e9.
>
> (Here’s the context 
> <https://groups.google.com/forum/#!topic/clojure/i8Rz-AnCoa8> for that 
> code, in case you were curious.)
>
> btw, you might want to take a look at the spec-provider 
> <https://github.com/stathissideris/spec-provider> library, too. It’s not 
> exactly what you were asking for, but I think it could help you quickly 
> create (rough, approximate) specs that incorporate all witnessed keys.
>
> On Friday, January 5, 2018 at 11:49:15 AM UTC-5, Lucas Wiener wrote:
>>
>> Hi,
>>
>> I'm writing a spec for a fairly complex data structure. One thing that I 
>> have identified troublesome is that I currently have no clue how "well" my 
>> spec describes my data. I keep iterating the spec, thinking that I have 
>> described all fields but then it turns out later that I've missed 
>> something. I would love some kind of functionality that tells me which keys 
>> are present in my data that are not described in my spec. I'm aware of the 
>> design principle that a spec should not be limiting to having extra data 
>> and I totally support that. However, at development time I think it would 
>> be useful to have something that tells me "keys :x, :y, :z are not in the 
>> spec" or "the spec describes a subset of the given data". Is this possible?
>>
>> Kind Regards
>> Lucas Wiener
>>
>

-- 
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 - is there any way to tell which keys are not described by a spec?

2018-01-05 Thread Lucas Wiener
Hi,

I'm writing a spec for a fairly complex data structure. One thing that I 
have identified troublesome is that I currently have no clue how "well" my 
spec describes my data. I keep iterating the spec, thinking that I have 
described all fields but then it turns out later that I've missed 
something. I would love some kind of functionality that tells me which keys 
are present in my data that are not described in my spec. I'm aware of the 
design principle that a spec should not be limiting to having extra data 
and I totally support that. However, at development time I think it would 
be useful to have something that tells me "keys :x, :y, :z are not in the 
spec" or "the spec describes a subset of the given data". Is this possible?

Kind Regards
Lucas Wiener

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


(doseq/lazy/interop)? problem, different behaviour when adding a println

2017-04-22 Thread Lucas Wiener
Hi all,

I'm working on solving the problem http://adventofcode.com/2016/day/11 , 
and ran into some weird behaviour. I have solved the actual problem, so 
let's not focus on it.

Here's my code:

(defn compute3
  {:test (fn []
   (is= (compute3 (create-state "F4 .  .  .  .  .  "
"F3 .  .  .  LG .  "
"F2 .  HG .  .  .  "
"F1 E  .  HM .  LM "))
11))}
  [state]
  (let [done-simple-state (state->simple-state (construct-finished-state 
state))
inner-fn (fn [states steps java-memory-map]
   (println "On step" steps)
   (println "Number of states" (count states))
   (let [next-states (->> states
  (map (fn [state]
 (->> (get-next-states 
state)
  (filter (fn [s] (nil? 
(.get java-memory-map (state->simple-state s
  (flatten))]
 ;; (println (count next-states)) <- Uncomment this 
line to change the behavior
 (if (.get java-memory-map done-simple-state)
   steps
   (do (doseq [next-state next-states]
 (.put java-memory-map (state->simple-state 
next-state) steps))
   (recur next-states (inc steps) 
java-memory-map)]
(inner-fn [state] 0 (java.util.HashMap.

When running this in the repl I get the following output:

On step 0
Number of states 1
On step 1
Number of states 1
On step 2
Number of states 3
On step 3
Number of states 11
On step 4
Number of states 14
On step 5
Number of states 22
On step 6
Number of states 37
On step 7
Number of states 48
On step 8
Number of states 35
On step 9
Number of states 22
On step 10
Number of states 17
On step 11
Number of states 7

However, if I uncomment the println statement I get the following output in 
the REPL:

On step 0
Number of states 1
1
On step 1
Number of states 1
3
On step 2
Number of states 3
11
On step 3
Number of states 11
15
On step 4
Number of states 15
28
On step 5
Number of states 28
63
On step 6
Number of states 63
107
On step 7
Number of states 107
90
On step 8
Number of states 90
82
On step 9
Number of states 82
115
On step 10
Number of states 115
81
On step 11
Number of states 81
110

Please note that "On step 4" prints "Number of states 14" and "Number of 
states 15"  differently.

Any thoughts?

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