Paste: word 'user' not found in vocab

Author: Sean Chapel
Mode: factor
Date: Fri, 17 Apr 2009 06:33:08
Plain Text |
! Copyright (C) 2009 Sean Chapel.
! See http://factorcode.org/license.txt for BSD license.
USING: kernel ;
IN: factrak


TUPLE: user name position email ;

: <user> ( name position email -- user )
	user boa ;

Annotation: completed what I wanted

Author: Sean Chapel
Mode: factor
Date: Fri, 17 Apr 2009 08:49:15
Plain Text |
! Copyright (C) 2009 Sean Chapel.
! See http://factorcode.org/license.txt for BSD license.
USING: kernel io io.files io.encodings.utf8 prettyprint accessors sequences math.parser json.writer json.reader assocs ;
IN: factrak


TUPLE: user id name position email ;

: <user> ( name id position email -- user )
    user boa ;

: userid>filename ( int -- string )
    number>string "c:\\factrak\\data\\users\\" prepend ;

: user-add ( user -- )
    dup id>> userid>filename utf8 [ json-print ] with-file-writer ;

: user-get ( int -- user )
    userid>filename utf8 file-lines concat json> ! get data
    values reverse [  ] each <user> ; ! convert data to user


: make-test-data ( -- user )
    1 "Sean Chapel" "Programmer" "me@gmail.com" <user> ;

New Annotation

Summary:
Author:
Mode:
Body: