Re: clojure diffs

2013-06-07 Thread Dennis Haupt
intellij can do exactly what you want 2013/6/7 Moocar > Hi all, > > Diffs for clojure code (and lisps in general) can be hard to read. Every > time we wrap a form, any lines below are indented. The resulting diff just > shows that you've deleted lines and added lines, even though you've only >

multimethod noob question

2013-06-22 Thread Dennis Haupt
hi, i was taking a look at multimethods: (defmulti fac int) (defmethod fac 1 [_] 1) (defmethod fac :default [n] (*' n (fac (dec n this works however, this also works: (defmulti fac print) (defmethod fac 1 [_] 1) (defmethod fac :default [n] (*' n (fac (dec n what exactly is "int" or "pr

can't compile anything except "def"

2013-06-22 Thread Dennis Haupt
hi, i'm trying to compiler a clojure file using intellij. the error i get is: Clojure Compiler: java.io.IOException: The system cannot find the path specified, compiling:(D:\cloj\MultiMethod.clj:3) where the line number is pointing at a line that contains something that is declared in core.clr if

Re: can't compile anything except "def"

2013-06-22 Thread Dennis Haupt
i don't know what "properly set up the environment" means exactly, but i can run my script in the repl 2013/6/22 Jim - FooBar(); > On 22/06/13 15:09, Dennis Haupt wrote: > >> where the line number is pointing at a line that contains something that >> is declare

Re: multimethod noob question

2013-06-22 Thread Dennis Haupt
13-14-15-16-17-18-19-20-21-22-23-24-25-26-27-28-until stackoverflow 2013/6/22 Chris Bilson > Dennis Haupt writes: > > > i was taking a look at multimethods: > > (defmulti fac int) > > (defmethod fac 1 [_] 1) > > (defmethod fac :default [n] (*' n (fac (

Re: can't compile anything except "def"

2013-06-22 Thread Dennis Haupt
clojure jvm, intellij's repl. i'll try to run the file via commandline and see what happens 2013/6/22 Jim - FooBar(); > On 22/06/13 15:16, Dennis Haupt wrote: > >> i don't know what "properly set up the environment" means exactly, but i >> can

Re: can't compile anything except "def"

2013-06-22 Thread Dennis Haupt
running the file works (from inside intellij), just intellijs compilation seems to be broken i can ignore the problem for now 2013/6/22 Dennis Haupt > clojure jvm, intellij's repl. i'll try to run the file via commandline and > see what happens > > > 2013/6/22

Re: can't compile anything except "def"

2013-06-22 Thread Dennis Haupt
it happens with both clojure 1.5.1 and 1.4.0. when intellij tries to compile clojure files, something strange happens. if i remove the option to compile the files (and instead just use clojure.main and run them) there is no problem 2013/6/22 Jim - FooBar(); > On 22/06/13 15:21, Dennis Ha

Re: multimethod noob question

2013-06-22 Thread Dennis Haupt
yes. all glory to the repl that makes me figure out the internals via experiments :D is there a way to just pass the given value along? 2013/6/22 Chris Bilson > Dennis Haupt writes: > > > i am not trying anything, i just want to figure out what happens. this > is my output

Re: multimethod noob question

2013-06-22 Thread Dennis Haupt
ere stuff is the "match" and stuff2 is the complete set of original arguments? can you provide an example where stuff2 has more information than stuff? for fac, both are equal thx :D 2013/6/22 Dennis Haupt > yes. all glory to the repl that makes me figure out the internals

Re: multimethod noob question

2013-06-22 Thread Dennis Haupt
"identity" :) 2013/6/22 Chris Bilson > Dennis Haupt writes: > > > yes. all glory to the repl that makes me figure out the internals via > experiments :D > > is there a way to just pass the given value along? > > Yes, that's what I meant by my inspec

multimethods for non constant values?

2013-06-23 Thread Dennis Haupt
i found example that i can do (defmethod x 5 [y] (do stuff)) but can i do (defmethod #(< % 10) [y] (do stuff)) somehow? like in a pattern match of haskell/scala? -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to

Re: multimethods for non constant values?

2013-06-23 Thread Dennis Haupt
alues > )) > ;; dispatch on the dispatch values > (defmethod x :less-then-10 [x] (do )) > > Hope it helps > > Las > > > 2013/6/23 Dennis Haupt > >> i found example that i can do >> (defmethod x 5 [y] (do stuff)) >> >> but can i do >&

Re: can't compile anything except "def"

2013-06-23 Thread Dennis Haupt
d > occasional problems with it. > > > On 23 June 2013 02:29, Dennis Haupt <mailto:d.haup...@gmail.com>> wrote: > > it happens with both clojure 1.5.1 and 1.4.0. when intellij tries to > compile clojure files, something strange happens. if i remove the >

too circular?

2013-08-26 Thread Dennis Haupt
(defn fib-n [n] (let [fib (fn [a b] (cons a (lazy-seq (fib b (+ b a)] (take n (fib 1 1 can't i do a recursion here? how can i achieve this without doing an "outer defn"? -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to thi

Re: too circular?

2013-08-27 Thread Dennis Haupt
thx 2013/8/26 Marshall Bockrath-Vandegrift > Dennis Haupt writes: > > > (defn fib-n [n] > > (let [fib (fn [a b] (cons a (lazy-seq (fib b (+ b a)] > > (take n (fib 1 1 > > > > can't i do a recursion here? how can i achieve this without doing

Re: profiler?

2013-08-27 Thread Dennis Haupt
yep, yourkit 2013/8/27 Jay Fields > What are you all using these days? I've been using YourKit and I'm > fairly happy with it. Just making sure I'm not missing out on some new > hotness. > > Cheers, Jay > > -- > -- > You received this message because you are subscribed to the Google > Groups "C

Re: too circular?

2013-08-29 Thread Dennis Haupt
thx again 2013/8/30 Bruno Kim Medeiros Cesar > This exact use case is covered by letfn, which creates a named fn > accessible to all function definitions and the body. That even allows > mutual recursive definitions without declare. Your example would be > > (defn fib-n [n] >(letfn [(fib [

Re: DSL in RTL (Right to Left) languages.

2015-01-14 Thread Dennis Haupt
i encountered a "german" progamming language once. it was terrible. everybody should stick to english when it comes ot programming - you have to do it anyway, and there is no reason not to go ahead and learn a language since that is what brains are built for 2015-01-14 17:11 GMT+01:00 Jesse Alama

Re: Considering dropping Eclipse 3.x support for counterclockwise

2014-12-04 Thread Dennis Haupt
yuno 2014-12-04 11:45 GMT+01:00 Laurent PETIT : > The following Eclipse names are 3.x based : Indigo, Helios, Galileo > > The following are 4.x based : Juno, Kepler, Luna > > 2014-12-04 11:17 GMT+01:00 Laurent PETIT : > >> Hello, >> >> Eclipse 4.x has been around for many years now, and I'm cons

Re: Why do map/get and similar return nil if not found?

2016-01-12 Thread Dennis Haupt
i agree with the fast fail camp if a value is nil but is not supposed to be, i want the program to immediately tell me about that instead of telling me later and force me to trace it back. in scala, this is solved by providing 2 methods. one that gives you a result or crashes, one that maybe gives

Re: why my java code (call clojure from java ) run spend so much loooooog time .

2014-02-13 Thread Dennis Haupt
give your vm more memory 2014-02-13 17:02 GMT+01:00 Xiaojun Weng : > I am a new clojure player,but i have wrote java code by few years. > > when i use emacs run my clojure code (read a big file 50M ) , nrepl run > over use 30 second. > but i use lein uberjar clojure to jar .and i use it jar i

Re: Do I have to have knowlegde about Lisp

2014-03-10 Thread Dennis Haupt
you can learn clojure without learning lisp first :) 2014-03-10 15:41 GMT+01:00 Roelof Wobben : > Hello, > > I like the idea of Clojure but I wonder if I have to know a lot of Lisp to > work with Clojure. > > What is the best way to go from a absolute beginner to someone who can > work with Cloj

Re: shenandoah

2014-03-13 Thread Dennis Haupt
i also did an asteroid game in clojure. i don't think you can ever achieve the performance of hackedyhack-mutablility with pure functional algorithms - my approach to get the best performance while staying as clean as possible would be to keep two copies of the game world, using one as source data

Re: How to go about 'proving' why dynamically typed languages are better.

2013-10-08 Thread Dennis Haupt
while i can see the strengths of both sides, the ideal solution is imho this: everything is statically typed. always. but you *never* have to write the type explicitly. you *can* do it, but it is always optional. i made good experiences with both scala and haskell (although i just wrote minor thi

Re: How to go about 'proving' why dynamically typed languages are better.

2013-10-09 Thread Dennis Haupt
let's see... really used: sql java javascript basic pascal/delphi scala experimented with: logo (some old language intended to teach people to make their first steps) haskell kotlin clojure seen in action: php groovy still prefer smart static typing :D 2013/10/9 Nando Breiter > >> The best

Re: How to go about 'proving' why dynamically typed languages are better.

2013-10-09 Thread Dennis Haupt
especially haskell & scala are missing in your list :) as long as you haven't at least seen haskell, you haven't seen the creme de la creme of statically typed languages 2013/10/9 Softaddicts > Let's see: > > strong data typing: > > Fortran > Cobol > Pl/1 > Pascal > C/C++ > Java > C# > Ruby > >

Re: How to go about 'proving' why dynamically typed languages are better.

2013-12-20 Thread Dennis Haupt
in my mental world, there is a "pure human", and a 4 armed human would probably be a 95% human or something, just like a hobbit would be. the other way round, a human would be a "95% hobbit". an elephant would be 4% hobbit on that scale. this model is flexible, covers everything, and is not really

Re: Is Clojure right for me?

2013-12-26 Thread Dennis Haupt
exactly which part of OOP is missing in clojure that you would like to use? if you took my java code and ported it to clojure, the main difference would be (a b) instead of b.a , but the main design would be similar 2013/12/26 Massimiliano Tomassoli > On Thursday, December 26, 2013 7:51:39 PM U

some clojure experience

2013-12-31 Thread Dennis Haupt
i solved a few little thingy with clojure now, including some euler problems, java interop and an asteroids clone. my summary would be: * very nice to write +1. i used clojure's collections for a lot of things, and they made a good impression * you need to plan far ahead compared to java. in java,

Re: Read Microsoft Word .doc files in Clojure

2014-01-02 Thread Dennis Haupt
use apache poi and write a small wrapper or something this is what i did 2014/1/2 Joshua Mendoza > Hi!, > > I've been looking for libraries or resources to read MS .doc files in > Clojure, but found none. Does anyone have tried, used, encountered or > witnessed such a thing to read them? > > I

Re: equality

2014-01-27 Thread Dennis Haupt
one does not simply compare floating point numbers for equality 2014-01-27 Eric Le Goff > Newbie question : > > user=> (= 42 42) > true > user=> (= 42 42.0) > false > > I did not expect last result. > > I understand that underlying classes are not the same > i.e > user=> (class 42) > java.lang.

Re: JRE/JVM for development

2014-01-29 Thread Dennis Haupt
my vm starts up within a second or so, what's the problem for you? 2014-01-29 > Are there any Java VMs strictly for development use that could be started > up quicker, use less memory or compile clojure during execution? > Alternatively can OpenJDK or similar be configured to do so? I don't car

is intellij idea a good ide for clojure development?

2013-01-28 Thread Dennis Haupt
the only ides i have used so far for clojure are intellij idea and netbeans. is there one that is a lot better? if yes, why? i am not interested in details or single features, i just want to know if there is some magic editor out there that i should look into because it is *obviously a lot* better

Re: is intellij idea a good ide for clojure development?

2013-01-29 Thread Dennis Haupt
i don't know emacs, so i would like to know as well what the killer features are that make you more productive with emacs 2013/1/29 Laurent PETIT > Hello Jay, > > I'd like to learn a little bit more from what makes you prefer emacs > over IntelliJ. > As the main developer of Counterclockwise, I

Re: is intellij idea a good ide for clojure development?

2013-01-29 Thread Dennis Haupt
Am 29.01.2013 23:05, schrieb Phil Hagelberg: > > Jay Fields writes: > >> On Tue, Jan 29, 2013 at 11:45 AM, Laurent PETIT >> wrote: >>> Hello Jay, >>> >>> I'd like to learn a little bit more from what makes you prefer emacs >>> over IntelliJ. >>> As the main developer of Counterclockwise, I'm I

Re: Why is this code so slow?

2013-02-03 Thread Dennis Haupt
without looking at the code: ranges in scala have been optimized in i think 2.10 to be able to be inlineable completely when you iterate over them. at runtime, it *should* be equal to a simple while loop and a counter variable Am 03.02.2013 14:28, schrieb Jules: > The Scala version is probably fas

Re: Boolean

2012-04-07 Thread Dennis Haupt
why is there an exception for Boolean.FALSE? Am 07.04.2012 17:28, schrieb Softaddicts: > Hi, > > You are not in the Clojure play ground when you use (Boolean. false). > > This expression creates a Java object, hence (if any-java-object ...) > always evaluate the "true" branch in Clojure. > > In

Re: Boolean

2012-04-07 Thread Dennis Haupt
i've never seen a "new Boolean(...)" in my 10 years of developing java code. Am 07.04.2012 22:49, schrieb Michael Klishin: > Steven Obua: > >> (if (Boolean. false) "jesus" "christ") >> >> will return "jesus", not "christ". Googling this on the net, I found >> that this is a known phenomenon > >

Re: 'last' on empty collections

2012-07-01 Thread Dennis Haupt
i'd do (actually, i did) it like this: (my-special-last coll) -> returns the last element or throws an exception if there is none (my-special-last coll if-empty) -> in case of an empty collections, ifEmpty is returned Am 01.07.2012 21:47, schrieb Warren Lynn: > Right now > > (last []) => nil >

Re: real-world usage of reducers?

2012-08-21 Thread Dennis Haupt
i assume you are coming from a java background? if so, every time you wrote this: Result result = null; for (Stuff s:stuffList) { if (result ==null) result = ... result.cuddleWith(s); } return result a reducer would have been a functional alternative to this Am 21.08.2012 13:04, schrieb Jim - F

Re: 'functional' performance VS 'imperative' complexity

2012-08-25 Thread Dennis Haupt
+1 i stay functional if possible and fall back to mutable on isolated, performance critical spots if i can't get it done fast enough in a purely functional way. i solved the move-mess-up-everything problem by forcing a move to implement both apply and unapply on a game board. (it was a java proje

language shootout / the phonecode study

2012-09-20 Thread Dennis Haupt
i stumbled upon this: http://page.mi.fu-berlin.de/prechelt/phonecode/ the results: http://page.mi.fu-berlin.de/prechelt/Biblio/jccpprt_computer2000.pdf summary: concise languages bashed c, c++ and java if you look at the time needed to complete the program. however, in 1999, there were no good id

Re: language shootout / the phonecode study

2012-09-20 Thread Dennis Haupt
asured, no debugging, fixing and so on) i'll have to think about that 2012/9/20 David Nolen > On Thu, Sep 20, 2012 at 10:52 AM, Dennis Haupt > wrote: > >> i stumbled upon this: >> http://page.mi.fu-berlin.de/prechelt/phonecode/ >> >> the results: >> http

Re: language shootout / the phonecode study

2012-09-20 Thread Dennis Haupt
Thursday, September 20, 2012 5:07:52 PM UTC+2, David Nolen wrote: > > On Thu, Sep 20, 2012 at 10:52 AM, Dennis Haupt > > wrote: > > i stumbled upon this: > http://page.mi.fu-berlin.de/prechelt/phonecode/ > <http://page.mi.fu-berlin.de/prec

Re: language shootout / the phonecode study

2012-09-20 Thread Dennis Haupt
i came to a correct solution without that hint :) just like in reality, i started coding without reading the spec. a few surprises came along the way ("what? they want it like this? they just added this to mock me!") i spent about 50% of the time writing code and 50% thinking about it. i'll tell m

Re: language shootout / the phonecode study

2012-09-22 Thread Dennis Haupt
here's my solution: https://gist.github.com/3766508 the original (done in 2 hours) solution is commented out. i made some improvements and solved the whole thing in 39 lines (counting only the content of "main"). doing it in the minimal amount of lines was not my goal. i was trying to minimize the

Re: language shootout / the phonecode study

2012-09-22 Thread Dennis Haupt
now. Am 22.09.2012 18:22, schrieb David Nolen: > On Sat, Sep 22, 2012 at 11:27 AM, Dennis Haupt <mailto:d.haup...@gmail.com>> wrote: > > here's my solution: > https://gist.github.com/3766508 > > the original (done in 2 hours) solution is commented out.

Re: language shootout / the phonecode study

2012-09-23 Thread Dennis Haupt
i did not need the hint to develop a correct solution. the hint just clarifies what could have been misunderstood. Am 23.09.2012 21:03, schrieb Mark Engelberg: > I agree that Odersky's version doesn't match the spec. Hint or no hint, > it doesn't look like he even attempts to address the issue of

Re: Clojure : a good start for non-programmers?

2012-09-25 Thread Dennis Haupt
basically anything except brainfuck is a good idea :) Am 26.09.2012 06:45, schrieb Leonardo Borges: > Hi Gregorius! > > I think Clojure is a great way to start to learn to program! Clojure > is a flavour of lisp and so is Scheme - which has been used for > decades to teach programming to MIT unde

Re: Clojure to Haskell Compiler

2012-11-17 Thread Dennis Haupt
why not just use haskell instead? i doubt you can just convert the code Am 17.11.2012 19:31, schrieb Ahmed Shafeeq Bin Mohd Shariff: > Hi guys, > > I've been frustrated with Clojure's slow speed on the JVM. I've been > thinking of how it can be compiled to native and I feel that compiling > C

Re: Efficiency of Dijkstra's algorithm

2012-11-21 Thread Dennis Haupt
i used a java priorityqueue for this. it's mutable (but local), and since you're not going to access he queue with more than in thread you can hide this fact and still pretend to be functional. i did it. in reality, cheats are always allowed. 2012/11/21 Sergey Didenko > I have used mutable code

Re: help choosing dev environment for clojure

2012-11-25 Thread Dennis Haupt
can you give a few examples that should convince a lot of people on the spot? Am 25.11.2012 17:57, schrieb Jay Fields: > I spent 3 years doing Clojure (for prod apps) in IntelliJ. 3 months ago > I switched to emacs - and would never go back. > > If the idea of customizing your dev environment to

why is nth called here?

2012-12-11 Thread Dennis Haupt
i am trying to solve euler problem 125. when i tested this code: (ns euler.Problem125) (defn is-palindrome [n] (let [s (str n)] (= (seq s) (reverse s (defn to-check [] (filter is-palindrome (range 1 1000))) (defn square-root [n] (Math/sqrt n)) (defn squared [n] (* n n)) (defn

Re: why is nth called here?

2012-12-11 Thread Dennis Haupt
i just saw my error :/ Am 11.12.2012 22:22, schrieb Ben Wolfson: > nth is called in doing the destructuring for the argument lists in > your fns defined in try-find-sequence. > > On Tue, Dec 11, 2012 at 1:20 PM, Dennis Haupt wrote: >> i am trying to solve euler problem

Re: why is nth called here?

2012-12-12 Thread Dennis Haupt
if anyone is interested, i used reduces instead of reductions. 2012/12/11 Dennis Haupt > i just saw my error :/ > > > Am 11.12.2012 22:22, schrieb Ben Wolfson: > > nth is called in doing the destructuring for the argument lists in > > your fns defined in try-find-

max doesn't return max?

2012-12-12 Thread Dennis Haupt
maybe i am blind, but why does max return the complete lazy seq here instead of the maximum number? if i just print as-products, i get a list of numbers. (count solution) tells me there are 1000+ and yet max gives me the complete list? (ns euler.Problem8) (def digits "73167176531330624919225119

Re: coming from statically typed oo languages - how do deal with complex objects graphs in clojure?

2011-09-04 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 i started with a tic tac toe implementation, but i'm stuck: (def open 0) (def p1 1) (def p2 2) (def emptyfield [open open open open open open open open open]) (defn updated [seq index replacement] (concat (take index seq) [replacement]

Re: coming from statically typed oo languages - how do deal with complex objects graphs in clojure?

2011-09-04 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 solved my last problem, and now i'm stucker than before: (def open 0) (def p1 1) (def p2 2) (def emptyfield [open open open open open open open open open]) (defn updated [seq index replacement] (concat (take index seq) [replacement] (dr

Re: coming from statically typed oo languages - how do deal with complex objects graphs in clojure?

2011-09-04 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Am 04.09.2011 19:08, schrieb Justin Kramer: > On Sunday, September 4, 2011 12:21:23 PM UTC-4, HamsterofDeath > wrote: > > * in the last loop where i am just printing out what i want to do, > i need something like "foldLeft" (from scala). how do i fold

Re: coming from statically typed oo languages - how do deal with complex objects graphs in clojure?

2011-09-04 Thread Dennis Haupt
ent some recursion and > rebind new values within a function's body. > > Luc P. > > On Sun, 04 Sep 2011 18:55:12 +0200 Dennis Haupt > wrote: > > solved my last problem, and now i'm stucker than before: > > (def open 0) (def p1 1) (def p2 2) (def emptyfield

Re: coming from statically typed oo languages - how do deal with complex objects graphs in clojure?

2011-09-06 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 i tried using letfn insteaf of defn for inner functions. (def open 0) (def p1 1) (def p2 2) (def emptyfield [open open open open open open open open open]) (defn indexOf [x y] (+ x (* y 3))) (defn withmove [x,y,player,field] (assoc field (indexOf

Re: coming from statically typed oo languages - how do deal with complex objects graphs in clojure?

2011-09-06 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 figured it out, i the () were a bit messed up. the working code: (def open 0) (def p1 1) (def p2 2) (def emptyfield [open open open open open open open open open]) (defn indexOf [x y] (+ x (* y 3))) (defn withmove [x,y,player,field] (assoc field (

Re: coming from statically typed oo languages - how do deal with complex objects graphs in clojure?

2011-09-06 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 thx, that's what i figured out a moment ago. i am used to allknowing ides Am 06.09.2011 15:25, schrieb Stefan Kamphausen: > hi, > > why does clojure want to cast the result to IFn? > > > if I parse that correctly, you have two parens around the >

Re: coming from statically typed oo languages - how do deal with complex objects graphs in clojure?

2011-09-06 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 > It was not a syntax error. Your expression just had the wrong > return value. I don't see how an IDE could help here. > > by type inference. i don't know how far an ide could track the types in clojure since it's completely lacking any type ann

Re: coming from statically typed oo languages - how do deal with complex objects graphs in clojure?

2011-09-06 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 > > or the equivalent shorthand form: > > #(= % 2) > should i ever write a bigger app with clojure, it will be filled with these. i like them. -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.14 (MingW32) Comment: Using GnuPG with Mozilla - http:

Re: coming from statically typed oo languages - how do deal with complex objects graphs in clojure?

2011-09-06 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Am 06.09.2011 16:28, schrieb Meikel Brandmeyer (kotarak): > > Am Dienstag, 6. September 2011 15:57:16 UTC+2 schrieb Mark > Rathwell: > > You want an anonymous function: > > (fn [x] (= x 2)) > > or the equivalent shorthand form: > > #(= % 2) > > O

Re: Clojure vs Scala - anecdote

2011-09-07 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 so the scala actors add much more overhead than the clojure equivalent? Am 07.09.2011 07:32, schrieb Sean Corfield: > I just wanted to share this experience from World Singles... > > Back in November 2009, we started developing with Scala. We needed

debugging

2011-09-10 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 hi there, what's the currently best way to debug a clojure program? ideally, i want to see all vars, symbols, functions etc. that are in the current scope and be able evaluate expressions on the fly a "start repl here and stop program until repl is

small project to learn clojure

2011-09-16 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 hi community, i feel compelled to do something more complex in clojure. not too big, but bigger than what fits in 100 lines and offers some chances to use macros. it should also be fun, maybe something like robocode. - -- -BEGIN PGP SIGNATURE--

Re: small project to learn clojure

2011-09-17 Thread Dennis Haupt
nguage by means of "I need to learn > something, what should I do" is not as effective, or as fun, as > learning it by doing something you care about. > > On Sep 16, 2:50 pm, Dennis Haupt wrote: > hi community, > > i feel compelled to do something more complex in

advantage of dynamic typing

2011-09-19 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 hi community, clojure is dynamically typed, so i thought here i might find some good reasons for that. what can you do if you sacrifice compile time type safety? an advantage i see is very, very concise code since you have no type annotations at all.

Re: advantage of dynamic typing

2011-09-20 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Am 20.09.2011 05:43, schrieb Sean Corfield: > On Mon, Sep 19, 2011 at 4:19 PM, Dennis Haupt > wrote: >> an advantage i see is very, very concise code since you have no >> type annotations at all. the downside is that exactly thi

Re: advantage of dynamic typing

2011-09-21 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Am 20.09.2011 22:55, schrieb Islon Scherer: > Scala is a OO language with FP support, clojure is a functional > language with OO support, they are very different. It's normal for > someone with a OO background to think that every method receives a > ob

Re: advantage of dynamic typing

2011-09-21 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Am 21.09.2011 19:58, schrieb Ken Wesson: > On Wed, Sep 21, 2011 at 3:00 AM, Dennis Haupt > wrote: >> yes, but you magically need to know a) for which types does it >> work? if you give a byte to the function, will you get an erro

beginner question

2011-09-24 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 in java, i would start coding a game with a loop like this: while (true) { logic(); render(); } i would store the current state of the world in an object containing the complete data of the whole game and update its values in each iteration. how woul

Re: beginner question

2011-09-24 Thread Dennis Haupt
ul of the lazy functions in clojure like map. It will only > execute when you ask a value for it. render should do that > > Matt Hoyt > -------- > > *From:* Dennis Haupt > *To:* clojure@googlegroups.com *Se

Re: beginner question

2011-09-24 Thread Dennis Haupt
he differences here: http://clojure.org/datatypes > > assoc for records sets the value of the property for the record. > > Matt Hoyt > ---- > > *From:* Dennis Haupt > *To:* clojure@googlegroups.com *Se

Re: beginner question

2011-09-24 Thread Dennis Haupt
> > Matt Hoyt > -------- > > *From:* Dennis Haupt > *To:* clojure@googlegroups.com *Sent:* Saturday, September 24, 2011 > 3:54 PM *Subject:* Re: beginner question > > i assumed my game to be so much fun that no one would ever want to > stop playing it. > > Am 24.09.2011 2

Re: beginner question

2011-09-25 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Am 25.09.2011 14:00, schrieb Stuart Halloway: >> the website says: >> >> deftype supports mutable fields, defrecord does not >> >> so deftype seems to be what would be a java bean with simple >> properties in java > > Nope. :-) > > Domain informat

Re: beginner question

2011-09-25 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 so there is no difference. Am 25.09.2011 15:28, schrieb Stuart Halloway: >> what's the difference between persistent and immutable? > > See http://en.wikipedia.org/wiki/Persistent_data_structure, which > now has a nice shout out to Clojure. > > Stu

Re: beginner question

2011-09-25 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 so persistent is immutable + x like "car" is "movable" + x. it doesn't make sense to ask what the difference is. Am 25.09.2011 18:59, schrieb Phil Hagelberg: > > On Sep 25, 2011 6:12 AM, "Dennis Haupt"

can't see the error

2011-09-25 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 (let [rand (new java.util.Random) nextInt (fn [a] (.nextInt rand))] ((map (print) (iterate ((nextInt "dummy") 0) the error is: java.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn (NO_SOURCE_FILE:0) why does it want

Re: can't see the error

2011-09-26 Thread Dennis Haupt
my") 0) > > extra parenthesis in three places, and the first argument to > iterate is a function, not a long: > > (let [rand (new java.util.Random) nextInt (fn [a] (.nextInt > rand))] (map print (iterate nextInt 0))) > > > On Sun, Sep 25, 2011 at 3:51 PM, Dennis Haupt

Re: can't see the error

2011-09-26 Thread Dennis Haupt
(new point (randomInt) (randomInt) (randomInt))] (repeatedly n randomPoint))) is there a way to avoid writing (randomInt)(randomInt)(randomInt) and instead something like (magic (repeatedly 3 randomInt))? Am 25.09.2011 22:14, schrieb Baishampayan Ghose: > On Mon, Sep 26, 2011 at 1:21 AM,

Re: can't see the error

2011-09-27 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Am 27.09.2011 06:27, schrieb Baishampayan Ghose: >> i wasn't really trying to achieve anything useful - just messing >> around and see where i get. >> >> now i'm here: (defrecord point [x y z]) (defn genPoints [n] (let >> [random (new Random) randomI

Re: Using Clojure to Generate Java Source?

2011-09-29 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 compile to java class, decompile to java source. works in theory, until someone actually looks at the source ;) btw, your new boss is ... not the type of boss that would keep me from looking for a new job. Am 29.09.2011 20:09, schrieb Dennis Crenshaw

clojure newbie collection question

2011-10-14 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 if i got it right, filter/remove and map (basically all batch transform functions) return lazy sequences. to convert them to real collections again, i do (vec lazyseq) in case i want the result to be stored in a vector. correct? what happens if i tra

Re: Can Simple be done with Static Typing?

2011-10-24 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 i have some (10 years) experience with difference statically typed languages and a bit with dynamic ones. i encountered a few typesafe solutions that don't introduce a lot of overhead - for example the types of scala. in addition to interfaces and clas

"Can't take value of a macro" aka "macro noob needs help"

2011-10-30 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 i played around a bit (defmacro times [times & exprs] '(let [countdown# ~times] (loop [remaining# countdown#] (when (< 0 remaining#) ~@exprs (recur (dec remaining#)) (defmacro forloop [[i end] & code] `(let [fini

Re: "Can't take value of a macro" aka "macro noob needs help"

2011-10-30 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 your magic eye is right. using a backquote fixed it Am 30.10.2011 15:37, schrieb David Powell: > > > On Sun, Oct 30, 2011 at 2:22 PM, Dennis Haupt > mailto:d.haup...@googlemail.com>> > wrote: > > -BEGIN PGP SIG

anyone interested in a small game?

2011-10-30 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 hi community, i decided to create a (small) game in clojure to get a bit of non-theoretical experience. i'm pretty much a clojure noob (only did a few experiments) but have done a few real things in scala - which is totally awesome btw - so i do have

Re: anyone interested in a small game?

2011-10-31 Thread Dennis Haupt
Asteroids/Spacewar! clone, mostly > because it would give us a chance to introduce Agents as the > building block of the game engine. > > Timothy > > On Sun, Oct 30, 2011 at 1:32 PM, Dennis Haupt > wrote: hi community, > > i decided to create a (small) game in cloj

Re: anyone interested in a small game?

2011-10-31 Thread Dennis Haupt
sion of SpaceWar! > > http://www.youtube.com/watch?v=yY5qHe2VadA > > I like the idea of doing a Asteroids/Spacewar! clone, mostly > because it would give us a chance to introduce Agents as the > building block of the game engine. > > Timothy > > On Sun, Oct 30, 201

Re: anyone interested in a small game?

2011-10-31 Thread Dennis Haupt
> > (send entity update-time timespan) > > (send asteroid do-split) > > etc. > > Actually, this really isn't too long of a project, at least the > asteroids part isn't. > > Timothy > > On Mon, Oct 31, 2011 at 8:00 AM, Dennis Haupt > wr

Re: anyone interested in a small game?

2011-10-31 Thread Dennis Haupt
t step on each > other's toes. > > Timothy > > On Mon, Oct 31, 2011 at 9:37 AM, Dennis Haupt > wrote: one agent per entity? i'd have > done an agent for the whole world and apply functions like > "apply-collision" and "apply-shot-fired" to it >

Re: anyone interested in a small game?

2011-10-31 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 no need for "IRender" since everything has a java.awt.polygon. i just draw it. in a sense, the polygon is my IRender and it's data is the implementation. i was thinking about using a simple type (:asteroid, :ship, :bullet) for each entity and pick an

Re: anyone interested in a small game?

2011-10-31 Thread Dennis Haupt
n if you don't > implement anything but the JVM version, if you can at least show > that your engine would work on these other platforms without heavy > modifications (massive kodos if you can do this without any > modifications to the core engine at all) then I would say you have &

Re: anyone interested in a small game?

2011-10-31 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 if you *really* make zero assumptions, every second call has to be a protocol/interface call. *i know what i am, so no assumption* -> *interface call* -> *repeat* i think "no assumptions" should be "make no assumptions about the internals of what you

Re: anyone interested in a small game?

2011-11-01 Thread Dennis Haupt
email unless it is absolutely > necessary. Spread environmental awareness. > > > > > > On Mon, Oct 31, 2011 at 12:02 AM, Dennis Haupt > wrote: hi community, > > i decided to create a (small) game in clojure to get a bit of > non-theoretical experience. i'm

  1   2   >