ok I'm trying

CompilerException java.lang.NoSuchFieldException: s,
compiling:(NO_SOURCE_PATH:1:1)

user> (defmacro is [s instant]
        `(= (.get ~instant Calendar/DAY_OF_WEEK)
            (. Calendar ~s)))
#'user/is
user> (is 'TUESDAY (Calendar/getInstance))
CompilerException java.lang.RuntimeException: Unable to resolve symbol:
TUESDAY in this context, compiling:(NO_SOURCE_PATH:1:1)

user>
user>
user> (defmacro is [s instant]
        `(= (.get ~instant Calendar/DAY_OF_WEEK)
            (. Calendar ~s)))
#'user/is
user> (defmacro is [s instant]
        `(= (.get ~instant Calendar/DAY_OF_WEEK)
            (. Calendar (symbol ~s))))
#'user/is
user> (is "TUESDAY" (Calendar/getInstance))
CompilerException java.lang.IllegalArgumentException: No matching method:
symbol, compiling:(NO_SOURCE_PATH:1:1)

user>


isn't working :[



On Tue, Aug 13, 2013 at 6:14 PM, Daniel Meneses Báez <dap...@gmail.com>wrote:

> Hi :)
>
> I really want to know if there is a way to do this:
>
> (ns ...
>    (:import [java.util Calendar]))
>
> (defsomething ;; if it is possible using a macro I'm ok with that
>    calendar-member
>    [member]
>     (symbol (str "Calendar/" member)))
>
> what I want to know if an instance of Calendar "isMonday", "isFriday"
> "isSunday" etc...
>
> so I was thinking to write something like
>
> (defn- isss [day instant]
>     (= (.get instant Calendar/DATE) (calendar-member day)))
>
> and then use it like (def is-friday (partial isss 'FRIDAY)) ;;
>
> am I being to crazy?
>
> btw I'm really loving the language.
>
>
>
> --
> Daniel Meneses Báez
>



-- 
Daniel Meneses Báez

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to