Re: why would this statement "java -server" ???

2011-12-15 Thread Ben Smith-Mannschott
On Fri, Dec 16, 2011 at 05:48, jayvandal wrote: > I was looking at the installation in "Learning clojure" and the batch > file had this statement: > >  java -server -cp .;%CLOJURE_JAR% clojure.main > >     why is  the "server" in the line and what is it referencing??? > Thanks for any help The Ja

why would this statement "java -server" ???

2011-12-15 Thread jayvandal
I was looking at the installation in "Learning clojure" and the batch file had this statement: java -server -cp .;%CLOJURE_JAR% clojure.main why is the "server" in the line and what is it referencing??? Thanks for any help -- You received this message because you are subscribed to the Go

Re: why would this statement "java -server" ???

2011-12-15 Thread Wilson MacGyver
It means to use the server version of JVM On Dec 15, 2011, at 11:48 PM, jayvandal wrote: > I was looking at the installation in "Learning clojure" and the batch > file had this statement: > > java -server -cp .;%CLOJURE_JAR% clojure.main > > why is the "server" in the line and what is it

why would this statement "java -server" ???

2011-12-15 Thread jayvandal
I was looking at the installation in "Learning clojure" and the batch file had this statement: java -server -cp .;%CLOJURE_JAR% clojure.main why is the "server" in the line and what is it referencing??? Thanks for any help -- You received this message because you are subscribed to the Go

Re: Bug with 1.3 primitive function return value hinting.

2011-12-15 Thread Brian Goslinga
On Dec 15, 10:03 pm, Cedric Greevey wrote: > So, I can wait until either larger numbers of primitive arguments are > supported, or primitive vectors are supported. We already have persistent vectors that store their contents as primitives with gvec. If you take a look at IFn.java, you'll see that

Re: Bug with 1.3 primitive function return value hinting.

2011-12-15 Thread David Nolen
On Thu, Dec 15, 2011 at 11:03 PM, Cedric Greevey wrote: > For instance, if I want to optimize (distance x1 y1 z1 x2 y2 z2), I > can't. If I declare anything primitive, the compiler complains as > there are more than four arguments. If I change the input format to > (distance [x1 y1 z1] [x2 y2 z2]

Re: Bug with 1.3 primitive function return value hinting.

2011-12-15 Thread Cedric Greevey
On Thu, Dec 15, 2011 at 10:13 PM, David Nolen wrote: > Nobody wants map-longs. We have lovely abstractions like map / filter / > reduce, we have primitive fns, we have collections which can hold > primitives, we have type hints. > > What I'd like to see is that by adding one single annotation to t

Re: Bug with 1.3 primitive function return value hinting.

2011-12-15 Thread David Nolen
On Thu, Dec 15, 2011 at 9:47 PM, Cedric Greevey wrote: > ... Nobody wants map-longs. We have lovely abstractions like map / filter / reduce, we have primitive fns, we have collections which can hold primitives, we have type hints. What I'd like to see is that by adding one single annotation to

Re: Bug with 1.3 primitive function return value hinting.

2011-12-15 Thread Cedric Greevey
On Thu, Dec 15, 2011 at 9:31 PM, David Nolen wrote: > On Thu, Dec 15, 2011 at 9:23 PM, Cedric Greevey wrote: >> There is no possibility of "high performance higher order usage", >> because primitives are boxed inside of collections. Unless you >> proliferate int-vectors, double-vectors, long-seqs

Re: Bug with 1.3 primitive function return value hinting.

2011-12-15 Thread David Nolen
On Thu, Dec 15, 2011 at 9:23 PM, Cedric Greevey wrote: > On Thu, Dec 15, 2011 at 8:56 PM, David Nolen > wrote: > > On Thu, Dec 15, 2011 at 8:16 PM, Cedric Greevey > wrote: > >> > >> public class MangledName implements IFn { > >>public Object invoke () { // unoptimized zero-arg version or ar

Re: Bug with 1.3 primitive function return value hinting.

2011-12-15 Thread Cedric Greevey
On Thu, Dec 15, 2011 at 8:56 PM, David Nolen wrote: > On Thu, Dec 15, 2011 at 8:16 PM, Cedric Greevey wrote: >> >> public class MangledName implements IFn { >>    public Object invoke () { // unoptimized zero-arg version or arity >> throw goes here } >>    public Object invoke (Object x) { // uno

Re: Bug with 1.3 primitive function return value hinting.

2011-12-15 Thread David Nolen
On Thu, Dec 15, 2011 at 8:16 PM, Cedric Greevey wrote: > public class MangledName implements IFn { >public Object invoke () { // unoptimized zero-arg version or arity > throw goes here } >public Object invoke (Object x) { // unoptimized one-arg version ... } >... >public static lo

Re: Bug with 1.3 primitive function return value hinting.

2011-12-15 Thread Cedric Greevey
On Thu, Dec 15, 2011 at 8:47 PM, Softaddicts wrote: > Your approach requires some lifting both in the runtime and the compiler. I beg your pardon? > Why not sign a CA, implement it and submit a patch and supporting runtime > data ? Sounds like a lot of hoops to jump through. The direct-primiti

Re: Bug with 1.3 primitive function return value hinting.

2011-12-15 Thread Softaddicts
Your approach requires some lifting both in the runtime and the compiler. Why not sign a CA, implement it and submit a patch and supporting runtime data ? However there a plans to rewrite Clojure in Clojure on the JVM, some lessons have been learned while writing the ClojureScript compiler. This m

Re: Bug with 1.3 primitive function return value hinting.

2011-12-15 Thread Cedric Greevey
On Thu, Dec 15, 2011 at 8:32 PM, Softaddicts wrote: > It's not "silly", it's the fastest way to dispatch fn calls... Only calls with more than 20 arguments (or via "apply") would need to be dispatched specially. -- You received this message because you are subscribed to the Google Groups "Cloju

Re: Bug with 1.3 primitive function return value hinting.

2011-12-15 Thread Softaddicts
It's not "silly", it's the fastest way to dispatch fn calls... > On Thu, Dec 15, 2011 at 8:05 PM, Softaddicts > wrote: > > From a JVM perspective, f(& arglist) is a one arg function. > > Try defining a fn with more than 20 args and you will get the > > "can't specify more than 20 arguments"

Re: Bug with 1.3 primitive function return value hinting.

2011-12-15 Thread Cedric Greevey
On Thu, Dec 15, 2011 at 8:05 PM, Softaddicts wrote: > From a JVM perspective, f(& arglist) is a one arg function. > Try defining a fn with more than 20 args and you will get the > "can't specify more than 20 arguments" error. > This is the maximum supported by the Clojure runtime for "non-opti

Re: Bug with 1.3 primitive function return value hinting.

2011-12-15 Thread Softaddicts
>From a JVM perspective, f(& arglist) is a one arg function. Try defining a fn with more than 20 args and you will get the "can't specify more than 20 arguments" error. This is the maximum supported by the Clojure runtime for "non-optimized" fns. One can argue about the argument size limit of

Re: Bug with 1.3 primitive function return value hinting.

2011-12-15 Thread Cedric Greevey
On Thu, Dec 15, 2011 at 7:48 PM, David Nolen wrote: > On Thu, Dec 15, 2011 at 7:43 PM, Cedric Greevey wrote: >> >> In that case, I don't see the need for the interface in the >> non-higher-order case. It could just create a Java method of some >> class that implements the primitive-ized version o

Re: ANN: Midje 1.3.0

2011-12-15 Thread ronen
Joining the congrats, one of the must have tools for any Clojure project Ronen On Dec 14, 8:01 am, Denis Labaye wrote: > Midje is getting better and better. > > Congrats! > > > > > > > > On Mon, Dec 12, 2011 at 5:41 PM, Brian Marick wrote: > > Midje 1.3's most important feature is compatibility

Re: Bug with 1.3 primitive function return value hinting.

2011-12-15 Thread David Nolen
On Thu, Dec 15, 2011 at 7:43 PM, Cedric Greevey wrote: > In that case, I don't see the need for the interface in the > non-higher-order case. It could just create a Java method of some > class that implements the primitive-ized version of the fn, and > This is what already happens, every fn is a

Re: Bug with 1.3 primitive function return value hinting.

2011-12-15 Thread Cedric Greevey
On Thu, Dec 15, 2011 at 7:29 PM, David Nolen wrote: > On Thu, Dec 15, 2011 at 7:14 PM, Cedric Greevey wrote: >> >> For helper fns, it's unlikely to be necessary to use the function >> widely in generic contexts, i.e. in a first-class manner, right? > > fns with prim args/return support already do

Re: Bug with 1.3 primitive function return value hinting.

2011-12-15 Thread David Nolen
On Thu, Dec 15, 2011 at 7:14 PM, Cedric Greevey wrote: > For helper fns, it's unlikely to be necessary to use the function > widely in generic contexts, i.e. in a first-class manner, right? > fns with prim args/return support already do this. When not used higher order if the compiler can infer

Re: Bug with 1.3 primitive function return value hinting.

2011-12-15 Thread Cedric Greevey
On Thu, Dec 15, 2011 at 6:51 PM, Softaddicts wrote: > Hi Cedric, > > Your statement " A limitation on primitive arguments simply cannot be > applicable to a function with no primitive arguments" does not stand It is true by axiom. Either the limitation is not actually a limitation "on primitive a

Re: Bug with 1.3 primitive function return value hinting.

2011-12-15 Thread Cedric Greevey
On Thu, Dec 15, 2011 at 6:33 PM, David Nolen wrote: > On Thu, Dec 15, 2011 at 6:19 PM, Cedric Greevey wrote: >> >> I don't see any logical reason why a function taking only >> non-primitive arguments cannot have a primitive return value. > > > You need a JVM method signature for every n number of

Re: Bug with 1.3 primitive function return value hinting.

2011-12-15 Thread Softaddicts
Hi Cedric, Your statement " A limitation on primitive arguments simply cannot be applicable to a function with no primitive arguments" does not stand given all the previous discussions about numeric optimizations and comparing optimizations found in other compiler. Look at any C compiler optimiza

Re: want to make a 'debug' function, how to get current source and line number?

2011-12-15 Thread Alan Malloy
On Dec 15, 1:09 pm, Cedric Greevey wrote: > On Thu, Dec 15, 2011 at 1:54 PM, Alan Malloy wrote: > > This will print all the debug information at compile time, which is > > usually not what you want. I have a little macro I use called ?, which > > looks like: > > > (defmacro ? [x] > >  `(let [x# ~

Re: Bug with 1.3 primitive function return value hinting.

2011-12-15 Thread David Nolen
On Thu, Dec 15, 2011 at 6:19 PM, Cedric Greevey wrote: > I don't see any logical reason why a function taking only > non-primitive arguments cannot have a primitive return value. > You need a JVM method signature for every n number of object arguments + the supported primitive return type. So mo

Re: Bug with 1.3 primitive function return value hinting.

2011-12-15 Thread Cedric Greevey
On Thu, Dec 15, 2011 at 6:05 PM, David Nolen wrote: > On Thu, Dec 15, 2011 at 6:01 PM, Cedric Greevey wrote: >> >> On Thu, Dec 15, 2011 at 5:59 PM, David Nolen >> wrote: >> > On Thu, Dec 15, 2011 at 5:53 PM, Cedric Greevey >> > wrote: >> >> #> >> primitives support only 4 or fewer args, >> >> >

Re: Clojure Stored Procedure

2011-12-15 Thread Vinzent
Hello, I'm interested in this kind of thing too. Do you have any progress? -- 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

Re: Bug with 1.3 primitive function return value hinting.

2011-12-15 Thread David Nolen
On Thu, Dec 15, 2011 at 6:01 PM, Cedric Greevey wrote: > On Thu, Dec 15, 2011 at 5:59 PM, David Nolen > wrote: > > On Thu, Dec 15, 2011 at 5:53 PM, Cedric Greevey > wrote: > >> # >> primitives support only 4 or fewer args, > >> > >> But the function isn't *taking* primitives. It's only *returni

Re: Bug with 1.3 primitive function return value hinting.

2011-12-15 Thread Cedric Greevey
On Thu, Dec 15, 2011 at 5:59 PM, David Nolen wrote: > On Thu, Dec 15, 2011 at 5:53 PM, Cedric Greevey wrote: >> #> primitives support only 4 or fewer args, >> >> But the function isn't *taking* primitives. It's only *returning* a >> primitive, after taking Objects. So it obviously shouldn't produ

Re: Bug with 1.3 primitive function return value hinting.

2011-12-15 Thread Cedric Greevey
And a related bug/quirk: I had had (defn- remm "Remainder of a modulo b; unlike (rem a b) result is in [0,b) even if a is negative." ([a b] (let [r (rem a b)] (if (< r 0) (+ r b) r and evaluated (defn- remm "Remainder of a modulo b; unlike (rem a b) result

Re: Bug with 1.3 primitive function return value hinting.

2011-12-15 Thread David Nolen
On Thu, Dec 15, 2011 at 5:53 PM, Cedric Greevey wrote: > (defn dist > "Shortest distance between x,y and x2,y2 in toroidal space of dimensions > w,h. > Input coordinates should be in range (0,0)-(w,h). For instance, will give > 1.414... if x,y = (0,0) and x2,y2 = (w-1,h-1), as these are diag

Bug with 1.3 primitive function return value hinting.

2011-12-15 Thread Cedric Greevey
(defn dist "Shortest distance between x,y and x2,y2 in toroidal space of dimensions w,h. Input coordinates should be in range (0,0)-(w,h). For instance, will give 1.414... if x,y = (0,0) and x2,y2 = (w-1,h-1), as these are diagonally adjacent." ([x y x2 y2 w h] (let [x2s [(- x2 w)

Re: Clojurescript, is it ready yet?

2011-12-15 Thread Mark Rathwell
>> >> Is clojurescript ready for wide water? > > > It's getting there. +1 > >> >> How far i can only see obscure compilation env and low level ops on >> html elemnts. > > > I find the compilation environment is quite nice, if there's something you > find confusing you should discuss it. I don't t

Re: Clojurescript, is it ready yet?

2011-12-15 Thread David Nolen
On Thu, Dec 15, 2011 at 5:11 PM, Michael Jaaka wrote: > Hi! > > Is clojurescript ready for wide water? > It's getting there. > How far i can only see obscure compilation env and low level ops on > html elemnts. > I find the compilation environment is quite nice, if there's something you find

Clojurescript, is it ready yet?

2011-12-15 Thread Michael Jaaka
Hi! Is clojurescript ready for wide water? How far i can only see obscure compilation env and low level ops on html elemnts. Are there any plans to start building second gwt? Swing 2.0? Google started darts as general purpose language with web browser's VM aka javascript. They want even to repla

Re: Expanding expression with macro

2011-12-15 Thread Michael Jaaka
Nothing is wrong with do I just missed the point how the macro works Thanks! On 15 Gru, 13:37, Meikel Brandmeyer wrote: > Hi, > > macros can only return one value. So multiple forms have to be wrapped into a > do. > > The do never hurts. Why do you want to get rid of it? > > Sincerely > Meikel

Re: my first attempt at a macro returns form wrapped in clojure.core/fn

2011-12-15 Thread Cedric Greevey
On Thu, Dec 15, 2011 at 2:16 PM, Alan Malloy wrote: > FWIW, much safer is > > (defmacro dc >  [sql-cmd] >  `(sql/with-connection db >     ~sql-cmd)) > > If you use the version with (list) and plain-quoting of the first two > items, then the namespace resolution is very fragile: it will only > work

Re: want to make a 'debug' function, how to get current source and line number?

2011-12-15 Thread Cedric Greevey
On Thu, Dec 15, 2011 at 1:54 PM, Alan Malloy wrote: > This will print all the debug information at compile time, which is > usually not what you want. I have a little macro I use called ?, which > looks like: > > (defmacro ? [x] >  `(let [x# ~x] >     (prn '~x '~'is x#) >     x#)) > > You could ad

How to: convert output stream into an input stream

2011-12-15 Thread Trevor
I have created an output stream, which appears to work fine, however I get an error when trying to convert the output stream into an input stream for use in ring: ('use [clojure.java.io :only [input-stream]]) => (with-out-str (ofn var)) "it works!" Now when I use ring: {:body (input-stream (ofn

Re: my first attempt at a macro returns form wrapped in clojure.core/fn

2011-12-15 Thread Alan Malloy
FWIW, much safer is (defmacro dc [sql-cmd] `(sql/with-connection db ~sql-cmd)) If you use the version with (list) and plain-quoting of the first two items, then the namespace resolution is very fragile: it will only work if the caller has referred to the sql library with the prefix sql/,

Re: letrec

2011-12-15 Thread Meikel Brandmeyer
Hi, if you always follow the let structure you outlined the following might work. Untested, though. Note, that things work recursively with this approach. (def ours? #{#'button #'label ...}) (defmacro panel [{:keys [id]} & components] (let [[bindings body] (reduce (fn [[bindings bod

Re: want to make a 'debug' function, how to get current source and line number?

2011-12-15 Thread Alan Malloy
This will print all the debug information at compile time, which is usually not what you want. I have a little macro I use called ?, which looks like: (defmacro ? [x] `(let [x# ~x] (prn '~x '~'is x#) x#)) You could add file and line information to this fairly simply: (defmacro ? [x]

Re: Lazy-seq of a binary file

2011-12-15 Thread Cedric Greevey
On Wed, Dec 14, 2011 at 11:47 PM, Simone Mosciatti wrote: > Ok thank you so much, i got it. > > Thanks again ;-) You're welcome. -- 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

Re: my first attempt at a macro returns form wrapped in clojure.core/fn

2011-12-15 Thread Cedric Greevey
On Thu, Dec 15, 2011 at 1:14 PM, Peter Buckley wrote: > TL;DR I have an extra clojure.core/fn wrapped around the form I want > returned from my macro. This is my first macro and I'm not sure what's > wrong, even though the macro "works." ... > (defmacro dc >  [sql-cmd] >  (list 'sql/with-connect

Re: Clojure videos no longer downloadable

2011-12-15 Thread Phil Hagelberg
On Wed, Dec 14, 2011 at 8:21 PM, Baishampayan Ghose wrote: > Every video has an RSS feed which can be mechanically constructed given the > URL. > > So for http://blip.tv/clojure/rich-hickey-unveils-clojurescript-5399498, > the RSS feed is at http://blip.tv/rss/flash/5399498 > > IIRC, the RSS feed

my first attempt at a macro returns form wrapped in clojure.core/fn

2011-12-15 Thread Peter Buckley
TL;DR I have an extra clojure.core/fn wrapped around the form I want returned from my macro. This is my first macro and I'm not sure what's wrong, even though the macro "works." I'm trying my first attempt at a macro by trying to save myself from having to type "sql/with-connection db" for every t

Re: want to make a 'debug' function, how to get current source and line number?

2011-12-15 Thread Dennis Haupt
in java i would throw an exception and parse its stack trace. don't know how to do that in clojure, but probably similar Am 15.12.2011 06:48, schrieb jaime: > Hello there, > > I want to write a function named "debug" which will print out "date- > time msg + current source-line + etc. info", but I

Re: want to make a 'debug' function, how to get current source and line number?

2011-12-15 Thread Jay Fields
You'll probably want to google around a bit. I wrote a blog entry at one point: http://blog.jayfields.com/2011/02/clojure-and.html - but it's not meant to cover everything in depth. 2011/12/15 jaime : > Great! that's exactly what I want. Thank you! > This is the first time I meet "&form", is there

Re: letrec

2011-12-15 Thread Meikel Brandmeyer
Hi, you'll probably have to rewrite your panel macro, so that it recognizes the button (and label, etc) macros ((= #'button (resolve &env sym)) in 1.3) and extracts the ids from the subform. Then you construct a global let which contains all the individual id namings. Then you group all '...' p

Re: want to make a 'debug' function, how to get current source and line number?

2011-12-15 Thread jaime
Great! that's exactly what I want. Thank you! This is the first time I meet "&form", is there any document about this 'form' or relevant things? On 12月15日, 下午9时19分, Jay Fields wrote: > This should get you started: > > (defmacro debug [x] > (println x) > (println (pr-str &form)) > (println *

Re: letrec

2011-12-15 Thread Nils Bertschinger
Hi, to implement letrec in a language with eager evaluation strategy some kind of mutability is probably needed. Consider for example a self- referential definition such as (let [fibo (lazy-cat [1 1] (map + fibo (rest fibo)))] (take 10 fibo)) This will not work since fibo is not in scope when

Re: letrec

2011-12-15 Thread Bobby Eickhoff
'declare' wouldn't be good because of the scope of vars. There's no sense using global (albeit namespaced) variables for what probably only need to be local identifiers. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send em

Re: namespace what?

2011-12-15 Thread tonyl
you are mixing up the format for ns. If you want to use an alias for your library, use require, like this: (ns examples.core (:require [clarity.component :as c])) ;; you can call the function/macro make, by using the alias. (c/make :button "The Button") but if you don't want to use an alias and

Re: letrec

2011-12-15 Thread Daniel
Is 'declare' possibly the missing component here? On Dec 14, 3:37 pm, Razvan Rotaru wrote: > Yes. Assuming I have following macros: > > (button :id b1 :listener #(...)) => (let [b1 (new JButton)] ...) > (panel [:id p1] (button :id b1 ...) (button :id b2 ...)) => (let [p1 > (new JPanel) b1 (button

Re: namespace what?

2011-12-15 Thread Tassilo Horn
Tassilo Horn writes: >> I think I understand namespace and then I don't! >> I try to run this example >> >> (ns examples.core >> (use [clarity.component :as c])) > > The syntax of ns is > > (ns examples.core > (:use [clarity.component :as c])) > > Notice the colon preceeding the "use." O

Re: namespace what?

2011-12-15 Thread Stathis Sideris
You can just say: (ns examples.core (:use clarity.component)) This will intern all the symbols in the clarity.component namespace into examples.core, so you can use them as if they were defined in examples.core in the first place: (make :button "the button") This has the disadvantage of potent

Re: want to make a 'debug' function, how to get current source and line number?

2011-12-15 Thread Jay Fields
This should get you started: (defmacro debug [x] (println x) (println (pr-str &form)) (println *file*) (println (meta &form))) On Thu, Dec 15, 2011 at 12:48 AM, jaime wrote: > Hello there, > > I want to write a function named "debug" which will print out "date- > time msg + current sourc

Re: Expanding expression with macro

2011-12-15 Thread Meikel Brandmeyer
Hi, macros can only return one value. So multiple forms have to be wrapped into a do. The do never hurts. Why do you want to get rid of it? Sincerely Meikel -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to cloju

Expanding expression with macro

2011-12-15 Thread Michael Jaaka
Hi! I have something like this: (defmacro testme[ & ops ] `(do ~@(for[ op ops ] `(println ~op (macroexpand '(testme 1 2 3)) (testme 1 2 3) How can I change the macro so "do" wouldn't be required? When I do doseq instead of for the resulting value is nill. (defmacr

Re: multiple return values

2011-12-15 Thread Razvan Rotaru
Thanks. On Dec 14, 8:30 pm, Alan Malloy wrote: > Correct, just like closures and reifies. > > On Dec 14, 7:33 am, Tom Faulhaber wrote: > > > > > > > > > Razvan, > > > I believe that proxy actually only creates a new class per call site, > > not per instance. However, I can't completely swear to

Re: namespace what?

2011-12-15 Thread Laurent PETIT
Hello, Jay, Your email is not precise enough. What did you place in which files, how were the files named, how were they stored relatively to some "root" folder, and how did you start a REPL ? 2011/12/13 jayvandal : > I think I understand namespace and then I don't! > I try to run this example >