Search found 10 matches
- Sun Sep 05, 2010 5:35 pm
- Forum: Common Lisp
- Topic: examine
- Replies: 4
- Views: 5396
Re: examine
thanx, i managed to solve it.
- Sun Sep 05, 2010 10:59 am
- Forum: Common Lisp
- Topic: examine
- Replies: 4
- Views: 5396
Re: examine
EVERY would be useful, however i need a recursive function
defun examine (list)
cond list empty return nil
if list element is a number go to next element, call examine again,
else return nil
?
defun examine (list)
cond list empty return nil
if list element is a number go to next element, call examine again,
else return nil
?
- Sun Sep 05, 2010 7:16 am
- Forum: Common Lisp
- Topic: examine
- Replies: 4
- Views: 5396
examine
hi all, i wanna examine the atoms in a nested list, if the list contains numbers only (return t), if there is a char or other symbol (return nil) (defun examine (lst) (cond ((null list) 0) ((atom list) 1) (if numberp lst (examine (car lst)) ???))) ) ) im stuck here.
- Wed Sep 01, 2010 4:39 pm
- Forum: Common Lisp
- Topic: mapcar or notmapcar
- Replies: 11
- Views: 12738
Re: mapcar or notmapcar
Warren, is there a way to get decimals as a result instead of a fraction?
- Tue Aug 31, 2010 8:44 pm
- Forum: Common Lisp
- Topic: mapcar or notmapcar
- Replies: 11
- Views: 12738
mapcar or notmapcar
hi,im trying to get the following: the input is a list of numbers (integers eg. (1 2 3 4) (5 6 7 8)) and the expected output is ((1*5)+(2*6)+(3*7)+(4*8))/(the sum of the second list). is there a non-recursive way of solving it? > (mapcar #'list '(1 2 3 4) '(5 6 7 8)) ((1 5) (2 6) (3 7)(4 8)) i was t...
- Tue Aug 31, 2010 4:32 pm
- Forum: Common Lisp
- Topic: averaging
- Replies: 12
- Views: 14297
averaging
hi, trying to solve this problem: a function that adds up the numbers at the end of lists and then averages them. input is like (xxx 1) (yyy 2) (zzz 3)....(nnn n) =>6 ;(1+2+3+..+n)/n (defun averaging (lst) (if (null lst) 0 (+(setq(last lst)? how does it register the number of lists it has visited, w...
- Tue Aug 31, 2010 7:41 am
- Forum: Common Lisp
- Topic: workingdir
- Replies: 3
- Views: 4804
workingdir
hi, whats the default working directory of clisp 2.48, where i can load my files from?
tried to run clisp with a batchfile to do my own dir, but it didn't work...
thanx
tried to run clisp with a batchfile to do my own dir, but it didn't work...
thanx
- Sun Aug 29, 2010 4:57 pm
- Forum: Common Lisp
- Topic: stuck
- Replies: 14
- Views: 15580
Re: stuck
hmmmm, recursively....
pretty elegant!
pretty elegant!
- Sun Aug 29, 2010 8:27 am
- Forum: Common Lisp
- Topic: stuck
- Replies: 14
- Views: 15580
Re: stuck
ok, so dolist. it doesn't need anything (stop condition, etc) other than the (lst), right? and it will know when the list ends. where do i initialize the variable sum?right after the dolist? (dolist (sum (lst) (sum 0)) (if (t(oddp lst)) (setq sum (+ 1 sum) ( ) im not sure..
- Sat Aug 28, 2010 6:15 pm
- Forum: Common Lisp
- Topic: stuck
- Replies: 14
- Views: 15580
stuck
hi, trying to write a function that counts odd numbers in a list: so far (defun odd-count(lst) (do ((i 0 (+ i 1) (sum 0)) ((>(+ 1 i) (length lst) (if (oddp lst) (+ 1 sum) ??not sure what to do from this point?? could somebody help? [ed note: added " " tags - nuntius]