Paste: primitives

Author: erg
Mode: factor
Date: Fri, 22 Jun 2012 01:46:20
Plain Text |
! Copyright (C) 2011 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: alien.strings byte-arrays kernel kernel.private
quotations words ;
IN: words.primitives

: make-sub-primitive ( word vocab effect -- )
    [
        create
        dup t "primitive" set-word-prop
        dup 1quotation
    ] dip define-declared ;

: make-primitive ( word vocab function effect -- )
    [
        [
            create
            dup reset-word
            dup t "primitive" set-word-prop
        ] dip
        >byte-array [ do-primitive ] curry
    ] dip define-declared ;


New Annotation

Summary:
Author:
Mode:
Body: