Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Porting Minilight to Clojure
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Mark Reid  
View profile  
 More options Apr 7 2009, 4:43 am
From: Mark Reid <mark.r...@gmail.com>
Date: Tue, 7 Apr 2009 01:43:37 -0700 (PDT)
Local: Tues, Apr 7 2009 4:43 am
Subject: Porting Minilight to Clojure
Hi,

In the interests of learning Clojure I thought it would be fun to port
the Minilight renderer to Clojure and write about the steps along the
way. If you're interested you can have a look at my first post here:

   http://mark.reid.name/sap/minilight-clojure-vectors.html

I've not programmed in a Lisp-like before (aside from hacking the
odd .emacs files) and one thing I've noticed is just how flexible this
type of language is. The downside, of course, is that there are many
ways to do things sub-optimally or inelegantly so I welcome any
feedback.

Regards,

Mark.
--
http://mark.reid.name


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Laurent PETIT  
View profile  
 More options Apr 7 2009, 5:35 am
From: Laurent PETIT <laurent.pe...@gmail.com>
Date: Tue, 7 Apr 2009 11:35:51 +0200
Local: Tues, Apr 7 2009 5:35 am
Subject: Re: Porting Minilight to Clojure

Hello Mark,

That's interesting, keep us informed of your progress!

Since you say you welcome any feedback, here are my remarks :

 * namespace names: you could maybe use more qualified names, e.g.
qualifying them maybe with your own reversed namespace ( vec -> com.reid.vec
). Indeed, one of the interests of namespaces is to avoid name clashes, and
it feels to me like creating namespaces of just one segment with such
generic names such as vec may not scale well, even for personal work ?

* you have a file named test/test.clj . The corresponding namespace
declaration should then be (ns test.test ...) instead of (ns test ...).

 * function calls in namespaces : your namespace 'test directly executes a
call. This would be problematic for people using IDEs that automatically
regularly auto-compile or auto-load files to give user error/warning
feedback.
One alternative solution could be to just guard the call against compilation
by checking the value of the *compile-files* global var :
(when-not *compile-files*
  (run-tests 'test.vec))
Another alternative could be to completely get rid of the immediate call to
run-tests and place it instead in a -main method, so that the ns can be used
as an independent executable file:

(ns test
  (:gen-class)
  (:use test.vec)
  (:use clojure.contrib.test-is))

(defn -main [] (run-tests 'test.vec))

HTH,

--
Laurent


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark Reid  
View profile  
 More options Apr 8 2009, 6:56 am
From: Mark Reid <mark.r...@gmail.com>
Date: Wed, 8 Apr 2009 03:56:14 -0700 (PDT)
Local: Wed, Apr 8 2009 6:56 am
Subject: Re: Porting Minilight to Clojure
Hi Laurent,

Thanks for the feedback regarding namespaces. That's exactly the sort
of thing I wasn't sure I was doing correctly.

I currently don't use an IDE that automatically compiles files so
wasn't aware of that problem. I prefer the solution that defines a
main method. My only question now is, if I don't want to compile the
test class, how do I call the main method from the command line?

Regards,

Mark.
--
http://mark.reid.name

On Apr 7, 7:35 pm, Laurent PETIT <laurent.pe...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Laurent PETIT  
View profile  
 More options Apr 8 2009, 7:11 am
From: Laurent PETIT <laurent.pe...@gmail.com>
Date: Wed, 8 Apr 2009 13:11:06 +0200
Local: Wed, Apr 8 2009 7:11 am
Subject: Re: Porting Minilight to Clojure

Hello,

function -main is a regular function, so the following works :
"
$ echo "(ns test (:gen-class)) (defn -main [] (println 1))" > test.clj
$ java -cp clojure.jar clojure.main -i test.clj -e "(test/-main)"

1
"

HTH,

--
Laurent

2009/4/8 Mark Reid <mark.r...@gmail.com>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »