Re: Transient Collection Identity

2016-04-22 Thread Alex Miller
transient collections collect values in an internal (mutable) data 
structure and periodically add them in batch. So you will typically see the 
identical value returned for a while, then it will change.

You should *always* use the return value - the same usage pattern as with 
persistent collections.

On Friday, April 22, 2016 at 2:38:14 PM UTC-5, JvJ wrote:
>
>
> While doing operations on transient collections, I've noticed that the 
> result of assoc! or conj! is always identical to the original structure 
> (i.e. it satisfies "identical?", and is not merely equivalent).
>
> Is this always the case, or can the return value of assoc! or conj! 
> sometimes be a different object?
>

-- 
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: Possible bug with (keys some-container) in a try-catch?

2016-04-22 Thread Kevin Downey
keys is lazy, you see the exception at the repl because printing out the
result forces the sequence, but if you don't do anything with the result
then it isn't forced, so no errors.

On 04/22/2016 01:28 PM, Steve Riley wrote:
> I am trying to determine if a container, x, passed to a function, is a
> map or not.
> 
> If I evaluation (keys x) at a REPL prompt, and, x is instantiated list,
> vector or set, I will get a java.lang.ClassCastException that some item
> in x cannot be cast to java.util.Map$Entry.
> 
> On the other hand, if I evaluate (try (keys x) true), the form evaluates
> to true. It will also evaluation to true if I add a catch expression
> with the last value of false. I've tried catching both
> ClassCastException and just Exception.
> 
> (try (/ 10 0) true (catch ArithmeticException _ "divide by zero!"))
> and (try (/ 10 1) true (catch ArithmeticException _ "divide by zero!")),
> for example, evaluate as expected.
> 
> Is this a feature I don't understand?
> 
> Some of you may recognize the 4Clojure problem I am working on. I'm not
> interested in solutions to that problem...just curious about this
> behavior and if there is something I am missing in the try (keys x)
> catch formulation.
> 
> Many thanks 
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to clojure+unsubscr...@googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.


-- 
And what is good, Phaedrus,
And what is not good—
Need we ask anyone to tell us these things?

-- 
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: Possible bug with (keys some-container) in a try-catch?

2016-04-22 Thread Alex Miller
(keys x) is a lazy seq so in (try (keys x) true), the (keys x) is created 
but not realized so the error is not discovered. The REPL will print the 
result, which requires the values to be realized.


On Friday, April 22, 2016 at 3:37:07 PM UTC-5, Steve Riley wrote:
>
> I am trying to determine if a container, x, passed to a function, is a map 
> or not.
>
> If I evaluation (keys x) at a REPL prompt, and, x is instantiated list, 
> vector or set, I will get a java.lang.ClassCastException that some item in 
> x cannot be cast to java.util.Map$Entry.
>
> On the other hand, if I evaluate (try (keys x) true), the form evaluates 
> to true. It will also evaluation to true if I add a catch expression with 
> the last value of false. I've tried catching both ClassCastException and 
> just Exception.
>
> (try (/ 10 0) true (catch ArithmeticException _ "divide by zero!")) 
> and (try (/ 10 1) true (catch ArithmeticException _ "divide by zero!")), 
> for example, evaluate as expected.
>
> Is this a feature I don't understand?
>
> Some of you may recognize the 4Clojure problem I am working on. I'm not 
> interested in solutions to that problem...just curious about this behavior 
> and if there is something I am missing in the try (keys x) catch 
> formulation.
>
> Many thanks 
>

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


Possible bug with (keys some-container) in a try-catch?

2016-04-22 Thread Steve Riley
I am trying to determine if a container, x, passed to a function, is a map 
or not.

If I evaluation (keys x) at a REPL prompt, and, x is instantiated list, 
vector or set, I will get a java.lang.ClassCastException that some item in 
x cannot be cast to java.util.Map$Entry.

On the other hand, if I evaluate (try (keys x) true), the form evaluates to 
true. It will also evaluation to true if I add a catch expression with the 
last value of false. I've tried catching both ClassCastException and just 
Exception.

(try (/ 10 0) true (catch ArithmeticException _ "divide by zero!")) 
and (try (/ 10 1) true (catch ArithmeticException _ "divide by zero!")), 
for example, evaluate as expected.

Is this a feature I don't understand?

Some of you may recognize the 4Clojure problem I am working on. I'm not 
interested in solutions to that problem...just curious about this behavior 
and if there is something I am missing in the try (keys x) catch 
formulation.

Many thanks 

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


Re: Transient Collection Identity

2016-04-22 Thread Timothy Baldridge
The answer is that you should treat them as you would persistent
structures. It's true that they don't always change, but they may
eventually change and without notice. For vectors this will be somewhere in
the range of once every 32 conj! calls, but could change in a future
version of clojure, so don't count on it.

As the docs say: "Don’t bash in place"

http://clojure.org/reference/transients

On Fri, Apr 22, 2016 at 1:38 PM, JvJ  wrote:

>
> While doing operations on transient collections, I've noticed that the
> result of assoc! or conj! is always identical to the original structure
> (i.e. it satisfies "identical?", and is not merely equivalent).
>
> Is this always the case, or can the return value of assoc! or conj!
> sometimes be a different object?
>
> --
> 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.
>



-- 
“One of the main causes of the fall of the Roman Empire was that–lacking
zero–they had no way to indicate successful termination of their C
programs.”
(Robert Firth)

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


Transient Collection Identity

2016-04-22 Thread JvJ

While doing operations on transient collections, I've noticed that the 
result of assoc! or conj! is always identical to the original structure 
(i.e. it satisfies "identical?", and is not merely equivalent).

Is this always the case, or can the return value of assoc! or conj! 
sometimes be a different object?

-- 
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] es-boat - an expert system for coastal navigation

2016-04-22 Thread ru
Thank you, Ivh, for finding my project!

пятница, 22 апреля 2016 г., 16:57:31 UTC+3 пользователь lvh ‌ написал:
>
> I couldn’t find a link to your project, but I think this is it: 
> https://github.com/rururu/es-boat
>
> Looks awesome!! Thanks for showing :D
>
> On Apr 22, 2016, at 8:50 AM, ru > wrote:
>
> Hi,
>
> A prototype of an expert system for coastal navigation - test example for 
> the rete4frames  expert system 
> shell - complex Clojure-ClojureScript client-server application.
>
> It uses:
>
>  - Protege-3.5 ontology editor  as a 
> knowledge representation system and GUI,
>
>  - OpenStreetMap  API as a data 
> source web service, 
>
>  - Leaflet  JavaScript library and Cesium 
>  WebGL virtual globe and map engine for 
> visualization,
>
>  - different auxiliary Clojure and ClojureScript libraries. 
>
> Work in progress.
>
> Enjoy,
>
> --ru
>
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@googlegroups.com 
> Note that posts from new members are moderated - please be patient with 
> your first post.
> To unsubscribe from this group, send email to
> clojure+u...@googlegroups.com 
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to clojure+u...@googlegroups.com .
> For more options, visit https://groups.google.com/d/optout.
>
>
>

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


Re: [ANN] es-boat - an expert system for coastal navigation

2016-04-22 Thread lvh
I couldn’t find a link to your project, but I think this is it: 
https://github.com/rururu/es-boat 

Looks awesome!! Thanks for showing :D

> On Apr 22, 2016, at 8:50 AM, ru  wrote:
> 
> Hi,
> 
> A prototype of an expert system for coastal navigation - test example for the 
> rete4frames  expert system shell - 
> complex Clojure-ClojureScript client-server application.
> 
> It uses:
> 
>  - Protege-3.5 ontology editor  as a knowledge 
> representation system and GUI,
> 
>  - OpenStreetMap  API as a data 
> source web service, 
> 
>  - Leaflet  JavaScript library and Cesium 
>  WebGL virtual globe and map engine for visualization,
> 
>  - different auxiliary Clojure and ClojureScript libraries. 
> 
> Work in progress.
> 
> Enjoy,
> 
> --ru
> 
> 
> -- 
> 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.


[ANN] es-boat - an expert system for coastal navigation

2016-04-22 Thread ru
Hi,

A prototype of an expert system for coastal navigation - test example for 
the rete4frames  expert system shell 
- complex Clojure-ClojureScript client-server application.

It uses:

 - Protege-3.5 ontology editor  as a 
knowledge representation system and GUI,

 - OpenStreetMap  API as a data 
source web service, 

 - Leaflet  JavaScript library and Cesium 
 WebGL virtual globe and map engine for 
visualization,

 - different auxiliary Clojure and ClojureScript libraries. 

Work in progress.

Enjoy,

--ru

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