Hi,

I am learning clojure these days, but on .Net. I have the following
code -

(import '(System.IO Path Directory File DirectoryNotFoundException))

(defn starts-with-hmorx [name]
        (if (or (= (.ToUpper (.ToString name)) "H")
                  (= (.ToUpper (.ToString name)) "M")
                  (= (.ToUpper (.ToString name)) "X")) true false))

(defn GetSubfolderName [filename]
        ((def name-wo-extn (Path/GetFileNameWithoutExtension filename))
         (def first-char (aget (.ToCharArray (.ToString name-wo-extn)) 0))
         (if (Char/IsDigit first-char) (Convert/ToInt32 first-char) (if
(starts-with-hmorx first-char) (.ToLower (.ToString first-char))
"other"))))

But when I call (GetSubfolderName "D:\\CsEx\\Manoj.cs"), I get this
exception -

System.InvalidCastException: Unable to cast object of type
'System.String' to type 'clojure.lang.IDeref'.
   at lambda_method(Closure , Object )
   at AFunction_impl.invoke(Object )
   at lambda_method(Closure , Object )
   at AFunction_impl.invoke(Object )
   at lambda_method(Closure )
   at AFunction_impl.invoke()
   at REPLCall(Closure )

Any help is greatly appreciated.

Thanks,
Manoj.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to