aboutsummaryrefslogtreecommitdiff
path: root/test2.lux
diff options
context:
space:
mode:
authorEduardo Julian2015-01-16 18:06:56 -0400
committerEduardo Julian2015-01-16 18:06:56 -0400
commit55e14407cc52f69e8c569c20af597676de5d80dd (patch)
tree3c5dd8eeeec7cd493d5f7ad97825fbf88c2f3bed /test2.lux
parent5a56806146d0bbf8309752f11fe601cf04624047 (diff)
[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).
Diffstat (limited to '')
-rw-r--r--test2.lux88
1 files changed, 14 insertions, 74 deletions
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))
- ))
- )#