Index: lang/smalltalk/misc
===================================================================
--- lang/smalltalk/misc (revision 4470)
+++  (revision )
@@ -1,218 +1,0 @@
-#!gst
-Object subclass: #Golf
-  instanceVariableNames: ''
-  classVariableNames: 'Dic Global'
-  poolDictionaries: ''
-  category: 'Golf'!
-Golf.Dic    := Dictionary new.
-Golf.Global := Dictionary new
-  add: $< -> stdin;
-  add: $> -> stdout;
-  add: $* -> Smalltalk arguments;
-  add: $S -> Smalltalk;
-  add: $X -> thisContext;
-  yourself!
-!Golf class methodsFor: 'golf'!
-printOn: s
-  s nextPutAll: self D; nl; nextPutAll: self G!
-D
-  ^'Golf', Dic displayString!
-G
-  ^String streamContents: [:s| Global associationsDo: [:a| s << a; nl ] ]!
-
-!ClassDescription methodsFor: 'golf'!
-?? abbr
-  | a s |
-  a := abbr occurrencesOf: $:.
-  s := ((abbr inject: '' writeStream into:
-    [:s :c| c <= $Z and: [ s << $* ]. s << c ]) << $*) contents.
-  ^Golf.Dic at: {abbr asSymbol. self} ifAbsentPut: [
-    self allSelectors asSortedCollection
-      detect: [:x| (x occurrencesOf: $:) = a and: [ s match: x ignoreCase: false ] ]
-      ifNone: [ self error: Golf D, ' "', abbr, '" not found.' ] ]!
-
-!Object methodsFor: 'golf'!
-doesNotUnderstand: m
-  ^m selector: self class ?? m selector; sendTo: self!
-H
-  ^'Hello, world!' displayNl!
-H: args
-  ^('%1ello, %2orld%3' bindWithArguments: args) displayNl!
-Q
-  | s |
-  s := thisContext.
-  [ s methodClass = UndefinedObject ] whileFalse: [ s := s sender ].
-  ^(s method methodSourceString, '!') display!
-P
-  ^self displayNl!
-P: f
-  self displayOn: f. f nl!
-|> f
-  self displayOn: f!
-
-!Symbol methodsFor: 'golf'!
-doesNotUnderstand: m
-  ^m sendTo: (self C ifNil:[ ^super doesNotUnderstand: m ])!
-
-!Character methodsFor: 'golf'!
-doesNotUnderstand: m
-  ^m sendTo: (Golf.Global at: self ifAbsent: [ ^super doesNotUnderstand: m ])!
-, o
-  ^self asString, (o isCharacter ifTrue: [ {o} ] ifFalse: [ o ])!
-+ n
-  ^(codePoint + n) asCharacter!
-* n
-  ^String new: n withAll: self!
-~ c
-  ^((codePoint ~ c value) inject: '' writeStream into:
-    [:s :v| s << v asCharacter ]) contents!
-<- o
-  ^Golf.Global at: self put: o!
-
-!CharacterArray methodsFor: 'golf'!
-?? o
-  ^(o isClass ifTrue: [ o ] ifFalse: [ o class ]) ?? self!
-C
-  | s |
-  s := (((self copyFrom: 2) inject: '' writeStream << self first into:
-    [:s :c| c <= $Z and: [ s << $* ]. s << c ]) << $*) contents.
-  ^Smalltalk at: (##(Smalltalk keys asSortedCollection)
-    detect: [:k| s match: k ignoreCase: false ]
-    ifNone: [ ^nil ])!
-E
-  ^Behavior evaluate: self!
-%% a
-  ^self bindWithArguments: a!
-
-!SequenceableCollection methodsFor: 'golf'!
-/ p
-  ^(p isKindOf: SequenceableCollection) ifTrue: [
-    | s r |
-    s := self readStream. r := OrderedCollection new.
-    [ r add: (s upToAll: p). s atEnd ] whileFalse.
-    r.
-  ] ifFalse: [ super / p ]!
-* o
-  ^o isNumber
-    ifTrue:  [ self species streamContents: [:s| o timesRepeat: [ s nextPutAll: self ] ] ]
-    ifFalse: [
-      | j |
-      j := (o isKindOf: SequenceableCollection) ifTrue: [ o ] ifFalse: [ {o} ].
-      self fold: [:a :b| a, j, b ]]!
->< d
-  "*Experimental*  e.g. 'Hello' >< {$H->$G. $l->$t} => 'Getto'"
-  ^d inject: self copy into: [:r :a| r replaceAll: a key with: a value ]!
-
-!Number methodsFor: 'golf'!
-doesNotUnderstand: m
-  ^[ super doesNotUnderstand: m copy ] ifError: [ ^m sendTo: (1 to: self) ]!
-~ n
-  ^self to: n by: (n < self ifTrue: [ -1 ] ifFalse: [ 1 ])!
-** n
-  ^self raisedTo: n!
-? n
-  ^self raisedTo: n!
-
-!Integer methodsFor: 'golf'!
->> n
-  ^self bitShift: n negated!
-<< n
-  ^self bitShift: n!
-& n
-  ^self bitAnd: n!
-| n
-  ^self bitOr:  n!
-\ n
-  ^self bitXor: n!
-
-!Boolean methodsFor: 'golf'!
-&& b
-  ^self and: b!
-|| b
-  ^self or:  b!
-? a
-  | o |
-  o := self ifTrue: [ a first ] ifFalse: [ a last ].
-  ^(o isKindOf: BlockClosure) ifTrue: [ o value ] ifFalse: [ o ]!
-
-!Collection methodsFor: 'golf'!
-R
-  "Answers a [R]andom item."
-  ^self asArray at: Random next * self size // 1 + 1!
-D
-  "Makes a [D]ictionary from an array of associations."
-  ^self asArray inject: Dictionary new into: [ :d :a | d add: a. d ]!
-@ o
-  ^(o respondsTo: #collect:)
-    ifTrue:  [ o collect: [:i| self at: i ] ]
-    ifFalse: [ self at: o ]!
-/ n
-  | r s |
-  r := OrderedCollection new: (self size / n) ceiling.
-  s := ReadStream on: self.
-  [ r add: (s nextAvailable: n). s atEnd ] whileFalse.
-  ^r!
-\ b
-  ^self collect: b!
-\> b
-  ^self \ [:x| (b value: x) displayNl ]!
-<< o
-  self add: o!
-sum
-  ^self fold: [:a :b| a + b ]!
-max
-  ^self fold: [:a :b| a < b ifTrue: [ b ] ifFalse: [ a ] ]!
-min
-  ^self fold: [:a :b| a > b ifTrue: [ b ] ifFalse: [ a ] ]!
-
-!BlockClosure methodsFor: 'golf'!
-* n
-  ^n timesRepeat: self!
-< a
-  ^self valueWithArguments: a!
-
-!FileStream methodsFor: 'golf'!
-\ b
-  ^(self contents subStrings: Character nl) \ b!
-
-
-" Not-so-golf Additions "
-
-!Object methodsFor: 'rubylike-case'!
-<> cases
-  cases do: [:a| a key =? self and: [ | v |
-    ^((v := a value) isKindOf: BlockClosure) ifTrue: [ v value ] ifFalse: [ v ] ] ].
-  ^nil!
-case: cases
-  ^self <> cases!
-case: cases else: elseBlock
-  ^self <> cases ifNil: elseBlock!
-=? o
-  ^self = o!
-!
-
-Object subclass: #Any
-  instanceVariableNames: ''
-  classVariableNames: ''
-  poolDictionaries: ''
-  category: '?'!
-!Any class methodsFor: 'rubylike-case'!
-=? o
-  ^true!
-
-!BlockClosure methodsFor: 'rubylike-case'!
-=? o
-  ^self value = o!
-
-!Class methodsFor: 'rubylike-case'!
-=? o
-  ^o isKindOf: self!
-
-!CharacterArray methodsFor: 'rubylike-case'!
-=? o
-  ^self match: o!
-
-!Collection methodsFor: 'rubylike-case'!
-=? o
-  ^self includes: o!
-!
