Re: [Factor-talk] Conversion ODBC help questions

2009-11-07 Thread Slava Pestov
On Sat, Nov 7, 2009 at 7:17 PM, Jim mack  wrote:
> I had thought that almost every word was compiled by source that I'd find in
> the USING: clause ( or recursively up).  Is this how the UnicodeData.txt is
> loaded?  I tried calling space itself in listener, to no avail, now I see
> CHAR: space works, which I didn't think of as possible unless it could
> interpret 'space' itself.  "space" name>char-hook of course answers that.
> I'll keep infix notation in mind in the future.

CHAR: is a parsing word, so it reads ahead from the input. Type
'parsing word' in the search box of the help browser for documentation
about them. Since you say you're familiar with Forth, parsing words
are the same as Forth 'immediate words'.

> Joe, are you involved with Crystal reports?

SourceForge mailing list software appends ads to every message. As far
as I know, Joe is not affiliated with Crystal Reports.

Slava

--
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
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Conversion ODBC help questions

2009-11-07 Thread Jim mack
Thanks, Joe.

If you look at the docs for CHAR: (
> http://docs.factorcode.org/content/word-CHAR__colon__%2Csyntax.html
> ), it says CHAR: takes a literal character, an escape code, or a
> Unicode character name. «CHAR: space» is using the Unicode character
> name for the space character. The Unicode character data is read from
> basis/unicode/data/UnicodeData.txt when the Unicode library is compiled.
>

I had thought that almost every word was compiled by source that I'd find in
the USING: clause ( or recursively up).  Is this how the UnicodeData.txt is
loaded?  I tried calling space itself in listener, to no avail, now I see
CHAR: space works, which I didn't think of as possible unless it could
interpret 'space' itself.  "space" name>char-hook of course answers that.
I'll keep infix notation in mind in the future.

>
> ...
>
> That's how it used to be, but we've since implemented a more robust
> namespacing scheme documented in the article I linked you from my
> first email. Could you tell us where you read that from in the docs so
> we can update them?
>

I think it was from an archived newsgroup site.

>
> > c) I read syntax << "alien.c-types" xxx >> would help, but can't
> > find that article now, and couldn't figure out exact syntax at the
> > time.
>
> Not sure where you got that from. << >> is just used for parse-time
> evaluation. Again, if you could point out where in the docs you read
> this so we can clarify it for future new users, that'd be helpful.
>

Again, archived newsgroups.  I may even have seen something like:  «FROM:
alien.c-types => short ;» and thought it was some usage of <<   >> rather
than a quotation device

>
> > 3)  Use of >r r>
> > c) is there a better temp stack technique?
>
> The temporary stack in Factor has been relegated to an implementation
> detail. The dip combinators (
> http://docs.factorcode.org/content/article-retainstack-combinators.html
> ) are the preferred way in Factor for temporarily stashing values,
> since they enforce balanced use of the temporary stack and tend to be
> more readable.
>

Am favorably impressed with combinators, although they many of them aren't
easy yet.

The only typo I've found so far is in the IRC info, for which I was a noob,
but

"irc.ui" run  from
http://concatenative.org/wiki/view/Concatenative%20IRC%20channel

fails for the precompiled image I'm using.


Joe, are you involved with Crystal reports?


> -Joe
>
> --
> 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
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>




-- 
Jim
"I'm for extending the working Medicare program for our seniors all the way
back to contraception, so Americans can concentrate on living their lives
without fear of changing a job, going bankrupt from deductibles or fighting
HMO bureaucracy."
--
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
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Conversion ODBC help questions

2009-11-07 Thread Joe Groff
Sorry Jim, I missed some nuances of your questions the first time  
around. I'll try to fill in the blanks.

On Nov 7, 2009, at 2:25 PM, Jim mack wrote:

> 1)  CHAR: \space  is missing \space.
> a) Of course CHAR: 32  works, but it seems we avoid  
> this.  What is better way?
> b) Closest I can come is command-writer.factor, which has a  
> CHAR: space write1.  I can't figure out where space is defined.  I  
> think I looked (but obviously missed it) in each file in USING: io  
> io.crlf kernel math.parser sequences strings interpolate locals ;   
> and browser is not helpful.  What techniques are there to start from  
> command-writer & find out where it thinks it's getting the word from?

If you look at the docs for CHAR: 
(http://docs.factorcode.org/content/word-CHAR__colon__%2Csyntax.html 
), it says CHAR: takes a literal character, an escape code, or a  
Unicode character name. «CHAR: space» is using the Unicode character  
name for the space character. The Unicode character data is read from  
basis/unicode/data/UnicodeData.txt when the Unicode library is compiled.

> 2)  finding conflicts for TYPEDEF: short XXX.
> a) says between alien.c-types & sequences
> b) I read the latter should win in USING: but this doesn't seem  
> to apply

That's how it used to be, but we've since implemented a more robust  
namespacing scheme documented in the article I linked you from my  
first email. Could you tell us where you read that from in the docs so  
we can update them?

> c) I read syntax << "alien.c-types" xxx >> would help, but can't  
> find that article now, and couldn't figure out exact syntax at the  
> time.

Not sure where you got that from. << >> is just used for parse-time  
evaluation. Again, if you could point out where in the docs you read  
this so we can clarify it for future new users, that'd be helpful.

> 3)  Use of >r r>
> c) is there a better temp stack technique?

The temporary stack in Factor has been relegated to an implementation  
detail. The dip combinators 
(http://docs.factorcode.org/content/article-retainstack-combinators.html 
) are the preferred way in Factor for temporarily stashing values,  
since they enforce balanced use of the temporary stack and tend to be  
more readable.

-Joe
--
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
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Conversion ODBC help questions

2009-11-07 Thread Joe Groff
On Nov 7, 2009, at 2:25 PM, Jim mack wrote:

> 1)  CHAR: \space  is missing \space.

«CHAR: \s» gives a space.

> 2)  finding conflicts for TYPEDEF: short XXX.

To resolve naming conflicts, you can use FROM: as follows:

«FROM: alien.c-types => short ;»

See http://docs.factorcode.org/content/article-word-search-syntax.html  
for full details on controlling name lookup.

> 3)  Use of >r r>

Use «[ foo ] dip» instead of «>r foo >r».

Hopefully that'll get you going again. Be sure to let us know if you  
have any more questions.

-Joe
--
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
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] Conversion ODBC help questions

2009-11-07 Thread Jim mack
Hi,

New to factor, did some forth long time ago.  Converting
unmaintained\odbc.factor for use on Windows. Am using the binary factor
deploy for now.

1)  CHAR: \space  is missing \space.
a) Of course CHAR: 32  works, but it seems we avoid this.  What
is better way?
b) Closest I can come is command-writer.factor, which has a CHAR: space
write1.  I can't figure out where space is defined.  I think I looked (but
obviously missed it) in each file in USING: io io.crlf kernel math.parser
sequences strings interpolate locals ;  and browser is not helpful.  What
techniques are there to start from command-writer & find out where it thinks
it's getting the word from?

2)  finding conflicts for TYPEDEF: short XXX.
a) says between alien.c-types & sequences
b) I read the latter should win in USING: but this doesn't seem to apply
c) I read syntax << "alien.c-types" xxx >> would help, but can't find
that article now, and couldn't figure out exact syntax at the time.
d) I actually fixed by moving to an ffi folder so it didn't have any
code requiring sequences, which may be correct, but I'd like to understand
c) or whatever name conflict resolution there is.

3)  Use of >r r>
a) I remember this from forth, but it seems to be stamped out, and may
even by a religious argument?
b) As a quick and ugly, I implemented this as
SYMBOL: fakestack
: init-fake-stack ( -- )
8  fakestack set ;
: >r ( n -- )  fakestack get push ;
: r> ( -- n )  fakestack get pop ;
init-fake-stack

which may be safe, because there's no call of another routine that uses >r
from the first >r to the last r>.  In a few routines, I changed to :: and
used named locals.  I switched to the above when one routine
(odbc-describe-column) put 6 elements on the return stack.  I first tried
solving this as a tuple, but then thought of the trick, and wanted to learn
how to implement it.
c) is there a better temp stack technique?
d) please don't suggest other rewrites of odbc-describe-column, I will
eventually come back to it.

Thanks!

-- 
Jim
"I'm for extending the working Medicare program for our seniors all the way
back to contraception, so Americans can concentrate on living their lives
without fear of changing a job, going bankrupt from deductibles or fighting
HMO bureaucracy."
--
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
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk