I just realized that I didn't let you guys know what was concluded.
In the end, with some help in irc, I went for the runtime reflection 
feature of mirrors

http://paste.factorcode.org/paste?id=1068

kobi


On 17/11/2009 02:38, Slava Pestov wrote:
> Hi Kobi,
>
> You need to ensure that the value passed in to 2cleave is constructed
> at compile time. To do this, move the 'map' call inside the macro.
>
> Also note that a macro's body must evaluate to a quotation, not a
> value; and declaring a macro as 'inline' has no effect. However, I'm
> puzzled as to why you're passing in the output of 'curry' as the assoc
> key to 'at'. Perhaps you meant to do something else here.
>
> Slava
>
> On Mon, Nov 16, 2009 at 10:40 AM, Kobi Lurie<[email protected]>  wrote:
>>   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
>>
> ------------------------------------------------------------------------------
> 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
>


-- 
China: stop persecuting Falun Gong!
http://faluninfo.net

URGENT: Innocent people are being persecuted for their belief in Communist 
China.


------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to