Mod operator?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Mod operator?

John Almberg
Sorry for this simple question, but I can't seem to find the mod operator. As in, "what's the remainder after doing division?"

Thanks: John



_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Mod operator?

John Almberg
Funny how asking a question can give you the answer...

I was looking for variations on mod, but after I wrote 'remainder'... well,  you can guess the rest :-)

Thanks anyway!

-- John

On Aug 11, 2007, at 11:05 AM, John Almberg wrote:

Sorry for this simple question, but I can't seem to find the mod operator. As in, "what's the remainder after doing division?"

Thanks: John


_______________________________________________
Beginners mailing list

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Marketing for On-line Collectible Dealers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Identry, LLC
John Almberg
(631) 546-5079
www.identry.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Mod operator?

ching
try \\\  e.g. 5 \\\ 2  returns 1

On 8/11/07, John Almberg <[hidden email]> wrote:
Funny how asking a question can give you the answer...

I was looking for variations on mod, but after I wrote 'remainder'... well,  you can guess the rest :-)

Thanks anyway!

-- John

On Aug 11, 2007, at 11:05 AM, John Almberg wrote:

Sorry for this simple question, but I can't seem to find the mod operator. As in, "what's the remainder after doing division?"

Thanks: John


_______________________________________________
Beginners mailing list
<a href="http://lists.squeakfoundation.org/mailman/listinfo/beginners" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://lists.squeakfoundation.org/mailman/listinfo/beginners

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Marketing for On-line Collectible Dealers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Identry, LLC
John Almberg
(631) 546-5079
<a href="http://www.identry.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> www.identry.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



_______________________________________________
Beginners mailing list
[hidden email]
<a onclick="return top.js.OpenExtLink(window,event,this)" href="http://lists.squeakfoundation.org/mailman/listinfo/beginners" target="_blank">http://lists.squeakfoundation.org/mailman/listinfo/beginners



_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Mod operator?

John Almberg
That works, too. Thanks.

-- John
 
On Aug 11, 2007, at 11:14 AM, Ching de la Serna wrote:

try \\\  e.g. 5 \\\ 2  returns 1

On 8/11/07, John Almberg <[hidden email]> wrote:
Funny how asking a question can give you the answer...

I was looking for variations on mod, but after I wrote 'remainder'... well,  you can guess the rest :-)

Thanks anyway!

-- John

On Aug 11, 2007, at 11:05 AM, John Almberg wrote:

Sorry for this simple question, but I can't seem to find the mod operator. As in, "what's the remainder after doing division?"

Thanks: John


_______________________________________________
Beginners mailing list
<a href="http://lists.squeakfoundation.org/mailman/listinfo/beginners" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://lists.squeakfoundation.org/mailman/listinfo/beginners

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Marketing for On-line Collectible Dealers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Identry, LLC
John Almberg
(631) 546-5079
<a href="http://www.identry.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> www.identry.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



_______________________________________________
Beginners mailing list
[hidden email]
<a onclick="return top.js.OpenExtLink(window,event,this)" href="http://lists.squeakfoundation.org/mailman/listinfo/beginners" target="_blank">http://lists.squeakfoundation.org/mailman/listinfo/beginners


_______________________________________________
Beginners mailing list

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Marketing for On-line Collectible Dealers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Identry, LLC
John Almberg
(631) 546-5079
www.identry.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Mod operator?

Nicolas Cellier-3
If you are interested by something closer to other languages for
processing negative numbers, (AMOD, fmod, etc...), you will have a look
at #quo: and #rem:

Nicolas

John Almberg a écrit :

> That works, too. Thanks.
>
> -- John
>  
> On Aug 11, 2007, at 11:14 AM, Ching de la Serna wrote:
>
>> try \\\  e.g. 5 \\\ 2  returns 1
>>
>> On 8/11/07, *John Almberg* <[hidden email]
>> <mailto:[hidden email]>> wrote:
>>
>>     Funny how asking a question can give you the answer...
>>
>>     I was looking for variations on mod, but after I wrote
>>     'remainder'... well,  you can guess the rest :-)
>>
>>     Thanks anyway!
>>
>>     -- John
>>
>>     On Aug 11, 2007, at 11:05 AM, John Almberg wrote:
>>
>>>     Sorry for this simple question, but I can't seem to find the mod
>>>     operator. As in, "what's the remainder after doing division?"
>>>
>>>     Thanks: John
>>>
>>>
>>>     _______________________________________________
>>>     Beginners mailing list
>>>     [hidden email]
>>>     <mailto:[hidden email]>
>>>     http://lists.squeakfoundation.org/mailman/listinfo/beginners
>>>     <http://lists.squeakfoundation.org/mailman/listinfo/beginners>
>>
>>     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>     Marketing for On-line Collectible Dealers
>>     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>     Identry, LLC
>>     John Almberg
>>     (631) 546-5079
>>     [hidden email] <mailto:[hidden email]>
>>     www.identry.com <http://www.identry.com>
>>     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>
>>
>>
>>     _______________________________________________
>>     Beginners mailing list
>>     [hidden email]
>>     <mailto:[hidden email]>
>>     http://lists.squeakfoundation.org/mailman/listinfo/beginners
>>     <http://lists.squeakfoundation.org/mailman/listinfo/beginners>
>>
>>
>> _______________________________________________
>> Beginners mailing list
>> [hidden email]
>> <mailto:[hidden email]>
>> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Marketing for On-line Collectible Dealers
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Identry, LLC
> John Almberg
> (631) 546-5079
> [hidden email] <mailto:[hidden email]>
> www.identry.com
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Mod operator?

Tapple Gao
In reply to this post by John Almberg
On Sat, Aug 11, 2007 at 11:05:54AM -0400, John Almberg wrote:
>    Sorry for this simple question, but I can't seem to find the mod operator.
>    As in, "what's the remainder after doing division?"
>    Thanks: John

For such questions, it is best to use the method finder:
- Open method finder (world menu -> open -> method finder)
- enter a mod expression ( such as 7 . 3 . 1 ) and hit enter
- method finder gives several answers. Two of them are what you
  are looking for

--
Matthew Fulmer -- http://mtfulmer.wordpress.com/
Help improve Squeak Documentation: http://wiki.squeak.org/squeak/808
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Mod operator?

John Almberg
Hi Matthew,

I found the rem: method by finally thinking 'remainder' rather than  
'mod'. I tried your approach, which sounded interesting, and it  
worked, but then I had to spend a few minutes thinking *Why* does it  
work?

When it finally dawned on me, I tried a couple other mathematical  
examples. After yelling Wow! a couple of times, I tried it with  
'hello . hel' and was really impressed.

Thanks for the tip!

-- John

On Aug 11, 2007, at 2:30 PM, Matthew Fulmer wrote:

> On Sat, Aug 11, 2007 at 11:05:54AM -0400, John Almberg wrote:
>>    Sorry for this simple question, but I can't seem to find the  
>> mod operator.
>>    As in, "what's the remainder after doing division?"
>>    Thanks: John
>
> For such questions, it is best to use the method finder:
> - Open method finder (world menu -> open -> method finder)
> - enter a mod expression ( such as 7 . 3 . 1 ) and hit enter
> - method finder gives several answers. Two of them are what you
>   are looking for
>
> --
> Matthew Fulmer -- http://mtfulmer.wordpress.com/
> Help improve Squeak Documentation: http://wiki.squeak.org/squeak/808
> _______________________________________________
> Beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Marketing for On-line Collectible Dealers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Identry, LLC
John Almberg
(631) 546-5079
[hidden email]
www.identry.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Mod operator?

Michael van der Gulik-3
In reply to this post by Tapple Gao
Matthew Fulmer wrote:

> On Sat, Aug 11, 2007 at 11:05:54AM -0400, John Almberg wrote:
>  
>>    Sorry for this simple question, but I can't seem to find the mod operator.
>>    As in, "what's the remainder after doing division?"
>>    Thanks: John
>>    
>
> For such questions, it is best to use the method finder:
> - Open method finder (world menu -> open -> method finder)
> - enter a mod expression ( such as 7 . 3 . 1 ) and hit enter
> - method finder gives several answers. Two of them are what you
>   are looking for
>  
****WOW****!! That's just magic!

I can't believe that I'm still finding more incredible features in
Squeak after spending a couple of years immersed in it.

Michael.
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners