<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
<div><br></div>Ok, sequences are interesting, I have probably never heard of them because they are PLT-specific.<div><br></div><div>However, length was more an example than a specific case I need to dealt with.</div><div><br></div><div>Thanks anyway!<br><br>> Date: Sat, 24 Apr 2010 23:18:46 -0700<br>> Subject: Re: [plt-scheme] generic programming in plt scheme<br>> From: mark.engelberg@gmail.com<br>> To: skeptic2000@hotmail.com<br>> CC: plt-scheme@list.cs.brown.edu<br>> <br>> In my experience, PLT Scheme is not generally written in a way that<br>> makes it easy to define generic operations over multiple datatypes,<br>> however, in this case you're in luck. You can use the sequence<br>> abstraction:<br>> <br>> (define (generic-length l)<br>> (for/fold ([len 0]) ([element l]) (add1 len)))<br>> <br>> Works on lists, vectors, strings, and user-defined streams (that<br>> implement the sequence abstraction).<br>> <br>> See sequence in the help desk for more info.<br>> <br>> On Sat, Apr 24, 2010 at 11:05 PM, Skeptic . <skeptic2000@hotmail.com> wrote:<br>> ><br>> > Hi,<br>> > What would be the idiomatic way of defining a generic length procedure over,<br>> > let's say lists, vectors, strings and user-defined streams, in PLT Scheme ?<br>> > Thanks.<br>> ><br></div>                                            <br /><hr />Gardez le contact. <a href='http://go.microsoft.com/?linkid=9724468' target='_new'>Obtenez la version mobile de Messenger ici</a></body>
</html>