Nick, Welcome to Clojure! On Mar 18, 5:04 pm, Nick <nschub...@gmail.com> wrote: > I want to learn Clojure and the first idea for a "simple" app that > popped into my head was some sort of roguelike (because I'm a gamer > and this is what I like to do...) I could go on making hello world > apps and tiny test apps that serve little purpose, but the way I learn > is by setting an end goal and going for it. I don't intend on making > this in the first shot, but like I said, there's the goal. > > I've read quite a bit on Clojure, done some simple stuff like the > "Hello World" apps and such already. I get the idea of the list > structure (though I'm still VERY green on this.) > > A little background: I have an extensive background (10+ years > professional, many more non-pro) in OOP and Procedural Programing > using everything from Javascript/Actionscript to C# and even the gross > VB4-6 in my early years and a little known Aspect Scripting (which > I've totally forgotten by now.) I've only really dealt with threaded > applications in C# because, let's face it... it's dead simple even > using mutex locking. Non-professionally I started on an old TRS-80 > then moved to a 80386 with GWBASIC/QBASIC and dabbled in C/C++ (but > mainly I've just read tons of books on C/C++...) > > So, I'm trying to put all that aside and think Functional for this. > I'm really trying, and it's mind bending to put all that aside... but > I learn by example so here's where I ask some clues. > > I've downloaded Netbeans and an addon and played with it a little bit, > but it seems to require a _main entry method and from the various > tutorials around, I see that's not the norm. > > I'm having an interesting (to me) question around a using REPL. Once > it's shut down, where does this code go? I feel like I'm in the old > TRS-80 volatile coding days where you write some code, and if you shut > down you've lost it all. Is this the case? So how do you save your > code in a REPL? I understand these could be unique per editor so I > understand if you get irate at me for asking such a silly question...
To answer your question about the REPL, yes everything is lost when you close it. However, this isn't the whole story. Once you create a new project w/ Enclojure, you can send code from a file too the REPL either from a context menu or keyboard shortcut (Alt+E in windows). It's standard practice to edit your file, and send the code to the REPL dynamically. This gets you out of the 1960s and back to 2010. > > I understand a list from ( to ) has the potential to be a function in > separate threads because I poked my head into a tutorial I should have > probably stayed clear of. If I create a function that I want to > execute first on start up to check for a file and load it, but if it > doesn't exist, create it and populate some array for world data. > That's fairly straight forward, but in a game environment, this gets > you nowhere but RAM full of data. About this point I'd then call a > function create a player that would read in data from this world > within a local proximity and act upon it. There's two ways I can see > going about this. One is threading it off to act on it's own (which > is what I'd love to do) and the other is appending it to the end of > this creation function (have that function call the player on > completion) but this is where I'm lost. Is it as simple as calling > said method at the end of the list or is that filling up a stack of > pain that I don't want to deal with when it all crashes? > > So I thought, I just need to do it. Just put it to silicon and start > making something then I stared at the screen... > > A part of me would approach this as a client/server model which I'm > not certain is right for functional programming. You have to have > some communication method, or is the "world data" stored in a global > location that is accessible to this player? Am I thinking about this > all wrong? Would the player spawn the world load/creation only when > it was needed? What if you wanted more than one actor? (would be a > boring game if there were no enemies...) How does each actor access > this world data? > > I realize some of this sounds totally noobish. Forgive me, but this > is new territory for me. With OOP and functional languages I could > scope a simple array of an array and reference it within it's scope. > Is all Clojure scoped globally for data or am I supposed to go find > something to handle that? I would figure with the nature of > functional programming I could have it store data in a simple file > format for the time being. That might not scale well, or it just > may. I don't know. > > Sorry for the length of this post, the rambling, and the incoherent > thought process. I realize I'm probably asking too many questions at > once... :-\ You're probably asking several questions at once because you're trying to learn a lot at once. It's understandable. It sounds to me like you would benefit from learning a bit more about the language before jumping into a full scale app. I'd recommend the following: 1. Watch Rich's videos on "Clojure for Java Programmers" and "Clojure for Lispers". They help with the general ideas. 2. Get yourself a copy of Programming Clojure by Halloway. It's very accessible, and will walk you through the basics. 3. Walk through the Clojure cheat sheet ( http://clojure.org/cheatsheet ) , and force yourself to learn how to use every function listed at the REPL at least once. It's a drill, but when you're done, it'll save you a lot of time learning the API. This whole process should take no more than 2-4 weeks. After that, you'll be in a much better place to ask these same questions. Also, when you're done there's another collection of reading material here: http://news.ycombinator.com/item?id=1033503 Hope this helps, Sean -- 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 To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.