Re: [ANN] riddley: code-walking without caveats

2013-09-05 Thread Stathis Sideris
Thanks for this library Zach,

It seems that the released version is a bit behind in comparison to the 
generated documentation [1]. For example, walk-exprs is advertised as being 
able to accept a special-forms parameter, but that's not the case in the 
jar that leiningen retrieved when I used [riddley "0.1.0"] in my 
project.clj.

Thanks,

Stathis

[1] http://ideolalia.com/riddley/


On Monday, 2 September 2013 21:49:01 UTC+1, Zach Tellman wrote:
>
> When I announced Proteus [1], it was rightfully pointed out that it didn't 
> play nicely with macros which rely on &env, as well as a few forms like 
> 'letfn' that I hadn't explicitly handled.  This flaw has been shared by 
> pretty much every library of this sort, and since this is a problem I've 
> half-solved two or three times already, I figured something more general 
> and lasting was in order.
>
> The resulting library is called Riddley [2].  For obvious reasons, I've 
> named it after a book which is written entirely in a barely-readable pidgin 
> dialect. While there may be lingering issues, it's good enough to replace 
> the code-walking mechanism in Proteus, which I think makes it the best game 
> in town right now.  Bug reports and pull requests are welcome.
>
> Zach
>
> [1] 
> https://groups.google.com/forum/#!searchin/clojure/proteus/clojure/7HNNiJJTte4/iMBWn8p6tZAJ
> [2] https://github.com/ztellman/riddley
>

-- 
-- 
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/groups/opt_out.


Re: ANN: Another binary parser combinator - this time for java's streams

2014-02-03 Thread Stathis Sideris
Hello,

Is it possible to use 'repeated with a dynamic size if the length-defining 
prefix does not directly precede the content? For example, see PNG chunks:

http://en.wikipedia.org/wiki/Portable_Network_Graphics#.22Chunks.22_within_the_file

The codec would be:

(def chunk
  (b/ordered-map
   :length :int-be
   :type (b/repeated :byte :length 4)
   :data (b/repeated :byte :length ???)
   :crc (b/repeated :byte :length 4)))

What do I put in the place of "???"

Thanks,

Stathis


On Friday, 31 January 2014 08:12:23 UTC, Steffen Dienst wrote:
>
> Thanks, I fixed the documentation issues. Feel free to share your id3 tags 
> parser, if you like :) You can see that mine is still stuck at the very 
> beginning..
>
>
>

-- 
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/groups/opt_out.


Re: ANN: Another binary parser combinator - this time for java's streams

2014-02-04 Thread Stathis Sideris
Thanks, header seems very useful and relevant to what I was doing, but I 
ended up doing something slightly different because I needed to include the 
information retrieved using the chunk header codec in the final result 
(specifically, the type of the chunk). Here is some code:

https://gist.github.com/stathissideris/8801295

select-codec is almost identical to header (didn't bother with writing in 
this case), but it also merges the result of the "decision-codec" with the 
result of the selected codec. Of course it's less generic than header 
because it makes the assumption that we're dealing with maps. Also, note 
the use of core.match to decide on what codec to use.

Stathis


On Monday, 3 February 2014 16:50:12 UTC, Steffen Dienst wrote:
>
> I would use header for this:
>
> (def chunk 
>   (header :int-be
>   #(ordered-map 
>   :type (b/repeated :byte :length 4)
>   :data (b/repeated :byte :length %)
>   :crc (b/repeated :byte :length 4))
>   #(count (:data %
>
> The resulting data structure would not contain the field length in this 
> case. Length only gets used to configure the inner codec for the body (the 
> map with :type, :data and :crc). You can read this codec as: "Read a 
> big-endian integer, then use this value to construct a new codec to read 
> the body. When writing, count the :data field, write the length using :type 
> and then write the body".
>
> Steffen
>
>
> 2014-02-03 Stathis Sideris >:
>
>> Hello,
>>
>> Is it possible to use 'repeated with a dynamic size if the 
>> length-defining prefix does not directly precede the content? For example, 
>> see PNG chunks:
>>
>>
>> http://en.wikipedia.org/wiki/Portable_Network_Graphics#.22Chunks.22_within_the_file
>>
>> The codec would be:
>>
>> (def chunk
>>   (b/ordered-map
>>:length :int-be
>>:type (b/repeated :byte :length 4)
>>:data (b/repeated :byte :length ???)
>>:crc (b/repeated :byte :length 4)))
>>
>> What do I put in the place of "???"
>>
>> Thanks,
>>
>> Stathis
>>
>>
>> On Friday, 31 January 2014 08:12:23 UTC, Steffen Dienst wrote:
>>>
>>> Thanks, I fixed the documentation issues. Feel free to share your id3 
>>> tags parser, if you like :) You can see that mine is still stuck at the 
>>> very beginning..
>>>
>>>
>>>  -- 
>> 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 a topic in the 
>> Google Groups "Clojure" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/clojure/2c9-oXfKlp0/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> clojure+u...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

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


Re: call clojure from java

2014-02-18 Thread Stathis Sideris
I think you're looking for this method here:

https://skillsmatter.com/skillscasts/3864-impromptu-rich-hickey-lightning-talk

(you need to register to see the video)

On Tuesday, 18 February 2014 11:39:20 UTC, sorin cristea wrote:
>
> Hi 
>
> do you know how I can call a clojure script from a java method ?
>
>
> Thanks,
> Sorin.
>

-- 
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/groups/opt_out.


Re: Lein, Speclj & clojure 1.6.0-beta1

2014-02-18 Thread Stathis Sideris
Leiningen can exclude certain dependencies of your dependencies, see here:

https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L48

Whether Speclj will work with Clojure 1.6 is something you'll have to 
test...

On Monday, 17 February 2014 12:09:13 UTC, Karsten Schmidt wrote:
>
> Hi all, am trying to test out the new hashing approach for my datatypes in 
> 1.6 but it seems that even though I'm referring to the latest beta in my 
> project.clj, Speclj is overriding that dependency with 1.5.1 and I can't 
> run my tests. How can I force it to honor my setting and use 1.6.0-beta1? I 
> guess that's a more general question about leiningen's dep resolution for 
> plugins...
>
> 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/groups/opt_out.


ANN: Retrograde v0.9

2014-03-16 Thread Stathis Sideris


Hello,


I would like to announce the first release of retrograde, a small Clojure 
DSL that deals with the problem of accessing information and results from 
previous iterations during the **lazy** transformation of a sequence or 
during the **lazy** generation of an infinite sequence. The main motivation 
for retrograde was the observation that in tricky cases, when a calculation 
requires access to previous iterations, Clojure programmers (the author at 
least!) tend to resort to using loop/recur, therefore losing laziness. Even 
if one sticks to lazy-seq, handling the passing of various bits of "state" 
to the next iteration is awkward at best, with the most horrific cases 
including use of real state such as atoms etc.

Retrograde allows access to the results of previous iterations using the 
"prime" syntax. For example, here is an infinite list of Fibonacci numbers:

(retrograde/calculate [x 1 (if (and x' x'') (+ x' x'') 0)])

x is defined as the name of the result in each iteration. The result of the 
previous iteration then becomes available as x' (read as "x-prime") and the 
result of the iteration before that is available as x''. You can go back as far 
as you like by adding more prime symbols (single quotes) to the name of your 
result. 

The optional 1 value after the name of the result is the value of x' during the 
first iteration. This is followed by the code fragment that calculates the 
value of x in each iteration. 

The code produced by the macro uses lazy-seq to make sure that the calculation 
happens in a lazy manner, without you having to handle the passing of "state" 
to the next iteration. 

Retrograde also supports access to previous iterations via accumulators. Let's 
look into the (made up) problem of lazily transforming a sequence of numbers so 
that each output element is the input number added to all the odd numbers that 
have occurred in the sequence so far:


> (retrograde/transform
   [odds [] (if (odd? x) (conj odds' x) odds')
x (apply + (conj odds' x))]
   (range 10))
(0 1 3 4 8 9 15 16 24 25)


Leiningen dependency: [retrograde "0.9"] 
Github: https://github.com/stathissideris/retrograde

Feeback in any form is more than welcome, please let me know.

Thanks,

Stathis


-- 
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: Community Interest in a Clojure Application Config Library, using Zookeeper?

2014-05-23 Thread Stathis Sideris
You guys should check stoic:

https://github.com/juxt/stoic

>From the readme:

This library marries Stuart Sierras Component library with distributed 
> config. Feed Stoic a SystemMap and it will ensure that the relevant 
> components are bounced when their config changes. Config-suppliers are 
> pluggable, at present Zookeeper is the sole config supplier implementation.


I've used it without any problems.

On Thursday, 22 May 2014 14:00:03 UTC+1, Daniel Higginbotham wrote:
>
> Yes, please do open source it!
>
> On Tuesday, May 20, 2014 5:33:05 PM UTC-4, Thomas Steffes wrote:
>>
>> Hey folks,
>>
>> At Room Key we're using Apache Zookeeper and a home-grown clojure library 
>> called drcfg for real-time application configuration management. We're 
>> debating open-sourcing drcfg and are trying to gauge community interest in 
>> such a tool. 
>>
>> We think it's got great usage semantics, basically you just def an atom 
>> in any namespace where you'd like a variable that can be changed in 
>> real-time on a running system. When you define the atom, you can also 
>> provide defaults to fall back to if zookeeper is unavailable, a validator 
>> to be run on any value when a change is attempted (to prevent invalid 
>> configuration data), as well as some meta-data about the variable.
>>
>> We've also got a web UI we use to change configuration data, but that 
>> would likely be released separate of drcfg itself.
>>
>> If anyone's interested, could you reply to this post? I can provide more 
>> information as well if need be.
>>
>>
>> -Thomas Steffes @ Room Key
>>
>>
>>
>>

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


Productivity tip for code transformations with cider

2014-09-14 Thread Stathis Sideris
Hello all,

There is some functionality in cider (C-c C-w) that can potentially save 
you a lot of typing when transforming Clojure code and I haven't seen many 
people using it, so I made a screencast to demonstrate:

http://www.youtube.com/watch?v=LXhWW1Yqpt0

Hopefully you'll find it useful.

Thanks,

Stathis

-- 
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] Instaparse 1.0.0

2013-04-11 Thread Stathis Sideris
Thanks, this looks fantastic! Is there any way to include comments in the 
syntax at all?

Thanks,

Stathis


On Tuesday, 9 April 2013 06:18:39 UTC+1, puzzler wrote:
>
> Instaparse is an easy-to-use, feature-rich parser generator for Clojure.  
> The two stand-out features:
>
> 1. Converts standard EBNF notation for context-free grammars into an 
> executable parser.  Makes the task of building parsers as lightweight and 
> simple as working with regular expressions.
>
> 2. Works with *any* context-free grammar.  This means you don't have to 
> learn the esoteric subtleties of LR, LL, LALR or any other specialized 
> subset.  Left-recursion, right-recursion, ambiguous grammars -- instaparse 
> handles it all.
>
> Example:
>
> (def as-and-bs
>   (parser
> "S = AB*
>  AB = A B
>  A = 'a'+
>  B = 'b'+"))
>
> => (as-and-bs "abbbbb")
> [:S
>  [:AB [:A "a" "a" "a" "a" "a"] [:B "b" "b" "b"]]
>  [:AB [:A "a" "a" "a" "a"] [:B "b" "b"]]]
>
> https://github.com/Engelberg/instaparse for full feature list and 
> extensive tutorial.
>

-- 
-- 
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/groups/opt_out.




Re: [ANN] Instaparse 1.0.0

2013-04-11 Thread Stathis Sideris
Sorry for the lack of clarity -- I meant comments about the grammar within 
the resource file that describes it. The (str) approach would be good for 
embedded grammars in Clojure code, but I'm working with a fairly bulky 
grammar which would be better to keep in its own file.

Stathis

On Thursday, 11 April 2013 15:16:29 UTC+1, Steven Degutis wrote:
>
> I'm not the OP, but if you mean comments within the grammar, sure as long 
> as "comment" is well defined, and if you mean comments *about* the grammar 
> within the parser code, how about creating the grammar using (str) with one 
> string per line, and putting your comments after each line's string?
>
> -Steven
>
>
> On Thu, Apr 11, 2013 at 9:08 AM, Stathis Sideris 
> 
> > wrote:
>
>> Thanks, this looks fantastic! Is there any way to include comments in the 
>> syntax at all?
>>
>> Thanks,
>>
>> Stathis
>>
>>
>> On Tuesday, 9 April 2013 06:18:39 UTC+1, puzzler wrote:
>>>
>>> Instaparse is an easy-to-use, feature-rich parser generator for 
>>> Clojure.  The two stand-out features:
>>>
>>> 1. Converts standard EBNF notation for context-free grammars into an 
>>> executable parser.  Makes the task of building parsers as lightweight and 
>>> simple as working with regular expressions.
>>>
>>> 2. Works with *any* context-free grammar.  This means you don't have to 
>>> learn the esoteric subtleties of LR, LL, LALR or any other specialized 
>>> subset.  Left-recursion, right-recursion, ambiguous grammars -- instaparse 
>>> handles it all.
>>>
>>> Example:
>>>
>>> (def as-and-bs
>>>   (parser
>>> "S = AB*
>>>  AB = A B
>>>  A = 'a'+
>>>  B = 'b'+"))
>>>
>>> => (as-and-bs "abbbbb")
>>> [:S
>>>  [:AB [:A "a" "a" "a" "a" "a"] [:B "b" "b" "b"]]
>>>  [:AB [:A "a" "a" "a" "a"] [:B "b" "b"]]]
>>>
>>> https://github.com/Engelberg/**instaparse<https://github.com/Engelberg/instaparse>for
>>>  full feature list and extensive tutorial.
>>>
>>  -- 
>> -- 
>> 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/groups/opt_out.
>>  
>>  
>>
>
>

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




Re: [ANN] Instaparse 1.0.0

2013-04-12 Thread Stathis Sideris
Thank you very much, I'll give it a try!

On Thursday, 11 April 2013 18:12:34 UTC+1, puzzler wrote:
>
> On Thu, Apr 11, 2013 at 7:08 AM, Stathis Sideris 
> 
> > wrote:
>
>> Thanks, this looks fantastic! Is there any way to include comments in the 
>> syntax at all?
>
>
> Last night I started a v1.1 branch to start work on these feature 
> requests.  The first feature I added was, in fact, support for EBNF comment 
> syntax:
> (* this is a comment *)
>
> Supports nested comments too, in case you want to wrap a comment around a 
> comment.
>
> Add [instaparse "1.1.0-SNAPSHOT"] to your dependencies and give it a try.
>
> As I add features, I'll add them to the v1.1 change log:
> https://github.com/Engelberg/instaparse/blob/v1.1/CHANGES.md
> and also update the README on the v1.1 branch:
> https://github.com/Engelberg/instaparse/blob/v1.1/README.md
>
> --Mark
>

-- 
-- 
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/groups/opt_out.




Re: Image analysis library recommendations

2013-04-29 Thread Stathis Sideris
There is a Clojure wrapper for OpenCV: http://nakkaya.com/vision.html

On Tuesday, 23 April 2013 19:54:20 UTC+1, Nils Blum-Oeste wrote:
>
> Hi,
>
> I would like to do some image analysis with clojure. So I am looking for 
> good libraries for that.
>
> Most important would be a good support for image segmentation. 
> Tresholding, histogram based methods, edge detection and region growing are 
> among the things I would like to have. Support for real time image analysis 
> is not needed, I want to transform static image files.
> Furthermore I am looking for a nice image import/export. This does not 
> have to be the same library, but would be great if things work together 
> nicely.
>
> Of course a pure clojure thing would be awesome, but using java interop 
> would be okay too.
> I have some background in image analysis and don't need to have all the 
> matrix stuff abstracted away. However, I don't want to rebuild all the 
> necessary algorithms myself, but focus on getting the parametrization right 
> and figuring out the best segmenation strategy instead.
>
> Currently I am evaluating incanter (also interested in this is a general 
> data analysis tool) and I wanted to have a look at OpenCV.
>
> If someone could recommend good libraries would be great. I really 
> appreciate any hints, recommendations and shared experience.
>
> Thanks and cheers
> Nils
>

-- 
-- 
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/groups/opt_out.




Re: Best IDE

2013-06-12 Thread Stathis Sideris
Ok, in my opinion (and I develop Clojure full-time with Emacs), it's way 
harder to learn Emacs than for Emacs to learn you ("In Soviet Russia, 
editor learns you" etc).

What I mean: Emacs is very-very-very customizable. If you're learning 
Clojure, to some extend you are becoming familiar with elisp (the embedded 
Emacs Lisp) at the same time because they're both Lisps. It's really worth 
learning how to customize Emacs very early on. For example, people complain 
all the time about the cryptic, hard to remember key combinations. You know 
what? Just re-assign the ones that you use frequently to something that you 
remember. My F7 toggles line wrapping. Not sure why that key made sense to 
me, but it did, and I have never forgotten it. There are good mechanisms 
for discovering what function is called when you press a key combination 
(and it's always the case that a function is called), so when you know the 
name of the function you can trivially create your own key combination for 
calling it.

Another approach is to discover the name and then call the function by 
typing it's name (Alt-X, function name, ENTER). I do that a lot, and when I 
get bored of doing it, I just assign it to a key combination.

This is an approach that pays huge dividends, because you end up with an 
editor that feels very close to your needs - and very close to your usage 
patterns. The main disadvantage is that once you customize it to such an 
extent, no other Emacs user can sit at your keyboard and use it :-)

Also, Emacs' paredit (the structural editing plugin for Lisps) is extremely 
useful when editing Clojure, I can't even imagine doing without it.

Stathis

On Friday, 7 June 2013 23:27:26 UTC+1, Denis Labaye wrote:
>
> *Learning Emacs is more important than learning Clojure.*
>
>   -- A Clojure fanboy and former Vim user
>
>
>
> On Fri, Jun 7, 2013 at 10:46 PM, futile  >wrote:
>
>> Before, I used vim for several years. But when I learned Clojure I 
>> switched to emacs, and it's really not hard or awkward like I was afraid 
>> of. Honestly now I like it much better than vim. And I've found paredit and 
>> nrepl.el to be extremely handy, even used together.
>>
>>
>> On Tuesday, January 17, 2012 3:38:05 PM UTC-6, Josef Frydl wrote:
>>>
>>> Can you please recommend the Best IDE for Clojure? I have Eclipse 
>>> NetBeans and JetBrain already installed. 
>>>
>>  -- 
>> -- 
>> 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/groups/opt_out.
>>  
>>  
>>
>
>

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




Re: ring 如何实现热加载代码?

2013-06-13 Thread Stathis Sideris
Instead of doing:

(defonce server (run-jetty my-app {:port 8080 :join? false}))

do:

(defonce server (run-jetty #'my-app {:port 8080 :join? false}))

This is make the code reload every time you redefine my-app.

Also see:

http://stackoverflow.com/questions/2706044/how-do-i-stop-jetty-server-in-clojure

Stathis


On Thursday, 13 June 2013 10:33:15 UTC+1, Stream wrote:
>
>
> 今天看了一下ring代码,想看一下,如何实现热加载clj代码。 
>
> 我尝试 run-jetty :join true 
> 导致server被阻塞,然后emacs nrepl 无法热加载代码。 
>
> 改成 join false,jetty 进程不加入主进程里,才可以正常加载。 
>
> 我翻查源码,没发现是如何分离server与逻辑代码,从而实现只热加载handler的。 
>
> 哪位大神能科普一下呢,谢谢

-- 
-- 
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/groups/opt_out.




[ANN] spec-provider 0.4.0

2017-05-07 Thread Stathis Sideris
This is a library that will produce a best-guess Clojure spec 
 based on multiple examples of in-memory 
data. The inferred spec is not meant to be used as is and without human 
supervision, it is rather a starting point that can (and should) be refined.

This version:

* Infer nilable: collect stats for nil values and s/nilable where 
appropriate.
* Fix issue #1: If a sample value was a collection, s/coll-of would 
override any other specs for the leaf. This is now fixed.
* Update to Clojure 1.9.0-alpha16.

https://github.com/stathissideris/spec-provider

-- Stathis

-- 
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] spectacles 0.3.0

2017-08-06 Thread Stathis Sideris
Hello all,

I just released spectacles 0.3.0, lenses for accessing/mutating nested data 
structures which are checked at runtime using spec. It provides get, 
get-in, assoc, assoc-in, update and update-in, where keys, paths and passed 
values are checked based on existing specs.

Check readme for more details:

https://github.com/stathissideris/spectacles

Thanks,

Stathis

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


alts!! on channels that may close early

2015-09-25 Thread Stathis Sideris
Hello,

I'm trying to process messages from 2 core.async channels at the same time 
using alts!! but I'm running into problems when one of the channels closes 
early. Specifically I have this function:

(defn >print [a b]
  (loop [limit 20] ;;limit to prevent infinite loop demonstrated below
(let [[v c] (alts!! [a b] :default ::done)]
  (if (and (not= c :default) (> limit 0))
(do
  (if (= c a)
(println "a:" v)
(println "b:" v))
  (recur (dec limit))
  nil)

If I run this, it works as expected:

(let [a (chan 10)
  b (chan 10)]
(>!! a 1)
(>!! a 1)
(>!! a 1)
(>!! a 1)
(>!! b 2)
(>!! b 2)
(>!! b 2)
(>!! b 2)
(>!! b 2)
(>print a b))

Output:

b: 2
a: 1
a: 1
b: 2
b: 2
a: 1
b: 2
b: 2
a: 1

If I close "a" early...

(let [a (chan 10)
  b (chan 10)]
(>!! a 1)
(close! a)
(>!! a 1)
(>!! a 1)
(>!! a 1)
(>!! b 2)
(>!! b 2)
(>!! b 2)
(>!! b 2)
(>!! b 2)
(>print a b))

This is what I get:

a: 1
b: 2
b: 2
b: 2
a: nil
a: nil
b: 2
b: 2
a: nil
a: nil
a: nil
a: nil
a: nil
a: nil
a: nil
a: nil
a: nil
a: nil
a: nil
a: nil

This code would continue running forever if it wasn't for the "limit" 
condition above. Am I using alts!! in a manner it's not meant to be used?

Thanks,

Stathis

-- 
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: alts!! on channels that may close early

2015-09-27 Thread Stathis Sideris
For the record, I ended up using core.async/merge instead, but I modified 
it to also return the channel for each value, as [v c] -- similarly to alts!

On Saturday, 26 September 2015 02:29:17 UTC+1, Stathis Sideris wrote:
>
> Hello,
>
> I'm trying to process messages from 2 core.async channels at the same time 
> using alts!! but I'm running into problems when one of the channels closes 
> early. Specifically I have this function:
>
> (defn >print [a b]
>   (loop [limit 20] ;;limit to prevent infinite loop demonstrated below
> (let [[v c] (alts!! [a b] :default ::done)]
>   (if (and (not= c :default) (> limit 0))
> (do
>   (if (= c a)
> (println "a:" v)
> (println "b:" v))
>   (recur (dec limit))
>   nil)
>
> If I run this, it works as expected:
>
> (let [a (chan 10)
>   b (chan 10)]
> (>!! a 1)
> (>!! a 1)
> (>!! a 1)
> (>!! a 1)
> (>!! b 2)
> (>!! b 2)
> (>!! b 2)
> (>!! b 2)
> (>!! b 2)
> (>print a b))
>
> Output:
>
> b: 2
> a: 1
> a: 1
> b: 2
> b: 2
> a: 1
> b: 2
> b: 2
> a: 1
>
> If I close "a" early...
>
> (let [a (chan 10)
>   b (chan 10)]
> (>!! a 1)
> (close! a)
> (>!! a 1)
> (>!! a 1)
> (>!! a 1)
> (>!! b 2)
> (>!! b 2)
> (>!! b 2)
> (>!! b 2)
> (>!! b 2)
> (>print a b))
>
> This is what I get:
>
> a: 1
> b: 2
> b: 2
> b: 2
> a: nil
> a: nil
> b: 2
> b: 2
> a: nil
> a: nil
> a: nil
> a: nil
> a: nil
> a: nil
> a: nil
> a: nil
> a: nil
> a: nil
> a: nil
> a: nil
>
> This code would continue running forever if it wasn't for the "limit" 
> condition above. Am I using alts!! in a manner it's not meant to be used?
>
> Thanks,
>
> Stathis
>
>

-- 
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] dali SVG library 0.7.0

2016-02-10 Thread Stathis Sideris
Hello all,

dali is a Clojure library for representing the SVG graphics format. It 
allows the creation and manipulation of SVG files. The syntax 
<https://github.com/stathissideris/dali/blob/master/doc/syntax.md> used to 
describe the graphical elements is based on hiccup 
<https://github.com/weavejester/hiccup> with a few extensions.

The main advantage of dali is that it provides facilities to perform 
complex layouts 
<https://github.com/stathissideris/dali/blob/master/doc/layout.md> without 
having to position elements explicitly.

The 0.7.0 brings a lot of new features and very complete documentation to 
get you started.

All feedback very welcome.


Thanks,

Stathis Sideris

-- 
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] dali SVG library 0.7.0

2016-02-10 Thread Stathis Sideris
...aaand the link to the repo: https://github.com/stathissideris/dali

On Thursday, 11 February 2016 00:49:54 UTC, Stathis Sideris wrote:
>
> Hello all,
>
> dali is a Clojure library for representing the SVG graphics format. It 
> allows the creation and manipulation of SVG files. The syntax 
> <https://github.com/stathissideris/dali/blob/master/doc/syntax.md> used 
> to describe the graphical elements is based on hiccup 
> <https://github.com/weavejester/hiccup> with a few extensions.
>
> The main advantage of dali is that it provides facilities to perform 
> complex layouts 
> <https://github.com/stathissideris/dali/blob/master/doc/layout.md> 
> without having to position elements explicitly.
>
> The 0.7.0 brings a lot of new features and very complete documentation to 
> get you started.
>
> All feedback very welcome.
>
>
> Thanks,
>
> Stathis Sideris
>

-- 
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: Minderbinder v0.2.0

2012-10-17 Thread Stathis Sideris
Very nice, thanks. Is the intent for this to eventually be as complete as 
Frink [1] or are you going to keep its scope to time, length and 
information?

Thanks,

Stathis

[1] http://futureboy.us/frinkdocs/


On Tuesday, 16 October 2012 16:50:34 UTC+1, Fogus wrote:
>
> Minderbinder is a Clojure library for defining unit conversions available 
> at read, compile and run time. 
>
> More information is available on the [Minderbinder source repo](
> https://github.com/fogus/minderbinder).
>
> Use
> 
>
> Include the following in your [Leiningen](
> https://github.com/technomancy/leiningen) project.clj file:
>
> [fogus/minderbinder "0.2.0"]
>
> Or include the following in your pom.xml file in the `dependencies` 
> section:
>
> 
>   fogus
>   minderbinder
>   0.2.0
> 
>
> Examples
> 
>
> Minderbinder includes unit conversions for the following units of measure:
>
>   * [Time][t]: via `#unit/time`, base is `:milliseconds`, ns is 
> `minderbinder.time`
>   * [Length][l]: via `#unit/length`, base is `:meters`, ns is 
> `minderbinder.length`
>   * [Information][i]: via `#unit/info`, base is `:byte`, ns is 
> `minderbinder.information`
>
> [t]: 
> https://github.com/fogus/minderbinder/blob/master/src/minderbinder/time.clj
> [l]: 
> https://github.com/fogus/minderbinder/blob/master/src/minderbinder/length.clj
> [i]: 
> https://github.com/fogus/minderbinder/blob/master/src/minderbinder/information.clj
>
> Using Minderbinder's unit reader form
> --
>
> (ns minderbinder.test.core
>   (:require minderbinder.time))
> 
> (== #unit/time [1 :second]
> #unit/time [1000 :ms])
> 
> ;;=> true
>
> (== #unit/time [1 :minute 30 :seconds]
> #unit/time [90 :seconds])
> 
> ;;=> true
>
> Using Minderbinder's unit parse functions
> -
>
> (ns minderbinder.test.core
>   (:require [minderbinder.length :as mbr]))
> 
> (mbr/parse-length-unit [1 :km])
> 
> ;;=> 1000
>
> (mbr/parse-length-unit [1 :ramsden-link])
> 
> ;;=> 381/1250
>
> Defining custom conversion rules
> 
>
> Defining a unit conversion is accomplished via Minderbinder's 
> `defunits-of` macro.  The body of the macro expects the following structure:
>
> (defunits-of *unit-name* *base-unit-tag* *docstring* *conversion-spec*)
>
> The *conversion spec* part of the body currently allows pairs of mappings 
> defined in reletive terms.  The pairs always start with a keyword used as 
> the unit tag.  However, the right-hand side of the pair can be one of the 
> following:
>
>  1. Number  - defines the value of the unit relative to the base unit
>  2. Vector  - defines the value of the unit relative to another contained 
> unit
>  3. Keyword - defines a single alias for a unit
>  4. Set - defined one or more aliases for a unit
>  
> A simplified version of Minderbinder's length conversion definition serves 
> as an example:
>
> (defunits-of length :meter
>   "The meter is the length of the path 
>   traveled by light in vacuum during a 
>   time interval of 1/299,792,458 of 
>   a second."
>
>   :m  :meter   ;; an alias for the base unit
>   :km 1000 ;; a larger value relative to the base 
> unit
>   :km #{kilometer kilometers}  ;; multiple aliases for a unit
>   :cm 1/100;; a smaller value relative to the base
>   :mm [1/10 :cm])  ;; a value relative to another unit
>
> ### Generated vars
>
> The `defunits-of` macro will define three things in the namespace where 
> the `defunits-of` macro appears:
>
>  1. `parse-XXX-unit` - a function that parses the unit vector according to 
> the conversion spec, returning the total value relative to the base.
>
>  2. `unit-of-XXX`- a macro that allows the for `(unit-of-XXX 1 :foo)` 
> that returns the total value relative to the base.
>  
>  3. `XXX-table`  - a map describing the unit conversion rules.
>
> Contributions welcomed!
>
>

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

Re: Coming from Common Lisp to Clojure

2012-10-18 Thread Stathis Sideris
One thing that you might be missing is the expressive power of the sequence 
handling functions (everything under sequences here: 
http://clojure.org/cheatsheet ). I found it very useful to follow a few 
other users in 4clojure [1] which allowed me to compare different styles in 
their solutions while I was solving the problems. In many cases I was 
humbled by discovering a half-line solution when I my solution was 5-6 
lines! So there is some poetry there I think.

Stathis

[1] http://www.4clojure.com/


On Wednesday, 17 October 2012 19:14:59 UTC+1, Curtis wrote:
>
> I do hope this is an appropriate topic. 
>
> I am very excited by the power and capability in clojure and amazed at the 
> rapid quality of tooling that exists so early in the projects life.
>
> I would like to admit that i am feeling like the simplicity and elegance 
> that I experienced writing in lisp seems to be bypassed in certain areas in 
> favor of extra syntax [] and what seems to be local variable declarations
> as well as 'many ways' to do something around looping and recursion.
>
> I am wondering how others feel about this and if there are any style 
> guides that i could be exposed to so that I can enjoy the poetry that I may 
> be missing. 
>
> Could some one help me with this please?
>
> Thank you!
>
> Curtis
>

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

Re: compile fails but stack trace does not mention a line of code in my app

2012-10-26 Thread Stathis Sideris
I've seen this error when putting the function name *after* the docstring 
instead of before in a defn.

Stathis


On Thursday, 25 October 2012 20:05:25 UTC+1, Philip Potter wrote:
>
> Since we're wild mass guessing, I'd say from that stack trace that there's 
> invalid syntax in a defn's signature somewhere.
>
> I'm basing this on the references to clojure.core$defn and 
> clojure.core$sigs shortly above compile and macroexpand. 
>
> Phil 
> On Oct 25, 2012 7:36 PM, "larry google groups" 
> > 
> wrote:
>
>>
>> I am finding the following stack trace unusually devoid of information. 
>> My app is Clojure 1.3. I run "lein compile" and I get the following stack 
>> trace. Am I blind, or does this stack trace fail to tell me what line I 
>> should look at?
>>
>>
>>
>> lein compile
>> Compiling who-is-logged-in.core
>> Exception in thread "main" java.lang.IllegalArgumentException: Don't know 
>> how to create ISeq from: clojure.lang.Symbol
>> at clojure.lang.RT.seqFrom(RT.java:487)
>> at clojure.lang.RT.seq(RT.java:468)
>> at clojure.lang.RT.first(RT.java:560)
>> at clojure.core$first.invoke(core.clj:55)
>> at clojure.core$map$fn__3811.invoke(core.clj:2432)
>> at clojure.lang.LazySeq.sval(LazySeq.java:42)
>> at clojure.lang.LazySeq.seq(LazySeq.java:60)
>> at clojure.lang.RT.seq(RT.java:466)
>> at clojure.core$seq.invoke(core.clj:133)
>> at clojure.core$filter$fn__3830.invoke(core.clj:2468)
>> at clojure.lang.LazySeq.sval(LazySeq.java:42)
>> at clojure.lang.LazySeq.seq(LazySeq.java:60)
>> at clojure.lang.RT.seq(RT.java:466)
>> at clojure.core$seq.invoke(core.clj:133)
>> at clojure.core$assert_valid_fdecl.invoke(core.clj:6464)
>> at clojure.core$sigs.invoke(core.clj:220)
>> at clojure.core$defn.doInvoke(core.clj:293)
>> at clojure.lang.RestFn.invoke(RestFn.java:525)
>> at clojure.lang.Var.invoke(Var.java:421)
>> at clojure.lang.AFn.applyToHelper(AFn.java:185)
>> at clojure.lang.Var.applyTo(Var.java:518)
>> at clojure.lang.Compiler.macroexpand1(Compiler.java:6320)
>> at clojure.lang.Compiler.macroexpand(Compiler.java:6381)
>> at clojure.lang.Compiler.compile1(Compiler.java:6970)
>> at clojure.lang.Compiler.compile(Compiler.java:7046)
>> at clojure.lang.RT.compile(RT.java:385)
>> at clojure.lang.RT.load(RT.java:425)
>> at clojure.lang.RT.load(RT.java:398)
>> at clojure.core$load$fn__4610.invoke(core.clj:5386)
>> at clojure.core$load.doInvoke(core.clj:5385)
>> at clojure.lang.RestFn.invoke(RestFn.java:408)
>> at clojure.core$load_one.invoke(core.clj:5200)
>> at clojure.core$compile$fn__4615.invoke(core.clj:5397)
>> at clojure.core$compile.invoke(core.clj:5396)
>> at user$eval27.invoke(NO_SOURCE_FILE:1)
>> at clojure.lang.Compiler.eval(Compiler.java:6465)
>> at clojure.lang.Compiler.eval(Compiler.java:6455)
>> at clojure.lang.Compiler.eval(Compiler.java:6431)
>> at clojure.core$eval.invoke(core.clj:2795)
>> at clojure.main$eval_opt.invoke(main.clj:296)
>> at clojure.main$initialize.invoke(main.clj:315)
>> at clojure.main$null_opt.invoke(main.clj:348)
>> at clojure.main$main.doInvoke(main.clj:426)
>> at clojure.lang.RestFn.invoke(RestFn.java:421)
>> at clojure.lang.Var.invoke(Var.java:405)
>> at clojure.lang.AFn.applyToHelper(AFn.java:163)
>> at clojure.lang.Var.applyTo(Var.java:518)
>> at clojure.main.main(main.java:37)
>> Compilation failed.
>>
>>  -- 
>> 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 post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: "A Practical Optional Type System for Clojure"

2012-11-05 Thread Stathis Sideris
Hello Ambrose,

Thanks for your great work, I look forward to using Typed Clojure!

Tiny correction: there is a double "are" on page 9: "Listing 1.5 shows a 
simple example of using singleton types in Typed Clojure.
Singleton types *are are* discussed further in section 2.5."

Stathis


On Thursday, 25 October 2012 05:03:00 UTC+1, Ambrose Bonnaire-Sergeant 
wrote:
>
> Hi,
>
> I have submitted my honours dissertation for marking, for those
> interested: https://github.com/downloads/frenchy64/papers/paper.pdf
>
> Corrections welcome!
>
> Thanks,
> Ambrose
>

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

Re: "A Practical Optional Type System for Clojure"

2012-11-05 Thread Stathis Sideris
Another one:

Page 31,
"This *mean* that at compile time we cannot completely trust the type 
signature of any Java method or eld that involves an array."

should be:

"This *means* that at compile time we cannot completely trust the type 
signature of any Java method or eld that involves an array."


On Monday, 5 November 2012 12:58:58 UTC, Stathis Sideris wrote:
>
> Hello Ambrose,
>
> Thanks for your great work, I look forward to using Typed Clojure!
>
> Tiny correction: there is a double "are" on page 9: "Listing 1.5 shows a 
> simple example of using singleton types in Typed Clojure.
> Singleton types *are are* discussed further in section 2.5."
>
> Stathis
>
>
> On Thursday, 25 October 2012 05:03:00 UTC+1, Ambrose Bonnaire-Sergeant 
> wrote:
>>
>> Hi,
>>
>> I have submitted my honours dissertation for marking, for those
>> interested: https://github.com/downloads/frenchy64/papers/paper.pdf
>>
>> Corrections welcome!
>>
>> Thanks,
>> Ambrose
>>
>

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

Re: unseq

2012-11-05 Thread Stathis Sideris
Given the setup that you provided, using apply is a perfectly valid answer. 
What are the complicating factors that prevent you form using it? Could you 
give us an example that's closer to your use case?

On Monday, 5 November 2012 13:35:41 UTC, cej38 wrote:
>
> No, you don't.  I want a command that works INSIDE of f not ON f.  The 
> function that I gave earlier was something overly simple.
>
>
> On Monday, November 5, 2012 12:46:24 AM UTC-5, Jerry Peng wrote:
>>
>> If I understand your problem correctly, you could use `apply`.
>>
>> user=> (defn f [w x y z] (+ w x y z))
>> #'user/f
>> user=> (f 1 2 3 4)
>> 10
>> user=> (apply f [1 2 3 4])
>> 10
>>
>>
>>
>> -- 
>> Jerry Peng
>>
>>
>>  

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

Re: Combining Complement and Not

2012-11-06 Thread Stathis Sideris
The difference between not and complement is that not takes a *value* and 
produces a new *value* which is true if the original was false (and vice 
versa) while complement takes a *function* and produces a new *function *which 
returns true in the cases where the original function would return false.

Here is an example that shows how complement can result in more concise 
code in comparison to not:

user> (filter (fn [x] (not (even? x))) [1 2 3 4 5 6 7])
(1 3 5 7)
user> (filter (complement even?) [1 2 3 4 5 6 7])
(1 3 5 7)

(of course you could just use odd? in this case, but it's only an example).

I hope that clears it up.

Stathis

On Monday, 5 November 2012 23:12:03 UTC, Charles Comstock wrote:
>
> Hi All,
>
> I quite like Clojure but have been confused from time to time on 
> particular design choices. I find understanding the root cause of these 
> decisions helps to understand the language better. As example, the fact 
> that complement and not are separate functions has been puzzling me for a 
> bit [1]. The implementation of not and complement is roughly;
>
> (defn not [x] (if x false true))
> (defn complement [f] 
>   (fn 
>  ([] (not (f)))
>  ([x] (not (f x)))
>  ([x y] (not (f x y)))
>  ([x y & zs] (not (apply f x y zs)
>
> What I'm wondering is if it's purely for performance, historical or idiomatic 
> reasons that it's not;
>
>
> (defn fnot [arg]
>   (if (ifn? arg)
> (fn
>   ([] (fnot (arg)))
>   ([x] (fnot (arg x)))
>   ([x y] (fnot (arg x y)))
>   ([x y & zs] (fnot (apply arg x y zs
> (if arg false true)))
>
> Perhaps a multi-method could also be appropriate here, though I'm not exactly 
> certain what the appropriate dispatch function would be. I follow why bit-not 
> is a separate function as the intended meaning is clearly different, but the 
> implied meaning of not seems to be the same as complement which is why it 
> seems odd that they are different methods. 
>
> After doing some experimentation with these, I finally realized that (not 
> identity) yields false, but I'm not quite following that use case. I'm 
> guessing the idiomatic argument against fnot is that it would complect not 
> and complement unnecessarily?
>
> While pouring through the clojure.core source, I also saw a few functions 
> like not-every? which use (comp not every?) instead of (complement every?). 
> This led me to question why complement is not implemented as;
>
>
> (defn complement [f] (comp not f))
>
>
> Is there a difference that I'm just not seeing? Or is that just a side effect 
> of either performance or dependency ordering in clojure.core [2].
>
> I think I may have answered my own question concerning fnot in a roundabout 
> manner, but I found the process of discovering this illuminating. Can anyone 
> else shed light on this, or am I correct in concluding that fnot would 
> complect not and complement?
>
> Thanks,
>  Charlie
>
> 1. I frequently misread comp as complement and not compose in point free 
> code, so perhaps that confusion is why complement is oddly jarring to me.
>
> 2. not-every? and not-any? are implemented using def instead of defn and 
> manually set meta :arglist, despite defn already being defined, is this just 
> for historical reasons?
>
>
>

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

Re: Clojure Signal Processing

2012-11-12 Thread Stathis Sideris
More abstractly, I think Prismatic's Graph library [1] is very similar to 
the topologies that you are describing. Unfortunately, they haven't 
open-sourced it yet. In the article they touch upon the subject of 
different ways to execute the same graph, which would allow you to 
parallelize parts that don't depend on each other (see 'Flexible execution 
strategies' section).

[1]: 
http://blog.getprismatic.com/blog/2012/10/1/prismatics-graph-at-strange-loop.html

Stathis


On Friday, 9 November 2012 23:37:49 UTC, Stephen Olsen wrote:
>
> Hey all,
>
> I've been thinking about and wanting to do some music transcription 
> projects recently (inferring musical notes from audio) and what the best 
> way to write systems like this is clojure would be. There are java 
> libraries and things like fftw that can handle the *hard* parts like 
> computing fourier transformations. These libraries are not necessarily easy 
> to use idiomatically from clojure or easily composable though. I'm also 
> having a hard time seeing the best way to wire up different components so 
> that a stream of audio can flow between them.
>
> What I think I want is a toolkit for creating signal processing graphs in 
> idiomatic clojure. It seems like the main abstractions that I'd want would 
> be similar to what storm uses for data processing; stream sources, bolts 
> and topologies to show how they connect. That way one could code up some 
> pieces, use common built in bolts to get things like frequency information, 
> declare how the pieces fit together and then run the system in a variety of 
> different ways.
>
> I'd also like the library to be built on a set of protocols so the 
> processing graphs can be run in a variety of settings. In process in an 
> async manner (something similar to the way lamina works), paralyzed across 
> many machines with storm or even in the web browser leveraging the new 
> html5 audio data apis.
>
> I plan to build this library and what I'm looking for is some feedback and 
> guidance before I begin. I'd especially love to hear from anyone that is 
> working on these kinds of systems in clojure.
>
> A Couple of the main questions I have before I can begin are these.
>
> 1) Are streams, bolts and topologies the right level of abstraction for 
> building systems like this? They will need to be a little more complicated 
> than the way storm does things I think. Different bolts will need to 
> operate on different length intervals of the signal. (an fft bolt will need 
> one bin size but then later down stream a pitch tracking bolt will need 
> different interval sizes) I guess giving bolts a buffer size would be 
> necessary and every time that buffer is filled the analysis function would 
> be called.
>
> 2) What is the best way to implement asynchronous streaming binary data in 
> clojure?
>

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

Re: ANN: clj-schema, Schemas For Clojure Maps

2012-11-27 Thread Stathis Sideris
Hello Alex,

This looks very useful, thanks. What's the license under which you are 
releasing this code? Also, I'm wondering whether something like that could 
be the next step for Typed Clojure. From Ambrose's thesis, I got the 
impression that he would like Typed Clojure to eventually cater for 
checking the contents of maps.

Thanks,

Stathis


On Sunday, 25 November 2012 23:22:04 UTC, Alex Baranosky wrote:
>
> Clj-schema is a library for defining and validating schemas for maps, as 
> well as for using those schemas to create valid test data.  We've been 
> using this in production for at least a few months now, at Runa.
>
> https://github.com/runa-dev/clj-schema
>
> The main benefits I've found from using this library are:
> * validating the inputs to the application: validating Ring request params 
> and config files
> * validating before storing maps into the DB
> * using the clj-schema.fixtures library to create valid test data that 
> stays valid.  So as the standard form of a map changes over time the tests 
> will stay in sync with those changes automatically.
> * there are some code-readability benefits as well - any developer can 
> pretty quickly see what certain kinds of maps tend to look like.
>
> There's more info in the README:
> https://github.com/runa-dev/clj-schema/blob/master/README.md
>
> Future possibilities:
> * auto-generating test data from clj-schema fixtures
> * being able to create schemas for sets and sequences (currently a schema 
> is always for a map)
>
> Contributors welcome.
>
> Alex
>

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

Re: start-process-shell-command: Spawning child process: invalid argument

2012-12-12 Thread Stathis Sideris
I've had this problem before when emacs was trying to start an external 
executable whose path contained spaces. Are you running Windows by any 
chance? Is your Java under "Program Files"? Try moving it to a space free 
path like "C:\development\tools\".

On Wednesday, 12 December 2012 12:20:46 UTC, Myrna van de Burgwal wrote:
>
> I also have a problem when I type in 'M-x slime' in Emacs. It causes the 
> same error (spawning child process: invalid argument).
> I assume I installed slime correctly and I rewrote ~/.emacs.
> What could ben the problem?
>

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

Re: JavaFX and Clojure

2012-12-17 Thread Stathis Sideris
Have you considered using the doto macro in order to avoid having to repeat 
the component as the first argument of all the setters?

(let [btn (Button.)]
  (.setLayoutX btn 100)
  (.setLayoutY btn 150)
  (.setText btn "Hello World!"))

becomes:

(doto (Button.)
  (.setLayoutX 100)
  (.setLayoutY 150)
  (.setText "Hello World!"))

On Sunday, 16 December 2012 13:37:46 UTC, Christian Sperandio wrote:
>
> I did some changes.
>
> First and foremost, I change the project's name to a more formal one: it 
> has became clj-javafx and the link is now 
> https://github.com/chrix75/clj-javafx
>
> I cleaned the code too, thus:
>
>- I remove the ugly Thread/sleep for promise and deliver
>- make the code cleaner
>
>
>
> Le dimanche 16 décembre 2012 00:24:34 UTC+1, Christian Sperandio a écrit :
>>
>> I had a test to show how it work.
>>
>>
>> Le samedi 15 décembre 2012 22:10:50 UTC+1, Christian Sperandio a écrit :
>>>
>>> Hi,
>>>
>>> After some studies about JavaFX with Clojure, and bricks broke with my 
>>> head, I wrote a sort of wrapper to work more easily with both.
>>> It's here : https://github.com/chrix75/javafx-clj
>>>
>>> You can play with JavaFX in your REPL and you have the macro with-javax 
>>> and wit-javafx-let that let you write JavaFX code  without managing the 
>>> JavaFX runtime thread.
>>>
>>> I hope it can help.
>>>
>>> Chris
>>>
>>>

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

core.logic - explaining transitive relationships

2012-12-18 Thread Stathis Sideris
Hello,

With the code below you can query transitive relationships between entities 
successfully. Is there any way to use core.logic "explain" the 
relationship? Specifically, is there any way to write a function explain so 
that:

> (explain :pitbull :chordate)

will give you:

[:pitbull :dog]
[:dog :mammal]
[:mammal :chordate]

Thanks,

Stathis


Code:

(ns test.logic
  (:refer-clojure :exclude [==])
  (:use clojure.core.logic))

(defrel is-a Entity Parent)
(fact is-a :pitbull :dog)
(fact is-a :dog :mammal)
(fact is-a :mammal :chordate)
(fact is-a :chordate :animal)

(defn transitive [r]
  (fn t [p1 p2]
(fresh [intermediate]
   (conde
  ((r p1 p2))
  ((r p1 intermediate)
   (t intermediate p2))

(defn iso [entity parent]
  ((transitive is-a) entity parent))

In the REPL:
> (run* [q] (iso :dog :animal))
(_.0)

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

Re: core.logic - explaining transitive relationships

2012-12-18 Thread Stathis Sideris
Hello David,

Yes, I wasn't expecting for this to be built-in. Your example is exactly 
what I was looking for, thanks a lot! I'll to need to spend some time to 
figure it out :-)

Stathis


On Tuesday, 18 December 2012 15:52:47 UTC, David Nolen wrote:
>
> There is no general "explain" functionality. However the following simple 
> solution should give you some ideas:
>
> (defrel is-a Entity Parent)
> (fact is-a :pitbull :dog)
> (fact is-a :dog :mammal)
> (fact is-a :mammal :chordate)
> (fact is-a :chordate :animal)
>
> (defn transitive [r]
>   (fn t
> ([x z] (t x z (lvar)))
> ([x z path]
>(fresh [y]
>  (conde
>[(r x z) (== path '())]
>[(fresh [a d]
>   (r x y)
>   (conso a d path)
>   (== a [x y])
>   (t y z d))])
>
> (defn iso
>   ([entity parent]
>  ((transitive is-a) entity parent))
>   ([entity parent path]
>  ((transitive is-a) entity parent path)))
>
> (comment
>   (run* [q]
> (iso :dog :animal q))
>   )
>
>
> On Tue, Dec 18, 2012 at 9:06 AM, Stathis Sideris 
> 
> > wrote:
>
>> Hello,
>>
>> With the code below you can query transitive relationships between 
>> entities successfully. Is there any way to use core.logic "explain" the 
>> relationship? Specifically, is there any way to write a function explain so 
>> that:
>>
>> > (explain :pitbull :chordate)
>>
>> will give you:
>>
>> [:pitbull :dog]
>> [:dog :mammal]
>> [:mammal :chordate]
>>
>> Thanks,
>>
>> Stathis
>>
>>
>> Code:
>>
>> (ns test.logic
>>   (:refer-clojure :exclude [==])
>>   (:use clojure.core.logic))
>>
>> (defrel is-a Entity Parent)
>> (fact is-a :pitbull :dog)
>> (fact is-a :dog :mammal)
>> (fact is-a :mammal :chordate)
>> (fact is-a :chordate :animal)
>>
>> (defn transitive [r]
>>   (fn t [p1 p2]
>> (fresh [intermediate]
>>(conde
>>   ((r p1 p2))
>>   ((r p1 intermediate)
>>(t intermediate p2))
>>
>> (defn iso [entity parent]
>>   ((transitive is-a) entity parent))
>>
>> In the REPL:
>> > (run* [q] (iso :dog :animal))
>> (_.0)
>>
>>  -- 
>> 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 post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: core.logic - explaining transitive relationships

2012-12-18 Thread Stathis Sideris
Thanks for this. I didn't think about that!

On Tuesday, 18 December 2012 15:51:55 UTC, Tassilo Horn wrote:
>
> Stathis Sideris > writes: 
>
> Hi Stathis, 
>
> > With the code below you can query transitive relationships between 
> > entities successfully. Is there any way to use core.logic "explain" 
> > the relationship? Specifically, is there any way to write a function 
> > explain so that: 
> > 
> >> (explain :pitbull :chordate) 
> > 
> > will give you: 
> > 
> > [:pitbull :dog] 
> > [:dog :mammal] 
> > [:mammal :chordate] 
>
> Can't you define `iso` with 3 args, one being a list of intermediates? 
> E.g., something like 
>
> (defn iso [entity is parent] 
>   (conde 
> [(is-a entity parent) (== is ())] 
> [(fresh [i nis] 
>(is-a entity i) 
>(conso i nis is) 
>(iso i nis parent))])) 
>
> Then you could run it like: 
>
>   test.logic> (run* [q] (iso :pitbull q :animal)) 
>   ((:dog :mammal :chordate)) 
>
> Bye, 
> Tassilo 
>

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

hash of 0 and nil

2012-12-20 Thread Stathis Sideris
Hello,

I noticed the following:

> (hash 0)
0
> (hash nil)
0

Which is fair enough I suppose. It seems to have the following side-effect 
though:

> (hash [1 2 3 0])
955327
> (hash [1 2 3 nil])
955327

Is that the intended behaviour? I suppose it's OK for two things to hash to 
the same value, but IMHO, it would make the hash function more useful to 
avoid this simple case. The implementation seems to check for nil 
specifically and to return 0.

Thanks,

Stathis

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

Re: hash of 0 and nil

2012-12-21 Thread Stathis Sideris
Yes that's exactly what I meant, sorry I think I didn't express it very 
well. Of course I know about hash collissions, but (maybe mistakenly) I 
always thought that they happened in relatively rare cases. Interestingly, 
'() has a hash of 1 which is the same as the hash of integer 1!

On Friday, 21 December 2012 20:10:07 UTC, Nicolas Oury wrote:
>
> I think the intial post was not about the fact that collision was a 
> problem but about the fact that 0 and nil are frequent elements, so using
> the same hash (if there is no good reason) would result in many useless 
> collisions.
>
> However, there might be a good reason to have nil and 0 having the same 
> hash.
> (nil must probably have a hash equal to '() for example)
>
>
> On Fri, Dec 21, 2012 at 9:05 AM, Christian Sperandio <
> christian...@gmail.com > wrote:
>
>> I write again my post because the previous was bad written and I want to 
>> respect the Englis language the more as I can.
>> With your question, I'm feeling you think each item has a different hash 
>> code. But it's wrong. You can meet collisions. 
>> An hash code is not an id, it's a way to find an element. 
>> So even if it's weird to have the same hash code for 0 and nil, this case 
>> is useful because it's shown you a case of collisions.
>>
>>
>> Le jeudi 20 décembre 2012 19:04:06 UTC+1, Stathis Sideris a écrit :
>>
>>> Hello,
>>>
>>> I noticed the following:
>>>
>>> > (hash 0)
>>> 0
>>> > (hash nil)
>>> 0
>>>
>>> Which is fair enough I suppose. It seems to have the following 
>>> side-effect though:
>>>
>>> > (hash [1 2 3 0])
>>> 955327
>>> > (hash [1 2 3 nil])
>>> 955327
>>>
>>> Is that the intended behaviour? I suppose it's OK for two things to hash 
>>> to the same value, but IMHO, it would make the hash function more useful to 
>>> avoid this simple case. The implementation seems to check for nil 
>>> specifically and to return 0.
>>>
>>> Thanks,
>>>
>>> Stathis
>>>
>>>  -- 
>> 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
>>
>
>
>
> -- 
> Sent from an IBM Model M, 15 August 1989. 
>

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

Re: ANN: bouncer, validation library for clojure

2013-01-09 Thread Stathis Sideris
Hey Leonardo,

This is very interesting, but I'd like to know whether it's possible to 
validate a map that contains an :errors key. Would bouncer overwrite this 
with its own :errors key? Should it not be using a fully-qualified keyword 
(as in ::errors) to avoid the clash?

Thanks,

Stathis


On Friday, 4 January 2013 06:56:19 UTC, Leonardo Borges wrote:
>
> Hey guys, 
>
> I extracted a small validation library from a side project I'm working 
> on and bouncer is the result. 
>
> While I do know there are a couple of validation libs out there 
> already, I decided this was worth publishing mostly because: 
>
> - That’s what I’m using in my current side project 
> - It takes a fundamentally different implementation approach that is 
> in itself worthy of exploration 
> - If nothing else, this is yet another example of where Monads can be 
> useful. 
>
> The full reasoning can be found in a post I wrote: 
> https://bitly.com/ZiLJzO 
>
> Where to find it: 
>
> Github: https://github.com/leonardoborges/bouncer 
> Clojars: https://clojars.org/bouncer 
>
> The README file on github contains a detailed guide to using the 
> library, hopefully that's enough should you want to try it out. 
>
> Cheers, 
> Leonardo Borges 
> www.leonardoborges.com 
>

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

Re: clojure API documentation

2013-01-29 Thread Stathis Sideris
_ is not special, but it is the convention to use it as the name for 
variables whose value is ignored.

On Tuesday, 29 January 2013 17:42:26 UTC, cej38 wrote:
>
> Hello,
>   I have noticed a couple of things that I think are standard Clojure 
> symbols but that aren't specified in the API documentation.  These are "." 
> and "_".  It may be that they are more Java than Clojure (I don't know Java 
> at all) and are thus supposedly known.  I run across "_" all of the time 
> when reading though other people's code (especially core.logic) and I saw 
> it again today when I was looking at the source code for drop-last.
>   Should these symbols be added to the documentation?
>
>   Also, could someone please give me a quick explanation of how to use _?
>
> 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/groups/opt_out.




Re: drawing a chess-board with seesaw ...

2012-08-09 Thread Stathis Sideris
How about drawing all the rectangles with 
.fillRect()and
 before each call alternate between black and white by calling 
.setColor().
 
You can alternate between the colours by taking the first of the following 
seq every time you set the color:

(cycle [java.awt.Color.black java.awt.Color.white])

Stathis

On Thursday, 9 August 2012 09:37:48 UTC+1, Jim foo.bar wrote:
>
> Hey all, 
>
> Spent most of yesterday trying to draw a chessboard on a paintable 
> canvas, however I'm stuck after drawing the lines of the grid...I mean 
> the grid is there but its all one colour (the background colour of the 
> panel)! The fn that draws the lines is simply this: 
>
> (defn draw-grid [c g] 
>(let [w (width c) 
>  h (height c)] 
>  (doseq [x (range 0 w 50)] 
>(.drawLine g x 0 x h)) 
>  (doseq [y (range 0 h 50)] 
>  (.drawLine g 0 y w y 
>
> Does anyone have any suggestions as to how to do the black-white 
> alteration on the grid? I know how to do it imperatively using loop(s) 
> and a couple of flags but I'm really struggling to tweak the 'draw-grid' 
> accordingly to paint the colours as well... 
>
> Any seesaw gurus? -> please help... 
>
> cheers, 
> Jim 
>

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

Re: drawing a chess-board with seesaw ...

2012-08-09 Thread Stathis Sideris
Yeah, sorry Dimitri, I wasn't very clear :-) I meant that if you were going 
to do it recursively you would be using the first element of the seq, and 
you would be passing the (rest) of the seq to the subsequent recursive 
call. Very elegant solution!

On Thursday, 9 August 2012 12:29:12 UTC+1, Jim foo.bar wrote:
>
> On 09/08/12 12:00, David Powell wrote: 
> > You can try using the multi-input version of map to knit your data 
> > together with some other, potentially infinite, sequence: 
> > 
> >(map vector items (cycle [black white])) 
> > 
> > It returns something like this: 
> > 
> >([item1 black] [item2 white] [item3 black] [item4 white]) 
> > 
> > Then you can use doseq over that, using destructuring to pick apart 
> > the items and colours and do something appropriate with each of them. 
> > 
>
> Thanks Dave that is pretty clever and looks very idiomatic! I managed to 
> get what I by using your suggestion: 
>
> (defn draw-grid2 [d g] 
>(let [w (width d) 
>  h (height d) 
>  tiles (map vector (for [x (range 0 w 50) 
>  y (range 0 h 50)] [x y]) 
>(cycle [java.awt.Color/WHITE 
>java.awt.Color/BLACK]))] 
>  (doseq [[[x y] c] tiles] 
> (.setColor g c) 
> (.fillRect g x y 50 50)) )) 
>
>
> Thanks a lot! It looked impossible to achieve without mutation, indices 
> and counting pixels!!! 
>
> Jim 
>

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

Re: Building School Seating Charts in Clojure and ClojureScript: Part 1

2012-08-29 Thread Stathis Sideris
Nice post, thanks. Did you write the the geometry utilities yourself?

On Wednesday, 29 August 2012 09:38:06 UTC+1, Evan Mezeske wrote:
>
> I finally got around to writing the first installment in what is going to 
> be a series of articles about my experiences with building a commercial web 
> app in Clojure and ClojureScript:
>
> http://blog.mezeske.com/?p=552
>
> Sorry if the first article doesn't have enough meaty technical details (or 
> code).  Hopefully the next couple of installments will have more detail!
>
> -Evan
>

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

Re: anonymous functions with names

2012-09-03 Thread Stathis Sideris
Thanks, this is a *very* useful bit of information.

On Monday, 3 September 2012 10:30:21 UTC+1, dmirylenka wrote:
>
> Just 2 cents:
>
> A name you give to the anonymous function also appears in the stack traces 
> instead of the things like fn_123_4532,
> which is very convenient for debugging.
>
> On Friday, August 31, 2012 5:52:55 PM UTC+2, Erlis Vidal wrote:
>>
>> Hi guys, 
>>
>> I've been reading but I'm still confused about the difference between an 
>> anonymous function with name vs a defn function
>>
>> (fn my-func1[x] x)
>>
>> (defn my-func2[x] x)
>>
>> Thanks, 
>> Erlis 
>>
>

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

Negation in core.logic

2012-09-19 Thread Stathis Sideris
Hello,

Is there a way to negate a goal in core.logic? I have written this goal 
below, and I would like to use it to query all the pairs of people who are 
*not* relatives according to my facts (for dating purposes of course :-D)

(defn relative [p1 p2]
  (conde
[(parent p1 p2)]
[(parent p2 p1)]
[(sibling p1 p2)]
[(cousin p1 p2)]
[(nephew p1 p2)]
[(uncle p1 p2)]))


Thanks,

Stathis

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

Re: Negation in core.logic

2012-09-20 Thread Stathis Sideris
Thanks a lot David. As much as I'd like to contribute, I've only just 
started looking into logic programming.

Stathis

On Wednesday, 19 September 2012 17:42:09 UTC+1, David Nolen wrote:
>
> On Wed, Sep 19, 2012 at 11:11 AM, Stathis Sideris 
> > 
> wrote:
> > Hello,
> >
> > Is there a way to negate a goal in core.logic? I have written this goal
> > below, and I would like to use it to query all the pairs of people who 
> are
> > *not* relatives according to my facts (for dating purposes of course :-D)
> >
> > (defn relative [p1 p2]
> >   (conde
> > [(parent p1 p2)]
> > [(parent p2 p1)]
> > [(sibling p1 p2)]
> > [(cousin p1 p2)]
> > [(nephew p1 p2)]
> > [(uncle p1 p2)]))
> >
> >
> > Thanks,
> >
> > Stathis
>
> core.logic currently only supports Prolog's negation as failure. You can 
> write a goal that looks like this:
>
> (defn not [g]
>   (fn [a]
> (if (nil? (g a))
>   a)))
>
> But you must be careful if you use this, all logic vars passed to the goal 
> g must be ground. So it's not relational.
>
> I have some leads based on recent Prolog research (CiaoProlog, and an 
> interesting dissertation on the abstract interpretation of Prolog) for 
> really handling negation in core.logic but I don't think I'll have time to 
> deal with it any time soon. Again, more than willing and excited to 
> collaborate with people who would like to see it done sooner.
>
> David
>

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

Re: Transforming an ugly nested loop into clojure code

2012-10-02 Thread Stathis Sideris
I'm not sure how/if the following would fit your use case exactly, but you 
might want to explore the get-in function (and assoc-in, the clojure.walk 
namespace and the zippers functionality. They all make dealing with such 
deeply nested structures easier.

Stathis

On Monday, 1 October 2012 23:36:15 UTC+1, arekanderu wrote:
>
> Thank you Gaz for your reply. You are correct about the side effects.
>
> I will go through your example more carefully and give it a go. It 
> definitely looks more promising than what I got :)
>
> On Tuesday, October 2, 2012 1:22:44 AM UTC+3, Gaz wrote:
>>
>> You appear to be running over the map purely for side-effects, 
>> therefore off the top of my head something like: 
>>
>> (defn my-func 
>>   [data] 
>>   (doseq [area data 
>>   warehouse (:warehouses area) 
>>   container (:containers warehouse) 
>>   box (:boxes container)] 
>> (if-not (empty? (:items box)) 
>>   (doseq [item (:items box)] (do-something (:box box) (:item item))) 
>>   (do-something-else (:warehouse warehouse) 
>>  (:container container) 
>>  (:box box) 
>>
>> Might be more appropriate... 
>>
>>
>> On Mon, Oct 1, 2012 at 5:07 PM, arekanderu  wrote: 
>> >> (def my-data [{:area "Somewhere" :warehouses 
>> >> 
>> >>[{:warehouse "W54321" :containers 
>> >> 
>> >> [{:container "C12345" :boxes 
>> >> 
>> >>   [{:box "B12345" :items 
>> >> 
>> >> [{:item "I12345"}]}]}]}]} 
>> >> 
>> >>   {:area "SomewhereElse" :warehouses 
>> >> 
>> >>[{:warehouse "W54321" :containers 
>> >> 
>> >> [{:container "C54321" :boxes 
>> >> 
>> >>   [{:box "B54321" :items 
>> >> 
>> >> [{:item "I54321"}]}]}]}]}]) 
>> >> 
>> >> 
>> >> (defn my-func [data] 
>> >> 
>> >>   (map (fn [area] 
>> >> 
>> >>  (map (fn [warehouse] 
>> >> 
>> >> (map (fn [container] 
>> >> 
>> >>(map (fn [box] 
>> >> 
>> >>   (if (not (empty? (:items box))) 
>> >> 
>> >> (map (fn [item] 
>> >> 
>> >>(doSomething (:box box) (:item 
>> >> item))) 
>> >> 
>> >>  (:items box)) 
>> >> 
>> >> (doSomethingElse (:warehouse 
>> warehouse) 
>> >> (:container container) (:box box 
>> >> 
>> >>   (:boxes container))) 
>> >> 
>> >>  (:containers warehouse))) 
>> >> 
>> >>   (:warehouses area))) 
>> >> 
>> >>data)) 
>>
>

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

Re: interleave

2012-10-04 Thread Stathis Sideris
Maybe performance is the reason:

> (time (dotimes [_ 100] (apply mapcat list [[1 2 3] [7 7 7]])))
"Elapsed time: 1853.904337 msecs"
> (time (dotimes [_ 100] (interleave [1 2 3] [7 7 7])))
"Elapsed time: 81.000798 msecs"


On Wednesday, 3 October 2012 19:21:37 UTC+1, Marc Dzaebel wrote:
>
> Thanks for the link! I proposed the change there.
>
> Am Mittwoch, 3. Oktober 2012 20:06:42 UTC+2 schrieb Andy Fingerhut:
>>
>> I don't know the reason for the current implementation rather than your 
>> suggested one, but at least on the comment about 0 or 1 arguments has a 
>> ticket for it:
>>
>> http://dev.clojure.org/jira/browse/CLJ-863
>>
>

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

Re: interleave

2012-10-04 Thread Stathis Sideris
You are right, but still:

> (time (dotimes [_ 100] (dorun (apply mapcat list [[1 2 3] [7 7 7]]
"Elapsed time: 4177.113292 msecs"
> (time (dotimes [_ 100] (dorun (interleave [1 2 3] [7 7 7]
"Elapsed time: 1156.658738 msecs"

:-)

Stathis

On Thursday, 4 October 2012 14:46:09 UTC+1, Meikel Brandmeyer (kotarak) 
wrote:
>
> Hi,
>
> you should probably add some dorun somewhere.
>
> Kind regards
> Meikel
>
>

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

Watching namespaces

2011-09-15 Thread Stathis Sideris
Hello,

Is it somehow possible to monitor all namespaces for new defs or re-
defs (and defns etc). Generally, it it possible to implement some sort
of notification whenever something is added or updated to a namespace?
I don't mind even the solution is hacky or not very fast.

The reason I'm asking is because such functionality would be very
useful for creating development tools that would react to the
developer eval-ing a function or re-compiling a file etc.

Thanks,

Stathis

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


ISeq protocol-like support

2011-10-11 Thread Stathis Sideris
Hello all,
Is it possible make an existing Java class behave as a seq? What I'm really
asking I guess, is how come Seqable is not a protocol so that we can say
something like

(extend-type java.awt.Container
  clojure.lang.Seqable
  (seq [this] (my-seq-function this)))

I know this can be achieved at creation time by proxy or reify, but this is
not in the spirit of protocols (which can add behaviour on, after the
definition of the type). Am I missing something?
Thanks,
Stathis

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

Re: ISeq protocol-like support

2011-10-12 Thread Stathis Sideris
Thanks, the bootstraping and performance explanations both make sense.
I guess questions like that arise because Clojure tries to accomodate
both the Java type system and its own, and sometimes there is tension
between the two...

On Oct 11, 11:01 pm, Stuart Sierra 
wrote:
> Nope, the core interfaces were written before Protocols existed. Making them
> protocols is a bootstrapping problem, although ClojureScript shows that it
> may be possible to fix this.
>
> If you want to make a Java class seqable, you'll have to wrap it in another
> type that you create.
>
> -Stuart Sierra
> clojure.com

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


Re: ANN: Korma - a SQL DSL for Clojure

2011-11-04 Thread Stathis Sideris
Very nice, thanks Chris!

Is there any way to use this to group together a bunch of SQL
statements as a transaction?

By the way, I think the colour scheme of the website is great, it does
really remind me of korma sauce!

Stathis


On Nov 4, 3:15 am, Daniel  wrote:
> Good color choices on the website.  It would be interesting to see
> some performance comparisons between korma and clojureql, but I don't
> really know what kinds of tests would make for good benchmarks.  From
> what I read c3po is the preferred way to do connection pooling (I had
> been configuring clj-dbcp), so kudos on that.  I've never used c3po
> before, but it looks like there's a config file which gives more
> flexibility than the connection-pool function - is there any ceremony
> involved in making korma use the c3po config file?
>
> Also, why use the log4j stuff directly and not tools.logging?  Don't
> take this the wrong way.  I want to know if there would be any salient
> advantage to use it in one of my projects.
>
> On Nov 3, 12:13 am, Chris Granger  wrote:
>
>
>
>
>
>
>
> > Color is always a touchy and very subjective realm. :)
>
> > In terms of "why not ClojureQL?" I'll quote my response from HN:
>
> > The issue I had with ClojureQL is that it seems like the wrong abstraction
> > to me. Myself and others I've talked to have found ourselves fighting with
> > how it tries to model data and more specifically the kind of queries it
> > generates. For example, it is very quick to use rather inefficient
> > sub-selects.
>
> > Cheers,
> > Chris.
>
> > On Wed, Nov 2, 2011 at 5:45 PM, Carin Meier  wrote:
> > > I really like the color pallette :)
>
> > > --
> > > 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 post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Introspecting functions

2011-11-04 Thread Stathis Sideris
Although it doesn't directly answer your question, I have used (with-
meta) to attach debug information to generated functions in the past.
If you are writing function combinators you can even do this
recursively by taking the existing debug info from a function that you
generated before and combine it new debug info for the function you
are currently generating.

For an actual example on how to do this, see (and-matcher) and the
surrounding matcher functions here:

https://github.com/stathissideris/clarity/blob/master/src/clarity/structure.clj

Stathis


On Nov 3, 9:59 pm, AndyK  wrote:
> Is it possible to print information about a function from within the
> repl? For example, after using comp or partial to create new
> functions, can you display the arity, the source, etc? I'm trying to
> debug a problem and it would be handy to be able to check that my
> dynamic funcitons are what I think they are.
>
> thx

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


ANN: Clarity 0.5.1 - New GUI library

2011-12-02 Thread Stathis Sideris
Hello everyone,

I would like to announce the first release of Clarity (v0.5.1), a
Swing-based GUI library. It's available on github and through clojars:

   https://github.com/stathissideris/clarity

   [clarity "0.5.1"]

Also, here's an introductory talk (will only play as embedded
unfortunately):

   
http://skillsmatter.com/podcast/scala/lightening-talk-clarity-a-wrapper-for-swing

Finally, a couple of tutorial-style pages from the wiki:

   https://github.com/stathissideris/clarity/wiki/Component

   https://github.com/stathissideris/clarity/wiki/Forms

This is a new library and I coule really use some feedback on the
syntax, the features, and maybe even the code.

Thanks,

Stathis

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


Re: ANN: Clarity 0.5.1 - New GUI library

2011-12-02 Thread Stathis Sideris
Well, there isn't much preventing it from being 1.3. It used to be
blocked by the dependency to clojure.contrib.miglayout, but then
Stephen Gilardi released artem (https://github.com/scgilardi/artem)
which provided a way out. I think it's probably a matter of days
before I get a version that's compatible with Clojure 1.3, although
I'm investigating how it would be possible to have 1.2 and 1.3
compatibility from one codebase.

Thanks,

Stathis


On Dec 2, 7:21 pm, Doug South  wrote:
> Hi Stathis,
>
> Nice presentation and the library looks interesting. One question,
> when do you think it will be ported to 1.3?
>
> Regards,
> Doug
>
>
>
>
>
>
>
> On Fri, Dec 2, 2011 at 12:55 PM, Stathis Sideris  wrote:
> > Hello everyone,
>
> > I would like to announce the first release of Clarity (v0.5.1), a
> > Swing-based GUI library. It's available on github and through clojars:
>
> >  https://github.com/stathissideris/clarity
>
> >   [clarity "0.5.1"]
>
> > Also, here's an introductory talk (will only play as embedded
> > unfortunately):
>
> >  http://skillsmatter.com/podcast/scala/lightening-talk-clarity-a-wrapp...
>
> > Finally, a couple of tutorial-style pages from the wiki:
>
> >  https://github.com/stathissideris/clarity/wiki/Component
>
> >  https://github.com/stathissideris/clarity/wiki/Forms
>
> > This is a new library and I coule really use some feedback on the
> > syntax, the features, and maybe even the code.
>
> > Thanks,
>
> > Stathis
>
> > --
> > 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 post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: ANN: Clarity 0.5.1 - New GUI library

2011-12-03 Thread Stathis Sideris
Hello Gary,

Hello Gary,

To be honest I didn't look at seesaw much while developing Clarity, so
I didn't make any conscious decision to differentiate with seesaw.
It's very interesting to see that both me and Dave Ray came up with
similar solutions/features.

It seems that Seesaw is more concise in comparison to Clarity, and
from the project page it does look like a more mature project. On the
other hand, it seems to me (and I might be wrong) that Clarity has a
more complete solution when it comes to selectors because it supports
"categories" on top of the IDs, and the syntax caters for arbitrary
logic operations and custom selectors.

It seems that Seesaw uses binding for keeping GUI values and atoms/
refs in sync, and Clarity instead provides easy ways to retrieve all
the values of all components in a panel as a map (see the HasValue
interface). I like Clarity's approach better because it's more de-
coupled.

The other thing that I think differentiates Clarity is the live
preview of layouts using clarity.dev/watch-component.

Finally, let me repeat that all of the above are based on a
superficial reading of Seesaw's docs, I may as well be wrong!

Thanks,

Stathis


On Dec 3, 2:52 pm, Gary Trakhman  wrote:
> Have you looked at seesaw?  What differences are there in the design and
> intent?

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


Re: ANN: Clarity 0.5.1 - New GUI library

2011-12-06 Thread Stathis Sideris
Hello Dave,

> I'll clarify some of Stathis' remarks about Seesaw below. Obviously,
> I'm a little biased, but Clarity looks cool and I plan on "borrowing"
> some of its features for Seesaw in the next release or two :)  I think
> it's great to have multiple projects like this to inspire each other
> and keep everyone honest. Keep up the nice work!

Thanks for your kind words, if you're borrowing I must be doing
something right! I too think that it's really cool to have multiple
projects, and it may help us learn from each other! We do have similar
problems after all.

> Seesaw selectors are basically Enlive selectors [1] ported to Swing.
> So it supports all the usually CSS hierarchical stuff, ids and classes
> (Clarity's categories). It can also select on Java class/sub-class
> relationships. I left it at that since selector+filter seemed a
> reasonable enough way to add custom predicates or whatever if
> necessary.
>
> [1]http://enlive.cgrand.net/syntax.html

OK that looks pretty powerful too, I retract my comments about being
able to do more with Clarity's selectors. :-)

> > The other thing that I think differentiates Clarity is the live
> > preview of layouts using clarity.dev/watch-component.
>
> I think that's very cool too. I approximate that workflow using
> lazytest's watcher to re-run my code when it changes.

I think that's a much better way. Currently, when watching a
component, Clarity bashes the JVM by creating the component every X
seconds (I did say it was an experimental feature!). I'll look into
lazytest's code to see how it detects the code changes. I suppose it
watches for changes in the class files, right?

Stathis

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


Re: namespace what?

2011-12-15 Thread Stathis Sideris
You can just say:

(ns examples.core
  (:use clarity.component))

This will intern all the symbols in the clarity.component namespace
into examples.core, so you can use them as if they were defined in
examples.core in the first place: (make :button "the button")

This has the disadvantage of potential clashes, if a make function
existed in examples.core, it would be overwritten.

You can also say:

(ns examples.core
  (:require clarity.component))

This makes the clarity.component namespace symbols available to you,
but you still have to fully qualify them: (clarity.component/
make :button "the button")

This is a bit long-winded, so you can alias the namespace to something
shorter:

(ns examples.core
  (:require [clarity.component :as c]))

In which case your code becomes: (c/make :button "the button")

So you manage to be concise, but also you keep your namespaces tidily
separated :-)

Stathis


On Dec 13, 9:50 pm, jayvandal  wrote:
> I think I understand namespace and then I don't!
> I try to run this example
> (ns examples.core
>   (use [clarity.component :as c]))
>
>  (make :button "The Button")
>  I have programs stored in c:\projects\klarity.clj
> I have clojure stored in c:\clojure-1.2.1\clojure-1.21.
> I am running c:\cljr\clj-installer-jar
>
> I tried running
> (ns clojure-1.2.1.clojure-1.2.1.src.clojure.core
>   (use [clarity.component :as c]))
>
>  (make :button "The Button")
>
> What is namespace suposed to point to or access???

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


Re: -> and ->>

2012-02-08 Thread Stathis Sideris
I've always wondered why there isn't a "thread-in-the-middle" macro
(or should it be "thread-wherever"?), with special syntax to indicate
where to thread like so:

(--> foo
  (bar x _ y)
  (baz _ x y)
  (test x y _))

Should be easy to implement I guess...

On Feb 8, 4:29 pm, Baishampayan Ghose  wrote:
> On Wed, Feb 8, 2012 at 9:46 PM, Simon Holgate  wrote:
> > Could anyone point me to a description of "->" and "->>", please?
>
> > I've seen a few references to them (e.g. git://gist.github.com/1761143.git)
> > but nothing in "Programming Clojure". Google doesn't seem to like
> > searching for such strings.
>
> These macros are collectively called the "threading macros". `->` is
> called "thread first" and `->>` is called "thread last". These macros
> lets you write deeply nested function invocations in a relatively flat
> manner.
>
> Something like
>
> (-> foo
>   (bar x)
>   (baz y)
>   (quux z))
>
> gets re-written as (quux (baz (bar foo x) y) z). So `->` basically
> threads the first expression through the subsequent forms, inserting
> it as the second item in the list (aka the first arg).
>
> Similarly, something like
>
> (->> foo
>   (bar x)
>   (baz y)
>   (quux z))
>
> gets re-written as (quux z (baz y (bar x foo))).
>
> More docs here -http://clojuredocs.org/clojure_core/clojure.core/-%3E
> &http://clojuredocs.org/clojure_core/clojure.core/-%3E%3E
>
> Regards,
> BG
>
> --
> Baishampayan Ghose
> b.ghose at gmail.com

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


Re: -> and ->>

2012-02-08 Thread Stathis Sideris
Ah, thanks, that's a very interesting thread. To be honest I haven't
found myself in a situation where --> would be very useful, it was
more of a random thought...

On Feb 8, 4:38 pm, Baishampayan Ghose  wrote:
> On Wed, Feb 8, 2012 at 10:06 PM, Stathis Sideris  wrote:
> > I've always wondered why there isn't a "thread-in-the-middle" macro
> > (or should it be "thread-wherever"?), with special syntax to indicate
> > where to thread like so:
>
> > (--> foo
> >  (bar x _ y)
> >  (baz _ x y)
> >  (test x y _))
>
> > Should be easy to implement I guess...
>
> Oh, no. Not again!
>
> https://groups.google.com/forum/?fromgroups#!topic/clojure/6Cb8MD5EC3w
>
> Regards,
> BG
>
> --
> Baishampayan Ghose
> b.ghose at gmail.com

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


Re: Stale .class files in protocols / records

2012-02-13 Thread Stathis Sideris
I have the same problem, and unfortunately I haven't found a better
way to fix this apart from restarting the JVM. I start lein swank and
connect to it using slime-connect from emacs, so it's not too painful,
but still annoying. Maybe there is a way to force reloading without a
restart, but I don't know how...

On Feb 12, 6:00 pm, Andrew Cholakian  wrote:
> I've noticed that code I change in defprotocol or defrecord does not get
> reflected unless I rm -rf classes. I've taken to 'rm -rf classes/myapp &&
> lein run' as the main way to run my code.
>
> Code outside defprotocol and defrecord gets reloaded just fine.
>
> I've tried this with JDK1.6 and 1.7 on OSX Lion, and it's bad on both. Does
> anyone know why this is? It makes SLIME in particular a pain.

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


Re: Released: nREPL 0.2.0-beta1

2012-02-15 Thread Stathis Sideris
It sounds great Chas, especially the wide acceptance that nREPL seems
to already have with the various tools.

I wanted to ask about the potential of this as an embedded Clojure
REPL in existing Java applications for the purpose of connecting
remotely and performing inspection (and possibly manipulation?) of the
current state of the application for debugging purposes. Is this a
legitimate use case? How easy do you think it would be to achieve this
with the current version of nREPL?

Thanks!

Stathis


On Feb 14, 2:42 pm, Chas Emerick  wrote:
> I have released nREPL 0.2.0-beta1, which should show up in Maven central soon.
>
> For those that don't know, nREPL is "a Clojure network REPL that provides a 
> REPL server and client, along with some common APIs of use to IDEs and other 
> tools that may need to evaluate Clojure code in remote environments":
>
> https://github.com/clojure/tools.nrepl
>
> This release is the result of gathering ideas, feedback, and requirements 
> from dozens of people that need to have a REPL backend in a variety of 
> environments, and want to maximize interoperability of Clojure tooling — much 
> of which inevitably ends up grounding out at running or connecting to a REPL 
> somewhere.
>
> This release marks a thorough breaking change from every aspect the last 
> release of nREPL, 0.0.5.  (The rationale for this is detailed in design notes 
> in the project's wiki, for those that haven't followed along.)  The result is 
> that a design that settles a number of failings of nREPL's original design, 
> and which provides a number of different vectors of extensibility — similar 
> in many respects to those provided by Ring — that I hope people will take 
> advantage of to build astonishingly cool tools.
>
> Note that pre-release versions of many Clojure tools are already using 
> snapshots of nREPL 0.2.0, including Counterclockwise, Leiningen, and Reply, 
> and as far as I know, more are on their way.
>
> My plans for the near future are to continue to tighten up the documentation, 
> and release an HTTP transport: a Ring handler that exposes nREPL as an HTTP 
> API.
>
> If you have any questions or find some shortcoming, bug, or problem with this 
> release, please reply here or ping me on irc or twitter (`cemerick` in either 
> case).
>
> Happy tooling,
>
> - Chas

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


Re: Released: nREPL 0.2.0-beta1

2012-02-16 Thread Stathis Sideris
Apart from going a bit cross-eyed from seeing clojure-as-java code
from the first time, I get it :-)

Thanks Chas, I'll give it a try and let you know how it goes.

Stathis


On Feb 15, 3:31 pm, Chas Emerick  wrote:
> You can absolutely run an nREPL server from a mostly-Java application.  
> Something like this would do (just a sketch, untested):
>
> 
> private static IFn startServer, stopServer;
>
> static {
>   try {
>     RT.var("clojure.core", 
> "require").invoke(Symbol.intern("clojure.tools.nrepl.server"));
>     startServer = RT.var("clojure.tools.nrepl.server", "start-server");
>     stopServer = RT.var("clojure.tools.nrepl.server", "stop-server");
>   } catch (Exception e) {
>       throw new RuntimeException(e);
>   }
>
> }
>
> public static Object startServer (int port) {
>   return startServer.invoke(Keyword.intern("port"), port);
>
> }
>
> public static void stopServer (Object server) {
>   stopServer.invoke(server);}
>
> 
>
> There's already a thin Java wrapper for the nREPL client API 
> (https://github.com/clojure/tools.nrepl/blob/master/src/main/java/cloj...one 
> for the server side would be good to cover that use case as well.
>
> - Chas
>
> On Feb 15, 2012, at 8:46 AM, Stathis Sideris wrote:
>
>
>
>
>
>
>
> > It sounds great Chas, especially the wide acceptance that nREPL seems
> > to already have with the various tools.
>
> > I wanted to ask about the potential of this as an embedded Clojure
> > REPL in existing Java applications for the purpose of connecting
> > remotely and performing inspection (and possibly manipulation?) of the
> > current state of the application for debugging purposes. Is this a
> > legitimate use case? How easy do you think it would be to achieve this
> > with the current version of nREPL?
>
> > Thanks!
>
> > Stathis
>
> > On Feb 14, 2:42 pm, Chas Emerick  wrote:
> >> I have released nREPL 0.2.0-beta1, which should show up in Maven central 
> >> soon.
>
> >> For those that don't know, nREPL is "a Clojure network REPL that provides 
> >> a REPL server and client, along with some common APIs of use to IDEs and 
> >> other tools that may need to evaluate Clojure code in remote environments":
>
> >>https://github.com/clojure/tools.nrepl
>
> >> This release is the result of gathering ideas, feedback, and requirements 
> >> from dozens of people that need to have a REPL backend in a variety of 
> >> environments, and want to maximize interoperability of Clojure tooling — 
> >> much of which inevitably ends up grounding out at running or connecting to 
> >> a REPL somewhere.
>
> >> This release marks a thorough breaking change from every aspect the last 
> >> release of nREPL, 0.0.5.  (The rationale for this is detailed in design 
> >> notes in the project's wiki, for those that haven't followed along.)  The 
> >> result is that a design that settles a number of failings of nREPL's 
> >> original design, and which provides a number of different vectors of 
> >> extensibility — similar in many respects to those provided by Ring — that 
> >> I hope people will take advantage of to build astonishingly cool tools.
>
> >> Note that pre-release versions of many Clojure tools are already using 
> >> snapshots of nREPL 0.2.0, including Counterclockwise, Leiningen, and 
> >> Reply, and as far as I know, more are on their way.
>
> >> My plans for the near future are to continue to tighten up the 
> >> documentation, and release an HTTP transport: a Ring handler that exposes 
> >> nREPL as an HTTP API.
>
> >> If you have any questions or find some shortcoming, bug, or problem with 
> >> this release, please reply here or ping me on irc or twitter (`cemerick` 
> >> in either case).
>
> >> Happy tooling,
>
> >> - Chas
>
> > --
> > 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 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