Smalltalk

    Date: 08/02/05 (Code WTF)    Keywords: no keywords

    Collection >> do: operation separatedBy: separator
    	"Evaluate the  argument, operation, 
    	for each of the receiver's elements, interspersed
    	with evaluations of the  
    	argument, separator. The separator is first 
    	evaluated after the first element, and is not
    	evaluated after the last element (i.e. it is not
    	evaluated at all if there are less than two elements)." 
    
    	| sep |
    
    	"Switch to the real separator after first eval." 
    	sep := [sep := separator].
    
    	self do: [:e |
    		sep value.
    		operation value: e].
    	sep := nil.

    Source: http://www.livejournal.com/community/code_wtf/12990.html

« кусочек кода... || PHP »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home