Search found 14 matches

by dsjoka
Tue Feb 15, 2011 8:58 am
Forum: Scheme
Topic: Some Idea
Replies: 8
Views: 17468

Re: Some Idea

sorry I'm new to this

is this the right idea? And can you tell me if I placed the () right?

(DEFINE (countzeros list)
(IF (<>(car(list)0)
0
(+1(countzeros(cdr(list)))
))

Thanks.
by dsjoka
Tue Feb 15, 2011 8:41 am
Forum: Scheme
Topic: reversing a list
Replies: 3
Views: 9208

reversing a list

Ok so I need to remove the last item of a list.

ie : (1 2 3 4)
I will get
(1 2 3)

my idea is as follows:

reverse(list)
car(list)
reverse(list)

however I don't know if there is simple function in scheme(racket) that does reverse?

If not, is there an easier way to approach this problem?

Thanks.
by dsjoka
Sat Feb 12, 2011 10:41 am
Forum: Scheme
Topic: Some Idea
Replies: 8
Views: 17468

Some Idea

Hey,

I need some help with a program. I don't expect anyone to write it for me. I just need help with the ideas or maybe some pseudo code to help me.

Problem:

Write a Scheme function that returns the number of zeros in a given simple list of numbers.

Thanks.
by dsjoka
Thu Feb 10, 2011 1:38 pm
Forum: Scheme
Topic: simple question
Replies: 1
Views: 5144

simple question

Hi,

I have maybe 1 day of scheme/lisp experience, and glad I found this forum.

I have a simple question.

Ok I know theres a null for detecting an empty list. However I have no idea how to find how many elements in a list. ie: (a) would return 1. Is there like a count function?

Thanks.