Re: Why is a non-transient `into` faster than the built-in one?

2012-11-04 Thread Herwig Hochleitner
On my repl into is consistently faster.
What versions of clojure, java and the OS are you running?

-- 
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: Why is a non-transient `into` faster than the built-in one?

2012-11-04 Thread Satoru Logic
Hi, I'm using Clojure1.4.0, Java1.6 on MacOS.


 user= (clojure-version)
 1.4.0

 

 ~ satoru$ java -version
 java version 1.6.0_35
 Java(TM) SE Runtime Environment (build 1.6.0_35-b10-428-11M3811)
 Java HotSpot(TM) 64-Bit Server VM (build 20.10-b01-428, mixed mode)


On Sunday, November 4, 2012 2:18:15 PM UTC+8, Herwig Hochleitner wrote:

 On my repl into is consistently faster.
 What versions of clojure, java and the OS are you running?


-- 
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: impossible to create classes for non-closure environment

2012-11-04 Thread Vladimir Tsichevski
Thank you Stephen,

the problem is that it is impossible to create create a Java class using 
closure with the following characteristics:

1) all methods must match given Java signature. For example, if I need a 
method

public String getSomeString();

all I get is

public Object getSomeString();

closure ignores my String hints and always uses Object instead.

2) must be no references to any closure classes. Now the closure compiler 
unconditionally creates at least one extra method

public static IPersistentVector getBasis()

which references several classes from closure runtime.

Regards,
Vladimir

On Sat, 2012-11-03 at 13:57 -0700, Vladimir Tsichevski wrote: 
  In one of my purely Java project I have to create hundreds of java 
 classes 
  with repeatable structure, so the task is an excellent candidate for 
  automation. I hoped I will be able to create these classes with the 
 latest 
  closure, using the 'deftype' construct. 

 If you know all the details of classes to create at compile time, you 
 can use macros instead, which are perfectly well able to output deftype 
 forms.  Untested: 

 (defmacro defrefs 
   Make a bunch of :x boxes. 
   [ names] 
   `(do ~@(map (fn [name] `(defrecord ~name [~'x])) names))) 

 ;; makes classes foo, bar, baz, qux, quux, all with the :x field. 
 (defrefs foo bar baz qux quux) 

 -- 
 Stephen Compall 
 ^aCollection allSatisfy: [:each|aCondition]: less is better 




-- 
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: Why is a non-transient `into` faster than the built-in one?

2012-11-04 Thread Marko Kocić
I get big fluctuation in results for bot naive-into and into, ranging from 
400ms to 1500ms.
This is probably because of the GC kicking in and influencing timings.

Changing timings to something like:
 (System/gc) (time (do (into #{} (range 1e6)) nil))
and
 (System/gc) (time (do (naive-into #{} (range 1e6)) nil))
gives much more consistent results with almost no variance, and on my box I 
get ~380 for into, and ~580 for naive-into

Cheers,
Marko

On Sunday, November 4, 2012 8:36:19 AM UTC+1, Satoru Logic wrote:

 Hi, I'm using Clojure1.4.0, Java1.6 on MacOS.


 user= (clojure-version)
 1.4.0

  

 ~ satoru$ java -version
 java version 1.6.0_35
 Java(TM) SE Runtime Environment (build 1.6.0_35-b10-428-11M3811)
 Java HotSpot(TM) 64-Bit Server VM (build 20.10-b01-428, mixed mode)


 On Sunday, November 4, 2012 2:18:15 PM UTC+8, Herwig Hochleitner wrote:

 On my repl into is consistently faster.
 What versions of clojure, java and the OS are you running?



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

Seems like bug in clojure-1.4.0

2012-11-04 Thread ru
ru@ru-maclin:~/ProtegeClojureOMTabs-1.5/lib_ext$ java -jar 
clojure-1.4.0.jar 
Clojure 1.4.0
user= (read-string 07)
7
user= (read-string 09)
NumberFormatException Invalid number: 09 
 clojure.lang.LispReader.readNumber (LispReader.java:253)
user= (read-string 08)
NumberFormatException Invalid number: 08 
 clojure.lang.LispReader.readNumber (LispReader.java:253)
user= (read-string 06)
6
user= (read-string 05)
5
user= (read-string 04)
4
user= (read-string 03)
3
user= (read-string 02)
2
user= (read-string 01)
1
user= (read-string 00)
0

Sincerely,
   Ru

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

Re: Seems like bug in clojure-1.4.0

2012-11-04 Thread ru
Thank you, Bronsa!

Sincerely,
  Ru
воскресенье, 4 ноября 2012 г., 14:27:30 UTC+4 пользователь Bronsa написал:

 Number prefixed by 0 are read by the clojure reader as octals.
 So the decimal 8 is 010

 2012/11/4 ru sor...@oogis.ru javascript:

 ru@ru-maclin:~/ProtegeClojureOMTabs-1.5/lib_ext$ java -jar 
 clojure-1.4.0.jar 
 Clojure 1.4.0
 user= (read-string 07)
 7
 user= (read-string 09)
 NumberFormatException Invalid number: 09 
  clojure.lang.LispReader.readNumber (LispReader.java:253)
 user= (read-string 08)
 NumberFormatException Invalid number: 08 
  clojure.lang.LispReader.readNumber (LispReader.java:253)
 user= (read-string 06)
 6
 user= (read-string 05)
 5
 user= (read-string 04)
 4
 user= (read-string 03)
 3
 user= (read-string 02)
 2
 user= (read-string 01)
 1
 user= (read-string 00)
 0

 Sincerely,
Ru

 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.comjavascript:
 Note that posts from new members are moderated - please be patient with 
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@googlegroups.com javascript:
 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: Why is a non-transient `into` faster than the built-in one?

2012-11-04 Thread Satoru Logic


On Sunday, November 4, 2012 6:20:37 PM UTC+8, Marko Kocić wrote:

 I get big fluctuation in results for bot naive-into and into, ranging from 
 400ms to 1500ms.
 This is probably because of the GC kicking in and influencing timings.

 Changing timings to something like:
  (System/gc) (time (do (into #{} (range 1e6)) nil))
 and
  (System/gc) (time (do (naive-into #{} (range 1e6)) nil))
 gives much more consistent results with almost no variance, and on my box 
 I get ~380 for into, and ~580 for naive-into


I still can't get consistent results with this.

BTW, what does System/gc do, I can't use `doc` on it.
 


 Cheers,
 Marko

 On Sunday, November 4, 2012 8:36:19 AM UTC+1, Satoru Logic wrote:

 Hi, I'm using Clojure1.4.0, Java1.6 on MacOS.


 user= (clojure-version)
 1.4.0

  

 ~ satoru$ java -version
 java version 1.6.0_35
 Java(TM) SE Runtime Environment (build 1.6.0_35-b10-428-11M3811)
 Java HotSpot(TM) 64-Bit Server VM (build 20.10-b01-428, mixed mode)


 On Sunday, November 4, 2012 2:18:15 PM UTC+8, Herwig Hochleitner wrote:

 On my repl into is consistently faster.
 What versions of clojure, java and the OS are you running?



-- 
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: Why is a non-transient `into` faster than the built-in one?

2012-11-04 Thread Marko Kocić


On Sunday, November 4, 2012 11:41:23 AM UTC+1, Satoru Logic wrote:



 On Sunday, November 4, 2012 6:20:37 PM UTC+8, Marko Kocić wrote:

 I get big fluctuation in results for bot naive-into and into, ranging 
 from 400ms to 1500ms.
 This is probably because of the GC kicking in and influencing timings.

 Changing timings to something like:
  (System/gc) (time (do (into #{} (range 1e6)) nil))
 and
  (System/gc) (time (do (naive-into #{} (range 1e6)) nil))
 gives much more consistent results with almost no variance, and on my box 
 I get ~380 for into, and ~580 for naive-into


 I still can't get consistent results with this.

 BTW, what does System/gc do, I can't use `doc` on it.
  

System/gc is a call to Java System.gc() which basically hints the JVM to 
run garbage collector. Whether it will actually run it depends on many 
factors, like your java version, various GC settings and memory settings. 
If you don't specify those settings on the cmdline, java decides on its own 
based on your system. It is quite possible that it just has to trigger 
garbage collector during execution of timing on your system, while it 
doesn't have to on my system. I'm running jdk 1.7 on 64bit linux, btw.

You can find more details of GC tuning here: 
http://www.oracle.com/technetwork/java/javase/gc-tuning-6-140523.html

Cheers,
Marko

-- 
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: Why is a non-transient `into` faster than the built-in one?

2012-11-04 Thread Satoru Logic
BTW, I can't even reproduce the examples here: 
 http://clojure.org/Transients#toc5

On Sunday, November 4, 2012 6:49:50 PM UTC+8, Marko Kocić wrote:



 On Sunday, November 4, 2012 11:41:23 AM UTC+1, Satoru Logic wrote:



 On Sunday, November 4, 2012 6:20:37 PM UTC+8, Marko Kocić wrote:

 I get big fluctuation in results for bot naive-into and into, ranging 
 from 400ms to 1500ms.
 This is probably because of the GC kicking in and influencing timings.

 Changing timings to something like:
  (System/gc) (time (do (into #{} (range 1e6)) nil))
 and
  (System/gc) (time (do (naive-into #{} (range 1e6)) nil))
 gives much more consistent results with almost no variance, and on my 
 box I get ~380 for into, and ~580 for naive-into


 I still can't get consistent results with this.

 BTW, what does System/gc do, I can't use `doc` on it.
  

 System/gc is a call to Java System.gc() which basically hints the JVM to 
 run garbage collector. Whether it will actually run it depends on many 
 factors, like your java version, various GC settings and memory settings. 
 If you don't specify those settings on the cmdline, java decides on its own 
 based on your system. It is quite possible that it just has to trigger 
 garbage collector during execution of timing on your system, while it 
 doesn't have to on my system. I'm running jdk 1.7 on 64bit linux, btw.

 You can find more details of GC tuning here: 
 http://www.oracle.com/technetwork/java/javase/gc-tuning-6-140523.html

 Cheers,
 Marko


-- 
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: Proposal/request: Give clojure.core/conj a unary implementation

2012-11-04 Thread Jonathan Fischer Friberg

 It would be nice if clojure.core/conj had a unary implementation

([coll] coll)


I support this. Reasons:

1. It makes sense, adding nothing to something should give back the
something.
2. It's consistent with disj as mentioned.
3. Supporting edge cases like this can make some algorithms much more
succinct.
   (as in CGAT's code - no need to check for extra cases)
   Compare: (conj nil 3) = (3)

Jonathan

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

Java-to-Clojure source translation?

2012-11-04 Thread Vladimir Tsichevski
Hi gurus,

I wonder if there are any means that'd help me translate Java sources to 
Clojure? I do not expect getting working Closure code OOTB, just anything 
to start from.

Regards,
Vladimir

-- 
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: Java-to-Clojure source translation?

2012-11-04 Thread Maik Schünemann
Why do you want this? If you have java code you can just call it from
clojure.no need for translation
 Am 04.11.2012 19:39 schrieb Vladimir Tsichevski tsichev...@gmail.com:

 Hi gurus,

 I wonder if there are any means that'd help me translate Java sources to
 Clojure? I do not expect getting working Closure code OOTB, just anything
 to start from.

 Regards,
 Vladimir

 --
 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: Java-to-Clojure source translation?

2012-11-04 Thread Vladimir Tsichevski
Hi Maik,

no, I need to re-implement existing code in Clojure.

Why do you want this? If you have java code you can just call it from 
 clojure.no need for translation
  Am 04.11.2012 19:39 schrieb Vladimir Tsichevski 
 tsich...@gmail.comjavascript:
 :

 Hi gurus,

 I wonder if there are any means that'd help me translate Java sources to 
 Clojure? I do not expect getting working Closure code OOTB, just anything 
 to start from.

 Regards,
 Vladimir

 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.comjavascript:
 Note that posts from new members are moderated - please be patient with 
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@googlegroups.com javascript:
 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: Java-to-Clojure source translation?

2012-11-04 Thread Maik Schünemann
A direct translation is often not a good idea because java uses so much
mutable stateand this is really not idiomatic in clojure.but it will be a
helpful experience to make the java code to functional clojure code.
IMO calling java code from clojure is better as a direct translation with
all that mutable code.
perhaps you can say more about what you are trying to achieve.

I hope I could help
Am 04.11.2012 20:26 schrieb Vladimir Tsichevski tsichev...@gmail.com:

 Hi Maik,

 no, I need to re-implement existing code in Clojure.

 Why do you want this? If you have java code you can just call it from
 clojure.no need for translation
  Am 04.11.2012 19:39 schrieb Vladimir Tsichevski tsich...@gmail.com:

 Hi gurus,

 I wonder if there are any means that'd help me translate Java sources to
 Clojure? I do not expect getting working Closure code OOTB, just anything
 to start from.

 Regards,
 Vladimir

 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@**googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/clojure?hl=enhttp://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: Proposal/request: Give clojure.core/conj a unary implementation

2012-11-04 Thread Jean Niklas L'orange
On Sunday, November 4, 2012 12:43:22 AM UTC+1, Ben wrote:

 There might be a reason to write (apply f coll seqable) in a situation 
 in which f might be conj, though. 


One may use (reduce f coll seqable) instead, if that makes sense 
semantically in that context.

-- 
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: impossible to create classes for non-closure environment

2012-11-04 Thread Stuart Sierra
Hello,

Clojure (by the way, it is not spelled closure) is not really designed to 
generate pure-Java classes. `gen-class` is slightly more flexible than 
`deftype`, but it will still generate references to Clojure classes.

If the structure of your Java classes is defined by interfaces, `deftype` 
can implement those interfaces. But if the structure of the Java classes is 
very regular, you may find it easier to generate Java source code as 
strings. That's how all the primitive interfaces in clojure.lang.IFn were 
created.

-S



On Sunday, November 4, 2012 4:43:59 AM UTC-5, Vladimir Tsichevski wrote:

 Thank you Stephen,

 the problem is that it is impossible to create create a Java class using 
 closure with the following characteristics:

 1) all methods must match given Java signature. For example, if I need a 
 method

 public String getSomeString();

 all I get is

 public Object getSomeString();

 closure ignores my String hints and always uses Object instead.

 2) must be no references to any closure classes. Now the closure compiler 
 unconditionally creates at least one extra method

 public static IPersistentVector getBasis()

 which references several classes from closure runtime.

 Regards,
 Vladimir

 On Sat, 2012-11-03 at 13:57 -0700, Vladimir Tsichevski wrote: 
  In one of my purely Java project I have to create hundreds of java 
 classes 
  with repeatable structure, so the task is an excellent candidate for 
  automation. I hoped I will be able to create these classes with the 
 latest 
  closure, using the 'deftype' construct. 

 If you know all the details of classes to create at compile time, you 
 can use macros instead, which are perfectly well able to output deftype 
 forms.  Untested: 

 (defmacro defrefs 
   Make a bunch of :x boxes. 
   [ names] 
   `(do ~@(map (fn [name] `(defrecord ~name [~'x])) names))) 

 ;; makes classes foo, bar, baz, qux, quux, all with the :x field. 
 (defrefs foo bar baz qux quux) 

 -- 
 Stephen Compall 
 ^aCollection allSatisfy: [:each|aCondition]: less is better 




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

pattern-matching in Closure?

2012-11-04 Thread Vladimir Tsichevski
Hi gurus.

Is it possible in Clojure to use pattern matching, like I can with Bigloo 
scheme, for example:

(match-case '(a b a)
  ((?x ?x) 'foo)
  ((?x ?- ?x) 'bar))

Regards,
Vladimir

-- 
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: Java-to-Clojure source translation?

2012-11-04 Thread Stuart Sierra
Hello,

It is not really possible to make a direct translation from Java to 
Clojure. Java has mutable variables and imperative flow-control, for which 
there is no equivalent in Clojure.

-S

-- 
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: pattern-matching in Closure?

2012-11-04 Thread Moritz Ulrich
Use core.match: https://github.com/clojure/core.match

On Sun, Nov 4, 2012 at 10:09 PM, Vladimir Tsichevski
tsichev...@gmail.com wrote:
 Hi gurus.

 Is it possible in Clojure to use pattern matching, like I can with Bigloo
 scheme, for example:

 (match-case '(a b a)
   ((?x ?x) 'foo)
   ((?x ?- ?x) 'bar))

 Regards,
 Vladimir

 --
 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: Java-to-Clojure source translation?

2012-11-04 Thread Vladimir Tsichevski
Hi Stuart.

On Monday, November 5, 2012 1:10:36 AM UTC+4, Stuart Sierra wrote:

 Hello,

 It is not really possible to make a direct translation from Java to 
 Clojure. Java has mutable variables and imperative flow-control, for which 
 there is no equivalent in Clojure.

 -S

  That's why I'm looking for means which could HELP me rewrite my code base 
to Clojure, not to produce compilable and runnable code. Just parse Java 
syntax tree and pretty-print it back as Clojure-like text.

Regards,
Vladimir


-- 
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: pattern-matching in Closure?

2012-11-04 Thread Vladimir Tsichevski
Hi Moritz,

this looks promising. Do you know where can I get any 
documentation/examples for this module?

Regards,
Vladimir

On Monday, November 5, 2012 1:10:59 AM UTC+4, Moritz Ulrich wrote:

 Use core.match: https://github.com/clojure/core.match 

 On Sun, Nov 4, 2012 at 10:09 PM, Vladimir Tsichevski 
 tsich...@gmail.com javascript: wrote: 
  Hi gurus. 
  
  Is it possible in Clojure to use pattern matching, like I can with 
 Bigloo 
  scheme, for example: 
  
  (match-case '(a b a) 
((?x ?x) 'foo) 
((?x ?- ?x) 'bar)) 
  
  Regards, 
  Vladimir 
  
  -- 
  You received this message because you are subscribed to the Google 
  Groups Clojure group. 
  To post to this group, send email to clo...@googlegroups.comjavascript: 
  Note that posts from new members are moderated - please be patient with 
 your 
  first post. 
  To unsubscribe from this group, send email to 
  clojure+u...@googlegroups.com javascript: 
  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: Java-to-Clojure source translation?

2012-11-04 Thread Stephen Compall
On Sun, 2012-11-04 at 13:18 -0800, Vladimir Tsichevski wrote:
 That's why I'm looking for means which could HELP me rewrite my code
 base to Clojure, not to produce compilable and runnable code. Just
 parse Java syntax tree and pretty-print it back as Clojure-like text.

I think the thesis of this thread is that, from the perspective of
varying levels of Clojure expertise, such means would be more of a
hindrance than a help in your goal.

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


Re: Why is a non-transient `into` faster than the built-in one?

2012-11-04 Thread Marek Šrank
These are my results using (dotimes (time (dotimes ...))) combo to get 
consistent results:

 - on sets:

(dotimes [i 10] (time (dotimes [j 100] (into #{} (range 1e4)
Elapsed time: 388.595226 msecs
Elapsed time: 406.666801 msecs
Elapsed time: 421.559753 msecs
Elapsed time: 444.719263 msecs
Elapsed time: 431.319374 msecs
Elapsed time: 392.3779 msecs
Elapsed time: 392.382365 msecs
Elapsed time: 408.71734 msecs
Elapsed time: 444.203973 msecs
Elapsed time: 442.351363 msecs

(dotimes [i 10] (time (dotimes [j 100] (naive-into #{} (range 1e4)
Elapsed time: 1287.412806 msecs
Elapsed time: 1318.931199 msecs
Elapsed time: 1314.773064 msecs
Elapsed time: 1292.664029 msecs
Elapsed time: 1277.616099 msecs
Elapsed time: 1289.514678 msecs
Elapsed time: 1700.74875 msecs
Elapsed time: 1352.734662 msecs
Elapsed time: 1464.09882 msecs
Elapsed time: 1449.704738 msecs

 - on vectors:

(dotimes [i 10] (time (dotimes [j 100] (into [] (range 1e4)
Elapsed time: 307.838501 msecs
Elapsed time: 243.426624 msecs
Elapsed time: 234.013566 msecs
Elapsed time: 247.711805 msecs
Elapsed time: 253.154264 msecs
Elapsed time: 284.375476 msecs
Elapsed time: 227.773865 msecs
Elapsed time: 247.807286 msecs
Elapsed time: 240.959477 msecs
Elapsed time: 230.627513 msecs

(dotimes [i 10] (time (dotimes [j 100] (naive-into [] (range 1e4)
Elapsed time: 406.55752 msecs
Elapsed time: 419.365134 msecs
Elapsed time: 413.544069 msecs
Elapsed time: 410.892756 msecs
Elapsed time: 394.827165 msecs
Elapsed time: 407.338251 msecs
Elapsed time: 441.60916 msecs
Elapsed time: 401.721826 msecs
Elapsed time: 412.7506 msecs
Elapsed time: 399.972445 msecs


Clojure 1.4.0

java version 1.6.0_26
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) Server VM (build 20.1-b02, mixed mode)


Cheers.

Marek.

On Sunday, November 4, 2012 3:41:14 AM UTC+1, Satoru Logic wrote:

 Hi, all.

 I am following an example demonstrating that `transient` can help optimize 
 mass updates to data structures:

 First, a function is defined, which doesn't use transient collection:

 (defn naive-into
   [coll source]
   (reduce conj coll source))


 This is supposed to run slower than the built-in `into`, because, as the 
 book said, `into` uses transient collections whenever possible.

 But the result shows up in my `repl` is just the reverse.


 user= (time (do (into #{} (range 1e6)) nil))
 Elapsed time: 4882.176 msecs
 nil
 user= (time (do (naive-into #{} (range 1e6)) nil))
 Elapsed time: 3745.707 msecs
 nil


 What could be the reason of this?


-- 
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: pattern-matching in Closure?

2012-11-04 Thread Marek Šrank
At the wiki: https://github.com/clojure/core.match/wiki :-)

Marek.

On Sunday, November 4, 2012 11:03:40 PM UTC+1, Vladimir Tsichevski wrote:

 Hi Moritz,

 this looks promising. Do you know where can I get any 
 documentation/examples for this module?

 Regards,
 Vladimir

 On Monday, November 5, 2012 1:10:59 AM UTC+4, Moritz Ulrich wrote:

 Use core.match: https://github.com/clojure/core.match 

 On Sun, Nov 4, 2012 at 10:09 PM, Vladimir Tsichevski 
 tsich...@gmail.com wrote: 
  Hi gurus. 
  
  Is it possible in Clojure to use pattern matching, like I can with 
 Bigloo 
  scheme, for example: 
  
  (match-case '(a b a) 
((?x ?x) 'foo) 
((?x ?- ?x) 'bar)) 
  
  Regards, 
  Vladimir 
  
  -- 
  You received this message because you are subscribed to the Google 
  Groups Clojure group. 
  To post to this group, send email to clo...@googlegroups.com 
  Note that posts from new members are moderated - please be patient with 
 your 
  first post. 
  To unsubscribe from this group, send email to 
  clojure+u...@googlegroups.com 
  For more options, visit this group at 
  http://groups.google.com/group/clojure?hl=en 



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

Re: pattern-matching in Closure?

2012-11-04 Thread Vladimir Tsichevski
Excellent! Thanks!

On Monday, November 5, 2012 2:12:16 AM UTC+4, Marek Šrank wrote:

 At the wiki: https://github.com/clojure/core.match/wiki :-)

 Marek.

 On Sunday, November 4, 2012 11:03:40 PM UTC+1, Vladimir Tsichevski wrote:

 Hi Moritz,

 this looks promising. Do you know where can I get any 
 documentation/examples for this module?

 Regards,
 Vladimir

 On Monday, November 5, 2012 1:10:59 AM UTC+4, Moritz Ulrich wrote:

 Use core.match: https://github.com/clojure/core.match 

 On Sun, Nov 4, 2012 at 10:09 PM, Vladimir Tsichevski 
 tsich...@gmail.com wrote: 
  Hi gurus. 
  
  Is it possible in Clojure to use pattern matching, like I can with 
 Bigloo 
  scheme, for example: 
  
  (match-case '(a b a) 
((?x ?x) 'foo) 
((?x ?- ?x) 'bar)) 
  
  Regards, 
  Vladimir 
  
  -- 
  You received this message because you are subscribed to the Google 
  Groups Clojure group. 
  To post to this group, send email to clo...@googlegroups.com 
  Note that posts from new members are moderated - please be patient 
 with your 
  first post. 
  To unsubscribe from this group, send email to 
  clojure+u...@googlegroups.com 
  For more options, visit this group at 
  http://groups.google.com/group/clojure?hl=en 



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

Re: Java-to-Clojure source translation?

2012-11-04 Thread Andy Fingerhut
On Nov 4, 2012, at 1:10 PM, Stuart Sierra wrote:

 Hello,
 
 It is not really possible to make a direct translation from Java to Clojure. 
 Java has mutable variables and imperative flow-control, for which there is no 
 equivalent in Clojure.
 
 -S

First, some suggestions that are not recommended, because they are fraught with 
perils if you go that way.   I mention them in case for some reason you like 
making your life difficult, or really want to be ultra-careful to use these 
correctly in multi-threaded programs.  They can be useful if you have some 
inner loop that needs screaming performance tweaks and for some reason you want 
written in Clojure, not Java, e.g. you are writing toy programs for benchmarks 
like I've spent too much time on:

http://shootout.alioth.debian.org/u64q/compare.php?lang=clojure

There is with-local-vars that can help you write more imperative style code if 
you really really want to, but it is very rarely if ever used in Clojure code I 
have seen and written.  Short example:

http://clojuredocs.org/clojure_core/clojure.core/with-local-vars

As far as I know, with-local-vars actually doesn't introduce problems with 
multi-threaded programs, because the variables it creates can only be modified 
from a single thread, textually within the boundary of the with-local-vars in 
your program.  I could be wrong about that, though, if you were devious enough 
to pass a function that did set-var in a future or something like that.

There is also deftype which permits you to create mutable fields in an object, 
again with big warning bells that if you ever use such objects from more than 
one thread and don't know what you are doing, you are likely introducing subtle 
hard-to-find bugs.

It isn't too difficult to use mutable Java arrays from within Clojure.


I agree with the other responders, Vladimir, that the two methods that will 
give you the most satisfying final result would be:

(1) Call already-written Java code from Clojure, while being as careful as you 
would in pure Java code of mutable state and side effects of the calls you are 
making

or

(2) Rewrite the code by hand, starting from what the functionality is that you 
want to achieve, and writing it in a more Clojure-like style.  Writing code in 
a more functional style tends to make global changes to the structure of the 
code, not just local method-by-method or function-by-function changes.

This takes much more time, and for programs with any complexity at all you'd 
have to do lots of re-testing to ensure your Clojure implementation was 
correct, but the end result should be more maintainable.

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


Re: Proposal/request: Give clojure.core/conj a unary implementation

2012-11-04 Thread Andy Fingerhut
I created CLJ-1103 and attached a patch that makes this change, as well as 
related changes to conj! assoc assoc! and dissoc! (dissoc, disj and disj! 
already handled these cases).

http://dev.clojure.org/jira/browse/CLJ-1103

Andy

On Nov 4, 2012, at 5:52 AM, Jonathan Fischer Friberg wrote:

 It would be nice if clojure.core/conj had a unary implementation
 
([coll] coll)
 
 I support this. Reasons:
 
 1. It makes sense, adding nothing to something should give back the something.
 2. It's consistent with disj as mentioned.
 3. Supporting edge cases like this can make some algorithms much more 
 succinct.
(as in CGAT's code - no need to check for extra cases)
Compare: (conj nil 3) = (3)
 
 Jonathan
 
 -- 
 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: Playing with clojure-encog, Machine-Learning wrapper

2012-11-04 Thread Dominic Cerisano
Well darn it.

Had a detailed response ready to go and found that GG does not save drafts. 
POS. Movin on.

The upshot was I tried predicting tick data (see attachment) with a model 
pretty much identical to the one given here with little real success.
It would only resolve if I removed all of the discontinuities in the data - 
that came to over 20% of the data)
The resulting fantasy set failed to predict trends that were not in the 
set with (15% success rate maximum)

The conclusion I came to is that actual tick data (which is aggregate of 
all trading) is not predictable with the given model.
NNs (certainly backprop) just try to spline a curve through a training set 
of input/ouput exemplars.
Tick data simply does not seem to provide such a curve. Equivalent to 
stating what is obvious - stock markets are unpredictable from moment to 
moment).

However one approach that occurred to me was rather than using aggregate 
tick data, rather use historical data from a given single brokerage that is 
known to use automated trading.

Rather than trying to learn a dog-breakfast of influences given by 
aggregate data, non-aggregated direct data coming direct from a automated 
trading algo should prove to be a likely subject for machine-learning.

However, if John Nash was correct then these systems would deliberately 
make bad trades in order to be less predictable. Can't do too much of that 
though :)

There are plenty of examples in Java of backprop. It is well known, and 
since you are using a known library I doubt there are errors in it, other 
than sub-optimal coding.

Historical FIX data (non-aggregated direct trading transactions) is 
generally not published anywhere. The model being explored here would be 
very useful if it were.

Cheers!

Dominic Cerisano









On Sunday, August 5, 2012 2:27:35 PM UTC-4, frye wrote:

 Hey all, 

 This post is a fork of a thread in the post community interest in 
 machine 
 learninghttps://groups.google.com/forum/?fromgroups#!topic/clojure/heBrnBuUGqs.
  
 Some of us were starting to take a deep dive into 
 clojure-encoghttps://github.com/jimpil/clojure-encog and 
 I thought it would be a good idea to have a new thread for that. 

 So I took a look at the way 
 encog-javahttps://github.com/encog/encog-java-core
  (what clojure-encog https://github.com/jimpil/clojure-encog wraps) 
 loads tick data into it's system. There is a 
 YahooFinanceLoaderhttps://github.com/encog/encog-java-core/blob/master/src/main/java/org/encog/ml/data/market/loader/YahooFinanceLoader.javathat
  pulls csv data from a URL. But it assumes that prices only have a 
 daily granularity. Now, the encog-java system seems to have the concept of 
 granularity going down to the second (see 
 herehttps://github.com/encog/encog-java-core/blob/master/src/main/java/org/encog/util/time/TimeUnit.java).
  But 
 all of it's market loaders and list of ticks, seem to stop at a time 
 granularity of daily. See the LoadedMarketData 
 sourcehttps://github.com/encog/encog-java-core/blob/master/src/main/java/org/encog/ml/data/market/loader/LoadedMarketData.java,
  
 which uses a daily-biased 
 MarketDataTypehttps://github.com/encog/encog-java-core/blob/master/src/main/java/org/encog/ml/data/market/MarketDataType.java.
  Obviously, 
 that's not enough if we want to calculate on a second or sub-second 
 interval. Ultimately the YahooFinanceLoader will give us a list of 
 LoadedMarketData, which assumes daily price ticks. 

 What I need to know is can I give the encog neural net a list of tick data 
 that has second or sub-second intervals? Back over the clojure-encog, the 
 thing that normalizes input data, the 
 make-datahttps://github.com/jimpil/clojure-encog/blob/master/src/clojure_encog/training.clj#L41function
  only deals with doubles (not a list of tick data entries). The make-trainer 
 and 
 trainhttps://github.com/jimpil/clojure-encog/blob/master/src/clojure_encog/training.clj#L137functions
  seem to iterate for the number of strategies that you've 
 specified. But I can't see in 
 BackPropogationhttps://github.com/encog/encog-java-core/blob/master/src/main/java/org/encog/neural/networks/training/propagation/back/Backpropagation.javaor
  it's 
 superclasshttps://github.com/encog/encog-java-core/blob/master/src/main/java/org/encog/neural/networks/training/propagation/Propagation.java,
  
 where that tick data is actually processed (init and iteration methods seem 
 to just setup a background process). So I'm left wondering how I can give 
 the core encog neural-net a list of tick data that has a second or 
 sub-second granularity? 


 Hmmm 

 Tim Washington 
 Interruptsoftware.ca 
 416.843.9060 

  

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

Re: Why is a non-transient `into` faster than the built-in one?

2012-11-04 Thread Satoru Logic
I can get more consistent results when running the examples in Ubuntu.

On Monday, November 5, 2012 6:09:25 AM UTC+8, Marek Šrank wrote:

 These are my results using (dotimes (time (dotimes ...))) combo to get 
 consistent results:

  - on sets:

 (dotimes [i 10] (time (dotimes [j 100] (into #{} (range 1e4)
 Elapsed time: 388.595226 msecs
 Elapsed time: 406.666801 msecs
 Elapsed time: 421.559753 msecs
 Elapsed time: 444.719263 msecs
 Elapsed time: 431.319374 msecs
 Elapsed time: 392.3779 msecs
 Elapsed time: 392.382365 msecs
 Elapsed time: 408.71734 msecs
 Elapsed time: 444.203973 msecs
 Elapsed time: 442.351363 msecs

 (dotimes [i 10] (time (dotimes [j 100] (naive-into #{} (range 1e4)
 Elapsed time: 1287.412806 msecs
 Elapsed time: 1318.931199 msecs
 Elapsed time: 1314.773064 msecs
 Elapsed time: 1292.664029 msecs
 Elapsed time: 1277.616099 msecs
 Elapsed time: 1289.514678 msecs
 Elapsed time: 1700.74875 msecs
 Elapsed time: 1352.734662 msecs
 Elapsed time: 1464.09882 msecs
 Elapsed time: 1449.704738 msecs

  - on vectors:

 (dotimes [i 10] (time (dotimes [j 100] (into [] (range 1e4)
 Elapsed time: 307.838501 msecs
 Elapsed time: 243.426624 msecs
 Elapsed time: 234.013566 msecs
 Elapsed time: 247.711805 msecs
 Elapsed time: 253.154264 msecs
 Elapsed time: 284.375476 msecs
 Elapsed time: 227.773865 msecs
 Elapsed time: 247.807286 msecs
 Elapsed time: 240.959477 msecs
 Elapsed time: 230.627513 msecs

 (dotimes [i 10] (time (dotimes [j 100] (naive-into [] (range 1e4)
 Elapsed time: 406.55752 msecs
 Elapsed time: 419.365134 msecs
 Elapsed time: 413.544069 msecs
 Elapsed time: 410.892756 msecs
 Elapsed time: 394.827165 msecs
 Elapsed time: 407.338251 msecs
 Elapsed time: 441.60916 msecs
 Elapsed time: 401.721826 msecs
 Elapsed time: 412.7506 msecs
 Elapsed time: 399.972445 msecs


 Clojure 1.4.0

 java version 1.6.0_26
 Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
 Java HotSpot(TM) Server VM (build 20.1-b02, mixed mode)


 Cheers.

 Marek.

 On Sunday, November 4, 2012 3:41:14 AM UTC+1, Satoru Logic wrote:

 Hi, all.

 I am following an example demonstrating that `transient` can help 
 optimize mass updates to data structures:

 First, a function is defined, which doesn't use transient collection:

 (defn naive-into
   [coll source]
   (reduce conj coll source))


 This is supposed to run slower than the built-in `into`, because, as the 
 book said, `into` uses transient collections whenever possible.

 But the result shows up in my `repl` is just the reverse.


 user= (time (do (into #{} (range 1e6)) nil))
 Elapsed time: 4882.176 msecs
 nil
 user= (time (do (naive-into #{} (range 1e6)) nil))
 Elapsed time: 3745.707 msecs
 nil


 What could be the reason of this?



-- 
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: Playing with clojure-encog, Machine-Learning wrapper

2012-11-04 Thread Timothy Washington
That's just the thing - I'm not using the encog 3rd party library. I wrote 
*github.com/twashing/nn* completely from scratch.

I did have the idea that maybe bid, ask and volume were not enough data
with which to make reliable predictions. So I'll also try adding 3, 5, and
7 tick running averages as input. But for each lifecycle, the error seems
to move up, then settle down at around 0.87, even for the next 1000 ticks
or so. Something in my weight update calculations, pushes the error up to
0.87 (or some other locality), and keeps it there, even going for 1000
ticks. So first, i) I wanted to make sure my math was correct. Then ii) I
wanted to ensure that I was correctly implementing the algorithm.

error progression

   1. *- 0.39489344469762966 ;; this error is a result of the initial
   randomized weights *
   2. - 0.8491601535927018
   3. - 0.8727499656138056
   4. - 0.870064689195726
   5. ...

Wrt to using a single brokerage's market data vs aggregate tick data...
aren't they one in the same? If we're both using the same exchange, I'd
assume I was getting the same market data as any other brokerage (allowing
for insiders, market makers, etc). I'd be interested in being educated
otherwise.

But in principle, this NN is just something that can be used to predict any
time series - plant growth, sunspots, etc. So that error progression should
still bother me, no?


Hmm

Tim Washington
Interruptsoftware.ca

*Today a young man on acid realized that all matter is merely energy
condensed to a slow vibration, that we are all one consciousness
experiencing itself subjectively, there is no such thing as death, life is
only a dream, and we are the imagination of ourselves. Here's Tom with the
Weather.* -- Bill Hicks



On Sun, Nov 4, 2012 at 6:49 PM, Dominic Cerisano dceris...@gmail.comwrote:

 Well darn it.

 Had a detailed response ready to go and found that GG does not save
 drafts.
 POS. Movin on.

 The upshot was I tried predicting tick data (see attachment) with a model
 pretty much identical to the one given here with little real success.
 It would only resolve if I removed all of the discontinuities in the data
 - that came to over 20% of the data)
 The resulting fantasy set failed to predict trends that were not in the
 set with (15% success rate maximum)

 The conclusion I came to is that actual tick data (which is aggregate of
 all trading) is not predictable with the given model.
 NNs (certainly backprop) just try to spline a curve through a training set
 of input/ouput exemplars.
 Tick data simply does not seem to provide such a curve. Equivalent to
 stating what is obvious - stock markets are unpredictable from moment to
 moment).

 However one approach that occurred to me was rather than using aggregate
 tick data, rather use historical data from a given single brokerage that is
 known to use automated trading.

 Rather than trying to learn a dog-breakfast of influences given by
 aggregate data, non-aggregated direct data coming direct from a automated
 trading algo should prove to be a likely subject for machine-learning.

 However, if John Nash was correct then these systems would deliberately
 make bad trades in order to be less predictable. Can't do too much of that
 though :)

 There are plenty of examples in Java of backprop. It is well known, and
 since you are using a known library I doubt there are errors in it, other
 than sub-optimal coding.

 Historical FIX data (non-aggregated direct trading transactions) is
 generally not published anywhere. The model being explored here would be
 very useful if it were.

 Cheers!

 Dominic Cerisano










 On Sunday, August 5, 2012 2:27:35 PM UTC-4, frye wrote:

 Hey all,

 This post is a fork of a thread in the post community interest in
 machine 
 learninghttps://groups.google.com/forum/?fromgroups#!topic/clojure/heBrnBuUGqs.
 Some of us were starting to take a deep dive into 
 clojure-encoghttps://github.com/jimpil/clojure-encog and
 I thought it would be a good idea to have a new thread for that.

 So I took a look at the way 
 encog-javahttps://github.com/encog/encog-java-core
  (what clojure-encog https://github.com/jimpil/clojure-encog** wraps)
 loads tick data into it's system. There is a 
 YahooFinanceLoaderhttps://github.com/encog/encog-java-core/blob/master/src/main/java/org/encog/ml/data/market/loader/YahooFinanceLoader.javathat
  pulls csv data from a URL. But it assumes that prices only have a
 daily granularity. Now, the encog-java system seems to have the concept of
 granularity going down to the second (see 
 herehttps://github.com/encog/encog-java-core/blob/master/src/main/java/org/encog/util/time/TimeUnit.java).
  But
 all of it's market loaders and list of ticks, seem to stop at a time
 granularity of daily. See the LoadedMarketData 
 sourcehttps://github.com/encog/encog-java-core/blob/master/src/main/java/org/encog/ml/data/market/loader/LoadedMarketData.java,
 which uses a daily-biased 
 

unseq

2012-11-04 Thread cej38
Say you are given a vector A=[a1 a2 a3 a4] by some function/library/Java 
call/whatever.
You want to use A in some function F that expects the values a1 a2 a3 a4 
but not in the form of A; for example (defn F [w x y z] (+ w x y z)).  
Is there some function G that you can use on A such that (F (G A)) would 
give the correct answer? 
I now know ways of getting around this, for example in the overly simple 
problem I gave above I would use (eval (cons F [1 2 3 4])).  
But I have came across problems where I have had to spend a large amount of 
time trying to figure out how to do this correctly.  
I would think that there could be something to act as G.  
Is there something like this?  It would definitely simplify things from 
time to 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

lein-ritz Swank character coding

2012-11-04 Thread Matthew Phillips
Hello,

my current lein-ritz (0.5.0) setup, started with slime-connect, hangs when 
handling Unicode characters, e.g.

user (def a \uD83D\uDE1F)  ; UTF-16 representation of Unicode 4 WORRIED 
FACE
#'clojure.core/a
user a
?

The REPL is hung at this point: in the the mini buffer I see error in 
process filter: Wrong type argument: listp, :write-string.

I've done (setq slime-net-coding-system 'utf-8-unix) in my Emacs config, 
and used :jvm-opts [-Dswank.encoding=utf-8] in my Lein project, which 
changed something (slightly different error message), but still broken.

I've also tried using :encoding on the lein command line, and looked into 
the ritz source, where it seems I'm doing the right thing.

I'm stumped: any ideas?

Cheers,

Matthew.

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