! Copyright (C) 2003, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: accessors kernel math.private sequences kernel.private math sequences.private slots.private byte-arrays alien.accessors ; IN: strings M: string equal? over string? [ over hashcode over hashcode eq? [ sequence= ] [ 2drop f ] if ] [ 2drop f ] if ; M: string hashcode* nip dup string-hashcode [ ] [ dup rehash-string string-hashcode ] ?if ; M: string length length>> ; inline M: string nth-unsafe [ >fixnum ] dip string-nth ; inline M: string set-nth-unsafe dup reset-string-hashcode [ >fixnum ] [ >fixnum ] [ ] tri* set-string-nth ; inline M: string clone (clone) [ clone ] change-aux ; inline M: string resize resize-string ; inline : 1string ( ch -- str ) 1 swap ; : >string ( seq -- str ) "" clone-like ; M: string new-sequence drop 0 ; inline INSTANCE: string sequence