Comment detail

与えた条件を満たす候補 (Nested Flatten)

This comment is reply for 2106 sumim: Squeak Smalltalk で。(与えた条件を満たす候補). Go to thread root.

#(not not not) などに対応できる版を Squeak Smalltalk で。
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
| input numArgs |
input := #(& | not &).
numArgs := (input collect: [:sel | sel numArgs]) sum + 1.
World findATranscript: nil.
{true. false} asDigitsToPower: numArgs do: [:xs |
     | xsStream expression |
     xsStream := xs readStream.
     expression := input inject: xsStream next printString into: [:expStr :sel |
          expStr, ' ', sel, (sel == #not ifFalse: [xsStream next printString] ifTrue: [''])].
     (Compiler evaluate: expression) ifTrue: [Transcript cr; show: xs]]

Index

Feed

Other

Link

Pathtraq

loading...