From 55e14407cc52f69e8c569c20af597676de5d80dd Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Fri, 16 Jan 2015 18:06:56 -0400 Subject: [Bugs] Incomplete normalization of the names of lambda-classes. Incomplete coverage of primitive classes in signatures and class names. [Enhancements] Java interop can now handle sending primitive args (automatically unboxes wrappers). --- test2.lux | 88 ++++++++++----------------------------------------------------- 1 file changed, 14 insertions(+), 74 deletions(-) (limited to 'test2.lux') diff --git a/test2.lux b/test2.lux index c3854ab19..8f076a839 100644 --- a/test2.lux +++ b/test2.lux @@ -339,17 +339,21 @@ #Nil (#Cons from (range (inc from) to)))) +(def (text->list text) + (let length (jvm/invokevirtual String "length" [] + text []) + (map (lambda [idx] + (jvm/invokevirtual String "charAt" [int] + text [idx])) + (range 0 length)))) + +(def (normalize-ident ident) + (fold concat "" (map normalize-char (text->list ident)))) + #( - (def (text->list text) - (let length (jvm/invokevirtual String "length" [] - text []) - (map (lambda [idx] - (jvm/invokevirtual String "charAt" [int] - text [idx])) - (range-to 0 length)))) + - (def (normalize-ident ident) - (fold concat "" (map normalize-char (text->list ident)))) + (def (fresh-class-loader path) (let file (jvm/new java.io.File [String] [path]) @@ -482,70 +486,6 @@ (do (print (show char)) (print " -> ") (println (normalize-char char)))) (println (show-list (range 0 10))) + (println (normalize-ident "text->list")) ) )) - -#( (def (main args) - (case (' ((~ "Oh yeah..."))) - (#Form (#Cons (#Text text) #Nil)) - (do (:: (:: System out) (println text)) - (:: (:: System out) (println (+ 10 20))) - (:: (:: System out) (println (inc 10))) - (:: (:: System out) (println (jvm/i- 10 20))) - (:: (:: System out) (println (jvm/i* 10 20))) - (:: (:: System out) (println (jvm/i/ 10 2)))) - )) - - (defmacro (::+ pieces) - (case pieces - (#Cons init #Nil) - init - - (#Cons init (#Cons access others)) - (' (::+ (:: (~ init) (~ access)) (~@ others))) - )) - - (def (main args) - (if true - (let f (lambda [x] (lambda [y] (x y))) - (let g (lambda [x] x) - (::+ System out (println (f g "WE'VE GOT CLOSURES!"))))) - (:: (:: System out) (println "FALSE")))) - - (def (main args) - (if true - (case (++ (#Cons "Pattern" #Nil) (#Cons "Matching" #Nil)) - (#Cons "Pattern" (#Cons second #Nil)) - (do (:: (:: System out) (println "Branch #1")) - (:: (:: System out) (println second))) - - (#Cons first (#Cons second #Nil)) - (do (:: (:: System out) (println "Branch #2")) - (:: (:: System out) (println first)) - (:: (:: System out) (println second)))) - (:: (:: System out) (println "FALSE")))) - - (def (main args) - (case (template (#Cons (#Cons (#Symbol "~@") (#Cons (#Symbol "Pattern") #Nil)) #Nil) - ## (#Cons (#Cons (#Symbol "~") (#Cons (#Symbol "Pattern") #Nil)) #Nil) - ) - (#Cons word #Nil) - (do (:: (:: System out) (println "Branch #1")) - (:: (:: System out) (println word))) - - (#Cons (#Symbol op) spliced) - (do (:: (:: System out) (println "Branch #2")) - (:: (:: System out) (println op))) - )) - - (def (main args) - (case (' "YOLO") - (#Text text) - (:: (:: System out) (println text)))) - - (def (main args) - (case (' ((~ "TROLOLOL"))) - (#Form (#Cons (#Text text) #Nil)) - (:: (:: System out) (println text)) - )) - )# -- cgit v1.2.3