Cheers, everyone. It seems if you ask 4 programmers a question and get
5 different answers. All useful though.

2009/6/10 Søren Enevoldsen <muzzlefl...@gmail.com>
>
> You have to have a quotation before the 'each', you have a word:
>
> array-to-tuple-quot each -- should be -- [ array-to-tuple-quot ] each
>
> At least that's my  understanding. Hope it helps.

The word array-to-tuple-quot places the desired quotation on the stack
so should work AFAIK. Originally the definition was inlined but I
extracted it in order to call inline on it since that has solved every
other problem of this type.

On Wed, Jun 10, 2009 at 2:11 PM, Doug Coleman<doug.cole...@gmail.com> wrote:
> Hi Gareth,
>
> Your code can just be:
>
> { 24 8 2004 } first3 spin <date>
>
> To make the code you posted work, you have to inline all the words
> that call ``call'' explicitly -- aday>tuple, etc. Also, you're using
> each with an unknown stack effect in the last word.  I'd suggest you
> just don't do it this way, but if you want to understand better, read
> "call" help and related sections.

The aday>tuple version was the original and worked. Maybe it was
inlined originally. I deleted it when I tried the new version after
convincing myself it worked in the listener then reconstructed it for
the OP. Your code solves the original problem of how do I convert an
array to a timestamp and thank you for that. I will look at the docs
for call more closely.

> Hi Gareth,
>
> You might want to look at how frequently shuffle words are used in the
> library. For example,
>
> \ -rot usage.
>
> The fact that something simple (converting a d/m/y triple into a
> timestamp) requires so much shuffling should alert you that your
> approach is wrong. As Doug pointed out, there is a much simpler way:
>
> reverse first3 <date>

Yeah I thought it was a bit heavy. I've been using Factor for a few
days and my process for learning a new language is 'get it to work.
Simplify', it is why I was trying remove the 3 definitions to begin
with. I actually have a long list of definitions for something as
trivial as converting a date string into a timestamp then validate it.
Obviously this isn't right so it is why I've been doing this.

On Wed, Jun 10, 2009 at 2:19 PM, Phil Dawes<p...@phildawes.net> wrote:
> Hi Gareth,
>
> I haven't had time to look at this properly, but on first glance it
> looks like you need to be using call( rather than call to tell the
> compiler what the stack effect of the quotation is.
>
> Hope that helps, sorry if I've got the wrong end of the stick!

call( looks interesting. Will read the docs.

Again cheers everyone. I can now solve the problem I had, the problem
I found and the problem I didn't even realise I had.

Thanks,
Gareth

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to