Re: Writing a text adventure in Clojure

2018-04-02 Thread Will Duquette
ture. Would I do better to define a couple of functions, like this? ```clojure (defn get-room [world id] (-> world :map id)) (defn flag-set? [world id] (-> world :flags id)) ``` Or would that be just complicating things to no good end? Thanks! On Thursday, March 29, 2018 at 3:45:02

Re: Writing a text adventure in Clojure

2018-04-02 Thread Will Duquette
Excellent. Yeah, I was thinking I was probably going to too much trouble to get the "nil" value. And the (derive) solution is very nice. Thanks very much! On Monday, April 2, 2018 at 11:30:53 AM UTC-7, Mikhail Gusarov wrote: > > Hello Will. > > You can simplify it fu

Re: Writing a text adventure in Clojure

2018-04-02 Thread Will Duquette
to skin this cat; but this one seems to give me maximum simplicity for the normal case, maximum flexibility for special cases, and it lets me keep all of the logic related to a single room in one place in the code. Comments? On Thursday, March 29, 2018 at 3:45:02 PM UTC-7, Will Duquette

Re: Writing a text adventure in Clojure

2018-04-02 Thread Will Duquette
Thanks! On Friday, March 30, 2018 at 11:12:04 AM UTC-7, Karsten Schmidt wrote: > > Hi Will, > > have a look at this workshop repository, in which we developed a > simple text adventure framework: > https://github.com/learn-postspectacular/resonate-workshop-2014 > >

Re: Writing a text adventure in Clojure

2018-04-02 Thread Will Duquette
e as a function of the state of the world, rather than to compute the change to the object as a function of the change to the state of the world. Your do-important-plot-changing-action function does the latter. But in general, yeah, this approach makes sense. We've agreed on the menu, now w

Re: Writing a text adventure in Clojure

2018-04-02 Thread Will Duquette
g games in Lisp, in > case you're into books. :) > > On Thu, Mar 29, 2018 at 6:45 PM, Will Duquette > wrote: > >> I'm an experienced programmer, but a Clojure newbie; as a beginner >> project, I'm looking into how one would idiomatically write a text &g

Re: Writing a text adventure in Clojure

2018-04-02 Thread Will Duquette
, the most common solution is to use > protocols and records. > > > On 29 March 2018 at 23:45, Will Duquette > wrote: > >> I'm an experienced programmer, but a Clojure newbie; as a beginner >> project, I'm looking into how one would idiomatically write

Re: Writing a text adventure in Clojure

2018-04-02 Thread Will Duquette
re often > implemented in OOP languages, but they really are not OOP at all. Here's a > good talk on the subject: https://www.youtube.com/watch?v=TW1ie0pIO_E > > On Thu, Mar 29, 2018 at 5:00 PM, Will Duquette > wrote: > >> Aha! How about this, to cut the Gordian knot:

Re: Writing a text adventure in Clojure

2018-03-29 Thread Will Duquette
ional. On Thursday, March 29, 2018 at 3:45:02 PM UTC-7, Will Duquette wrote: > > I'm an experienced programmer, but a Clojure newbie; as a beginner > project, I'm looking into how one would idiomatically write a text > adventure of sorts in Clojure. I'm less interested

Writing a text adventure in Clojure

2018-03-29 Thread Will Duquette
oint-reached) Normally, to describe a room you just return its :description. (defn describe [room] (:description (world get room))) But for the :fancy-room, the returned description depends on the global flag, and it will be specific to :fancy-room. I could add this logic directly to the (d

Re: Macro for quickly switching libraries

2016-04-16 Thread Will Bridewell
Thanks for this. Gives me a much better idea of where to start. This is the second time that I've run across a need to switch libraries on the fly, so I figure it's time to work out a better approach. -- You received this message because you are subscribed to the Google Groups "Clojure" group.

Macro for quickly switching libraries

2016-04-05 Thread Will Bridewell
I'm working on some code where I want to evaluate different implementations of the same functionality. Each implementation of a function lives in its own namespace. For example, suppose that I have the following simplified code. (ns tst1) (defn foo [x] (+ x 1)) (ns tst2) (defn foo [x] (+ x 2))

Registering commands in a command language

2014-05-28 Thread Will Duquette
If there's a better place to ask this kind of question, please point me in the right direction! I'm learning Clojure, and part of the project I'm making is a command language: the user can type commands at the application in something like a REPL, and have a dialog with the application. I want

ANN: mcmc: a Clojure Library for MCMC Computations

2012-07-14 Thread Will M. Farr
ry out, feel free to contact me off- or on-list to discuss. Hoping folks find this useful, Will -- 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 mem

Re: The vsClojure Project

2010-10-15 Thread Will Kennedy
Very cool! I've been working on something similar. Will check it out! On Oct 3, 4:49 pm, jmis wrote: > It's very encouraging to see others interested in the project.  I've > added the licensing information to the grammar file.  There's a few > other attributions I

Re: Clojure for VS2010

2010-09-25 Thread Will Kennedy
Thanks for the great feedback, Shawn. On Sep 23, 3:09 pm, Shawn Hoover wrote: > On Thu, Sep 23, 2010 at 4:20 PM, Will Kennedy wrote: > > Some background: I've been spending some of my free time providing by > > basic Clojure support in VS 2010. To be honest, I'm a bi

Clojure for VS2010

2010-09-23 Thread Will Kennedy
Some background: I've been spending some of my free time providing by basic Clojure support in VS 2010. To be honest, I'm a bit of a Clojure newbie, so I figured something that would require me to build a lexer and parser for the language and delve into the clojure source would be a great way to le

Re: Please help! Really simple function not working.

2010-08-10 Thread Will M. Farr
t; procedure is called (i.e. placed on the top of the stack), and then your computation proceeds. When you return your way back to the handler, it recalls the previous stack from the heap, jumps to the bottom of it, and your computation proceeds. In effect, the stack is treated as a limited-si

Re: Examples of Clojure in production?

2010-04-19 Thread Will
The only one I know of is FlightCaster: http://www.datawrangling.com/how-flightcaster-squeezes-predictions-from-flight-data But that's a pretty good endorsement. Will On Apr 18, 11:55 pm, Daniel Glauser wrote: > I would like to start a thread about Clojure use in production.  Who &g

Re: Events vs Threads paper

2010-04-16 Thread Will
I've put up the code those guys eventually worked on (and then abandoned) while at UCBerkley: http://github.com/wlangstroth/capriccio On Apr 15, 4:16 pm, TimDaly wrote: > This might be interesting when the discussion of events vs threads > comes > up:http://www.usenix.org/events/hotos03/tech/fu

Clojure / Lisp Developers job listings

2010-03-09 Thread Will Fitzgerald
Hello, I maintain a (free) listing of Lisp and Clojure jobs at lispjobs.wordpress.com If you have a Clojure job you'd like to advertise, please send it to one of the addresses found on the About page: http://lispjobs.wordpress.com/about/ Will Fitzgerald -- You received this message be

Re: newbie encountering java.lang.OutOfMemoryError: Java heap space

2010-02-10 Thread Will Hidden
high hopes that closing over known-map will solve your out of memory issue it starts, i believe, making the code more idiomatic. Once that is done I would look at simplifying what update- known-map and dist functions do. Its unclear to me why you do a merge of a zipmap of keys to numbers. Making tha

Re: Looping idiom

2009-09-07 Thread Brian Will
should read: (loop [s origSeq n [ ]) (let [a (first s b (second s)] (if (nil? b) n (recur (rest s) (conj n (+ a b)) On Sep 7, 6:51 pm, Brian Will wrote: > Very basic question. What's the idiom for producing a new seq

Looping idiom

2009-09-07 Thread Brian Will
Very basic question. What's the idiom for producing a new seq wherein each val is based on pairs from an existing seq, e.g.: ; add together n0 n1, n1 n2, n2 n3, etc. [1 2 3 4 5 6] ; giving... [3 5 7 9 11] The verbose way would be something like: (loop [s origSeq n [ ]) (let [a (first or

Is syntax quote "reader" only?

2009-02-16 Thread Brian Will
I'm a bit mystified how syntax quote does what it does. I don't see how syntax quote can quote the whole while unquoting parts without some evaluation-time intervention. If I had to implement it myself, I'd just punt the problem to evaluation-time by introducing a special form 'unquote', e.g.:

Re: automatic concurrency

2009-01-03 Thread Brian Will
rite event-driven code, but it would all involve just one thread, much like Javascript events work in the browser now.) > The article looks out-of-date and inaccurate, alas... Yeah, I got this impression as well. I coulda sworn it was better the last time I looked at it. --Brian Will On

Re: automatic concurrency

2009-01-03 Thread Brian Will
licit direction from the programmer, however, is another matter. The implementations of Haskell that do this are experimental and not widely used. http://en.wikipedia.org/wiki/Automatic_parallelization --Brian Will On Jan 3, 12:20 pm, "Mark Volkmann" wrote: > One of the s

Re: meaning and pronunciation of Clojure

2009-01-03 Thread Brian Will
Yes. Pronounced "closure" as if the "j" is French. On Jan 3, 1:06 pm, "Mark Volkmann" wrote: > I assume that the name "Clojure" is taken from the word "closure", > replacing the "s" with a "j" for Java. I've never seen that in writing > though and my curiosity compels me to have this verified. I

Re: literate snake

2009-01-03 Thread Brian Will
ection :down) at-bottom) (if left-half :right :left) (and (= direction :left) at-left) (if top-half :down :up) (and (= direction :up) at-top) (if left-half :right :left) true direction))) On Jan 3, 9:28 am, "Mark Volkmann" wrote: > On Sat, Jan 3, 2009 at 3:03 AM, Br

Re: literate snake

2009-01-03 Thread Brian Will
ght (and (= direction :up) top right-half) :left true direction))) --Brian Will On Jan 2, 11:07 am, "Mark Volkmann" wrote: > I've written a new version of the snake program that uses a more > literate style and therefore, to my eyes, calls for far fewer > co

Re: iteration idioms

2008-12-12 Thread Brian Will
Thanks, Mark. I don't suppose (reduce into ...) is a common enough idiom that it deserves its own function? Perhaps (into x) should do (reduce into x), e.g. (into [[3 5] [6 7]]) => [3 5 6 7]. This makes sense to me, but maybe it's too semantically different from (into x y). If not, though, you co

iteration idioms

2008-12-12 Thread Brian Will
st old) (prepend3 new (first old) user=> (24 6 3 5 3 5 7 3 5 3 2) Again, hardly elegant. Maybe there's a cleaner way to use loop in these cases, or maybe I'm just forgetting some function(s) to use. Hopefully someone can demonstrate better idioms to handle

Re: Learning Clojure

2008-12-11 Thread Brian Will
Tim, just go ahead and make any changes you like. If I don't like them, I can always revert ;) Actually, I'm sure anything you add we can find a place for, but like I said, that would likely be a separate example page in most cases. Thanks, Randall, I mention keywords-as-functions where I talk ab

Re: Learning Clojure

2008-12-10 Thread Brian Will
Hopefully keeping the whole text reasonably short will encourage volunteers. Thanks for your feedback. --Brian Will --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group

Re: Learning Clojure

2008-12-10 Thread Brian Will
towards the end. Vars have to be introduced before I can discuss namespaces, but the thread- local binding aspect of Vars can be deferred to later. btw, you'll see a few notes I left in the text in square brackets where I wasn't sure on some point.

Re: Learning Clojure

2008-12-10 Thread Brian Will
d to distill that simple essence into something sequentially readable and easily digestible. While the language is still open for amendment, I hope Clojure takes some measures to preserve and optimize ease of learning. Ease of learning is a big part of what will give Clojure a chance that other Li