Re: My SLIME installation diary

2009-02-09 Thread bOR_
HI Phil. Tried the clojure-install on a fairly clean ubuntu / emacs23 Here is what went and what went wrong: Had to use a different .emacs. Just autoload and add-to-list didn't seem to load clojure-mode.el. Took a moment to figure out that I had to set clojure-src-root as well, as that isn't me

Re: Discarding entire transactions

2009-02-09 Thread Anand Patil
On Feb 8, 9:03 pm, Dan wrote: > > (def a (ref 1)) > > (def b (ref 1)) > > > ; Do these concurrently, either from separate agents or using pmap > > (dosync (commute b error-throwing-fn a)) > > (dosync (commute a + @b)) > > > I want to have the option to abort the first transaction without > > roll

Re: My SLIME installation diary

2009-02-09 Thread bOR_
Slowly wrestling myself through getting to know emacs. Ok. autoload works fine. Didn't realize I have to open emacs with a .clj file for the clojure-mode to load. Now looking where this 'Cannot open load file:slime-repl' is coming from. On Feb 9, 10:36 am, bOR_ wrote: > HI Phil. Tried the cloju

Re: if-let

2009-02-09 Thread jdz
> (let [basedir (if-let [bdir (:basedir *locs)] bdir ".")] >     ...) I'd personally write that as: (let [basedir (or (:basedir *locs*) ".")] ...) There is also when-let, which can be used to iterate over sequences: (loop [items some-sequence] (when-let [item (first items)] (do somethi

Re: Am I "holding on to the head" here ?

2009-02-09 Thread Rich Hickey
On Feb 8, 5:13 pm, Jeffrey Straszheim wrote: > I have this piece of code: > > (defn- run-work-elements-in-parallel > "Runs a group of work elements in parallel. Returns an extended database." > [elements database] > (assert (set elements)) > (let [[rec simp] (separate :recursive element

Re: Questions about a Clojure Datalog

2009-02-09 Thread Rich Hickey
On Feb 7, 2:25 pm, John Fries wrote: > I agree with Jeffrey that there is no reason to have just one option. I never suggested there ought to be only one option, nor am I trying to argue against the utility of open-world reasoners. I merely asked, given your assertion that open-world reasoners

Re: Datalog update

2009-02-09 Thread Rich Hickey
Looks like you're moving apace! Have you considered query/subquery optimization instead of magic sets? Rich On Feb 8, 7:51 pm, Jeffrey Straszheim wrote: > By the way, if anyone on this list has experience implementing bottom-up > optimizations for logic programs, particularly from the magic se

Re: Minor bug report: (merge-with f) returns nil, not {}

2009-02-09 Thread Rich Hickey
On Sat, Feb 7, 2009 at 9:16 PM, Jason Wolfe wrote: > > merge-with says it returns a map, but if you give it no arguments it > gives you back nil instead of the empty map. > > In my code, I had something like: > > ((apply merge-with concat maps) key) > > and got NPE rather than "nil" when "maps" w

Clojure + Slick - "stylistic" questions

2009-02-09 Thread phtrivier
Hi everyone first of all, this is my first post, so if I ask FAQs or deserve to RTFM, please tell me. I am learning clojure, and trying to adapt some game code written in a Java framework called Slick. After a couple of beginner's mistake (the kind you do to learn ;) ), I got a working convesti

Re: Am I "holding on to the head" here ?

2009-02-09 Thread Jeffrey Straszheim
Cool, thanks. On Mon, Feb 9, 2009 at 7:14 AM, Rich Hickey wrote: > > > > On Feb 8, 5:13 pm, Jeffrey Straszheim > wrote: > > I have this piece of code: > > > > (defn- run-work-elements-in-parallel > > "Runs a group of work elements in parallel. Returns an extended > database." > > [elements

Re: Datalog update

2009-02-09 Thread Jeffrey Straszheim
No, but I'm really learning as I go here. I'll look into it. On Mon, Feb 9, 2009 at 7:58 AM, Rich Hickey wrote: > > Looks like you're moving apace! > > Have you considered query/subquery optimization instead of magic sets? > > Rich > > On Feb 8, 7:51 pm, Jeffrey Straszheim > wrote: > > By the

Re: Stack overflow problem

2009-02-09 Thread Jeffrey Straszheim
Did this work for you? Do you understand what the problem was? On Sun, Feb 8, 2009 at 8:06 PM, Jeffrey Straszheim < straszheimjeff...@gmail.com> wrote: > In fact, try this: > > (defn add-children [searchtype statelist] > (let [c (children (first statelist)) >s (rest statelist)]

Re: Clojure + Slick - "stylistic" questions

2009-02-09 Thread Laurent PETIT
Since you say you're an Eclipse user, one answer could be : use clojuredev (eclipse plugin supporting clojure development), and wait patiently for this feature to be included :-). More seriously : clojuredev, while still a baby compared to slime, has some interesting features worth considering fo

Re: Clojure + Slick - "stylistic" questions

2009-02-09 Thread Laurent PETIT
I wanted to say compared to emacs+slime+clojure-swank, of course. There are also netbeans and jetbrain Ideas implementations, also. I just posted here because you told about eclipse, but those other environments are good, too ! -- Laurent 2009/2/9 Laurent PETIT > Since you say you're an Eclip

Curious about Cells

2009-02-09 Thread Jeffrey Straszheim
I know I could just go read the docs, but I hope someone familiar with this Cells stuff could save me some time: 1. Does Cells handle circular dependencies in your computation? If so, (briefly) how? (e.g. if the value of X depends on Y, and Y depends on X, can it handle it?) 2. How is state

Re: pmap issues

2009-02-09 Thread Rich Hickey
On Feb 7, 9:36 pm, Jeffrey Straszheim wrote: > With the help of the IRC folks I solved my own problem. > > I thought I'd share my findings: > > You cannot safely call pmap inside of another pmap function. Because > pmap is implemented on top of agents, the actual calls to your > function are a

Re: pmap issues

2009-02-09 Thread Jeffrey Straszheim
Good. This one concerned me, as I'd like to use pmap given its simplicity, but that would prevent other from calling my code in their own pmap (and how would they know not to do that). On Mon, Feb 9, 2009 at 11:29 AM, Rich Hickey wrote: > > > > On Feb 7, 9:36 pm, Jeffrey Straszheim > wrote: > >

Re: Clojure + Slick - "stylistic" questions

2009-02-09 Thread phtrivier
Oh, don't worry, I used clojuredev for this ;) I noticed a few bugs here and there, by the way, so i'll have to find some time and report / patch ... anyway on this topic you really have the same probleme with java, except that propers tools just hide the hugly list of import anyway. Cheers PH O

Re: Clojure + Slick - "stylistic" questions

2009-02-09 Thread phtrivier
Oh, don't worry, I used clojuredev for this ;) I noticed a few bugs here and there, by the way, so i'll have to find some time and report / patch ... anyway on this topic you really have the same probleme with java, except that propers tools just hide the hugly list of import anyway. Cheers PH O

building a class or jar file from clojure

2009-02-09 Thread hank williams
How does one make a standard clojure based class file or jar file without embedding clojure source files. Hank -- blog: whydoeseverythingsuck.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To

Re: Clojure + Slick - "stylistic" questions

2009-02-09 Thread Matt Clark
I agree with what Laurent said about clojuredev, I've been having great success using it myself, for my clojure/slick creations. My first project was converting Kevin Glass's platformer example over to clojure which gave me a chance to learn slick and Clojure all in one go! Unfortunately, the co

Re: Getting a result from a swing JDialog

2009-02-09 Thread chris
I would create a ref in the let statement that is launching the dialog. Then create a countdown latch and launch the dialog using SwingUtilities/invokeLater. Ensure the ref is set (dosync ...) and the latch is counted when the dialog is closed. Now you have a synchronous result from your asynch

Re: Clojure + Slick - "stylistic" questions

2009-02-09 Thread Laurent PETIT
Oh nice ! So there's more clojuredev users than the ones having subscribed to the clojuredev-user ml :-) Feel free to report bugs. I like them :-) Correcting a bug is like a step forward to perfection :-) :-) -- Laurent 2009/2/9 phtrivier > > Oh, don't worry, I used clojuredev for this ;) I

Re: building a class or jar file from clojure

2009-02-09 Thread Joshua Fox
Ahead of Time compilation might be what you are looking for . This lets you distribute.class files rather than your .clj source files, and makes for slightly faster code at startup. http://groups.google.com/group/clojure/msg/58e3f8e5dfb876c9 Joshua On Mon, Feb 9, 2009 at 6:52 PM, hank williams w

Re: building a class or jar file from clojure

2009-02-09 Thread Meikel Brandmeyer
Hi, Am 09.02.2009 um 17:52 schrieb hank williams: How does one make a standard clojure based class file or jar file without embedding clojure source files. http://clojure.org/compilation You might want to read also the other items on the left hand side in the reference section. Sincerely M

Re: My SLIME installation diary

2009-02-09 Thread Phil Hagelberg
bOR_ writes: > Had to use a different .emacs. Just autoload and add-to-list didn't > seem to load clojure-mode.el. That's correct; this will not load the code. It just sets it up so that the file gets loaded on-demand when you open a clojure file. I will add a note mentioning that the first tim

Fwd: Patch: universal main() with repl/script/compile

2009-02-09 Thread Thorsen Eric
For some reason I could not reply to the original thread... Begin forwarded message: > From: "Stephen C. Gilardi" > Date: February 6, 2009 12:49:34 PM EST > To: Eric Thorsen > Subject: Re: Patch: universal main() with repl/script/compile > > Hi Eric, > >> I've been using the repl in clojure,ma

Re: Fwd: Patch: universal main() with repl/script/compile

2009-02-09 Thread Rich Hickey
On Feb 9, 2:10 pm, Thorsen Eric wrote: > For some reason I could not reply to the original thread... > > Begin forwarded message: > > > From: "Stephen C. Gilardi" > > Date: February 6, 2009 12:49:34 PM EST > > To: Eric Thorsen > > Subject: Re: Patch: universal main() with repl/script/compile

Re: building a class or jar file from clojure

2009-02-09 Thread hank williams
Thanks! On Mon, Feb 9, 2009 at 1:21 PM, Joshua Fox wrote: > Ahead of Time compilation might be what you are looking for . This lets you > distribute.class files rather than your .clj source files, and makes for > slightly faster code at startup. > http://groups.google.com/group/clojure/msg/58e3f

Re: Clojure, Slime and multiple file projects

2009-02-09 Thread Bradbev
On Feb 8, 11:35 pm, David Nolen wrote: > A simple solution is to define a namespace that brings in all of your > different files. Is there some reason you can't do things this way? > That would probably work fine, I guess I'd just never considered it. I guess evaluating a namespace that uses al

Re: building a class or jar file from clojure

2009-02-09 Thread Jeffrey Straszheim
Off topic, but I miss reading updates to your blog. On Mon, Feb 9, 2009 at 2:15 PM, hank williams wrote: > Thanks! > > > On Mon, Feb 9, 2009 at 1:21 PM, Joshua Fox wrote: > >> Ahead of Time compilation might be what you are looking for . This lets >> you distribute.class files rather than your .

Re: My SLIME installation diary

2009-02-09 Thread bOR_
Thanks for all the explanations. I'll try again this wednesday! --~--~-~--~~~---~--~~ 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 To unsubscribe from this g

Re: building a class or jar file from clojure

2009-02-09 Thread hank williams
lol. Thanks much Jeffrey. I'm coming back soon. After the economic meltdown I needed a new thesis. I didnt think a bunch of "I told you so" posts would be tasteful so I needed a recharge. Hank On Mon, Feb 9, 2009 at 2:39 PM, Jeffrey Straszheim < straszheimjeff...@gmail.com> wrote: > Off topic, b

Re: Questions about a Clojure Datalog

2009-02-09 Thread John Fries
Sorry, I didn't mean to suggest that you held that opinion. In any case, I am still learning Clojure, so I think I should restrict myself to newbie questions until I am better at it. I hope I will have time to implement an open-world reasoner, which would help make the discussion concrete. On Mo

Re: Questions about a Clojure Datalog

2009-02-09 Thread Jeffrey Straszheim
I was considering extending my Datalog work with customized evaluable predicates, but have decided against it. The safety guarantees of Datalog are just not worth giving up. To compensate, I have (very tentative) plans of building some sort of logic oriented bottom up computation engine -- think

Re: building a class or jar file from clojure

2009-02-09 Thread prhlava
Hello hank, > How does one make a standard clojure based class file or jar file without > embedding clojure source files. Shameful plug: http://en.wikibooks.org/wiki/Clojure_Programming/Tutorials_and_Tips#Distributing_application_as_self_contained_.jar (the above URL should be 1 line..., it

Re: Curious about Cells

2009-02-09 Thread Stuart Sierra
Hi Jeffrey, There's not a straightforward answer, since there so many implementations of Cells floating around now. The original implementation, written by Ken Tilton for Common Lisp, *does* handle circular dependencies. It is single-threaded and synchronous. It uses a global time counter to m

Re: Curious about Cells

2009-02-09 Thread Frantisek Sodomka
See neman.cells: http://clojure.org/libraries#toc61 I believe there is at least one more implementation somewhere. Frantisek On 9 Ún, 17:26, Jeffrey Straszheim wrote: > I know I could just go read the docs, but I hope someone familiar with this > Cells stuff could save me some time: >  1. Doe

Re: A pipe macro for left-to-right coll streams

2009-02-09 Thread Mark Fredrickson
This inspired me to write a general purpose version: (defmacro let-> "Provide a name that will be bound to the result of the first form. For each additional form, the variable will be used in the invocation, and then rebound to the result of the form." [varname start & forms] (let

Re: Clojure + Slick - "stylistic" questions

2009-02-09 Thread Timothy Pratley
> Will i get used to the nested 'if' blocks someday ? Any way to write > the equivalent of a switch case here, if only to improve > readibility ? You could use cond: (cond (not (blocked? screen new_x new_y)) [(assoc player :y new_y) true] (not (blocked? screen new_x (player :y)) [(assoc play

Re: A pipe macro for left-to-right coll streams

2009-02-09 Thread Jason Wolfe
Nice, I would definitely use this! One comment/question: would it be more efficient to expand to a bunch of nested "let" statements, rather than nested function calls? I'm not sure how Clojure handles "let" under the hood, or how Hotspot inlining works here. Here's my version: (defmacro let->

Re: Clojure + Slick - "stylistic" questions

2009-02-09 Thread Jason Wolfe
> I know there is no way to import org.newdawn.slick.* (as discussed > here :http://groups.google.com/group/clojure/browse_thread/thread/fa00a0ff4... > ). What do you do in programs that need huge list of imports ? I'm > kinda spoiled by the Eclipse way of doing this, which is roughly : > import e

Re: A pipe macro for left-to-right coll streams

2009-02-09 Thread Mark Fredrickson
I like that implementation. The recursive call makes it much cleaner. A slight improvement (?) yet: (defmacro let-> "Provide a name that will be bound to the result of the first form. For each additional form, the variable will be used in the evaluation, and then rebound to the result

Re: Patch: universal main() with repl/script/compile

2009-02-09 Thread Stephen C. Gilardi
On Feb 9, 2009, at 2:13 PM, Rich Hickey wrote: On Feb 9, 2:10 pm, Thorsen Eric wrote: For some reason I could not reply to the original thread... Begin forwarded message: From: "Stephen C. Gilardi" Date: February 6, 2009 12:49:34 PM EST To: Eric Thorsen Subject: Re: Patch: universal main

Re: A pipe macro for left-to-right coll streams

2009-02-09 Thread Jason Wolfe
> I like that implementation. The recursive call makes it much cleaner. > A slight improvement (?) yet: > > (defmacro let-> > "Provide a name that will be bound to the result of the first form. > For each additional form, the variable will be > used in the evaluation, and then rebound to the

unintended consequences of printing

2009-02-09 Thread Chouser
A conversation on IRC tonight[1] got me thinking... Although most collections can be safely printed, such as at the REPL, this is not true of all collections. Probably the best-known exception in Clojure are infinite lazy sequences, where printing can cause an infinite loop: (prn (iterate inc 0