[racket-dev] Please help me to fix the code

From: Yingjian Ma (yingjian.ma1955 at gmail.com)
Date: Tue May 31 12:01:53 EDT 2011

Hi Marijn,

I am new to Racket.  I did not expect that output is
"#<procedure:...uments...".  It is like an error message to me.

Because the restrictions on this function (and on others), I need to study
more about Racket to go further.  I also need to code a function to remove
the duplicates from a list.  There is a such function in Racket but I cannot
use it.

On Tue, May 31, 2011 at 1:03 AM, Marijn <hkBst at gentoo.org> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi Yingjian,
>
> On 05/31/11 01:17, Yingjian Ma wrote:
> > Hi All,
> >
> > I wrote a piece of code to count the occurrance of a letter in a list.
>  But
> > it gave me an error saying "#<procedure:...uments..."
>
> What makes you think it's an error?
>
> > The code is below:
> >
> > (define (count-matches s l)
> >       (cond
> >      [(empty? l) 0]
> >      [(equal? s (first l)) (lambda (i)(+ i 1))]
> >      [else (count-matches s (rest l))]))
>
> Part of this code reads:
>
> compare s to the first element of list l and if they are equal return a
> function that returns its argument plus one (and forget about the rest
> of the list).
>
> Marijn
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.17 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAk3koL8ACgkQp/VmCx0OL2ztFwCfUG1WrfbagBXTp7F9prAvvaL8
> sycAoJWBleSTJ/eE2CExwx1zt71Z1Lks
> =e+cf
> -----END PGP SIGNATURE-----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/dev/archive/attachments/20110531/53861845/attachment.html>

Posted on the dev mailing list.