Re: Do type hints cause auto casting?
The hints are not use for static type analysis they are there for speed. There is no type checker. In your example the compiler tries using it as an int if that is not working the compiler uses reflaction to find out the type. no auto casts are by design. On 31 Dez., 05:57, Jarl Haggerty fictivela...@gmail.com wrote: I think I asked the wrong question, not only that but I guess I answered the question I asked, what I want to know is what exactly is a type hint. I think I've failed to understand exactly what a type hint is, I assumed to give a hint was to statically type something but that doesn't seem to be what happens here. On Dec 30, 9:18 pm, Sunil S Nandihalli sunil.nandiha...@gmail.com wrote: I don't think type hints lead to auto casting .. May be somebody else can throw more light on it. And it is this way by design. Sunil. On Fri, Dec 31, 2010 at 9:35 AM, Jarl Haggerty fictivela...@gmail.comwrote: I have this function (defn floor ^int [^float x] x) and (floor 1.5) returns 1.5 which confuses me as to how type hints work, I was expecting the result to be truncated or for the program to spit out some exception about expecting an int and getting a float. -- 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.comclojure%2bunsubscr...@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: clojure - javascript
The dream would be to have: - Everything for clojure in clojure - A nice compiler in clojure - java speed clojure - Collections and multimethodes in clojure - A js generating backend for the compiler that works with GWT for the required java stuff Unfortunately I do not (jet) have the skill to do any of that and this will takes a very long time (if ever). In the mean time I think Chouser In-between sound pretty good and I think it would be the most practical. Write clojure code, use the clojure core functions, be able to use macros and clojure collections would already be a great project. -- 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: Native Clojure
Clojure is designed to be hosted. So I'm pretty sure that there are no plan to write a nativ clojure VM but you could try to compile the byte code with llvm. I here there is a java byte code frontend. On Dec 20, 8:43 am, kaveh_shahbazian kaveh.shahbaz...@gmail.com wrote: Is there a natively compiled version of Clojure? Is there any plans to do so? 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: Lazy Programming
I've been a lazy programmer for more than 30 years. :-) True me to but the trick is to let the computer be lazy too. Because we all know a team of lazy 'things' work best. -- 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: The 'in' family
On Dec 15, 6:12 am, Mark Engelberg mark.engelb...@gmail.com wrote: One thing I've argued for in the past, but got no traction: We have: get-in, get assoc-in, assoc update-in, ? Let's add update to go with update-in. update should really be in there. I always try to write update then i remember that I have to use update-in. -- 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: Yegge's Lisp is not an acceptable Lisp - was he talking about Clojure?
Lisp is Not an Acceptable Lisp Friday, April 14, 2006 Clojure wasn't out then. -- 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 I'm getting StackoverflowError?
What is the difference between rest and next? This has to do with lazyness. I wrote an answer to that on stackoverflow. http://stackoverflow.com/questions/4288476/clojure-rest-vs-next Should answer everthing. I'm confused, should I use empty? or not? when to use it? Why Clojure decided to handle an empty list as a not false? this is a big (if not) departure from Common Lisp? The list is not nil because why should a empty list be nil but not en empty set/map/vector. To make all of them nil would probebly make other problems (100% sure we didn't do that would be intressting to know). So a common pattern is to just call seq or empty on the collection to be sure that the empty list dosn't pass as true. (On of the constant pain points when you work on books that are written in CL or Scheme) Next let my talk about the Stackoverflow: If you use empty? you don't have one on small list but if the get bigger you run in problems because you have to many nessted stacks. The easy (and good) solution is to pass the running result onlong the way. This can be done in diffrent ways. First the CL Style where you creat a new function in you function that then does all the work. (from Ken Wesson) (defn list-length [coll] (let [ll (fn [n s] (if s (recur (inc n) (next s)) n))] (ll 0 (seq coll I don't really like this because the core logic is somwhat hidden. Then we could use arity functions. (Alex Osborne) (defn list-length ([coll] (list-length coll 0)) ([coll n] (if-let [s (seq coll)] (recur (rest s) (inc n)) n))) This is nice style in my opinion but I would do it like this: (defn list-lenght [coll] (loop [coll coll n 0] (if (empty? coll) n (recur (rest coll) (inc n) or with seq instead of empty? (defn list-lenght [coll] (loop [coll coll n 0] (if (seq coll) (recur (rest coll) (inc n)) n))) Hope that helps a little. -- 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 I'm getting StackoverflowError?
On Dec 6, 11:40 am, Ken Wesson kwess...@gmail.com wrote: Won't that make the internal recursive call fail though? And even if not -- ugly IMO. :) Agree. Why make something slower and more ugly? -- 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: Porting libraries to ClojureCLR
I thought about that a little too. The thing is that clojure is doing something almost imposible. There is almost know way around writing you json library backand in clr interop. If we want to make clojure programm that run on the clr, the jvm and possibly in the browser we have to write pure clojure but not using native stuff is against the clojure way. So how can we solve this? I think we need a kind of tagsystem. With the tags you could indicate if a library is pure clojure or if it uses lower level stuff. For librarys that use jvm we have to define a interface with the clr version can mirror. That way we would at least not need to change code that runes on these librarys. That would need lots of communication between the clr and jvm people. But there will always be code that only runes on one host. You cant (trivially) call hadoop on the clr for example. The other possibility is to develop to diffrent ecosystems but that would make it even harder to switch from one to the other. In the long run the librarys that are writen in pure clojure will hopfully become the standard. - The same problem we have with the typesystem. No idea how to solve that. -- 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: Destructuring noob question
as for first and next: You can do this (let [fst (first [1 2 3 4 5 6]) rst (rest [1 2 3 4 5 6])] (println first: fst) (println rest: rst)) or (let [[fst rst] [1 2 3 4 5 6]] (println first: fst) (println rest: rst)) both print this: first: 1 rest: (2 3 4 5 6) -- 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
benchmarking tipps and tricks
Hallo all, I know that what I'm asking here is not 100% about clojure but I hope people in here can help me anyway. Me and a classmade of mine have to do a project for school and we though i would be cool to do some programming language benchmarking. Its a good fit because he is a systems guy and I'm a programmer. So I can write the benchmarks and he can test them but neither of us ever did any benchmarking. To keep things simple I choose three jvm languages (Clojure, Scala and JRuby but I could change them if there would be a good reason). The other thing I have to work out is what algorithms (2) I want to benchmark. So I have a few questions. - is there good information (i could find much) on whats importend in benchmarking and other general things you should know when you do benchmarking. - Can it make sence to ask the question on how fast a language is if you write the test in a idiomatic way. - I don't want test that are only based on number crunching (on of them could be). What would be good benchmarks for languages? - What are the best tools to benchmark on the jvm (and optimize your tests) - Are there other things that you think could be helpful to me. Thanks for you 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