[Newbies] Re: translateFrom:to:table:

Thomas Keller thokeller at gmail.com
Sat Jul 29 22:45:43 UTC 2006


That works for lots of methods. But for some methods there are no decent
comments or examples. This is what I get from "Senders of
translateFrom:to:table:"
 translateWith: table
    "translate the characters in the string by the given table, in place"
    ^ self translateFrom: 1 to: self size table: table

I don't find see anything called "references".
I cannot find a single example of what a table arguments should look like.

Here's a simple example of what I want to do:

myString := 'ACGTACGT'.
myFixedString := myString translateFrom: 1 to; (myString size) table: table.

Where table would be something like a hash: A => 5, G => 6, C => 7, T => 8.

in Perl, I would write: perl -pe 'tr/AGCT/5678/' <return> on the command
line and then paste in the string and perl would return the translated
string.

Thanks for your help.
Tom Keller

On 7/28/06, Klaus D. Witzel <klaus.witzel at cobss.com> wrote:
>
> On Fri, 28 Jul 2006 20:49:13 +0200, Mathieu wrote:
>
> > Hi thomas,
> >
> > You can find some sender of it by right click -> more.. -> senders of it
>
> And there is a way to avoid stinkin' right-click: in any text, select the
> text of a selector (including its arguments) and do cmd-m and cmd-n :) For
> example, in a browser with the class definition template (Object subclass:
> #NameOfSubclass ...) do select from subclass: to category: and see what I
> mean.
>
> > So you can understand how people use it.
>
> Yes, one of the best ways to come to use to Smalltalk/Squeak.
>
> /Klaus
>
> > Other wise find the references to it and you can read comment of the
> > metod or even understand the implementation. (follow same method for
> > 'sender of it' but chose 'references to it')
> >
> > Math
>
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>



-- 
Tom
"Ecrasez l'Infame!" -- Voltaire
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20060729/b5d80475/attachment.htm


More information about the Beginners mailing list