[CLJS] Finding current time in millis

2012-01-14 Thread Shantanu Kumar
Hi,

I am trying to write a CLJS (0df1bc4d7b) function that finds out the
current system time in milliseconds, equivalent of (System/
currentTimeMillis) in Clojure:

(ns foo)

(defn now []
  ;; new Date().getTime()
  (.getTime (js/Date.)))


This displays the following when displayed using JavaScript
alert("Found " + foo.now()):

Found function getTime() {
[native code]
}


When I wrap into a function call
(defn now []
  ;; new Date().getTime()
  ((.getTime (js/Date.

I see the exception in Firebug: "Can't convert null to object" while
executing the following code:
return(new Date).getTime.call(null)

What am I doing wrong?

Shantanu

-- 
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: [CLJS] Finding current time in millis

2012-01-14 Thread Baishampayan Ghose
> I am trying to write a CLJS (0df1bc4d7b) function that finds out the
> current system time in milliseconds, equivalent of (System/
> currentTimeMillis) in Clojure:
>
> (ns foo)
>
> (defn now []
>  ;; new Date().getTime()
>  (.getTime (js/Date.)))
>
>
> This displays the following when displayed using JavaScript
> alert("Found " + foo.now()):
>
> Found function getTime() {
>    [native code]
> }
>
>
> When I wrap into a function call
> (defn now []
>  ;; new Date().getTime()
>  ((.getTime (js/Date.
>
> I see the exception in Firebug: "Can't convert null to object" while
> executing the following code:
> return(new Date).getTime.call(null)
>
> What am I doing wrong?

.getTime is a method which takes no arguments. In JavaScript (and by
extension ClojureScript) instance methods are also properties.

So in your case, (.getTime (js/Date.)) actually returns the value of
the method (the native code) instead of calling it.

If you wish to call .getTime instead, you'll have to invoke it thusly
- (. (js/Date.) (getTime))

Also note that this problem has been fixed in a very recent commit
with the introduction of a new property lookup syntax -
http://dev.clojure.org/display/design/Unified+ClojureScript+and+Clojure+field+access+syntax

Hope this helps.

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: Finding current time in millis

2012-01-14 Thread Shantanu Kumar
> If you wish to call .getTime instead, you'll have to invoke it thusly
> - (. (js/Date.) (getTime))

It works. Thank you!

Regards,
Shantanu

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


i am so bored

2012-01-14 Thread Dennis Haupt
hi there,

i am looking for something to do, preferably something that makes me
rich, but that is not a must have - if it's interesting, i'll code for free.

i can offer almost 15 years of coding experience (important: while being
open minded the whole time). i am a one man army, if you will :)
(procedural, OO (that one for money), FP, even some assembler). one
thing i have not yet done is write something big without static type
checking, so that'll be new.

clojure has caught my interest. in general, high level programming has.
i played around with clojure a bit and would like to get something done
that has at least some purpose. are there any small/new projects looking
for help?

-- 
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: 4Clojure exersice question

2012-01-14 Thread Erlis Vidal
Hi guys,

I don't know how the validations for this are done, but in this case I can
think on a naive check for the usage of a banned function. I think a regex
can do it. Something that look for* (count\s*+*
*
I know maybe there are more edges cases but I don't think it'll be much
than that. I understand all the sandbox discussion but in this case the
question we are trying to answer is: Given the user has found a solution,
did he used any banned function?

Sometimes while solving a problem, we can not see simpler solutions.

What do you think?

Erlis

On Fri, Jan 13, 2012 at 11:18 PM, Anthony Grimes wrote:

> I responded to this earlier, but I accidentally hit the 'reply to author'
> button instead of 'reply to post', and thus it went directly to Cedric
> rather than to the group. I'll respond here and quote the previous emails:
>
> On Fri, Jan 13, 2012 at 8:57 PM, Anthony Grimes 
> wrote:
>
>> 4Clojure uses clojail for sandboxing behind the scenes. I didn't realize
>> that you may not be aware of that.
>
>
> On Friday, January 13, 2012 at 8:12 PM, Cedric Greevey wrote:
>
>> Indeed I wasn't, and I doubt much of the rest of its user base is either.
>
> On top of that, the *reason* for this is that it's an implementation
>
> detail. Implementation details do not excuse incorrect user-visible
>> behavior in an application. Figuring out how to make the application
>> do what it should, from the user's perspective, and how best to
>> implement it to do so is part of the developer's responsibility.
>
>
> Sandboxing is hard. Sacrifices have to be made. This is *not* just an
> implementation detail. Users are running their code inside of a sandbox.
> This can't be really be hidden. That said, you are absolutely correct. It
> is the developer's responsibility to make sure that all of this is as clean
> and easy as possible.
>
> I think Jack's suggestion below is a nice middleground. As a matter of
> fact, given a small patch to add a little pre-processing step to clojail
> (optional, of course), clojail could even throw a nice error message when a
> user tries to use 'for'. How does something like that sound to you? Would
> that be an okay compromise? There isn't much more that can be done beyond
> actually providing reasonable error messages for these failures. There are
> limitations to what can be done.
>
> On Friday, January 13, 2012 6:44:11 PM UTC-6, Cedric Greevey wrote:
>
>> On Fri, Jan 13, 2012 at 6:47 PM, Anthony Grimes 
>> wrote:
>> > Clojail errs on the side of safety and not on the side of "Oh, well
>> maybe he
>> > wasn't trying to break the sandbox. Let's allow it anyway.". Treating
>> macros
>> > as opaque is just another hole in what is already difficult sandboxing.
>> > Macros are not even remotely close to functions. They *create* code.
>> That
>> > code, just like any other explicitly written in your application, needs
>> to
>> > be sandboxed. It is much easier and safer to sandbox dangerous
>> functions.
>> > The fact that expanded macro code that uses those functions is also
>> affected
>> > is less of a bug and more of a feature.
>>
>> You seem to be confused. We were discussing 4Clojure's rules, where
>> the stakes are at worst letting a person "cheat" slightly, not a
>> server security system or something, where the stakes would be
>> allowing hacking of some sort. Your concern is immensely out of
>> proportion to the consequences of someone cheating at 4Clojure's
>> learning game.
>>
>> > That said, of course it is unfortunate that things like this occur in
>> > 4Clojure for things as simple as for. But clojail and 4clojure are
>> separate
>> > projects. clojail is focused on being as safe as possible, which may
>> > sometimes clash with what would be most convenient in 4Clojure.
>>
>> Unclear here is what the two have to do with one another. There's no
>> obvious relevance of clojail's requirements for 4Clojure. Indeed, as
>> you seem to have realized, the requirements are distinct and sometimes
>> would conflict.
>>
>>  --
> 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: i am so bored

2012-01-14 Thread Alex Baranosky
If you can help with any of Midje's issues that would be greatly
appreciated.  It is a pretty large code-base, but likely won't make you any
money.

www.githib.com/marick/midje

Please feel free to add your 2 cents to the conversation in the issues
section as well.

Pull requests are always appreciated.

Alex
On Jan 14, 2012 7:12 AM, "Dennis Haupt"  wrote:

> hi there,
>
> i am looking for something to do, preferably something that makes me
> rich, but that is not a must have - if it's interesting, i'll code for
> free.
>
> i can offer almost 15 years of coding experience (important: while being
> open minded the whole time). i am a one man army, if you will :)
> (procedural, OO (that one for money), FP, even some assembler). one
> thing i have not yet done is write something big without static type
> checking, so that'll be new.
>
> clojure has caught my interest. in general, high level programming has.
> i played around with clojure a bit and would like to get something done
> that has at least some purpose. are there any small/new projects looking
> for help?
>
> --
> 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: i am so bored

2012-01-14 Thread Thorsten Wilms

On 01/14/2012 01:12 PM, Dennis Haupt wrote:


clojure has caught my interest. in general, high level programming has.
i played around with clojure a bit and would like to get something done
that has at least some purpose. are there any small/new projects looking
for help?


Not a currently existing project, but one that could fill some very real 
needs:

A platform for collaborative, multi-lingual documentation/book-writing.

For example the Ubuntu Manual Project suffers from the barriers for 
potential contributors, that are the result from exposing Latex, bzr 
version management and being unable to start translation before the 
English version for a specific release of Ubuntu has been finished.


The solution I imagine would allow
- collaborative real-time editing comparable to Etherpad, but fulfilling 
the logical markup and structuring needs of book projects.

- comparison/editing of 2 language version side by side.
- to define ranges of text independent of paragraph boundaries to map 
blocks of meaning between translations.
- Tracking of changes in a way that makes it feasible to update one 
translation from another translation in any order they come.


I assume this would be a quite challenging and expandable project that 
could benefit from using Clojurescript.



--
Thorsten Wilms

thorwil's design for free software:
http://thorwil.wordpress.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: i am so bored

2012-01-14 Thread Joseph Smith
How about a native I/O library that'll detect the platform and architecture at 
runtime? Something like java 1.7's nio, but they'll work on clojure hosted on 
1.5.x? Make use of JNA to make native calls to get file system details, etc. 

Right now you cannot even stat a file from clojure without calling the stat 
command from a shell. :/


---
Joseph Smith
j...@uwcreations.com
(402)601-5443


On Jan 14, 2012, at 6:12 AM, Dennis Haupt  wrote:

> hi there,
> 
> i am looking for something to do, preferably something that makes me
> rich, but that is not a must have - if it's interesting, i'll code for free.
> 
> i can offer almost 15 years of coding experience (important: while being
> open minded the whole time). i am a one man army, if you will :)
> (procedural, OO (that one for money), FP, even some assembler). one
> thing i have not yet done is write something big without static type
> checking, so that'll be new.
> 
> clojure has caught my interest. in general, high level programming has.
> i played around with clojure a bit and would like to get something done
> that has at least some purpose. are there any small/new projects looking
> for help?
> 
> -- 
> 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: i am so bored

2012-01-14 Thread Rogier Peters
On Sat, Jan 14, 2012 at 2:44 PM, Alex Baranosky
 wrote:
> If you can help with any of Midje's issues that would be greatly
> appreciated.  It is a pretty large code-base, but likely won't make you any
> money.
>
> www.githib.com/marick/midje

githib, eh? ;) probably meant https://github.com/marick/midje

>
> Please feel free to add your 2 cents to the conversation in the issues
> section as well.
>
> Pull requests are always appreciated.
>
> Alex
>
> On Jan 14, 2012 7:12 AM, "Dennis Haupt"  wrote:
>>
>> hi there,
>>
>> i am looking for something to do, preferably something that makes me
>> rich, but that is not a must have - if it's interesting, i'll code for
>> free.
>>
>> i can offer almost 15 years of coding experience (important: while being
>> open minded the whole time). i am a one man army, if you will :)
>> (procedural, OO (that one for money), FP, even some assembler). one
>> thing i have not yet done is write something big without static type
>> checking, so that'll be new.
>>
>> clojure has caught my interest. in general, high level programming has.
>> i played around with clojure a bit and would like to get something done
>> that has at least some purpose. are there any small/new projects looking
>> for help?
>>
>> --
>> 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



-- 
Rogier Peters
rogier@twitter, flickr, delicious

-- 
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: i am so bored

2012-01-14 Thread Samuel Lê
Hi there,

I was just looking for someone like you.
I have started to develop a mathematica clone in clojure (OK, I started.
For now it calculates the derivatives and does a bit of expression
simplification). For now I have couple of function that I test on the REPL.
I was trying to write a command line interface so I would have something to
show to people. My next step would be to make a clojure syntax translator
(from "derivative(x^2,x)" to (derivative '(^ x 2) 'x)  ).
If you find it interesting we can work together (I consider myself as a
clojure noob - you can see that from the question I posted on this mailing
list earlier today-  I am starting to get OK with the syntax, I am
something like 400-500th on 4clojure, but I have no experience in deploying
anything in clojure).
If I can get stuff done I am planning to make a web app from it at some
point, but I am starting to realize I am not good enough to do the whole
thing by myself, hence that email.

Looking forward to have a reply from you,
Sam

On Sat, Jan 14, 2012 at 12:12 PM, Dennis Haupt wrote:

> hi there,
>
> i am looking for something to do, preferably something that makes me
> rich, but that is not a must have - if it's interesting, i'll code for
> free.
> tax
> i can offer almost 15 years of coding experience (important: while being
> open minded the whole time). i am a one man army, if you will :)
> (procedural, OO (that one for money), FP, even some assembler). one
> thing i have not yet done is write something big without static type
> checking, so that'll be new.
>
> clojure has caught my interest. in general, high level programming has.
> i played around with clojure a bit and would like to get something done
> that has at least some purpose. are there any small/new projects looking
> for help?
>
> --
> 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: ClojureScript One - "No such namespace" error when following "Getting Started" instructions

2012-01-14 Thread utel
Thanks! Yes, that was exactly the problem.

And... apologies. On reading the wiki page again, it's very clear.


On Jan 13, 4:04 pm, Brenton  wrote:
> You are trying to evaluate ClojureScript in a Clojure REPL.
>
> The easiest way to get a ClojureScript REPL is to run:
>
> script/cljs-repl
>
> If you start a ClojureScript REPL manually then you always need to
> load/reload the development page afterwords to establish the
> connection.
>
> On Jan 12, 5:07 pm, utel  wrote:
>
>
>
>
>
>
>
> > The amount of effort that's gone into ClojureScript One initiative is
> > very impressive!
>
> > Just one question. I've tried following the instructions on the 
> > page:https://github.com/brentonashworth/one/wiki/Getting-started
>
> > All goes well until the step where I evaluate the expression (js/alert
> > "hello")
>
> > Then I get the following error:
> > CompilerException java.lang.RuntimeException: No such namespace: js,
> > compiling:(NO_SOURCE_PATH:1)
>
> > I've tried it on both Linux and OS X 10.7  (both with jdk 1.6.0_29)
> > and in both cases get the error above.
>
> > It may be that I've missed something obvious!
>
> > Any help appreciated.
>
> > 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


converting a string to a list

2012-01-14 Thread Samuel Lê
Hi,

I was wondering if there was a function to convert a list into a string,
something like:
(string-to-list "abcde")   ;; (a b c d e)

thanks!

Sam

-- 
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: converting a string to a list

2012-01-14 Thread Bruce Durling
Sam,

Strings can be turned into sequences with seq.

> (seq "foo")
(\f \o \o)

The backslashes are because f o and o are character literals.

cheers,
Bruce

On Sat, Jan 14, 2012 at 10:13, Samuel Lê  wrote:
> Hi,
>
> I was wondering if there was a function to convert a list into a string,
> something like:
> (string-to-list "abcde")   ;; (a b c d e)
>
> thanks!
>
> Sam
>
> --
> 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: converting a string to a list

2012-01-14 Thread dennis zhuang
You can do this
> ((comp #(map str %) seq) "abcdef")
("a" "b" "c" "d" "e" "f")

2012/1/15 Bruce Durling 

> Sam,
>
> Strings can be turned into sequences with seq.
>
> > (seq "foo")
> (\f \o \o)
>
> The backslashes are because f o and o are character literals.
>
> cheers,
> Bruce
>
> On Sat, Jan 14, 2012 at 10:13, Samuel Lê  wrote:
> > Hi,
> >
> > I was wondering if there was a function to convert a list into a string,
> > something like:
> > (string-to-list "abcde")   ;; (a b c d e)
> >
> > thanks!
> >
> > Sam
> >
> > --
> > 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
>



-- 
庄晓丹
Email:killme2...@gmail.com
伯岩(花名)  bo...@taobao.com
Site:   http://fnil.net

淘宝(中国)软件有限公司 / 产品技术部 / Java中间件

-- 
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: converting a string to a list

2012-01-14 Thread Jay Fields
this seems easier...

user=> (map str "abc")
("a" "b" "c")

Though the original question says a list to a string and the example shows a 
string to a list (of symbols)

user=> (apply str ["a" "b" "c"])
"abc'

But, the example is looks like it wants

user=> (map (comp symbol str) "abc")
(a b c)

Hopefully one of those is what you're looking for.

Cheers, Jay

On Jan 14, 2012, at 1:01 PM, dennis zhuang wrote:

> You can do this
> > ((comp #(map str %) seq) "abcdef")
> ("a" "b" "c" "d" "e" "f")
> 
> 2012/1/15 Bruce Durling 
> Sam,
> 
> Strings can be turned into sequences with seq.
> 
> > (seq "foo")
> (\f \o \o)
> 
> The backslashes are because f o and o are character literals.
> 
> cheers,
> Bruce
> 
> On Sat, Jan 14, 2012 at 10:13, Samuel Lê  wrote:
> > Hi,
> >
> > I was wondering if there was a function to convert a list into a string,
> > something like:
> > (string-to-list "abcde")   ;; (a b c d e)
> >
> > thanks!
> >
> > Sam
> >
> > --
> > 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
> 
> 
> 
> -- 
> 庄晓丹 
> Email:killme2...@gmail.com
> 伯岩(花名)  bo...@taobao.com
> Site:   http://fnil.net
> 
> 淘宝(中国)软件有限公司 / 产品技术部 / Java中间件
> 
> 
> -- 
> 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

A STM profile tool

2012-01-14 Thread dennis
I written a profile tool for clojure STM,it statistics all
transactions information such as execution times,execution cost,the
retry reason and times etc.

If you are interested in it,please check it on github:

https://github.com/killme2008/stm-profiler

It's just a try to profile STM,if you have any problems ,please let me
know,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


Re: i am so bored

2012-01-14 Thread Dennis Haupt
looks like there will be some macro related work which is one of the
things i wanted to look into. i wrote a simple expression (+,-,*,/) and
a creole parser in scala once and spent 2 years on a fps shooter (hello
vector math) so i am not completely lost here :)

did you upload your stuff to github yet?

Am 14.01.2012 13:31, schrieb Samuel Lê:
> Hi there,
> 
> I was just looking for someone like you.
> I have started to develop a mathematica clone in clojure (OK, I started.
> For now it calculates the derivatives and does a bit of expression
> simplification). For now I have couple of function that I test on the
> REPL. I was trying to write a command line interface so I would have
> something to show to people. My next step would be to make a clojure
> syntax translator (from "derivative(x^2,x)" to (derivative '(^ x 2) 'x)  ).
> If you find it interesting we can work together (I consider myself as a
> clojure noob - you can see that from the question I posted on this
> mailing list earlier today-  I am starting to get OK with the syntax, I
> am something like 400-500th on 4clojure, but I have no experience in
> deploying anything in clojure).
> If I can get stuff done I am planning to make a web app from it at some
> point, but I am starting to realize I am not good enough to do the whole
> thing by myself, hence that email.
> 
> Looking forward to have a reply from you,
> Sam
> 
> On Sat, Jan 14, 2012 at 12:12 PM, Dennis Haupt  > wrote:
> 
> hi there,
> 
> i am looking for something to do, preferably something that makes me
> rich, but that is not a must have - if it's interesting, i'll code
> for free.
> tax
> i can offer almost 15 years of coding experience (important: while being
> open minded the whole time). i am a one man army, if you will :)
> (procedural, OO (that one for money), FP, even some assembler). one
> thing i have not yet done is write something big without static type
> checking, so that'll be new.
> 
> clojure has caught my interest. in general, high level programming has.
> i played around with clojure a bit and would like to get something done
> that has at least some purpose. are there any small/new projects looking
> for help?
> 
> --
> 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


-- 

-- 
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: is there some way to extract the parameter list from a function

2012-01-14 Thread Andrew Xue
that is exactly what i was looking for ! thanks!

On Jan 14, 1:33 am, Baishampayan Ghose  wrote:
> Something like (:arglists (meta #'my-func)) ?
>
> Regards,
> BG
>
>
>
>
>
>
>
>
>
> On Sat, Jan 14, 2012 at 12:01 PM, Andrew Xue  wrote:
> > given something like
>
> > (defn my-func [a b c] (str a b c))
>
> > is there something like (extract-parameters my-func) which returns (a
> > b c)?
>
> > thanks,
> > andy
>
> > --
> > 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
>
> --
> 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: Help! Migrating to 1.3.0

2012-01-14 Thread myriam abramson
I couldn't find quite the equivalent to read-lines from duck-streams. I
found read-line but it's not the same. Where is the equivalent read-lines
outside of clojure.contrib?

On Fri, Jan 13, 2012 at 9:51 PM, Stephen Compall  wrote:

> On Fri, Jan 13, 2012 at 11:47 AM,   wrote:
> > Warning: *default-encoding* not declared dynamic and thus is not
> dynamically
> > rebindable, but its name suggests otherwise. Please either indicate
>
> More indirectly, stop using clojure-contrib and move to
> http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go .
> In the selected example, duck-streams was replaced with the included
> clojure.java.io in Clojure 1.2.
>
> --
> Stephen Compall
> "^aCollection allSatisfy: [:each | aCondition]": less is better than
>
> --
> 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: Help! Migrating to 1.3.0

2012-01-14 Thread James Reeves
On 14 January 2012 23:34, myriam abramson  wrote:
> I couldn't find quite the equivalent to read-lines from duck-streams. I
> found read-line but it's not the same. Where is the equivalent read-lines
> outside of clojure.contrib?

There's clojure.core/line-seq, but it doesn't close the reader when
the seq finishes.

- James

-- 
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 clr files ?????

2012-01-14 Thread Jeff Dik
On Fri, Jan 13, 2012 at 6:41 PM,   wrote:
> When I run leiningen , I can execute lein within any folder. For instance I
> have a folder c:\projects, i run lein new abc. I then have a folder "abc"
> that is created ,and all the projects files are stored within folder "abc".

As far as I can know, Leiningen won't really be of use for ClojureCLR
projects.  It's a tool for Clojure on the JVM.

> I installed clojure clr in a folder "clr". I can run clojure.main.exe
> located in c:\clr\
> Do have to create ui.clj in the same folder as is clr
> ?

No, you can put ui.clj anywhere.

> I thought i would have a place that is designated for clojureclr
> Do I set clr in my path: so I can execute from within any folder?

No, you can call Clojure.Main.exe with an absolute path if you want.
However, adding the directory to your PATH environment variable is
often more convenient, so that you only have to type Clojure.Main.exe
instead of the full path to Clojure.Main.exe.

Hope this helps,
Jeff

> - Original Message - From: "Jeff Dik" 
> To: 
> Sent: Friday, January 13, 2012 2:43 PM
> Subject: Re: clojure clr files ?
>
>
>
> On Fri, Jan 13, 2012 at 2:21 PM, jayvandal  wrote:
>>
>> I have installed clr in a folder called "clr" and have net installed.
>> I can click on main exe and get the clr to give me a repl . When I get
>> ready to create the ui. file in the example where am i storing files
>> In leiningen i create a folder for the project all the files are
>> stored in the project folder.
>> In creating a "UI with Windows Forms", do i have other files 
>
>
> I don't really understand the question, but perhaps this helps?
> http://www.myclojureadventure.com/2012/01/intro-to-clojure-clr-creating-ui-with.html
>
> --
> 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

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


clojure clr db error

2012-01-14 Thread jayvandal
I am running ui.clj ,  this is my commands and error mgs.
I can access the mysql  data for these datasets  but when I try to
load ui and  am confused ???
Thanks for any help
(def conn-str
"SERVER=localhost;DATABASE=clr_demo_4;UID=root;PASSWORD=pass;")
==

Clojure 1.3.0
user=> (use :reload 'intro)
nil
user=> (-main)
yep, it worked! (called println)
I just called a .NET method! (called System.Console/WriteLine)
Remeber to dismiss the dialog so the program will end.
The message box doesn't always show up on top!
OK
user=> (use :reload 'ui)
FileNotFoundException Could not locate db.mysql.clj.dll or db/
mysql.clj on load
path.  clojure.lang.RT.load (d:\work\clojure-clr\Clojure\Clojure\Lib
\RT.cs:3065)

user=>

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


Libraries for ClojureScript.

2012-01-14 Thread mmwaikar
Hi,

My question is about design of libraries for ClojureScript.

So for ex, there is clojure.test which has some public API. Now assume one 
has used it and is comfortable with its API.
Now he has to write some ClojureScript code and wants to write some unit 
tests as well.

Obviously, he'll use some pre-existing JS library / framework, but it will 
have its own API.
Now -

1) Does it make sense to write a ClojureScript wrapper over existing JS 
libraries (as there are wrappers over many Java libraries / frameworks)?
2) Does it make sense, or is it better if this ClojureScript wrapper, 
exposes the same (as far as possible) or similar API to that of one of the 
Clojure libraries? The obvious advantage being the programmer has to get 
accustomed to just one API, which works for Clojure as well as 
ClojureScript.

Please let me know your views.

Thanks,
Manoj.

-- 
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: converting a string to a list

2012-01-14 Thread Andy Fingerhut
This may not be important for your application, but if what you want in the
returned sequence are strings, and if you expect to deal with Unicode
characters that are not in the Basic Multilingual Plane (BMP) set, then
note the following differences.

(map str s) will return a separate string for each UTF-16 code unit, so any
supplementary characters will result in 2 strings in the result, not one.
Those 2 resulting strings won't be complete Unicode strings by themselves,
since they each only contain one surrogate character. [1] has more info on
UTF-16 encoding if you are curious.

e.g. (map str "smile \ud83d\ude03") will contain two strings "\ud83d" and
"\ude03" at the end of the resulting sequence

(re-seq #"." s) will return a separate string for each Unicode code point,
so BMP or supplementary characters will each result in one string in the
output sequence, where supplementary characters become strings with 2 Java
chars in them.

e.g. (re-seq #'." "smile \ud83d\ude03") will contain one string
"\ud83d\ude03" at the end of the resulting sequence, since those two are a
surrogate pair representing a single Unicode character

Similarly, there is the notion of combining characters in Unicode [2], e.g.
a with a grave accent can be represented either with a single Unicode code
point, or it can be represented by the Unicode character for "a" followed
by the Unicode character for a combining grave accent, U+0300.   (re-seq
#'." s) would return separate strings for the "a" and the combining
character in that case.  If you want each non-combining character plus any
following combining characters to be kept together, you can use:

(re-seq #"\PM\pM*" s)

\pM matches any Unicode combining character (whether it is in the BMP or
supplementary), and \PM matches any other Unicode character.

Andy

[1] http://en.wikipedia.org/wiki/UTF-16

[2]
http://en.wikipedia.org/wiki/Unicode#Ready-made_versus_composite_characters



On Sat, Jan 14, 2012 at 10:13 AM, Jay Fields  wrote:

> this seems easier...
>
> user=> (map str "abc")
> ("a" "b" "c")
>
> Though the original question says a list to a string and the example shows
> a string to a list (of symbols)
>
> user=> (apply str ["a" "b" "c"])
> "abc'
>
> But, the example is looks like it wants
>
> user=> (map (comp symbol str) "abc")
> (a b c)
>
> Hopefully one of those is what you're looking for.
>
> Cheers, Jay
>
> On Jan 14, 2012, at 1:01 PM, dennis zhuang wrote:
>
> You can do this
> > ((comp #(map str %) seq) "abcdef")
> ("a" "b" "c" "d" "e" "f")
>
> 2012/1/15 Bruce Durling 
>
>> Sam,
>>
>> Strings can be turned into sequences with seq.
>>
>> > (seq "foo")
>> (\f \o \o)
>>
>> The backslashes are because f o and o are character literals.
>>
>> cheers,
>> Bruce
>>
>> On Sat, Jan 14, 2012 at 10:13, Samuel Lê  wrote:
>> > Hi,
>> >
>> > I was wondering if there was a function to convert a list into a string,
>> > something like:
>> > (string-to-list "abcde")   ;; (a b c d e)
>> >
>> > thanks!
>> >
>> > Sam
>> >
>> > --
>> > 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
>>
>
>
>
> --
> 庄晓丹
> Email:killme2...@gmail.com
> 伯岩(花名)  bo...@taobao.com
> Site:   http://fnil.net
>
> 淘宝(中国)软件有限公司 / 产品技术部 / Java中间件
>
>
> --
> 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
>

-- 
You received this message because you are subscribed to the Google
G