Changes

Jump to: navigation, search

Scheme for Java Programmer

56 bytes added, 18:08, 8 March 2011
no edit summary
String
>>>>>>>> in Java
String st = new String("Seneca");
st = st.replace("e", "u");
System.out.println(st); // Sunuca
>>>>>>>> in Scheme
(define st (java.lang.String'new "Seneca"))
(set! st (st'replace "e" "u" ))
if
>>>>>>>> in Java
int x = 3, y = 5, large = 0;
if (x > y)
System.out.print(large); // 5
>>>>>>>> in Scheme
(define x 3)
(define y 5)
for
>>>>>>>> in Java
for (int i = 0; i < 10; i++)
System.out.print(i); // 0123456789
>>>>>>>> in Scheme
(for ((i 0)) (< i 10) (set! i (+ i 1))
(display i) ; 0123456789
While
>>>>>>>> in Java
int n = 0;
while(n < 10){
// 0123456789
>>>>>>>> in Scheme
(define n 0)
Switch Case
>>>>>>>> in Java
int x = 7;
String st = "";
System.out.println(st);
>>>>>>>> in Scheme
(define x 7)
(define st "")
Iterator
>>>>>>>> in Java
ArrayList numbers = new ArrayList();
>>>>>>>> in Scheme
(import 'java.util.ArrayList)
(define numbers (java.util.ArrayList'new))
Try and Catch
>>>>>>>> in Java
try {
// finally
>>>>>>>> in Scheme
(try
(define x (/ 1 0))
1
edit

Navigation menu