Browse files

fixes bug on otp-value coercion for tuples and lists

  • Loading branch information...
1 parent 57d75bc commit 3ddcbaa133e0d74b5c44b800c9c016b55ebbb836 @videlalvaro committed Aug 14, 2010
Showing with 19 additions and 5 deletions.
  1. +19 −5 src/closerl/core.clj
@@ -117,15 +117,29 @@
(defmethod otp-value OtpErlangUInt [o] (parse-integer (str o)))
(defmethod otp-value OtpErlangLong [o]
(if (.isLong o)
- (long o)
- (.bigIntegerValue o)))
+ (.longValue o)
+ (.bigIntegerValue o)))
(defmethod otp-value OtpErlangFloat [o] (float (.floatValue o)))
(defmethod otp-value OtpErlangDouble [o] (float (.floatValue o)))
-(defmethod otp-value OtpErlangList [o] (with-meta (map value (.elements o)) {:otp-type "List"}))
-(defmethod otp-value OtpErlangTuple [o] (with-meta (map value (.elements o)) {:otp-type "Tuple"}))
+(defmethod otp-value OtpErlangList [o] (with-meta (map otp-value (.elements o)) {:otp-type "List"}))
+(defmethod otp-value OtpErlangTuple [o] (with-meta (map otp-value (.elements o)) {:otp-type "Tuple"}))
(defmethod otp-value nil [o] "")
(defmethod otp-value OtpErlangObject [o] o)
(defmulti as-seq class)
(defmethod as-seq OtpErlangList [o] (seq (.elements o)))
-(defmethod as-seq OtpErlangTuple [o] (seq (.elements o)))
+(defmethod as-seq OtpErlangTuple [o] (seq (.elements o)))
+(defn otp-long [v] (OtpErlangLong. (long v)))
+(defn otp-tuple [& args]
+ (let [msg (into-array OtpErlangObject args)
+ ]
+ (OtpErlangTuple. msg)
+ ))
+;OtpErlangObject[] msg = new OtpErlangObject[2];
+;msg[0] = mbox.self();
+;msg[1] = new OtpErlangAtom("hello, world");
+;OtpErlangTuple tuple = new OtpErlangTuple(msg);

0 comments on commit 3ddcbaa

Please sign in to comment.