-
Notifications
You must be signed in to change notification settings - Fork 0
/
SupportingDoc.txt
30 lines (15 loc) · 1.13 KB
/
SupportingDoc.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
PROJECT BY: RUCHIR PATEL. F002BZ1
Task: Convert a "defun lisp" into "def ruby".
Description: Run a ruby.rb file, input a valid "defun lisp" function, (lexically binded), and file will output the corresponding ruby function which takes the same amount of parameters and does the same thing as lisp function.
Language: ruby
Partners: none. Would prefer to work alone on this project.
Test Cases: Following are some of the test cases for your help.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(defun revlist (x)(if (null (cdr x)) (car x) (list (revlist(cdr x)) (car x))))
(defun revlist_f (y)(if (null (car y)) (cdr y) (list (revlist_f(car y)) (cdr y))))
(defun dfs (y) (cond ((null y) nil);((atom y) (cons y nil));((consp y) (nconc (dfs(car y)) (dfs(cdr y))))))
(define fun_name (x1, y2, z3)(if (null (car x1)) (cdr z3)))
(defun rlen (x)(cond ((null x) 0);((atom x) 0);((consp x) (+ 1 (rlen (cdr x))))))
(define fun_name ())
(defun maxall (x)(if (null (cdr x)) (car x) (if (> (car x) (maxall (cdr x))) (car x) (maxall (cdr x)))))
(defun rlen (x)(cond ((null x) 0);((atom x) 0);((consp x) (+ 1 (rlen (cdr x))))))