special forms

2010-05-20 Thread Аркадий Рост
Hi!
It turned out that special forms are behaving strangely when you try
to redefine them.

For example,
(defn def [ more]
(println smth))

but when you try to use this function you'll got unexpected behavior.
(def 5) - you'll got an exeption

There is another situation when you use let.
(let [def 5]
(def e def))


In my opinion, this situation must be resolved.
For example it is possible to
1) prohibit such definition
2) allow redefining keywords in namespaces

-- 
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


Re: special forms

2010-05-20 Thread Konrad Hinsen

On 20 May 2010, at 08:03, Аркадий Рост wrote:


It turned out that special forms are behaving strangely when you try
to redefine them.


You can't redefine special forms. What you define in your examples is  
the symbols that serve to identify special forms. But they indicate  
special forms only when used in the first position of a list that is  
evaluated. Everywhere else, they behave just like symbols, so you can  
use them to name vars or provide local bindings in a let form.


Konrad.

--
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


Re: special forms

2010-05-20 Thread Rasmus Svensson
I thought I'd just share some thoughts on special forms...

2010/5/20 Konrad Hinsen konrad.hin...@fastmail.net

 You can't redefine special forms. What you define in your examples is the
 symbols that serve to identify special forms. But they indicate special
 forms only when used in the first position of a list that is evaluated.
 Everywhere else, they behave just like symbols, so you can use them to name
 vars or provide local bindings in a let form.


One thing that this implies is that you cannot for example pass a reference
to 'if'.

(map if [true false] [:a :b] [:c :d])
; throws java.lang.Exception: Unable to resolve symbol: if in this context
(NO_SOURCE_FILE:1)

Also, you can't circumvent this by using macros:

(defmacro if-macro [pred tbranch fbranch]
  `(if ~pred ~tbranch ~fbranch))
; The var #'if-macro now holds a real reference to something that does what
if does.

(map if-macro [true false] [:a :b] [:c :d])
; throws java.lang.Exception: Can't take value of a macro: #'user/if-macro
(NO_SOURCE_FILE:4)

Special forms and macros are compile time constructs (all expressions are
compiled when evaluated). The symbols that represent special forms are not
resolved into vars at all. If special forms were a special kind of value,
the var holding them could be rebound at run time, implying that the control
flow structure of the code could be changed at run time. Just imagine what
rebinding 'cond' to 'do' would do... This does not make a lot of sense in a
compiled language, so the Clojure compiler simply looks for symbols with the
right name, and unconditionally treats them as special forms.

Special forms are a part and special case of the function invocation syntax.
As Konrad said, the symbols identifying special forms only have special
meaning in the function position of evaluated lists. Everywhere else they
work as ordinary symbols.

2010/5/20 Аркадий Рост arkr...@gmail.com
In my opinion, this situation must be resolved.
For example it is possible to
1) prohibit such definition
2) allow redefining keywords in namespaces

I agree that it would probably be good to make the use of one of those
symbols outside the function position of an evaluated list an error (or at
least emit a warning).

// raek

-- 
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

Re: swank-clojure and GNU Emacs 23 - package.el install issues

2010-05-20 Thread doug smith
this may help:

http://www.bestinclass.dk/index.clj/2009/12/clojure-101-getting-clojure-slime-installed.html

-doug

On May 17, 4:18 pm, Terrence Brannon scheme...@gmail.com wrote:
 Hello, I wanted to try out Clojure. It was my understanding that
 swank-clojure was a package GNU Emacs that would download clojure
 automatically. But the docs for it no longer say that.

 Anyway, I successfully installed slime and slime-repl using package.el
 under a manually built GNU Emacs 23 with Ubuntu.

 However, whenever I try to install swank-clojure or clojure, the
 package system reports:

 let: File exists:
 /home/metaperl/.emacs.d/elpa/clojure-mode-1.7.1/clojure-mode.el

 Manually removing the directory
 /home/metaperl/.emacs.d/elpa/clojure-mode-1.7.1 and trying again
 simply leads to the same error.

 Here is the output of M-x report-emacs-bug

 In GNU Emacs 23.2.1 (i686-pc-linux-gnu, GTK+ Version 2.18.3)
  of 2010-05-14 on locohost
 Windowing system distributor `The X.Org Foundation', version 11.0.10604000
 configured using `configure  '--with-x-toolkit=gtk''

 Important settings:
   value of $LC_ALL: nil
   value of $LC_COLLATE: nil
   value of $LC_CTYPE: nil
   value of $LC_MESSAGES: nil
   value of $LC_MONETARY: nil
   value of $LC_NUMERIC: nil
   value of $LC_TIME: nil
   value of $LANG: en_US.UTF-8
   value of $XMODIFIERS: nil
   locale-coding-system: utf-8-unix
   default enable-multibyte-characters: t

 Major mode: Apropos

 Minor modes in effect:
   desktop-save-mode: t
   shell-dirtrack-mode: t
   show-paren-mode: t
   global-auto-revert-mode: t
   tooltip-mode: t
   mouse-wheel-mode: t
   menu-bar-mode: t
   file-name-shadow-mode: t
   global-font-lock-mode: t
   font-lock-mode: t
   blink-cursor-mode: t
   auto-encryption-mode: t
   auto-compression-mode: t
   line-number-mode: t
   transient-mark-mode: t

 Recent input:
 triple-mouse-4 triple-down-mouse-4 triple-mouse-4
 triple-down-mouse-4 triple-mouse-4 triple-down-mouse-4
 triple-mouse-4 triple-down-mouse-4 triple-mouse-4
 help-echo down-mouse-1 mouse-movement mouse-1
 down-mouse-5 mouse-5 double-down-mouse-5 double-mouse-5
 triple-down-mouse-5 triple-mouse-5 triple-down-mouse-5
 triple-mouse-5 triple-down-mouse-5 triple-mouse-5
 help-echo down-mouse-1 mouse-movement mouse-1
 C-x 2 C-x b * m e s return C-p C-p C-p C-p C-p C-p
 C-p C-p C-p C-p C-p C-p C-p C-v C-l help-echo help-echo
 help-echo help-echo help-echo help-echo help-echo
 down-mouse-1 mouse-movement mouse-1 down-mouse-4
 mouse-4 double-down-mouse-4 double-mouse-4 triple-down-mouse-4
 triple-mouse-4 triple-down-mouse-4 triple-mouse-4
 down-mouse-4 mouse-4 down-mouse-4 mouse-4 double-down-mouse-4
 double-mouse-4 down-mouse-1 mouse-movement mouse-1
 i x C-x o C-x o C-x d backspace return g n n n
 n ! r m SPC - r f return g C-x o x y e s return
 ESC  C-x o ESC  C-x b * return ESC  help-echo
 help-echo help-echo help-echo down-mouse-1
 mouse-movement mouse-1 help-echo down-mouse-1
 mouse-movement mouse-movement drag-mouse-1 g
 p p v C-x k return p p p p p v ESC  C-x k return
 help-echo down-mouse-1 mouse-movement mouse-1
 down-mouse-5 mouse-5 double-down-mouse-5 double-mouse-5
 triple-down-mouse-5 triple-mouse-5 triple-down-mouse-5
 triple-mouse-5 triple-down-mouse-5 triple-mouse-5
 triple-down-mouse-5 triple-mouse-5 down-mouse-4
 mouse-4 double-down-mouse-4 double-mouse-4 triple-down-mouse-4
 triple-mouse-4 triple-down-mouse-4 triple-mouse-4
 down-mouse-5 mouse-5 down-mouse-5 mouse-5 help-echo
 help-echo help-echo help-echo help-echo down-mouse-1
 mouse-movement mouse-movement drag-mouse-1 help-echo
 help-echo down-mouse-1 mouse-movement mouse-1
 down-mouse-4 mouse-4 double-down-mouse-4 double-mouse-4
 triple-down-mouse-4 triple-mouse-4 triple-down-mouse-4
 triple-mouse-4 triple-down-mouse-4 triple-mouse-4
 triple-down-mouse-4 triple-mouse-4 down-mouse-1
 mouse-movement drag-mouse-1 down-mouse-5 mouse-5
 double-down-mouse-5 double-mouse-5 triple-down-mouse-5
 triple-mouse-5 triple-down-mouse-5 triple-mouse-5
 triple-down-mouse-5 triple-mouse-5 down-mouse-5
 mouse-5 down-mouse-1 mouse-movement mouse-1
 x down-mouse-1 mouse-movement mouse-1 down-mouse-5
 mouse-5 double-down-mouse-5 double-mouse-5 triple-down-mouse-5
 triple-mouse-5 triple-down-mouse-5 triple-mouse-5
 down-mouse-1 mouse-movement mouse-1 help-echo
 help-echo help-echo down-mouse-1 mouse-movement
 mouse-1 ESC x m e a c s - backspace backspace
 backspace backspace backspace backspace e m
 a c s - b u tab tab tab C-g f1 a b u g return
 C-x o C-v C-s e m a s c ESC x r e p o r t e backspace
 - e m tab return

 Recent messages:
 byte-code: Beginning of buffer
 Mark set
 Contacting host: tromey.com:80
 Reading [text/plain]... 28k of 28k (100%)
 Reading... done.
 let: File exists:
 /home/metaperl/.emacs.d/elpa/clojure-mode-1.7.1/clojure-mode.el
 byte-code: End of buffer [2 times]
 Quit
 Type M-x display-buffer RET to restore the other window.
 Mark saved where search started

 Load-path shadows:
 ~/emacs-contrib/cperl-mode hides 

Re: Running Clojure scripts in Maven

2010-05-20 Thread Jason Smith
Okay, yes, what you are asking is possible, and I know how to do it.
Of course, to see the compiled artifacts on the classpath, you'll have
to be running in a state that runs after they have been created.  :-)

This shouldn't be terribly hard to do, but it's a bit arcane.  I'll
see if I can make it happen in the next couple of days.  In the
meantime, I need a parameter name!  Any suggestions?

Mode 1:
* Original plugin classloading.  All scripts share the same set of
variables (defs), as if all run from a single REPL, but they don't
share the project artifact or any project dependencies.  This mode
runs fastest since Clojure only has to be inited once.
* Isolated classloading.  The scripts are isolated from one another,
but share artifacts with the project.  Thus not isolated at all.  So
what do I call it??? Clojure has to be inited for each execution, so
this will be a bit slower.

The other option is that I only make the second form of classloading
available, but I also kind of like the ability to share state between
scripts... which you would lose if I did that...

-- 
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


Re: Running Clojure scripts in Maven

2010-05-20 Thread Jason Smith
Tracking this issue at http://code.google.com/p/sandflea/issues/detail?id=2

-- 
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


Re: Serializable functions?

2010-05-20 Thread Michael Jaaka
Hi! I have found two issues which stops me from using function
serializations.



(ns code.serialfn
(:refer-clojure :exclude (fn)))


(defn- save-env [env form]
  (if env
`(let ~(vec (apply concat (for [[name local] env]
[name (.eval (.init local))])))
   (~...@form))
form))

(defmacro fn [ sigs]
  `(with-meta (clojure.core/fn ~...@sigs)
 {:type ::serializable-fn
  ::source (quote ~(save-env env form))}))

(defmethod print-method ::serializable-fn [o ^Writer w]
  (print-method (::source (meta o)) w))




; here are some examples

; gives null pointer

(prn-str { :kozak (fn [z]
[z (fn ([] (println abc)) ([a] (println a))) ]) })

; gives can't eval locals - unsupported operation

(defn pipe
 ([] (pipe java.util.Collections/EMPTY_LIST))
 ([col]
 (let [q (java.util.concurrent.LinkedBlockingQueue. col)]
   [(take-while #(not (= % q)) (repeatedly #(.take q) ))
 (fn ([e] (.put q e))
   ([] (.put q q)))])))


any help?

thanks

-- 
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


Re: agents returning nil by default

2010-05-20 Thread Daniel Werner
On 20 May 2010 11:42, Anders Rune Jensen anders.rune.jen...@gmail.com wrote:
 The algorithm:

 (defn change-state [cur-state]
   (when ( (:value cur-state) 10)
      (assoc cur-state :message danger, danger)))

 How I'd have to write it when using an agent:

 (defn change-state [cur-state]
   (cond ( (:value cur-state) 10)
      (assoc cur-state :message danger, danger)
      :else cur-state))

In this example, you could also have written your function using 'if',
which is not much more complex than your original definition using
'when':

(defn change-state [cur-state]
  (if ( (:value cur-state) 10)
 (assoc cur-state :message danger, danger)
 cur-state))

Of course, like you already said, this is a trivial example, but it
shows an important fact about agent actions: They don't modify state.
Instead, action functions just take a value (which just happens to be
the agents current state) and return a value (which just happens to
become the agents new state). Incidentally, for this reason you can
also use built-in primitive functions like 'assoc' or 'merge' as agent
actions, with no changes required. So, once you start focusing on
writing a function that returns the value you want, instead of
worrying about state change, chances are that you'll have less trouble
with nil values ending up in the agent's state.

Disclaimer: This mental approach worked for me. YMMV :-)
--
Daniel

-- 
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


Re: agents returning nil by default

2010-05-20 Thread Anders Rune Jensen
On Thu, May 20, 2010 at 2:26 PM, Daniel Werner
daniel.d.wer...@googlemail.com wrote:
 On 20 May 2010 11:42, Anders Rune Jensen anders.rune.jen...@gmail.com wrote:
 The algorithm:

 (defn change-state [cur-state]
   (when ( (:value cur-state) 10)
      (assoc cur-state :message danger, danger)))

 How I'd have to write it when using an agent:

 (defn change-state [cur-state]
   (cond ( (:value cur-state) 10)
      (assoc cur-state :message danger, danger)
      :else cur-state))

 In this example, you could also have written your function using 'if',
 which is not much more complex than your original definition using
 'when':

 (defn change-state [cur-state]
  (if ( (:value cur-state) 10)
     (assoc cur-state :message danger, danger)
     cur-state))

 Of course, like you already said, this is a trivial example, but it
 shows an important fact about agent actions: They don't modify state.

I've been contemplating how to answer this for a little while. I think
I'll just show you the code that prompted me to write the macro:

(defn track-removed-on-agent [cur-state index]
  (let [pindex (cur-state :playlist-index)]
(cond (= pindex index)
  (cond
(= (count @playlist/tracks) 0) (stop-on-agent cur-state)
(= pindex (count @playlist/tracks))
(let [new-index (dec pindex)]
  (cond (= (cur-state :state) player-state/playing)
(play-track-i-on-agent cur-state new-index)
:else
(assoc cur-state :playlist-index new-index)))
:else
(cond (= (cur-state :state) player-state/playing)
  (play-track-i-on-agent cur-state pindex)))
  ( pindex index)
  (assoc cur-state :playlist-index (dec pindex))
  :else cur-state)))

Where is the bug in the above code?

Any code that can help me write code with less bugs for *free* is
welcome in my book. I don't know about yours?

-- 
Anders Rune Jensen

-- 
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


Re: Running Clojure scripts in Maven

2010-05-20 Thread Geoff
How about two separate maven goals? One script goal that does the
current behaviour and shares vars, and one execute goal that can run
code from the project.
I imagine the execute goal would usually be used to call a single
function in the clj source files. To simply support this, the goal
could optionally take an entryFn instead of source. The entryFn
would be something like my.ns/main-func and would name a no-argument
function to be called.

- Geoff

On May 19, 11:44 pm, Jason Smith ja...@lilypepper.com wrote:
 Okay, yes, what you are asking is possible, and I know how to do it.
 Of course, to see the compiled artifacts on the classpath, you'll have
 to be running in a state that runs after they have been created.  :-)

 This shouldn't be terribly hard to do, but it's a bit arcane.  I'll
 see if I can make it happen in the next couple of days.  In the
 meantime, I need a parameter name!  Any suggestions?

 Mode 1:
 * Original plugin classloading.  All scripts share the same set of
 variables (defs), as if all run from a single REPL, but they don't
 share the project artifact or any project dependencies.  This mode
 runs fastest since Clojure only has to be inited once.
 * Isolated classloading.  The scripts are isolated from one another,
 but share artifacts with the project.  Thus not isolated at all.  So
 what do I call it??? Clojure has to be inited for each execution, so
 this will be a bit slower.

 The other option is that I only make the second form of classloading
 available, but I also kind of like the ability to share state between
 scripts... which you would lose if I did that...

 --
 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 
 athttp://groups.google.com/group/clojure?hl=en

-- 
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


Re: Strange protocol behaviour

2010-05-20 Thread Steve Purcell
Before anyone spends time investigating, this has been accepted as an issue:

  https://www.assembla.com/spaces/clojure/support/tickets/353

My workaround for now is to use reify in place of deftype.

-Steve


On 20 May 2010, at 13:43, Steve Purcell wrote:

 I'm loving protocols, but I keep having to restart my JVM to avoid a puzzling 
 issue when changing protocol definitions.
 
 Here's the simplest way to reproduce the problem:
 
 Start with file protoproblem/proto.clj:
 
(ns protoproblem.proto)
 
(defprotocol Steps
  (one [x])
  (two [x]))
 
 and file protoproblem/impl.clj:
 
(ns protoproblem.impl
  (:require [protoproblem.proto :as proto]))
 
(deftype ArraySteps [a]
  proto/Steps
  (one [x] (first a))
  (two [x] (second a)))
 
 In the repl, everything works as expected:
 
user (load protoproblem/proto)
nil
user (load protoproblem/impl)
nil
user (protoproblem.proto/one (protoproblem.impl.ArraySteps. [1 2]))
1
 
 Now, we redefine the protocol by commenting out the 'one' method def in 
 proto.clj, and then reloading it:
 
user= (load protoproblem/proto)
nil
user= (protoproblem.proto/one (protoproblem.impl.ArraySteps. [1 2]))
java.lang.NullPointerException (NO_SOURCE_FILE:9)
user= (load protoproblem/impl)
java.lang.IllegalArgumentException: Can't define method not in interfaces: 
 one (impl.clj:5)
 
 That's pretty much as expected. But what if we try to get back to how things 
 were, by reversing the changes in proto.clj, and reloading? This is where the 
 problems arise:
 
user= (load protoproblem/proto)
nil
user= (load protoproblem/impl)
nil
user= (protoproblem.proto/one (protoproblem.impl.ArraySteps. [1 2]))
java.lang.IllegalArgumentException: No implementation of method: :one of 
 protocol: #'protoproblem.proto/Steps found for class: 
 protoproblem.impl.ArraySteps (NO_SOURCE_FILE:0)
 
 Ouch!
 
 At this point, I have to restart my JVM to proceed, which is making 
 incremental development of protocols-based code unusually tedious.
 
 I initially encountered the behaviour using C-c C-k under 
 slime/swank-clojure, but the above transcript is from a plain command-line 
 repl, using a Clojure 1.2 snapshot from today. (The same thing happened with 
 a snapshot from 2 weeks ago.)
 
 Is this a classloader issue, or something else? Any help greatly appreciated.
 
 -Steve
 
 -- 
 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
 

-- 
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


Re: functional check slower than imperative?

2010-05-20 Thread Christophe Grand
On Wed, May 19, 2010 at 7:13 PM, braver delivera...@gmail.com wrote:

 On May 18, 11:45 am, Christophe Grand christo...@cgrand.net wrote:
  (defn sorted-by? [pred s]
(if-let [ns (next s)]
  (let [[a b] s]
(and (pred a b) (recur pred ns)))
  true))

  (defn reps-sorted2? [dreps]
   (every? #(sorted-by? = (map first (val %))) dreps))
 
  and it should be as fast as the iterative version.

 Should be sorted-by?  for my purposes.  Still slower than the loop by
 5-6x.


Can you post a representative data sample?

Thanks,

Christophe

-- 
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

Accessing final methods of superclass using :gen-class

2010-05-20 Thread Edmund
Hello,

   I'm attempting to use some java classes in clojure, where I need
the clojure to be AOT compiled.  I'm running into trouble with
accessing final methods in the superclass of genclass.  Some code:

--= Hello.java =
package com.example;
public class Hello {
public void hello() {
System.err.println(Hello, World!);
}

protected final void yo() {
System.err.println(Yo, World!);
}
}

--= HelloWorld.clj =--
(ns com.example.HelloWorld
  (:gen-class
   :extends com.example.Hello
   :methods [[go [] void]]
   :exposes-methods {yo yoSuper}))

(defn -go [this]
  (.yoSuper this))



In this case I cannot access the protected final void yo() in the
Hello class with the clojure code.  Now I'm not trying to override the
method myself, but is the :exposes-methods doing so under the hood ?
If so how do I get around this ?

Thanks for your help,

   Edmund

-- 
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


Clojure on Android

2010-05-20 Thread David Blubaugh
To All,


Has anyone yet ported clojure to the android cellphones at this
time ??  I want to develop applications for the Android cellphones by
utilizing a dialect of the lisp programming language


David


-- 
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


Re: Clojure on Android

2010-05-20 Thread rob levy
Hi David,

Check-out http://github.com/remvee/clojurehelloandroid

I'm surprised we don't hear more talk of people doing this.  It's on my list
of things to do too (I just got an mp3 player that runs Android 1.6 and I'm
going to start with Remvee's Hello World example).

Rob

On Thu, May 20, 2010 at 12:37 PM, David Blubaugh 
davidblubaugh2...@gmail.com wrote:

 To All,


 Has anyone yet ported clojure to the android cellphones at this
 time ??  I want to develop applications for the Android cellphones by
 utilizing a dialect of the lisp programming language


 David


 --
 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.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en

-- 
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

Re: Clojure on Android

2010-05-20 Thread rob levy
Also see the tutorial:
http://riddell.us/ClojureAndAndroidWithEmacsOnUbuntu.html

On Thu, May 20, 2010 at 3:21 PM, rob levy r.p.l...@gmail.com wrote:

 Hi David,

 Check-out http://github.com/remvee/clojurehelloandroid

 I'm surprised we don't hear more talk of people doing this.  It's on my
 list of things to do too (I just got an mp3 player that runs Android 1.6 and
 I'm going to start with Remvee's Hello World example).

 Rob


 On Thu, May 20, 2010 at 12:37 PM, David Blubaugh 
 davidblubaugh2...@gmail.com wrote:

 To All,


 Has anyone yet ported clojure to the android cellphones at this
 time ??  I want to develop applications for the Android cellphones by
 utilizing a dialect of the lisp programming language


 David


 --
 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.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en




-- 
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

Re: Running Clojure scripts in Maven

2010-05-20 Thread Jason Smith
Now that I've had more time to think about it, I think your original
idea should be the default, and only, behavior.  Scripts should be
able to access dependencies of the project, and, if possible, the
compiled project classes as well (available after they are compiled).
The code I checked into /trunk works this way, or at least it seems
to.  :-)  This will require some new documentation, but it's ready to
try (for now, you'll have to check out the code and build it locally).

-- 
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


Re: Clojure on Android

2010-05-20 Thread Mike Meyer
[Format recovered from top posting.

 On Thu, May 20, 2010 at 3:21 PM, rob levy r.p.l...@gmail.com wrote:
  On Thu, May 20, 2010 at 12:37 PM, David Blubaugh 
  davidblubaugh2...@gmail.com wrote:
  Has anyone yet ported clojure to the android cellphones at this
  time ??  I want to develop applications for the Android cellphones by
  utilizing a dialect of the lisp programming language
 
  Check-out http://github.com/remvee/clojurehelloandroid
 
  I'm surprised we don't hear more talk of people doing this.  It's on my
  list of things to do too (I just got an mp3 player that runs Android 1.6 and
  I'm going to start with Remvee's Hello World example).

Me as well, except the Android SDK doesn't run on any of my native
desktops, so I'm going the longer way 'round...

For a REPL on your phone, try here:

http://groups.google.com/group/clojure/browse_thread/thread/14725172c626642c?pli=1

Clojure on Android isn't hard to set up, but performance isn't very
good. IIRC, there are two issues: both reflection and GC - which
Clojure tends to use heavily - are slow on Dalvik. Possibly Froyo will
help with that.

mike
-- 
Mike Meyer m...@mired.org http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.

O ascii ribbon campaign - stop html mail - www.asciiribbon.org

-- 
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


Long as keys in hash-map

2010-05-20 Thread Mibu
I tried to use Long keys from the java.io.File/length method in a hash-
map and failed to retrieve values using them. sorted-map is fine. The
doc says hash-maps require keys that support .equals and .hashCode.
Doesn't Long support those or am I missing something else?

-- 
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


Re: Long as keys in hash-map

2010-05-20 Thread MarkSwanson


On May 20, 10:57 pm, Mibu mibu.cloj...@gmail.com wrote:
 I tried to use Long keys from the java.io.File/length method in a hash-
 map and failed to retrieve values using them. sorted-map is fine. The
 doc says hash-maps require keys that support .equals and .hashCode.
 Doesn't Long support those or am I missing something else?

Perhaps you could post a code snippet that shows the problem.
Here's a snippet that shows it works:

Clojure= (def ml {(long 1) one})
Clojure= (ml (long 1))
one

To show you that a Long is really used:
Clojure= (class (first (keys ml)))
java.lang.Long

-- 
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