Here is the file in question, called crud.factor:
REQUIRES: libs/furnace libs/sqlite libs/httpd ;
USING: tuple-db sqlite namespaces prettyprint
sequences kernel ;
IN: crud
TUPLE: foo bar baz ;
foo default-mapping set-mapping
SYMBOL: crud-db
: open-db ( db-name -- )
sqlite-open crud-db set ;
TUPLE: sqlite-master name ;
sqlite-master default-mapping set-mapping
: has-table? ( db class -- tuples )
unparse <sqlite-master> find-tuples empty? not ;
: create-tuple-table* ( db class -- )
2dup has-table? [ 2drop ] [ create-tuple-table ] if ;
: table-columns ( db class -- )
"PRAGMA table_info(" swap unparse ");" 3append
sqlite-prepare [ 1 column-text ] sqlite-map ;
After doing "crud.factor" run-file, I try the following:
sqlite-master => no-word-name
\ <sqlite-master> => pushes <sqlite-master> onto the stack
sqlite_master => pushes sqlite_master onto the stack
Strange, because I never defined sqlite_master!
I picked through the definition of TUPLE: and the docs, and couldn't
find any explanation of this phenomenon.
Yuuki
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk