Hey guys, if you may I would like to ask another question
I get an error about 2cleave cannot be compiled from the following code.
And I feel in any case I'm going the wrong way here.
Is what I'm doing makes sense?
please give pointers. Also I'm new to macros, not sure I use them correctly.
The purpose of the code is to get values from a hashtable and put them
into the tuple fields. (or 'f' if they couldn't be found)
Many thanks, Kobi
TUPLE: smtp-config server local-domain tls? smtp-read-timeout smtp-auth
username password ;
: value-slot-pairs ( -- seq )
{
{ [ "server" ] [ >>server ] }
{ [ "local-domain" ] [ >>local-domain ] }
{ [ "tls?" ] [ >>tls? ] }
{ [ "smtp-read-timeout" ] [ >>smtp-read-timeout ] }
{ [ "smtp-auth" ] [ >>smtp-auth ] }
{ [ "username" ] [ >>username ] }
{ [ "password" ] [ >>password ] }
} ; inline
MACRO: (prepare-table) ( pair-seq -- )
first2 [ when* drop ] curry
[ swap at ] prepose compose ; inline
: hash>slots ( tuple hash pair-seq -- tuple' )
[ dup ] 2dip
[ (prepare-table) ] map 2cleave ;
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk