home *** CD-ROM | disk | FTP | other *** search
/ The CDPD Public Domain Collection for CDTV 3 / CDPDIII.bin / pd / programming / gnusmalltalk / changes.st < prev    next >
Text File  |  1992-02-16  |  2KB  |  49 lines

  1. "======================================================================
  2. |
  3. | Copyright (C) 1990, 1991, 1992 Free Software Foundation, Inc.
  4. | Written by David Duke.
  5. |
  6. | This file is part of GNU Smalltalk.
  7. |
  8. | GNU Smalltalk is free software; you can redistribute it and/or modify it
  9. | under the terms of the GNU General Public License as published by the Free
  10. | Software Foundation; either version 1, or (at your option) any later version.
  11. | GNU Smalltalk is distributed in the hope that it will be useful, but WITHOUT
  12. | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  13. | FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
  14. | details.
  15. | You should have received a copy of the GNU General Public License along with
  16. | GNU Smalltalk; see the file COPYING.  If not, write to the Free Software
  17. | Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  
  18. |
  19.  ======================================================================"
  20.  
  21. "
  22. |     Change Log
  23. | ============================================================================
  24. | Author       Date       Change 
  25. | sbb         16 Feb 92      Created by David Duke.
  26. |
  27. "
  28.  
  29. "This is loaded later, after the Fraction Class has been created.  Logically
  30.  it belongs in builtins."
  31.  
  32. !Integer methodsFor: 'built ins'!
  33.  
  34. / arg
  35.     <primitive: 10>
  36.     (arg isMemberOf: Integer) & (self isMemberOf: Integer) 
  37.     ifTrue: [ ^(Fraction numerator: self denominator: arg)]. 
  38.     ^self retry: #/ coercing: arg
  39. !!
  40.  
  41. !Integer methodsFor: 'converting'!
  42.  
  43. asFraction
  44.     ^Fraction numerator: self denominator: 1
  45. !!
  46.  
  47.