Re: Practical Clojure

2012-04-14 Thread JuanManuel Gimeno Illa


On Friday, April 13, 2012 9:11:07 PM UTC+2, faenvie wrote:
>
>
>
> in addition there could be a separate book 'professional clojure' that 
> focuses on extensions and advanced topics of the clojure cosmos: 
> clojurescript, monads, continuations, building dsl, core.logic, ring, 
> korma, noir  ... this could be a great selling book IMO. it is the 
> book david nolan, jim duey, chris granger ... would probably love to 
> review. 


I'd like a book covering similar themes as Functional Programming in 
Scala but 
centered on clojure.

Juan Manuel

-- 
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: Practical Clojure

2012-04-14 Thread faenvie
light table looks like a candidate for the book ...
btw 'professional clojure' is not a good title ... better: 'beyond
clojure' ? etc.

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

2012-04-14 Thread Vinzent

>
> So 'false?' doesn't help you here.
>
It does, actually (see earlier responses for details)
 

> So if anyone runs into this problem _in real world code_ it's because
>
> they are calling a Java API that somehow returns a Java Boolean object
> embedded in the result. If you are working with a Java data structure
> full of _Objects_ then you need to take care of converting those
> Object instances into appropriate Clojure values. Calling (boolean v)
> is sufficient to convert the Java Object to a Clojure true/false
> value.
>
Yeah it was stated in the very beginning of the thread.

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

2012-04-14 Thread Angel Java Lopez
What is the situation in ClojureCLR?

And, seeing the if code cited, I just run this code:

public class BoolTest {
public static void main(String[] args)
{
Boolean f = new Boolean(false);
System.out.println(f.equals(false)); // true
System.out.println(f == false); // true
System.out.println(f == Boolean.FALSE); // false
System.out.println(f.equals(Boolean.FALSE)); // true
}
}

why not replace
public Object eval() {
Object t = testExpr.eval();
if(t != null && t != Boolean.FALSE)
return thenExpr.eval();
return elseExpr.eval();
}

by
public Object eval() {
Object t = testExpr.eval();
if(t != null && !t.equals(Boolean.FALSE))
return thenExpr.eval();
return elseExpr.eval();
}


My guess: performance. But it should be measured

Angel "Java" Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez


On Sat, Apr 14, 2012 at 6:16 AM, Vinzent  wrote:

> So 'false?' doesn't help you here.
>>
> It does, actually (see earlier responses for details)
>
>
>> So if anyone runs into this problem _in real world code_ it's because
>>
>> they are calling a Java API that somehow returns a Java Boolean object
>> embedded in the result. If you are working with a Java data structure
>> full of _Objects_ then you need to take care of converting those
>> Object instances into appropriate Clojure values. Calling (boolean v)
>> is sufficient to convert the Java Object to a Clojure true/false
>> value.
>>
> Yeah it was stated in the very beginning of the thread.
>
> --
> 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

ANN: A more fully-featured lein-vimclojure

2012-04-14 Thread Daniel Solano Gómez
Hello,

I am happy to let you know I have published a new Leiningen plug-in for
VimClojure support.

I know there are already a number of VimClojure plug-ins out there, some
of them called lein-nailgun and others called lein-vimclojure. However,
most of them tend to be fairly minimal. In particular, most of them
lacked two key features:

1. Support for both Leiningen 1.x and Leiningen 2.x projects, and
2. The ability to run a standalone REPL in the same process as the
server.

I hope that this is will be useful for other VimClojure users.  It's
available from Clojars as [com.sattvik/lein-vimclojure "0.9.0"].  Please
check out the README from GitHub for more detailed instructions on
configuration options at .

Sincerely,

Daniel


signature.asc
Description: Digital signature


Re: ANN: A more fully-featured lein-vimclojure

2012-04-14 Thread Jim - FooBar();
good stuff...can i ask something completely irrelevant? is there any 
chance the clojure repl for android will ever get support for loading 
external libraries? also i run a tiny genetic algorithm on it only 
showed all the output at the end of the simulation rather than going one 
step at a time. is this expected?

thanks!

Jim

On 14/04/12 14:20, Daniel Solano Gómez wrote:

Hello,

I am happy to let you know I have published a new Leiningen plug-in for
VimClojure support.

I know there are already a number of VimClojure plug-ins out there, some
of them called lein-nailgun and others called lein-vimclojure. However,
most of them tend to be fairly minimal. In particular, most of them
lacked two key features:

1. Support for both Leiningen 1.x and Leiningen 2.x projects, and
2. The ability to run a standalone REPL in the same process as the
server.

I hope that this is will be useful for other VimClojure users.  It's
available from Clojars as [com.sattvik/lein-vimclojure "0.9.0"].  Please
check out the README from GitHub for more detailed instructions on
configuration options at.

Sincerely,

Daniel


--
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: Supporting platform specific code

2012-04-14 Thread Kevin Lynagh
I have no idea what, if anything, Clojure the language(s) *should* do
about this issue, but I can explain the reasoning behind CLJX.

CLJX uses the reader to statically analyze toplevel forms in a file
and generate new ones according to declarative rewrite rules.
The motivating use case was to make the C2 data visualization library
work on both Clojure and ClojureScript.

C2's source is spit across

src/cljx ;;most of the code
src/clj  ;;Clojure-specific
src/cljs ;;ClojureScript-specific (i.e., DOM manipulation code)

and most of the cljx files only have one or two platform metadata
annotations.
Any namespace which uses macros has two ns forms to accomidate
ClojureScript's :use-macros syntax.

I explicitly wanted a solution where code for different platforms
would be in the same file because it eases the burden on the
maintainer to ensure consistency between implementations.
That makes sense when the differing implementations are very small:

(defn ^:clj log10 [x] (Math/log10 x))
(defn ^:cljs log10 [x] (/ (.log js/Math x)
                          (.-LN10 js/Math)))

and I agree with Dave in that it could get unwieldy fast if you try to
mix larger implementation-specific functions together.

If I wanted to write something cross-platform, I'd start by defining
the needed foundation (beyond what is provided by the Clojure
runtimes, e.g., "str"), write those platform-specific functions
completely separate from each other, and then write the shared Clojure
code that implements the bulk of the functionality.
The CLJX solution works nicely with C2 because 90% of C2 code
manipulates Clojure data structures only.
There are relatively few implementation details that need to be
papered over.

Clojure was designed to be a hosted language, and it's very easy to
reach out to the underlying platform.
If you don't need to do that and can get by with Clojure/core---great,
your code will be portable.
However, if you use libraries and facilites native to the host
platform, then you're not writing Clojure so much as you are writing
Clojure+Java or Clojure+JavaScript.
If that's the case, just have separate projects with a shared spec or
test suite and not worry about mashing it all together with compiler
or pre-processing tricks.

On Apr 13, 10:06 am, Aaron  wrote:
> I posed this question briefly in this post here:  
> https://groups.google.com/d/msg/clojure/K65Va0rCCls/Ow5bAJ_YTGIJ.  In this
> real world example of porting Korma over to ClojureCLR, I encountered the
> following things:
>
>    - One namespace which handled JDBC interaction needed to be rewritten
>    completely to target ADO.NET
>    - Another namespace required a few minor changes, only one of these
>    (changing .indexOf to IndexOf) was platform specific
>
> Korma is a library that is probably exceptional in its avoidance of
> platform specific features in most namespaces.  Porting something like
> swank would not have been so easy.  In general, I would say that for this
> library, I would prefer to use the platform specific folder approach - i.e
> having two namespaces korma.platform.db and korma.platform.util in src-jvm/
> and src-clr/ folders.  Then there could be a CLR specific project.clj
> (maybe project.clr.clj) sitting next to the JVM project.clj (and eventually
> maybe a project.py.clj).  Each project.clj would reference the correct
> platform specific folder in addition to the shared src/ folder.  Just off
> the top of my head, the reasons for supporting this approach are:
>
>    - It forces the developer to isolate platform specific code into
>    manageable units that can be 1) more easily ported to another platform, 2)
>    easily maintained, and 3) tested in isolation for compatibility
>    - There is no need for one clojure dialect to know about the whereabouts
>    or contents of code for another dialect.  This would seem to be unnecessary
>    overhead.
>
> While I can see why it might be nice to be able to quickly add some
> metadata to distinguish this platform specific code while keeping
> everything in one file, as other have mentioned, I would encourage people
> to think about the downsides of this.  Say, I had just taking korma.db and
> put some conditionally compiled CLR code alongside the JVM code.  The file
> doubles in size.  Would I then want the py team to do the same?  Also, for
> the one .indexOf -> IndexOf change, say there are little changes like that
> all over the place.  Would a team adding a new port want to go through the
> whole source tree and find every instance of this?  Without modifying the
> clojure compilers we have now, the platform specific directory approach
> will work and is probably cleaner.  It just requires team consensus on
> adopting this approach.
>
> One thing, I would propose is adding some build tool awareness of this so
> that maybe an NLein or PyLein could use the same project.clj and just see
> :platform-clr, :platform-py, :platform-jvm attributes.  Or this could be
> done by having a shared pr

Re: Practical Clojure

2012-04-14 Thread Qiu Xiafei
how about Programming Clojure? I am reading it as a start point of learn
clojure

On Sat, Apr 14, 2012 at 4:52 PM, faenvie  wrote:

> light table looks like a candidate for the book ...
> btw 'professional clojure' is not a good title ... better: 'beyond
> clojure' ? etc.
>
> --
> 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: Light Table - a new IDE concept

2012-04-14 Thread daly

> 
> On Friday, April 13, 2012 1:34:54 PM UTC-5, looselytyped wrote:
> This is an awesome implementation of Brett Victors "Inventing
> On 
> Principle" [http://vimeo.com/36579366] using Clojure and Noir
> by Chris 
> Granger (who also wrote Noir). 
> 
> Figured I would share it with the group. 
> 
> 
> http://www.chris-granger.com/2012/04/12/light-table---a-new-ide-concept/ 
> 
> Raju
> 

A most excellent piece of work.

I would like to see some extensions to support literate programming.

Look at http://axiom-developer.org/axiom-website/litprog.html
Look at section 2.2

Besides the function, I would like to see the surround  text.
Even better, I would like to be able to edit the text as well as
the function. Search could be specialized to the text.

For Clojure code, look at
http://daly.axiom-developer.org/clojure.pamphlet which is a latex
document containing the source code for Clojure, as well as its
test cases and Ant build script. 
(The PDF is at http://daly.axiom-developer.org/clojure.pdf)

Here I have Clojure and Java code, access to a table of contents
as well as an index of terms. The document is broken up into
\chapter, \section, \subsection, and other text markups.

Is light-table open source? 
How can I contribute these kinds of changes?

Tim Daly
d...@literatesoftware.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: Practical Clojure

2012-04-14 Thread Manuel Paccagnella
It depends on the audience I guess. I've bought "Practical Clojure" but I 
found its minimalism a little too... minimal to my experience at the time. 
I was (an in many ways I still am) a nearly total novice on fp and Clojure, 
and although it's a very good and concise introduction to Clojure I don't 
think I was in its target audience.

Instead, I found quite useful "Programming Clojure" 2nd edition (By Stuart 
Halloway and Aaron Bedra). It's more comprehensive and rich with examples 
while staying quite lean (less than 260 pages). It also has an entire 
chapter devoted to the entire process and tooling to write a small albeit 
significant application.

I've also recently bought "Clojure Programming" by Chas Emerick, Brian 
Carper and Christophe Grand. This is, well, *bigger* (630 pages long!) but 
in the few pages I've read I already appreciate the style.

BTW: they are all good books, it's just a matter of taste, learning style 
and experience I guess. 

Il giorno venerdì 13 aprile 2012 12:19:43 UTC+2, faenvie ha scritto:
>
> hi community, 
>
> i simply want to state that i love this book 
> http://www.apress.com/9781430272311 
>
> it's minimalism is amazing and it helped me a lot. its good to 
> repeatedly read single chapters to get conscious of ... minimal is 
> good. 
>
> i would love to read a second edition with maybe a chapter about 
> clojurescript. 
>
> have a successful time

-- 
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: Practical Clojure

2012-04-14 Thread Stuart Sierra
Hi, faenvie, 

Thanks for your comments about "Practical Clojure," really glad you enjoyed 
it!

Unfortunately, it seems unlikely right now that there will be a second 
edition of "Practical Clojure" from Apress, but Luke VanderHart and I are 
currently working on a second book together. Details to come later this 
Spring.

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

2012-04-14 Thread Softaddicts

Can't talk too much about CLR, but interop with CLR while having similarities 
syntax wise
is a different interop beast (like JS interop has its specifics).

You can compare CLR and the JVM but not with Java.
Java is a implementation of a language on top of the JVM as Clojure is over 
both 
the JVM and CLR (and JS).

The JVM and CLR (and JS) in this context are engines running language 
implementations, not language implementations by themselves.

Clojure is not Java and vice-versa.  Java objects are values to Clojure.
So is a Boolean object. What you have shown here is a Java specific behaviour,
an ugly patch introduced in Java 5. Even then,

System.out.println(f == Boolean.FALSE); // false 

Can be seen as odd. According to the original poster, I could complain that this
result is non sense in regards to this one:

System.out.println(f == false); // true

Knowing that Boolean.FALSE is the false primitive value and that the Boolean 
object
has its wrapped value set as false. I could complain that they should be equal.

Performance of your suggestion has been measured as posted in this thread, 20x 
slower.

Considering that it's not recommended even by Java implementors to use this 
class 
instead of the primitive type, that it's an alien issue to Clojure and that it 
hampers
performance significantly, it's not worth it.

This case (and this thread) should be dead by now.

Luc

> What is the situation in ClojureCLR?
> 
> And, seeing the if code cited, I just run this code:
> 
> public class BoolTest {
> public static void main(String[] args)
> {
> Boolean f = new Boolean(false);
> System.out.println(f.equals(false)); // true
> System.out.println(f == false); // true
> System.out.println(f == Boolean.FALSE); // false
> System.out.println(f.equals(Boolean.FALSE)); // true
> }
> }
> 
> why not replace
> public Object eval() {
> Object t = testExpr.eval();
> if(t != null && t != Boolean.FALSE)
> return thenExpr.eval();
> return elseExpr.eval();
> }
> 
> by
> public Object eval() {
> Object t = testExpr.eval();
> if(t != null && !t.equals(Boolean.FALSE))
> return thenExpr.eval();
> return elseExpr.eval();
> }
> 
> 
> My guess: performance. But it should be measured
> 
> Angel "Java" Lopez
> http://www.ajlopez.com
> http://twitter.com/ajlopez
> 
> 
> On Sat, Apr 14, 2012 at 6:16 AM, Vinzent  wrote:
> 
> > So 'false?' doesn't help you here.
> >>
> > It does, actually (see earlier responses for details)
> >
> >
> >> So if anyone runs into this problem _in real world code_ it's because
> >>
> >> they are calling a Java API that somehow returns a Java Boolean object
> >> embedded in the result. If you are working with a Java data structure
> >> full of _Objects_ then you need to take care of converting those
> >> Object instances into appropriate Clojure values. Calling (boolean v)
> >> is sufficient to convert the Java Object to a Clojure true/false
> >> value.
> >>
> > Yeah it was stated in the very beginning of the thread.
> >
> > --
> > 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
--
Softaddicts sent by ibisMail!

-- 
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: A more fully-featured lein-vimclojure

2012-04-14 Thread Evan Mezeske
Thank you!  In particular, the Leiningen 1/2 support is a huge win.  I'm 
really glad someone decided to tackle this!

I feel I should point out, though, that the name of the plugin is 
unfortunate.  There are already several plugins named "lein-vimclojure", so 
that when I google that term, the top couple of results are other plugins. 
 Picking the right lein-vimclojure plugin is *already* a PITA, because 
searching e.g. clojars.org for "vimclojure" returns like 20 results, and I 
can never remember which user's lein-vimclojure is the one I like.

Also, using the name "lein-vimclojure" is going to make it more difficult 
for me to recommend your awesome looking plugin to a friend.  I can't just 
tell them to google lein-vimclojure; I'll have to provide a bunch of 
context, and even then it will still be confusing.

-Evan

On Saturday, April 14, 2012 6:20:12 AM UTC-7, Daniel Solano Gómez wrote:
>
> Hello,
>
> I am happy to let you know I have published a new Leiningen plug-in for
> VimClojure support.
>
> I know there are already a number of VimClojure plug-ins out there, some
> of them called lein-nailgun and others called lein-vimclojure. However,
> most of them tend to be fairly minimal. In particular, most of them
> lacked two key features:
>
> 1. Support for both Leiningen 1.x and Leiningen 2.x projects, and
> 2. The ability to run a standalone REPL in the same process as the
> server.
>
> I hope that this is will be useful for other VimClojure users.  It's
> available from Clojars as [com.sattvik/lein-vimclojure "0.9.0"].  Please
> check out the README from GitHub for more detailed instructions on
> configuration options at .
>
> Sincerely,
>
> Daniel
>
>

-- 
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: A more fully-featured lein-vimclojure

2012-04-14 Thread Evan Mezeske
I just thought of an additional disadvantage to overloading the 
lein-vimclojure name, which is that searching for troubleshooting purposes 
will potentially return misleading results.  E.g., I might search for 
"lein-vimclojure throws error", and click through to the first couple of 
results.  If I'm not very careful to notice that I'm reading about 
org.clojars.autre's version instead of com.sattvik's version, I'm liable to 
be very confused.  Even worse, if the result just refers to the plugin as 
lein-vimclojure without the group ID, I'm totally hosed.

On Saturday, April 14, 2012 1:10:40 PM UTC-7, Evan Mezeske wrote:
>
> Thank you!  In particular, the Leiningen 1/2 support is a huge win.  I'm 
> really glad someone decided to tackle this!
>
> I feel I should point out, though, that the name of the plugin is 
> unfortunate.  There are already several plugins named "lein-vimclojure", so 
> that when I google that term, the top couple of results are other plugins. 
>  Picking the right lein-vimclojure plugin is *already* a PITA, because 
> searching e.g. clojars.org for "vimclojure" returns like 20 results, and 
> I can never remember which user's lein-vimclojure is the one I like.
>
> Also, using the name "lein-vimclojure" is going to make it more difficult 
> for me to recommend your awesome looking plugin to a friend.  I can't just 
> tell them to google lein-vimclojure; I'll have to provide a bunch of 
> context, and even then it will still be confusing.
>
> -Evan
>
> On Saturday, April 14, 2012 6:20:12 AM UTC-7, Daniel Solano Gómez wrote:
>>
>> Hello,
>>
>> I am happy to let you know I have published a new Leiningen plug-in for
>> VimClojure support.
>>
>> I know there are already a number of VimClojure plug-ins out there, some
>> of them called lein-nailgun and others called lein-vimclojure. However,
>> most of them tend to be fairly minimal. In particular, most of them
>> lacked two key features:
>>
>> 1. Support for both Leiningen 1.x and Leiningen 2.x projects, and
>> 2. The ability to run a standalone REPL in the same process as the
>> server.
>>
>> I hope that this is will be useful for other VimClojure users.  It's
>> available from Clojars as [com.sattvik/lein-vimclojure "0.9.0"].  Please
>> check out the README from GitHub for more detailed instructions on
>> configuration options at .
>>
>> Sincerely,
>>
>> Daniel
>>
>>

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

Clojurescript, sencha, animations

2012-04-14 Thread Marius Seritan
I am looking into integrating clojurescript with sencha toolkit for a 
complex web app. The app is consumer facing so it needs to be fast and 
animation rich. I would love to talk to people who have interests/expertise 
in this area. We can talk about mutating your financial state, if 
apropriate :)

Marius
lov2...@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

Streaming song

2012-04-14 Thread Simone Mosciatti
Hi everybody,

I was looking for streaming a song between my server and my laptop, 
the only problem is that I have no ideas at all, never do something like 
that.

I have a little idea of what aleph is and how it work (very little idea) so 
i was thinking to use that lib and stream byte by byte using the TCP or UDP 
(which one ?) protocol, but then i have no idea how play the song on my 
laptop...

I guess that there is already something, probably in java, that would made 
everything simpler, but i didn't find...

So im looking for every idea, suggestion, link, documentation, everything 
that would be useful (also theorical information/paper).

Thanks everybody

-- 
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: Streaming song

2012-04-14 Thread sean neilan
Over the internet or a LAN?

On Sat, Apr 14, 2012 at 7:34 PM, Simone Mosciatti wrote:

> Hi everybody,
>
> I was looking for streaming a song between my server and my laptop,
> the only problem is that I have no ideas at all, never do something like
> that.
>
> I have a little idea of what aleph is and how it work (very little idea)
> so i was thinking to use that lib and stream byte by byte using the TCP or
> UDP (which one ?) protocol, but then i have no idea how play the song on my
> laptop...
>
> I guess that there is already something, probably in java, that would made
> everything simpler, but i didn't find...
>
> So im looking for every idea, suggestion, link, documentation, everything
> that would be useful (also theorical information/paper).
>
> Thanks everybody
>
> --
> 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: Streaming song

2012-04-14 Thread Simone Mosciatti
Sorry, over internet...

Il giorno sabato 14 aprile 2012 19:34:21 UTC-5, Simone Mosciatti ha scritto:
>
> Hi everybody,
>
> I was looking for streaming a song between my server and my laptop, 
> the only problem is that I have no ideas at all, never do something like 
> that.
>
> I have a little idea of what aleph is and how it work (very little idea) 
> so i was thinking to use that lib and stream byte by byte using the TCP or 
> UDP (which one ?) protocol, but then i have no idea how play the song on my 
> laptop...
>
> I guess that there is already something, probably in java, that would made 
> everything simpler, but i didn't find...
>
> So im looking for every idea, suggestion, link, documentation, everything 
> that would be useful (also theorical information/paper).
>
> Thanks everybody
>

-- 
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: Supporting platform specific code

2012-04-14 Thread Dave Sann
I agree with all of that.

If you are extracting and writing jvm, py, clr, cljs interop as a means to 
enable portability, then you are effectively writing extensions to the core 
clojure platform libs. 

I.e providing a base, in a similar way that, for example, clojure.string 
extends common string operations across platforms.

It is the capability of the core platform that enables portability.

It's a double edged sword though and there are certainly many cases where 
it does not make sense.

I think that there are a couple of areas where core extensions for 
portability might be useful.

I have used this for cljs and jvm with:
1. math, as above
2. string -> numeric parsing, (although the reader can be used too)
3. logging - but only in simple cases for debugging.
4. exceptions - but only in very limited form

I find that beyond these - I can pretty much get away with completely 
generic code. 
The only challenge then is how to get the platform specific and generic 
files to the relevant compiler in a clean and standard, rather than ad-hoc 
manner. (lein cljs-build et al)

Dave


On Sunday, 15 April 2012 02:42:27 UTC+10, Kevin Lynagh wrote:
>
> I have no idea what, if anything, Clojure the language(s) *should* do 
> about this issue, but I can explain the reasoning behind CLJX. 
>
> CLJX uses the reader to statically analyze toplevel forms in a file 
> and generate new ones according to declarative rewrite rules. 
> The motivating use case was to make the C2 data visualization library 
> work on both Clojure and ClojureScript. 
>
> C2's source is spit across 
>
> src/cljx ;;most of the code 
> src/clj  ;;Clojure-specific 
> src/cljs ;;ClojureScript-specific (i.e., DOM manipulation code) 
>
> and most of the cljx files only have one or two platform metadata 
> annotations. 
> Any namespace which uses macros has two ns forms to accomidate 
> ClojureScript's :use-macros syntax. 
>
> I explicitly wanted a solution where code for different platforms 
> would be in the same file because it eases the burden on the 
> maintainer to ensure consistency between implementations. 
> That makes sense when the differing implementations are very small: 
>
> (defn ^:clj log10 [x] (Math/log10 x)) 
> (defn ^:cljs log10 [x] (/ (.log js/Math x) 
>   (.-LN10 js/Math))) 
>
> and I agree with Dave in that it could get unwieldy fast if you try to 
> mix larger implementation-specific functions together. 
>
> If I wanted to write something cross-platform, I'd start by defining 
> the needed foundation (beyond what is provided by the Clojure 
> runtimes, e.g., "str"), write those platform-specific functions 
> completely separate from each other, and then write the shared Clojure 
> code that implements the bulk of the functionality. 
> The CLJX solution works nicely with C2 because 90% of C2 code 
> manipulates Clojure data structures only. 
> There are relatively few implementation details that need to be 
> papered over. 
>
> Clojure was designed to be a hosted language, and it's very easy to 
> reach out to the underlying platform. 
> If you don't need to do that and can get by with Clojure/core---great, 
> your code will be portable. 
> However, if you use libraries and facilites native to the host 
> platform, then you're not writing Clojure so much as you are writing 
> Clojure+Java or Clojure+JavaScript. 
> If that's the case, just have separate projects with a shared spec or 
> test suite and not worry about mashing it all together with compiler 
> or pre-processing tricks. 
>
> On Apr 13, 10:06 am, Aaron  wrote: 
> > I posed this question briefly in this post here:  
> https://groups.google.com/d/msg/clojure/K65Va0rCCls/Ow5bAJ_YTGIJ.  In 
> this 
> > real world example of porting Korma over to ClojureCLR, I encountered 
> the 
> > following things: 
> > 
> >- One namespace which handled JDBC interaction needed to be rewritten 
> >completely to target ADO.NET 
> >- Another namespace required a few minor changes, only one of these 
> >(changing .indexOf to IndexOf) was platform specific 
> > 
> > Korma is a library that is probably exceptional in its avoidance of 
> > platform specific features in most namespaces.  Porting something like 
> > swank would not have been so easy.  In general, I would say that for 
> this 
> > library, I would prefer to use the platform specific folder approach - 
> i.e 
> > having two namespaces korma.platform.db and korma.platform.util in 
> src-jvm/ 
> > and src-clr/ folders.  Then there could be a CLR specific project.clj 
> > (maybe project.clr.clj) sitting next to the JVM project.clj (and 
> eventually 
> > maybe a project.py.clj).  Each project.clj would reference the correct 
> > platform specific folder in addition to the shared src/ folder.  Just 
> off 
> > the top of my head, the reasons for supporting this approach are: 
> > 
> >- It forces the developer to isolate platform specific code into 
> >manageable units that can be 1) more 

Re: Supporting platform specific code

2012-04-14 Thread kovas boguta
I think there are 2 big ideas of relevant to this problem.

1. Tagged literals
2. Compiler-as-a-service

Tagged literals do not have the drawbacks of metadata, or of macros.

They are ideal for indicating the semantics of a piece of data. If a
piece of data needs to be tagged as representing clojure,
clojurescript, clojure-py, or for that matter any language whatsoever,
it can be done.

Lets give it the polyglot namespace:

#polyglot/clj (foo bar)
#polyglot/cljs (foo bar)
#polyglot/clj-py (foo bar)
...
#polyglot/js "foo(bar);"
...
#polyglot/common-lisp (foo bar)

Now the code can be reliably manipulated as data, and transmitted to
compiler services as needed.

For the purposes of the previous discussion we need a compile-time
macro to pick code corresponding to the current platform, something
like

(pick-current-platform [#polyglot/clj impl1 #polyglot/cljs imp2])

For some projects it makes sense to segregate things into files for
different languages, but that could be a higher level of organization
built on top of tagged literal source code representations.

Furthermore, powerful things can be achieved using the tagged literal
model. It becomes possible to nest languages within one another, to
build polyglot systems.

For the sake of argument, suppose that tagged code turns into
datatypes that implement some useful interfaces. In addition to code
compilation, they could also implement Callable.

So you could write something like

#polyglot/cljs (+ 1 ( #polyglot/clj #(+ % 1) 2)
--> 4

(assuming that the compiler/evaluation service has been configured to
allow communication between the different hosts)

One detail I haven't worked out yet is if the tagged code literals
should be quoted, or not.

-- 
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: Supporting platform specific code

2012-04-14 Thread kovas boguta
Ok, here is an obvious follow-on idea:

Let the file suffix correspond to the tagged literal with which the
file contents are interpreted.

so foo.clj would get read as #clj 

and so forth. (non-official releases would use namespace-qualified
suffixes, though the "/" would have to get munged approrpiately)

This has the benefit of being systematically extendable, and useable
by all kinds of systems that need to read data from disk, in addition
to source code.



On Sat, Apr 14, 2012 at 10:41 PM, kovas boguta  wrote:
> I think there are 2 big ideas of relevant to this problem.
>
> 1. Tagged literals
> 2. Compiler-as-a-service
>
> Tagged literals do not have the drawbacks of metadata, or of macros.
>
> They are ideal for indicating the semantics of a piece of data. If a
> piece of data needs to be tagged as representing clojure,
> clojurescript, clojure-py, or for that matter any language whatsoever,
> it can be done.
>
> Lets give it the polyglot namespace:
>
> #polyglot/clj (foo bar)
> #polyglot/cljs (foo bar)
> #polyglot/clj-py (foo bar)
> ...
> #polyglot/js "foo(bar);"
> ...
> #polyglot/common-lisp (foo bar)
>
> Now the code can be reliably manipulated as data, and transmitted to
> compiler services as needed.
>
> For the purposes of the previous discussion we need a compile-time
> macro to pick code corresponding to the current platform, something
> like
>
> (pick-current-platform [#polyglot/clj impl1 #polyglot/cljs imp2])
>
> For some projects it makes sense to segregate things into files for
> different languages, but that could be a higher level of organization
> built on top of tagged literal source code representations.
>
> Furthermore, powerful things can be achieved using the tagged literal
> model. It becomes possible to nest languages within one another, to
> build polyglot systems.
>
> For the sake of argument, suppose that tagged code turns into
> datatypes that implement some useful interfaces. In addition to code
> compilation, they could also implement Callable.
>
> So you could write something like
>
> #polyglot/cljs (+ 1 ( #polyglot/clj #(+ % 1) 2)
> --> 4
>
> (assuming that the compiler/evaluation service has been configured to
> allow communication between the different hosts)
>
> One detail I haven't worked out yet is if the tagged code literals
> should be quoted, or not.

-- 
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: Dealing with dynamic header in log file processing

2012-04-14 Thread Benny Tsai
Hi Cliff,

There are at least 2 approaches you can try:

1. Use an atom to store the fields data, updating it whenever you encounter 
a #Fields row, and referencing it when processing data rows.

2. Use (reduce) to process the rows, using the accumulator to store both 
the current count and fields data.  Something like this:

(reduce (fn [{:keys [count fields] :as acc} row]
  ;; the above de-structuring makes current count and fields 
available
  (cond
   ;; if it's a fields row...
   (fields-row? row) (let [new-fields :compute-new-fields-here]
   (assoc acc :fields new-fields))
   ;; if it's a data row...
   (data-row? row) (let [new-count :compute-new-count-here]
 (assoc acc :count new-count
{:count 0 :fields []}
rows)

I think both approaches are equally valid, it's just a matter of which one 
appeals to you more.  Hope this helps!

On Thursday, April 12, 2012 9:38:31 AM UTC-7, Cliff Mosley wrote:
>
> Prefacing this with being a complete Clojure novice, my question is more 
> about approach than the actual code required. Like many, I have a few tried 
> and true examples that I like to work through in each language. In my case, 
> I have a set of IIS log files that I want to generate usage statistics on. 
> The hitch in my particular problem is that the log files may or may not 
> have columns redefined within the file.
>
> As an example 
> #Software: Microsoft Internet Information Services 6.0
> #Version: 1.0
> #Date: 2011-05-02 17:42:15
> #Software: Microsoft Internet Information Services 6.0
> #Version: 1.0
> #Date: 2011-05-02 17:42:15
> #Fields: date time c-ip cs-username s-ip s-port cs-method cs-uri-stem 
> cs-uri-query sc-status cs(User-Agent)
> 2011-05-02 17:42:15 172.22.255.255 - 172.30.255.255 80 GET 
> /images/picture2.jpg - 200 
> Mozilla/4.0+(compatible;MSIE+5.5;+Windows+2000+Server)
> 2011-05-02 17:43:15 172.22.255.255 - 172.30.255.255 80 GET 
> /images/picture1.jpg - 200 
> Mozilla/4.0+(compatible;MSIE+5.5;+Windows+2000+Server)
> .
> .
> 
> .
> .
> #Same file, s-ip is now removed so ordinal positions are changed
> #Fields: date time c-ip cs-username s-port cs-method cs-uri-stem 
> cs-uri-query sc-status cs(User-Agent)
> 2011-05-02 17:48:15 172.22.255.255 - 80 GET /images/picture1.jpg - 200 
> Mozilla/4.0+(compatible;MSIE+5.5;+Windows+2000+Server)
> 2011-05-02 17:49:15 172.22.255.255 - 80 GET /images/picture3.jpg - 200 
> Mozilla/4.0+(compatible;MSIE+5.5;+Windows+2000+Server)
>
> So with the above data, I am trying to get the count of log file hits from 
> a given cs(User-Agent). In other languages, I would just read in the 
> #Fields row and continue processing merrily given the most recent order I 
> encountered moving through the file sequentially. With Clojure, the 
> immutability of the fields is throwing a wrench for me.
>
> If anyone could give me a nudge in the right direction, I would appreciate 
> it.
> Cliff
>
>

-- 
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 Urly 1.0 is released

2012-04-14 Thread Michael Klishin
With 1.0 jar hitting clojars, I think it's time to announce Urly here.

Urly is a library that provides a common immutable abstraction for URLs and 
URIs, including
string representations. It also makes it easier to 

 * extract and mutate parts of URLs (like path or query string)
 * resolve URLs in a more forgiving way (closer to how browsers do it)
 * work with certain invalid URLs that can be found in real world HTML markup

and in general provides some useful functions java.net.URI and java.net.URL 
lack.

For example, functions like host-of or without-query-string can work on string 
inputs, java.net.URL instances, java.net.URI instances and so on.

Urly lives on github [1], targets Clojure 1.3+, licensed under the Eclipse 
Public License and
tested against Clojure 1.3 and 1.4 (betas) on travis-ci.org [2].

More detailed rationale and code examlpes for Urly can be found in the README. 
The test suite is pretty extensive and provides more examples (until we put up 
a real documentation site).

New releases, features and so on are announced on Twitter @ClojureWerkz [3].

1. https://github.com/michaelklishin/urly
2. http://travis-ci.org/#!/michaelklishin/urly
3. http://twitter.com/clojurewerkz/


MK

-- 
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: New VimClojure plug-in now known as lein-tarsier

2012-04-14 Thread Daniel Solano Gómez
Hello,

Thanks for your thoughts.  After considering your points, I've decided
to rename the plug-in 'lein-tarsier', after the animal that appears on
the cover of 'Learning the vi and Vim Editors'.

As a result, I have bumped the revision number and created a new GitHub
repository.  You can now get it using [lein-tarsier "0.9.1"] and the
repository is at .

Sincerely,

Daniel


On Sat Apr 14 13:23 2012, Evan Mezeske wrote:
> I just thought of an additional disadvantage to overloading the 
> lein-vimclojure name, which is that searching for troubleshooting purposes 
> will potentially return misleading results.  E.g., I might search for 
> "lein-vimclojure throws error", and click through to the first couple of 
> results.  If I'm not very careful to notice that I'm reading about 
> org.clojars.autre's version instead of com.sattvik's version, I'm liable to 
> be very confused.  Even worse, if the result just refers to the plugin as 
> lein-vimclojure without the group ID, I'm totally hosed.
> 
> On Saturday, April 14, 2012 1:10:40 PM UTC-7, Evan Mezeske wrote:
> >
> > Thank you!  In particular, the Leiningen 1/2 support is a huge win.  I'm 
> > really glad someone decided to tackle this!
> >
> > I feel I should point out, though, that the name of the plugin is 
> > unfortunate.  There are already several plugins named "lein-vimclojure", so 
> > that when I google that term, the top couple of results are other plugins. 
> >  Picking the right lein-vimclojure plugin is *already* a PITA, because 
> > searching e.g. clojars.org for "vimclojure" returns like 20 results, and 
> > I can never remember which user's lein-vimclojure is the one I like.
> >
> > Also, using the name "lein-vimclojure" is going to make it more difficult 
> > for me to recommend your awesome looking plugin to a friend.  I can't just 
> > tell them to google lein-vimclojure; I'll have to provide a bunch of 
> > context, and even then it will still be confusing.
> >
> > -Evan
> >
> > On Saturday, April 14, 2012 6:20:12 AM UTC-7, Daniel Solano Gómez wrote:
> >>
> >> Hello,
> >>
> >> I am happy to let you know I have published a new Leiningen plug-in for
> >> VimClojure support.
> >>
> >> I know there are already a number of VimClojure plug-ins out there, some
> >> of them called lein-nailgun and others called lein-vimclojure. However,
> >> most of them tend to be fairly minimal. In particular, most of them
> >> lacked two key features:
> >>
> >> 1. Support for both Leiningen 1.x and Leiningen 2.x projects, and
> >> 2. The ability to run a standalone REPL in the same process as the
> >> server.
> >>
> >> I hope that this is will be useful for other VimClojure users.  It's
> >> available from Clojars as [com.sattvik/lein-vimclojure "0.9.0"].  Please
> >> check out the README from GitHub for more detailed instructions on
> >> configuration options at .
> >>
> >> Sincerely,
> >>
> >> Daniel
> >>
> >>
> 
> -- 
> 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


signature.asc
Description: Digital signature


Andy Fingerhut wants to chat

2012-04-14 Thread Andy Fingerhut
---

Andy Fingerhut wants to stay in better touch using some of Google's coolest new
products.

If you already have Gmail or Google Talk, visit:
http://mail.google.com/mail/b-d7d845b242-b84a102cf0-A1gnhr4A2hNcJ4MUjH_o4M_4vTk
You'll need to click this link to be able to chat with Andy Fingerhut.

To get Gmail - a free email account from Google with over 7,500 megabytes of
storage - and chat with Andy Fingerhut, visit:
http://mail.google.com/mail/a-d7d845b242-b84a102cf0-A1gnhr4A2hNcJ4MUjH_o4M_4vTk

Gmail offers:
- Instant messaging right inside Gmail
- Powerful spam protection
- Built-in search for finding your messages and a helpful way of organizing
  emails into "conversations"
- No pop-up ads or untargeted banners - just text ads and related information
  that are relevant to the content of your messages

All this, and it's yours for free. But wait, there's more! By opening a Gmail
account, you also get access to Google Talk, Google's instant messaging
service:

http://www.google.com/talk/

Google Talk offers:
- Web-based chat that you can use anywhere, without a download
- A contact list that's synchronized with your Gmail account
- Free, high quality PC-to-PC voice calls when you download the Google Talk
  client

We're working hard to add new features and make improvements, so we might also
ask for your comments and suggestions periodically. We appreciate your help in
making our products even better!

Thanks,
The Google Team

To learn more about Gmail and Google Talk, visit:
http://mail.google.com/mail/help/about.html
http://www.google.com/talk/about.html

(If clicking the URLs in this message does not work, copy and paste them into
the address bar of your browser).

-- 
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: A more fully-featured lein-vimclojure

2012-04-14 Thread Daniel Solano Gómez
On Sat Apr 14 16:39 2012, Jim - FooBar(); wrote:
> good stuff...can i ask something completely irrelevant? is there any 
> chance the clojure repl for android will ever get support for loading 
> external libraries?

Yes, there is.  I have not forgotten about the REPL, and there are many
updates that I would like to apply to it.  For example, in addition to
loading scripts, there is converting the core of the REPL to an Android
service (so it won't get killed off), and perhaps saving the output of
the REPL session.

The main problem for me, unfortunately, is a lack of time.  I have way
too many projects going on at the moment.

In the meantime, I have written about a way to load arbitrary scripts
into the REPL, but that's not quite the same thng as being able to
support libraries.  If you haven't seen it, it's available at
.

> also i run a tiny genetic algorithm on it only showed all the output
> at the end of the simulation rather than going one step at a time. is
> this expected?

I think so.  The processing all occurs in a background thread and the
output from the REPL is dumped into a string.  It's a lot trickier to
show output as it is generated, as that would require not just getting
the result of the input, but also coordinating what output has been
produced and what has been consumed.

Sincerely,

Daniel


signature.asc
Description: Digital signature