How to work with photos in Clojure

2016-07-19 Thread Cecil Westerhof
It never hurts to combine things. I just started again with Clojure and I
started with taking photos. In doing the latter I found out that I can take
nice pictures of insects. But they mostly only take a part of the photo. At
the moment I am using Image Magick on the command line with trial and error
to crop the right part of the photo. For example:
https://www.instagram.com/p/BH7r97NgvFX/

But this is a ‘bit’ of work. So I was thinking about writing a Clojure
program to do the cropping for me. That would save me a lot of time I think
and the best way to learn a language is to use it. I think I could manage
most parts, but I need a little help.

My pictures have a dimension of 5,184x3,456 and I need to make a crop of
1.080x1.080. This is a little to big for my screen. So I am thinking about
dividing everything by 8.

I need to know two things:
- How would I display the picture as a 648x432 picture?
- How do I draw a square of 135x135 on it? So I can select what to crop.

There are some other things to find out. But those I can find out for
myself I would think. ;-)

Would anyone be interested in something like this? Then I could share it on
GitHub.
If anyone has ideas for other functionalities: let me know.
I have myself a few:
- Posting the picture on Instagram (and others) from the program.
- Putting the pictures into SQLite.
- Something to select pictures out of a range.
- …

How easy is it to use Clojure to work with InstaGram, LinkedIn, FaceBook,
Google+ and Twitter?

-- 
Cecil Westerhof

-- 
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 work with photos in Clojure

2016-07-19 Thread Miguel Ping
If you want to learn clojure by image processing, thats fine, but if your 
goal is to do the image processing part rather sooner than later, I 
recommend using an external lib like imagemagick or sharp 
(http://sharp.dimens.io/en/stable/) to do that for you, and hook it via FFI.

As for interacting with instagram, linkedin, etc - there should be libs out 
there for that. If there are no libs, its easy to consume those service's 
APIs via clojure.

On Tuesday, July 19, 2016 at 8:26:15 AM UTC+1, Cecil Westerhof wrote:
>
> It never hurts to combine things. I just started again with Clojure and I 
> started with taking photos. In doing the latter I found out that I can take 
> nice pictures of insects. But they mostly only take a part of the photo. At 
> the moment I am using Image Magick on the command line with trial and error 
> to crop the right part of the photo. For example:
> https://www.instagram.com/p/BH7r97NgvFX/
>
> But this is a ‘bit’ of work. So I was thinking about writing a Clojure 
> program to do the cropping for me. That would save me a lot of time I think 
> and the best way to learn a language is to use it. I think I could manage 
> most parts, but I need a little help.
>
> My pictures have a dimension of 5,184x3,456 and I need to make a crop of 
> 1.080x1.080. This is a little to big for my screen. So I am thinking about 
> dividing everything by 8.
>
> I need to know two things:
> - How would I display the picture as a 648x432 picture?
> - How do I draw a square of 135x135 on it? So I can select what to crop.
>
> There are some other things to find out. But those I can find out for 
> myself I would think. ;-)
>
> Would anyone be interested in something like this? Then I could share it 
> on GitHub.
> If anyone has ideas for other functionalities: let me know.
> I have myself a few:
> - Posting the picture on Instagram (and others) from the program.
> - Putting the pictures into SQLite.
> - Something to select pictures out of a range.
> - …
>
> How easy is it to use Clojure to work with InstaGram, LinkedIn, FaceBook, 
> Google+ and Twitter?
>
> -- 
> Cecil Westerhof
>

-- 
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 work with photos in Clojure

2016-07-19 Thread Cecil Westerhof
2016-07-19 10:23 GMT+02:00 Miguel Ping :

> If you want to learn clojure by image processing, thats fine, but if your
> goal is to do the image processing part rather sooner than later, I
> recommend using an external lib like imagemagick or sharp (
> http://sharp.dimens.io/en/stable/) to do that for you, and hook it via
> FFI.
>

​I was (in the first instance) planning to use just Image Magick like I do
now. The only thing I wanted was to display the picture, move the rectangle
around to select the part to crop and then let Image Magick do the
cropping. But your link says sharp is 4-5 times as fast, so I probably
should switch.​

Maybe I could use sharp to convert from 5.184x3.456 to 648x432 and then
display that. But how can I then draw the outline of a square on it to
select the part to crop?

(And maybe I should display that part separately while selecting. But that
will be phase two.)


​By the way: what is better to use for GUI? JavaFX or S​wing? JavaFX is the
better technology (I understood), but maybe SeeSaw is more mature.


As for interacting with instagram, linkedin, etc - there should be libs out
> there for that. If there are no libs, its easy to consume those service's
> APIs via clojure.
>

​I will look into it. But first my crop program. ;-)



> On Tuesday, July 19, 2016 at 8:26:15 AM UTC+1, Cecil Westerhof wrote:
>>
>> It never hurts to combine things. I just started again with Clojure and I
>> started with taking photos. In doing the latter I found out that I can take
>> nice pictures of insects. But they mostly only take a part of the photo. At
>> the moment I am using Image Magick on the command line with trial and error
>> to crop the right part of the photo. For example:
>> https://www.instagram.com/p/BH7r97NgvFX/
>>
>> But this is a ‘bit’ of work. So I was thinking about writing a Clojure
>> program to do the cropping for me. That would save me a lot of time I think
>> and the best way to learn a language is to use it. I think I could manage
>> most parts, but I need a little help.
>>
>> My pictures have a dimension of 5,184x3,456 and I need to make a crop of
>> 1.080x1.080. This is a little to big for my screen. So I am thinking about
>> dividing everything by 8.
>>
>> I need to know two things:
>> - How would I display the picture as a 648x432 picture?
>> - How do I draw a square of 135x135 on it? So I can select what to crop.
>>
>> There are some other things to find out. But those I can find out for
>> myself I would think. ;-)
>>
>> Would anyone be interested in something like this? Then I could share it
>> on GitHub.
>> If anyone has ideas for other functionalities: let me know.
>> I have myself a few:
>> - Posting the picture on Instagram (and others) from the program.
>> - Putting the pictures into SQLite.
>> - Something to select pictures out of a range.
>> - …
>>
>> How easy is it to use Clojure to work with InstaGram, LinkedIn, FaceBook,
>> Google+ and Twitter?
>>
>
-- 
Cecil Westerhof

-- 
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 work with photos in Clojure

2016-07-19 Thread Cecil Westerhof
2016-07-19 10:49 GMT+02:00 Cecil Westerhof :

> 2016-07-19 10:23 GMT+02:00 Miguel Ping :
>
>> If you want to learn clojure by image processing, thats fine, but if your
>> goal is to do the image processing part rather sooner than later, I
>> recommend using an external lib like imagemagick or sharp (
>> http://sharp.dimens.io/en/stable/) to do that for you, and hook it via
>> FFI.
>>
>
> ​I was (in the first instance) planning to use just Image Magick like I do
> now. The only thing I wanted was to display the picture, move the rectangle
> around to select the part to crop and then let Image Magick do the
> cropping. But your link says sharp is 4-5 times as fast, so I probably
> should switch.​
>

​Well I get:
npm ERR! sharp@0.15.1 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sharp@0.15.1 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the sharp package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project
with:
npm ERR! npm bugs sharp
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls sharp
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /root/npm-debug.log


So I think I begin with the Image Magick version and migrate later.

-- 
Cecil Westerhof

-- 
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 work with photos in Clojure

2016-07-19 Thread Karl Blomström
Hello Cecil!

If you want to work with the instagram API I've put together a library that
simplifies the retrieval of the necessary oauth2 token. Maybe you will find
it useful!

Please see https://github.com/blmstrm/loudmoauth
and here is an example using the library with instagram among other APIs
https://github.com/blmstrm/loudmoauth-examples/blob/master/src/loudmoauth_examples/core.clj

Cheers,

blmstrm

Den 19 juli 2016 4:26 em skrev "Cecil Westerhof" :

> It never hurts to combine things. I just started again with Clojure and I
> started with taking photos. In doing the latter I found out that I can take
> nice pictures of insects. But they mostly only take a part of the photo. At
> the moment I am using Image Magick on the command line with trial and error
> to crop the right part of the photo. For example:
> https://www.instagram.com/p/BH7r97NgvFX/
>
> But this is a ‘bit’ of work. So I was thinking about writing a Clojure
> program to do the cropping for me. That would save me a lot of time I think
> and the best way to learn a language is to use it. I think I could manage
> most parts, but I need a little help.
>
> My pictures have a dimension of 5,184x3,456 and I need to make a crop of
> 1.080x1.080. This is a little to big for my screen. So I am thinking about
> dividing everything by 8.
>
> I need to know two things:
> - How would I display the picture as a 648x432 picture?
> - How do I draw a square of 135x135 on it? So I can select what to crop.
>
> There are some other things to find out. But those I can find out for
> myself I would think. ;-)
>
> Would anyone be interested in something like this? Then I could share it
> on GitHub.
> If anyone has ideas for other functionalities: let me know.
> I have myself a few:
> - Posting the picture on Instagram (and others) from the program.
> - Putting the pictures into SQLite.
> - Something to select pictures out of a range.
> - …
>
> How easy is it to use Clojure to work with InstaGram, LinkedIn, FaceBook,
> Google+ and Twitter?
>
> --
> Cecil Westerhof
>
> --
> 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: How to work with photos in Clojure

2016-07-19 Thread Cecil Westerhof
2016-07-19 11:31 GMT+02:00 Karl Blomström :

> Hello Cecil!
>
> If you want to work with the instagram API I've put together a library
> that simplifies the retrieval of the necessary oauth2 token. Maybe you will
> find it useful!
>
> Please see https://github.com/blmstrm/loudmoauth
> and here is an example using the library with instagram among other APIs
>
> https://github.com/blmstrm/loudmoauth-examples/blob/master/src/loudmoauth_examples/core.clj
>

​Thank you. I will look into it.

​


> Den 19 juli 2016 4:26 em skrev "Cecil Westerhof" :
>
>> It never hurts to combine things. I just started again with Clojure and I
>> started with taking photos. In doing the latter I found out that I can take
>> nice pictures of insects. But they mostly only take a part of the photo. At
>> the moment I am using Image Magick on the command line with trial and error
>> to crop the right part of the photo. For example:
>> https://www.instagram.com/p/BH7r97NgvFX/
>>
>> But this is a ‘bit’ of work. So I was thinking about writing a Clojure
>> program to do the cropping for me. That would save me a lot of time I think
>> and the best way to learn a language is to use it. I think I could manage
>> most parts, but I need a little help.
>>
>> My pictures have a dimension of 5,184x3,456 and I need to make a crop of
>> 1.080x1.080. This is a little to big for my screen. So I am thinking about
>> dividing everything by 8.
>>
>> I need to know two things:
>> - How would I display the picture as a 648x432 picture?
>> - How do I draw a square of 135x135 on it? So I can select what to crop.
>>
>> There are some other things to find out. But those I can find out for
>> myself I would think. ;-)
>>
>> Would anyone be interested in something like this? Then I could share it
>> on GitHub.
>> If anyone has ideas for other functionalities: let me know.
>> I have myself a few:
>> - Posting the picture on Instagram (and others) from the program.
>> - Putting the pictures into SQLite.
>> - Something to select pictures out of a range.
>> - …
>>
>> How easy is it to use Clojure to work with InstaGram, LinkedIn, FaceBook,
>> Google+ and Twitter?
>>
>
-- 
Cecil Westerhof

-- 
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 work with photos in Clojure

2016-07-19 Thread Cecil Westerhof
2016-07-19 9:26 GMT+02:00 Cecil Westerhof :

>
> My pictures have a dimension of 5,184x3,456 and I need to make a crop of
> 1.080x1.080. This is a little to big for my screen. So I am thinking about
> dividing everything by 8.
>
> I need to know two things:
> - How would I display the picture as a 648x432 picture?
> - How do I draw a square of 135x135 on it? So I can select what to crop.
>

​It looks like SeeSaw is the way to go, so I will ask this at
Clojure-seesaw.​


-- 
Cecil Westerhof

-- 
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 work with photos in Clojure

2016-07-19 Thread Cecil Westerhof
2016-07-19 11:19 GMT+02:00 Cecil Westerhof :

> 2016-07-19 10:49 GMT+02:00 Cecil Westerhof :
>
>> 2016-07-19 10:23 GMT+02:00 Miguel Ping :
>>
>>> If you want to learn clojure by image processing, thats fine, but if
>>> your goal is to do the image processing part rather sooner than later, I
>>> recommend using an external lib like imagemagick or sharp (
>>> http://sharp.dimens.io/en/stable/) to do that for you, and hook it via
>>> FFI.
>>>
>>
>> ​I was (in the first instance) planning to use just Image Magick like I
>> do now. The only thing I wanted was to display the picture, move the
>> rectangle around to select the part to crop and then let Image Magick do
>> the cropping. But your link says sharp is 4-5 times as fast, so I probably
>> should switch.​
>>
>
> ​Well I get:
> npm ERR! sharp@0.15.1 install: `node-gyp rebuild`
> npm ERR! Exit status 1
> npm ERR!
> npm ERR! Failed at the sharp@0.15.1 install script 'node-gyp rebuild'.
> npm ERR! This is most likely a problem with the sharp package,
> npm ERR! not with npm itself.
> npm ERR! Tell the author that this fails on your system:
> npm ERR! node-gyp rebuild
> npm ERR! You can get information on how to open an issue for this project
> with:
> npm ERR! npm bugs sharp
> npm ERR! Or if that isn't available, you can get their info via:
> npm ERR!
> npm ERR! npm owner ls sharp
> npm ERR! There is likely additional logging output above.
>
> npm ERR! Please include the following file with any support request:
> npm ERR! /root/npm-debug.log
>

​Problem solved: I needed to install nodejs-devel.​

-- 
Cecil Westerhof

-- 
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 News is out

2016-07-19 Thread Erlis Vidal
Great idea! I've already added it to my favorites.

Thanks!

On Fri, Jul 15, 2016 at 11:19 AM, Ertuğrul Çetin  wrote:

> Hi Everyone,
>
> I'm very excited to announce that Clojure News(Beta) https://clojure.news is
> out which is Hacker News Clone built for Clojurists.
>
> My goal is gathering Clojurists under one roof and helping Clojure
> Community to improve.
>
> It has cool and community driven features.
>
> P.S: It is open source you can check out the source code from GitHub:
> https://github.com/ertugrulcetin/ClojureNews
>
> --
> 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.


clojure.spec from returns object instaced of data for every-kv

2016-07-19 Thread Mamun
Hi 

According to documentation of clojure.spec/from, it should return data not 
object. But when I try for every-kv, it is returning object. 


(s/form (s/every-kv keyword? int?))
=>
(clojure.spec/every
 (clojure.spec/tuple keyword? int?)
 :into
 {}
 :clojure.spec/kind-form
 nil
 :clojure.spec/kfn
 #object[t.spec$eval5492$fn__5493 0x1d39ed6f 
"t.spec$eval5492$fn__5493@1d39ed6f"])


But for other it looks ok

(s/form (s/coll-of keyword? ))
=>
 (clojure.spec/every keyword? :clojure.spec/kind-form nil 
:clojure.spec/conform-all true)


(s/form (s/alt :i int? :s string?))
=>
(clojure.spec/alt :i clojure.core/int? :s clojure.core/string?)


Clojure version: [org.clojure/clojure "1.9.0-alpha10"] 


Br,
Mamun


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


clojure.spec from returns object instaced of data for every-kv

2016-07-19 Thread Alex Miller
This is a bug. I'm actually looking at it (and some other form bugs right 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.


clojure.spec merge is excellent, but do you consider dissoc spec for keys?

2016-07-19 Thread Mamun
Hi 

Without dissoc in keys, how to avoid duplicate spec between backend and 
frontend layer?

As an example 

I have backend service where I defined spec like this 

(s/def ::person-spec (s/keys ::req-un [::id ::fname ::lname]))

Here Id is mandatory for some purpose. 

Now application layer I would like to reuse that backend spec but only id. 
Look like now it is not possible as there is no dissoc 

As it is application layer 

(s/def ::person-ui-spec (s/merge (s/keys ::req-un [::channel])
   ::person-spec
   ) )

merge is excellent, as I could reuse exiting spec. But how I dissoc id from 
exiting spec.

Only way is now to do is define again in application layer.

(s/def ::person-ui-spec (s/keys ::req-un [::channel ::fname ::lname]))


Do you consider dissoc in spec for keys?



Br,
Mamun
bnp paribas groups










 

-- 
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.spec merge is excellent, but do you consider dissoc spec for keys?

2016-07-19 Thread Alex Miller
Well first I'd say it's actually more important here that you are reusing 
the attribute specs for ::fname ::lname etc across front and back.

And second, perhaps you should be breaking out the common parts into a spec 
you can reuse instead:

(s/def ::person-shared-spec (s/keys ::req-un [::fname ::lname]))
(s/def ::person-spec (s/merge ::person-shared-spec (s/keys ::req-un 
[::id])))
(s/def ::person-ui-spec (s/merge ::person-shared-spec (s/keys ::req-un 
[::channel])))

Or maybe you really want to combine both of these into a single spec:

(s/def ::person-spec (s/keys :req-un [(or ::id ::channel) ::fname ::lname]))

Or you could potentially use multi-spec, but I doubt you need an open spec 
for this.

We're not going to add anything like dissoc afaik.

On Tuesday, July 19, 2016 at 11:54:52 AM UTC-5, Mamun wrote:
>
> Hi 
>
> Without dissoc in keys, how to avoid duplicate spec between backend and 
> frontend layer?
>
> As an example 
>
> I have backend service where I defined spec like this 
>
> (s/def ::person-spec (s/keys ::req-un [::id ::fname ::lname]))
>
> Here Id is mandatory for some purpose. 
>
> Now application layer I would like to reuse that backend spec but only id. 
> Look like now it is not possible as there is no dissoc 
>
> As it is application layer 
>
> (s/def ::person-ui-spec (s/merge (s/keys ::req-un [::channel])
>::person-spec
>) )
>
> merge is excellent, as I could reuse exiting spec. But how I dissoc id 
> from exiting spec.
>
> Only way is now to do is define again in application layer.
>
> (s/def ::person-ui-spec (s/keys ::req-un [::channel ::fname ::lname]))
>
>
> Do you consider dissoc in spec for keys?
>
>
>
> Br,
> Mamun
> bnp paribas groups
>
>
>
>
>
>
>
>
>
>
>  
>
>

-- 
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 News is out

2016-07-19 Thread Jacob Strength
This looks great! I was just curious though, what are the advantages of 
this over say the Clojure page on reddit? To me it seems very similar.

On Friday, July 15, 2016 at 9:28:12 AM UTC-6, Ertuğrul Çetin wrote:
>
> Hi Everyone,
>
> I'm very excited to announce that Clojure News(Beta) https://clojure.news is 
> out which is Hacker News Clone built for Clojurists.
>
> My goal is gathering Clojurists under one roof and helping Clojure 
> Community to improve.
>
> It has cool and community driven features.
>
> P.S: It is open source you can check out the source code from GitHub: 
> https://github.com/ertugrulcetin/ClojureNews
>
>

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


Indexable structures for easier lookup and retrieve

2016-07-19 Thread Olek
Hi!

Often through the software development I bump into structures defining 
specification/manifest/configuration of some Unit 
(service/process/transformation/configuration).
>From my observation I've noticed the repeating pattern in software 
development for consuming above. We star with a 

structure > (then go to) slurp > (then) morph to indexed structures > (for 
final) retrieve (during algorithms executions)

What bothers me is the slurp and morph steps. These always seem to be big 
effort which is not particular functional from the algorithm use (these are 
internal steps not produced by Business Analytics and not consumed by 
Program Algorithms). It would be nice if there was a method to make slurp 
and morph as one step in declarative (because it is most natural way to 
express statement) manner.

Now lets dive to example and make some assumptions. Let assume that 
structure can be any tree structure. For example let say it will be XML 
which can have parent node, child nodes with attributes.


 
 
 
 
 
 
 
 


This can be for example specification of node which has declared group of 
events and group of transformations. So it can easily fit in memory and is 
read only once at startup.
Now it would be nice to make slurp of that structure (and it's pretty easy 
in clojure - the only true language in which you express the algorithms in 
terms of thoughts - only if there are built of lists ;-) ) and next get the 
structure of which we could make farther retrieves. For example we could 
ask for all incoming events or ask if we can expect the event of name "foo" 
in that spec. Or we can ask for transformation of name "transfoo". As you 
can see, to be able to ask such questions, I would have to index above 
structure for given predicates.
First I thought about indexing every data. For example I make inverted 
index of all terminal nodes. So I got indexes like: transformation, name, 
events, event, node, source, dest-event, from which I could just ask for 
(query example) #{transformation [ :name %1 ]} to get all transformation 
which match the %1 argument.
Latter I noticed that in fact, Datomic does that, but the indexing and 
query language would be not so easy.

Nevertheless do you know any piece of code/software/library which allow for 
such functionality?








-- 
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: Indexable structures for easier lookup and retrieve

2016-07-19 Thread Mark Stang
I have been experimenting with something I call "path database".
It is very rough, but usable.
I would welcome some additional eyes and hands.

I have an index structure where you can "build an index" and then "find"
things.

https://github.com/mstang/pathdatabase

regards,

Mark

On Tue, Jul 19, 2016 at 4:05 PM, Olek  wrote:

> Hi!
>
> Often through the software development I bump into structures defining
> specification/manifest/configuration of some Unit
> (service/process/transformation/configuration).
> From my observation I've noticed the repeating pattern in software
> development for consuming above. We star with a
>
> structure > (then go to) slurp > (then) morph to indexed structures > (for
> final) retrieve (during algorithms executions)
>
> What bothers me is the slurp and morph steps. These always seem to be big
> effort which is not particular functional from the algorithm use (these are
> internal steps not produced by Business Analytics and not consumed by
> Program Algorithms). It would be nice if there was a method to make slurp
> and morph as one step in declarative (because it is most natural way to
> express statement) manner.
>
> Now lets dive to example and make some assumptions. Let assume that
> structure can be any tree structure. For example let say it will be XML
> which can have parent node, child nodes with attributes.
>
> 
>  
>  
>  
>  
>  
>  
>  
>  
> 
>
> This can be for example specification of node which has declared group of
> events and group of transformations. So it can easily fit in memory and is
> read only once at startup.
> Now it would be nice to make slurp of that structure (and it's pretty easy
> in clojure - the only true language in which you express the algorithms in
> terms of thoughts - only if there are built of lists ;-) ) and next get the
> structure of which we could make farther retrieves. For example we could
> ask for all incoming events or ask if we can expect the event of name "foo"
> in that spec. Or we can ask for transformation of name "transfoo". As you
> can see, to be able to ask such questions, I would have to index above
> structure for given predicates.
> First I thought about indexing every data. For example I make inverted
> index of all terminal nodes. So I got indexes like: transformation, name,
> events, event, node, source, dest-event, from which I could just ask for
> (query example) #{transformation [ :name %1 ]} to get all transformation
> which match the %1 argument.
> Latter I noticed that in fact, Datomic does that, but the indexing and
> query language would be not so easy.
>
> Nevertheless do you know any piece of code/software/library which allow
> for such functionality?
>
>
>
>
>
>
>
>
> --
> 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.