Re: [Factor-talk] Factor and MacOS arm64

2020-11-23 Thread KUSUMOTO Norio

> 2020/11/23 5:36、John Benediktsson のメール:
> 
> Right now the compiler doesn’t make a correct boot quotation to jump into 
> after the binary loads the factor image. 
> 
> My M1 technically comes in a couple days, so I hope to help with the effort 
> soon!
> 
> Doug worked on the arm64 assembler and now we have to implement the compiler 
> hooks properly with assembly output. 
> 
> More to come soon!

Wow! That's exciting information!

--
KUSUMOTO Norio



___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Default stack size and stack consumption

2020-08-12 Thread KUSUMOTO Norio
Hi, John and everyone!
I wish you all good health.


> 2020/08/11 8:17、John Benediktsson のメール:
> 
> Hi,
> 
> I recently changed the Factor command-line help to annotate with the default 
> values for those parameters.
> 
> See if that helps you.  Regarding the profiler, you need to run a computation 
> that takes longer.  I'm not sure what the minimum threshold for observations 
> is, but try something like this:
> 
> [ 0 100,000 [ 1 + ] times ] profile


Thank you for your information.

By the way, the Development release on the official web page tends to be 
stagnant, especially the Mac version, which is currently on 2020-04-12. Is 
there a problem with this?

--
KUSUMOTO Norio



___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] Default stack size and stack consumption

2020-03-09 Thread KUSUMOTO Norio
Hello all,

- The following page shows how to specify the size of each stack for a Factor 
VM, but what are these default size when those switches are not used?

<https://docs.factorcode.org/content/article-runtime-cli-args.html>


- Is there a way to know how much of the stack was used when a quote was 
executed?


- I don't know how to use 'profile'. I tried this with reference to the 
following page, but I got an error. What am I doing wrong?

[ 1 2 + ] profile
top-down profile.

<https://docs.factorcode.org/content/article-tools.profiler.sampling.html>

--
KUSUMOTO Norio







___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Factor and Python's generator

2020-03-05 Thread KUSUMOTO Norio
> 2020/03/04 22:02、KUSUMOTO Norio のメール:
>>def gen():
>>for i in xrange(10**5):
>>yield i
>> 
>>for i in gen():
>>pass
> 
> 
>> "libs/coroutines" require
>> USE: coroutines
>> : gen ( -- co ) [ 10 [ over coyield 2drop ] each f swap coyield ] 
>> cocreate ;
>> : run ( co -- ) f swap coresume [ run ] [ drop ] if ;
>> 
>> [ gen run ] time
> 
> 
> But, this code doesn't seem to work in modern Factor.
> So I tried to avoid errors, but it doesn't work as I expected and seems wrong.

It seems that another person had the same question as me.
[Factor-talk] Working with Coroutines?

<https://www.mail-archive.com/factor-talk@lists.sourceforge.net/msg03332.html>

Today, I came up with the following code:

: gen ( -- co )
[
drop 10  [ coyield* ] each
f coterminate
] cocreate ;

gen [ dup *coresume dup ] [ drop ] while 2drop


I think this idea is working well. (But to tell the truth, I still don't know 
much about coroutine.)

IN: scratchpad USE: coroutines
: gen10 ( -- co )
[
drop 10  [ coyield* ] each
f coterminate
] cocreate ;

gen10 [ dup *coresume dup ] [ . ] while 2drop

Loading resource:extra/coroutines/coroutines.factor
Loading resource:extra/coroutines/coroutines-docs.factor
0
1
2
3
4
5
6
7
8
9
IN: scratchpad 

This code purposely creates a double virtual sequence that doesn't make much 
sense, but it gives me a foothold to understand coroutine.

Sometimes I've come across the explanation that the slow speed of Factor's 
"Continuation" makes it expensive to execution of "Exception Handling" "Escape" 
and "Coroutine".
Is it impossible to make Factor's continuation faster?
For example, do you think Factor's continuation will be faster if continuation 
tuples do not hold `data`, `call`, `retain`, `name`, and `catch` stacks, but VM 
manages multiple areas of a pair and switches between them?

--
KUSUMOTO Norio



___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] Factor and Python's generator

2020-03-04 Thread KUSUMOTO Norio
Hello all,


I'm looking at how features written in Python's generator can be implemented 
with Factor.
I found such an example in the mailing list archive.

<https://www.mail-archive.com/factor-talk@lists.sourceforge.net/msg00392.html>
<https://www.mail-archive.com/factor-talk@lists.sourceforge.net/msg00394.html>

> def gen():
> for i in xrange(10**5):
> yield i
> 
> for i in gen():
> pass


> "libs/coroutines" require
> USE: coroutines
> : gen ( -- co ) [ 10 [ over coyield 2drop ] each f swap coyield ] 
> cocreate ;
> : run ( co -- ) f swap coresume [ run ] [ drop ] if ;
> 
> [ gen run ] time


But, this code doesn't seem to work in modern Factor.
So I tried to avoid errors, but it doesn't work as I expected and seems wrong.


USE: coroutines
: gen ( -- co ) [ 10  [ over coyield 2drop ] each f swap coyield ] 
cocreate ;
: run ( co -- ) f swap coresume dup [ run ] [ drop ] if ;

IN: scratchpad [ gen run ] time
Running time: 0.000414741 seconds


How should I change that?



--
KUSUMOTO Norio





___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Search time on Windows Factor

2020-02-07 Thread KUSUMOTO Norio

> 2020/02/08 0:16、John Benediktsson のメール:
> 
> It's worth investigating, for sure.
> 
> The time is largely taken up by this:
> 
> IN: scratchpad gc [ "" disk-vocabs-recursive-for-prefix ] time
> 
> If you want to make a GitHub issue we can track the conversation and 
> improvements.
> 
> Perhaps some of our directory traversal code could be improved in Windows.


I understand. I'll report that as an issue.


--
KUSUMOTO Norio



___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] Search time on Windows Factor

2020-02-06 Thread KUSUMOTO Norio
Hello, everyone.

When I launch Windows Factor and do my first search in the browser, it takes 
quite a long time to get results. It seems that Factor start reading the files 
it 
needs to search at the timing.
Mac Factor, on the other hand, seems to have done this already, and will 
quickly 
display the first search result.

Why are there differences between platforms? Is there a way to do a quick first 
search with windows Factor?

--
KUSUMOTO Norio







___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] logica -- a prolog-like library

2019-11-03 Thread KUSUMOTO Norio
I renamed this library "factlog".

"factlog" may not be as cool as "Factual" or "Triceratops", but I thought
it was great because someone could guess what it was like when he saw it.

Thanks, Jack.


factlog, subset-Prolog-like DSL running on Factor

<https://github.com/kusumotonorio/factlog>

--
KUSUMOTO Norio



> 2019/11/01 21:05、KUSUMOTO Norio のメール:
> 
> Hi, Jack.
> 
> 
> 2019/10/31 22:32、Jack Lucas via Factor-talk 
> のメール:
>> 
>> -- Factual
>> 
>> -- Factlog
> 
> Both are good! Thank you.
> 
> 
>> And keeping with the dinosaur motif
>> 
>> -- Solvasaurus 
> 
> I like Triceratops. What kind of dinosaur looks smart? ;-)
> 
> I am interested in your comment that you may port miniKanren to Factor.
> It would be great if this library could help with some of your plans,
> and if you decide to port miniKanren separately from this library,
> I hope I could help in some way.
> 
> Oh, and I'm also looking forward to writing your book.
> 
> --
> KUSUMOTO Norio
> 
> 
> 
> 
> 
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk



___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] logica -- a prolog-like library

2019-11-01 Thread KUSUMOTO Norio
Hi, Jack.


2019/10/31 22:32、Jack Lucas via Factor-talk 
のメール:
> 
> -- Factual
> 
> -- Factlog

Both are good! Thank you.


> And keeping with the dinosaur motif
> 
> -- Solvasaurus 

I like Triceratops. What kind of dinosaur looks smart? ;-)

I am interested in your comment that you may port miniKanren to Factor.
It would be great if this library could help with some of your plans,
and if you decide to port miniKanren separately from this library,
I hope I could help in some way.

Oh, and I'm also looking forward to writing your book.

--
KUSUMOTO Norio





___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] logica -- a prolog-like library

2019-10-31 Thread KUSUMOTO Norio
Happy Halloween!

I stopped using Latin words and replaced them with English words and symbols.

The name of the vocabulary is still "logica" but I might have to replace it. :-)
I would like to ask you to add it to extra when I'm sure that this library is 
working as planned, but I hesitate to use the name "logic" in it. 
I hope it is not too long and there is a suitable name.

--
KUSUMOTO Norio



___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] logica -- a prolog-like library

2019-10-12 Thread KUSUMOTO Norio
> "semper" means "always" in Latin.
> 
> Semper avarus eget.
> 
> https://eudict.com/?lang=lateng=semper%20avarus%20eget

I use some Latin words because the person who wrote this original logic engine 
used the Latin `si` and I respected him.

It's also because it's an embedded language, so I wanted to use words that 
would not normally be used in factors.

--
KUSUMOTO Norio



> 2019/10/12 21:10、KUSUMOTO Norio のメール:
> 
> 
> 
>> 2019/10/12 20:27、Alexander Ilin のメール:
>> 
>> I like the idea, and I will definitely keep in mind that such a thing 
>> exists, but at the moment don't have a use for it.
>> 
>> The words like "semper", etc. - is there a tradition behind it? I've never 
>> seen such terminology in computing before.
> 
> Oh, did that mean that? That is a problem.
> 
> "semper" means "always" in Latin.
> 
> Semper avarus eget.
> 
> https://eudict.com/?lang=lateng=semper%20avarus%20eget
> 
> 
> 
> --
> KUSUMOTO Norio
> 
> 
> 
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk



___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] logica -- a prolog-like library

2019-10-12 Thread KUSUMOTO Norio


> 2019/10/12 20:27、Alexander Ilin のメール:
> 
>  I like the idea, and I will definitely keep in mind that such a thing 
> exists, but at the moment don't have a use for it.
> 
>  The words like "semper", etc. - is there a tradition behind it? I've never 
> seen such terminology in computing before.

Oh, did that mean that? That is a problem.

"semper" means "always" in Latin.

Semper avarus eget.

https://eudict.com/?lang=lateng=semper%20avarus%20eget



--
KUSUMOTO Norio



___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] logica -- a prolog-like library

2019-10-12 Thread KUSUMOTO Norio
Hello everyone.


I wrote an explanation about logica.

<https://github.com/kusumotonorio/logica>

I would appreciate it if you could give me your opinions and comments.

Also, I would appreciate it if you could think about how to use it. ;-)

--
KUSUMOTO Norio



> 2019/10/03 21:40、KUSUMOTO Norio のメール:
> 
> logica is a library that implements the functionality of a subset of Prolog.
> It's still in the making and there's no documentation. Some features are 
> written, but not tried, or not implemented well.
> 
> However, it has been confirmed that it works meaningfully to some extent, 
> so I make the repository public as it is now.
> 
> <https://github.com/kusumotonorio/logica>
> 
> logica is a port from tiny_prolog and its descendants, ruby-prolog.
> 
> 
> For example, to solve a zebra puzzle 
> ( <https://rosettacode.org/wiki/Zebra_puzzle> ) :
> 
> 
> USING: locica logica.test.zebra ;
> { houseso Hs X Y } query .
> 
> 
> --
> KUSUMOTO Norio
> 
> 
> 



___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Escapable each

2019-10-05 Thread KUSUMOTO Norio
Ouch, I correct the previous statement.

> 2019/10/05 10:44、KUSUMOTO Norio のメール:
> 
> Leave the code using while instead of nfind until the corresponding 
> code is included in the release build.


*I* leave the code using while instead of nfind until the corresponding 
code is included in the release build.

--
KUSUMOTO Norio



___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Escapable each

2019-10-04 Thread KUSUMOTO Norio
Thank you for your quick response, John.

Leave the code using while instead of nfind until the corresponding 
code is included in the release build.

--
KUSUMOTO Norio



> 2019/10/05 10:20、John Benediktsson のメール:
> 
> This works in the non-optimizing compiler (for example, the Listener):
> 
> 3 [ f ] times
> 
> But not in the optimizing compiler.  I pushed a quick fix that makes your 
> word work:
> 
> https://github.com/factor/factor/commit/e17b9119293783728e193b29856d81ba5862c8eb
> 
> 



___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Escapable each

2019-10-04 Thread KUSUMOTO Norio
I would like to use nfind as an escapable 2each, but I'm in trouble.
I simplified the problem as follows:

In scratchpad, when I input:

USE: sequences.generalizations
{ 1 2 3 4 5 } { 5 4 3 2 1 } [ > ] 2 nfind

get:

--- Data stack:
3
4
2

And I define nfind-test and use it:

: nfind-test ( x y -- i/f elt1 elt2 ) [ > ] 2 nfind ;
{ 1 2 3 4 5 } { 5 4 3 2 1 } nfind-test 

But I receive an error:

The word nfind-test cannot be executed because it failed to compile

The input quotation to “times” doesn't match its expected effect
Input Expected   Got
[ f ] ( ... -- ... ) ( -- x )


What am I wrong?


--
KUSUMOTO Norio



___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] logica -- a prolog-like library

2019-10-03 Thread KUSUMOTO Norio
logica is a library that implements the functionality of a subset of Prolog.
It's still in the making and there's no documentation. Some features are 
written, but not tried, or not implemented well.

However, it has been confirmed that it works meaningfully to some extent, 
so I make the repository public as it is now.

<https://github.com/kusumotonorio/logica>

logica is a port from tiny_prolog and its descendants, ruby-prolog.


For example, to solve a zebra puzzle 
( <https://rosettacode.org/wiki/Zebra_puzzle> ) :


USING: locica logica.test.zebra ;
{ houseso Hs X Y } query .


--
KUSUMOTO Norio





___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Escapable each

2019-10-02 Thread KUSUMOTO Norio

> 2019/10/02 23:07、Alexander Ilin のメール:
> 
> I like the LGBT reference, well done! : )


Oh, that's true. :-)


--
KUSUMOTO Norio





___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Escapable each

2019-10-02 Thread KUSUMOTO Norio
> 2019/10/02 22:23、John Benediktsson のメール:
> 
> Any desire to make it available for others to use?

Yes, of course!


--
KUSUMOTO Norio





___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Escapable each

2019-10-02 Thread KUSUMOTO Norio
 2019/09/23 18:03、Alexander Ilin のメール:
> 
> 
> Have you used the `backtrack` vocab for this?
> https://re-factor.blogspot.com/2015/06/send-more-money.html

I ported a Prolog program to solve the same puzzle.



USING: logica lists assocs sequences kernel math
locals formatting io ;
IN: logica.test.money

LOGIC-PREDS: sumo sum1o digitsumo delo nonzeroo donaldo moneyo ;
LOGIC-VARS: S E N D M O R Y A L G B T
N1 N2 C C1 C2 D1 D2 L1
Digits Digs Digs1 Digs2 Digs3 ;

{ sumo N1 N2 N } {
{ sum1o N1 N2 N 0 0 L{ 0 1 2 3 4 5 6 7 8 9 } __ }
} si

{ sum1o L{ } L{ } L{ } 0 0 Digits Digits } semper
{ sum1o [ D1 N1 cons ] [ D2 N2 cons ] [ D N cons ] C1 C Digs1 Digs } {
{ sum1o N1 N2 N C1 C2 Digs1 Digs2 }
{ digitsumo D1 D2 C2 D C Digs2 Digs }
} si

{ digitsumo D1 D2 C1 D C Digs1 Digs } {
{ delo D1 Digs1 Digs2 }
{ delo D2 Digs2 Digs3 }
{ delo D Digs3 Digs }
[ [ [ D1 of ] [ D2 of ] [ C1 of ] tri + + ] S is ]
[ [ S of 10 mod ] D is ]
[ [ S of 10 / >integer ] C is ]
} si

{ delo A L L } { { nonvaro A } | } si
{ delo A [ A L cons ] L } semper
{ delo A [ B L cons ] [ B L1 cons ] } { delo A L L1 } si


{ moneyo L{ 0 S E N D }
 L{ 0 M O R E }
 L{ M O N E Y }
} semper

{ donaldo  L{ D O N A L D }
   L{ G E R A L D }
   L{ R O B E R T } 
} semper

:: S-and-M-can't-be-zero ( seq -- seq' )
seq [| hash |
 1 hash N1 of list>array nth 0 = not
 1 hash N2 of list>array nth 0 = not and
] filter ;

:: print-puzzle ( hash-array -- )
hash-array
[| hash |
 "   " printf hash N1 of list>array [ "%d " printf ] each nl
 "+  " printf hash N2 of list>array [ "%d " printf ] each nl
 "" printf nl
 "   " printf hash N  of list>array [ "%d " printf ] each nl nl
] each ;




IN: scratchpad [ { { moneyo N1 N2 N } { sumo N1 N2 N } } query
  S-and-M-can't-be-zero
  print-puzzle
] time
   0 9 5 6 7 
+  0 1 0 8 5 

   1 0 6 5 2 

Running time: 0.320353468 seconds


--
KUSUMOTO Norio



___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Generating symbols at runtime

2019-09-27 Thread KUSUMOTO Norio
Oh, the single underline was used in 'fry' vocab. 
I consider using a double underline to represent anonymous variables...

--
KUSUMOTO Norio


> 2019/09/19 7:21、KUSUMOTO Norio  のメール:
> 
>> Yep, you can also use the syntax for it:
>> 
>> << { "foo "bar" "baz" } [ create-word-in define-symbol ] each >>
> 
> 
> 
> Thank you. 
> My program needs to make a symbol every time it finds '_'.
> It became as follows:
> 
> SYMBOL: *anonymouse-var-no* 0 *anonymouse-var-no* set-global
> 
> : reset-anonymouse-var-no ( -- )  0 *anonymouse-var-no* set-global ;
> 
> : inc-anonymouse-var-no ( -- ) 
>*anonymouse-var-no* get-global 1 + *anonymouse-var-no* set-global ;
> 
> : generate-anonymouse-var ( -- var-symbol )
>[
>inc-anonymouse-var-no
>*anonymouse-var-no* get-global "ANONYMOUSE-VAR-#%d_" sprintf
>"factor-logica" create-word dup dup
>define-symbol
>LOGIC-VAR swap set-global
>] with-compilation-unit ;
> 
> : replace-anonymouse-vars ( before -- after )
>{
>{ [ dup _ = ] [ drop generate-anonymouse-var ] }
>{ [ dup sequence? ] [ [ replace-anonymouse-vars ] map ] }
>{ [ dup tuple? ] [
>  [ class-of 1array ] [ tuple-slots ] bi
>  [ replace-anonymouse-vars ] map append >tuple ] }
>[ ]
>} cond ;
> 
> --
> KUSUMOTO Norio



___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Escapable each

2019-09-23 Thread KUSUMOTO Norio
> 2019/09/23 18:03、Alexander Ilin のメール:
> 
> Have you used the `backtrack` vocab for this?
> https://re-factor.blogspot.com/2015/06/send-more-money.html

No, I didn't. I didn't know it.

This my liblary is a port from tiny_prolog and its descendants, ruby-prolog.
https://github.com/preston/ruby-prolog

The current number of lines, including a few built-in predicates, is 450.


--
KUSUMOTO Norio






___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Escapable each

2019-09-23 Thread KUSUMOTO Norio

> 2019/09/22 20:21、Alexander Ilin のメール:
> 
> I use `loop` or `while`, depending on the details.

Hello. Thank you for your answer.

I rewrote my program using `loop 'and `while'. The library I'm currently 
building is an extended port from Ruby's one, and I used `with-return`
to mimic the code. 

The use of `with-return` in this code, which does a lot of repetition, 
seems to have been a very bad choice. 
The zebra puzzle is now running about 20 times faster than before.


USING: factor-logica lists ;
IN: factor-logica.test.zebra
LOGIC-PREDS: houseso neighboro zebrao watero nexto lefto ;
LOGIC-VARS: Hs A B Ls X Y ;
SYMBOLS: red blue green white yellow ;
SYMBOLS: english swede dane norwegian german ;
SYMBOLS: dog cat birds horse zebra ;
SYMBOLS: tea coffee beer milk water ;
SYMBOLS: pall-mall dunhill blue-master prince blend ;
TUPLE: house color nationality drink smoke pet ;

{ houseso Hs X Y } {
{ (=) Hs L{! #1
  T{ house f _ norwegian _ _ _ }   ! #10
  T{ house f blue _ _ _ _ }! #15
  T{ house f _ _ milk _ _ } _ _ } }! #9
{ membero T{ house f red english _ _ _ } Hs }  ! #2
{ membero T{ house f _ swede _ _ dog } Hs }! #3
{ membero T{ house f _ dane tea _ _ } Hs } ! #4
{ lefto T{ house f green _ _ _ _ } T{ house f white _ _ _ _ } Hs } ! #5
{ membero T{ house f green _ coffee _ _ } Hs } ! #6
{ membero T{ house f _ _ _ pall-mall birds } Hs }  ! #7
{ membero T{ house f yellow _ _ dunhill _ } Hs }   ! #8
{ nexto T{ house f _ _ _ blend _ } T{ house f _ _ _ _ cat } Hs }   ! #11
{ nexto T{ house f _ _ _ dunhill _ } T{ house f _ _ _ _ horse } Hs }   ! #12
{ membero T{ house f _ _ beer blue-master _ } Hs } ! #13
{ membero T{ house f _ german _ prince _ } Hs }! #14
{ nexto T{ house f _ _ water _ _ } T{ house f _ _ _ blend _ } Hs } ! #16
{ membero T{ house f _ X water _ _ } Hs }
{ membero T{ house f _ Y _ _ zebra } Hs }
} si

{ nexto A B Ls } {
{ appendo _ [ A B _ cons cons ] Ls } vel
{ appendo _ [ B A _ cons cons ] Ls }
} si

{ lefto A B Ls } { appendo _ [ A B _ cons cons ] Ls } si


IN: scratchpad  { houseso Hs X Y } query .
{
H{
{
Hs
L{
T{ house
{ color yellow }
{ nationality norwegian }
{ drink water }
{ smoke dunhill }
{ pet cat }
}
T{ house
{ color blue }
{ nationality dane }
{ drink tea }
{ smoke blend }
{ pet horse }
}
T{ house
{ color red }
{ nationality english }
{ drink milk }
{ smoke pall-mall }
{ pet birds }
}
T{ house
{ color green }
{ nationality german }
{ drink coffee }
{ smoke prince }
{ pet zebra }
}
T{ house
{ color white }
{ nationality swede }
{ drink beer }
{ smoke blue-master }
{ pet dog }
}
}
}
{ X norwegian }
{ Y german }
}
}
IN: scratchpad [ 1000 [ { houseso Hs X Y } query drop ] times ] time

Running time: 20.393989632 seconds

--
KUSUMOTO Norio





___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Escapable each

2019-09-22 Thread KUSUMOTO Norio
> 2019/09/22 22:41、Doug Coleman のメール:
> 
> You can use 'find' itself as an 'each'. Do whatever you each would do before 
> checking the stop condition and return true when your stop condition is met. 
> Then drop what you found if you don't need it.


That's true! I was bound by the impression I got from Word's name.




--
KUSUMOTO Norio



___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] Escapable each

2019-09-22 Thread KUSUMOTO Norio
Hello all,


'each 'and' 2each 'are very useful for writing iterative processes, but 
sometimes 
I want to get out of a process before repeating it to the end under certain 
conditions.

I think it would be possible to write such a combinator because 'find' stops 
iterating 
when it finds something that satisfies the condition, but I don't know how to 
write
'each' that can escape.

What code do you write for such a process?
I use 'with-return' to handle such situations. But I suspect it's costing time.

--
KUSUMOTO Norio





___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Generating symbols at runtime

2019-09-19 Thread KUSUMOTO Norio
> 2019/09/19 11:21、John Benediktsson のメール:
> 
> Some small simplifications using ``counter`` and ``slots>tuple``:

These are nice!
Thanks, Jhon. I'll use them.


My code was heavy and confused about what was "anonymous variable".
So I change it as follow:


SYMBOL: *anonymouse-var-no*

: reset-anonymouse-var-no ( -- )  0 *anonymouse-var-no* set-global ;

: var-for-'_' ( -- var-symbol )
[
*anonymouse-var-no* counter "ANONYMOUSE-VAR%d_" sprintf
"factor-logica" create-word dup dup
define-symbol
LOGIC-VAR swap set-global
] with-compilation-unit ;

: replace-'_' ( before -- after )
{
{ [ dup _ = ] [ drop var-for-'_' ] }
{ [ dup sequence? ] [ [ replace-'_' ] map ] }
{ [ dup tuple? ] [
  [ tuple-slots [ replace-'_' ] map ]
  [ class-of slots>tuple ] bi ] }
[ ]
} cond ;

--
KUSUMOTO Norio



___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Generating symbols at runtime

2019-09-18 Thread KUSUMOTO Norio
> Yep, you can also use the syntax for it:
> 
> << { "foo "bar" "baz" } [ create-word-in define-symbol ] each >>



Thank you. 
My program needs to make a symbol every time it finds '_'.
It became as follows:

SYMBOL: *anonymouse-var-no* 0 *anonymouse-var-no* set-global

: reset-anonymouse-var-no ( -- )  0 *anonymouse-var-no* set-global ;

: inc-anonymouse-var-no ( -- ) 
*anonymouse-var-no* get-global 1 + *anonymouse-var-no* set-global ;

: generate-anonymouse-var ( -- var-symbol )
[
inc-anonymouse-var-no
*anonymouse-var-no* get-global "ANONYMOUSE-VAR-#%d_" sprintf
"factor-logica" create-word dup dup
define-symbol
LOGIC-VAR swap set-global
] with-compilation-unit ;

: replace-anonymouse-vars ( before -- after )
{
{ [ dup _ = ] [ drop generate-anonymouse-var ] }
{ [ dup sequence? ] [ [ replace-anonymouse-vars ] map ] }
{ [ dup tuple? ] [
  [ class-of 1array ] [ tuple-slots ] bi
  [ replace-anonymouse-vars ] map append >tuple ] }
[ ]
} cond ;

--
KUSUMOTO Norio



___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Generating symbols at runtime

2019-09-17 Thread KUSUMOTO Norio
> How do I code to generate symbols at runtime? "define-symbol" seems to work 
> only at compile time.

Oh, I was able to do it as follows:

 [ "a-symbol" "factor-logica" create-word define-symbol ] with-compilation-unit


--
KUSUMOTO Norio



> 2019/09/17 19:40、KUSUMOTO Norio のメール:
> 
> Hello all,
> 
> 
> How do I code to generate symbols at runtime? "define-symbol" seems to work 
> only at compile time.
> 
> I'm writing an embedded language that runs on Factor with the capabilities of
> a subset of Prolog. To achieve the anonymous variable functionality, I want to
> generate as many symbols as needed at runtime.
> 
> In the following code, the Prolog anonymous variables '_' are equivalent
> to explicitly generated N1 to N11 logical variables. I want to automate
> that operation.
> 
> 
> USING: actor-logica factor-logica.built-in lists ;
> 
> ! Do the same as this Prolog program
> !
> ! neighbor(L,R,[L,R|_]).
> ! neighbor(L,R,[_|Xs]) :- neighbor(L,R,Xs).
> !
> ! zebra(X) :- Street = [H1,H2,H3],
> ! member(house(red,english,_), Street),
> ! member(house(_,spanish,dog), Street),
> ! neighbor(house(_,_,cat), house(_,japanese,_), Street),
> ! neighbor(house(_,_,cat), house(blue,_,_), Street),
> ! member(house(_,X,zebra),Street).
> 
> LOGIC-PREDS: neighboro zebrao ;
> LOGIC-VARS: L R X Xs H1 H2 H3 Street ;
> LOGIC-VARS: N1 N2 N3 N4 N5 N6 N7 N8 N9 N10 N11 ;
> SYMBOLS: red blue ;
> SYMBOLS: english spanish japanese ;
> SYMBOLS: dog cat zebra ;
> TUPLE: house color nationality pet ;
> 
> { neighboro L R [ L R N1 cons cons ] } semper
> { neighboro L R [ N1 Xs cons ] } { neighboro L R Xs } si
> 
> { zebrao X } {
>{ (=) Street [ { H1 H2 H3 } >list ] }
>{ membero [ T{ house f red english N1 } ] Street }
>{ membero [ T{ house f N2 spanish dog } ] Street }
>{ neighboro [ T{ house f N3 N4 cat } ] [ T{ house f N5 japanese N6 } ]  
> Street }
>{ neighboro [ T{ house f N7 N8 cat } ] [ T{ house f blue N9 N10 } ] Street 
> }
>{ membero [ T{ house f N11 X zebra } ] Street }
> } si
> 
> 
> Loading resource:work/factor-logica/factor-logica.factor
> Loading resource:work/factor-logica/built-in/built-in.factor
> IN: scratchpad { zebrao X } query .
> { H{ { X japanese } } H{ { X japanese } } }
> 
> 
> --
> KUSUMOTO Norio
> 
> 
> 
> 
> 
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk



___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] Generating symbols at runtime

2019-09-17 Thread KUSUMOTO Norio
Hello all,


How do I code to generate symbols at runtime? "define-symbol" seems to work 
only at compile time.

I'm writing an embedded language that runs on Factor with the capabilities of
a subset of Prolog. To achieve the anonymous variable functionality, I want to
generate as many symbols as needed at runtime.

In the following code, the Prolog anonymous variables '_' are equivalent
to explicitly generated N1 to N11 logical variables. I want to automate
that operation.


USING: actor-logica factor-logica.built-in lists ;

! Do the same as this Prolog program
!
! neighbor(L,R,[L,R|_]).
! neighbor(L,R,[_|Xs]) :- neighbor(L,R,Xs).
!
! zebra(X) :- Street = [H1,H2,H3],
! member(house(red,english,_), Street),
! member(house(_,spanish,dog), Street),
! neighbor(house(_,_,cat), house(_,japanese,_), Street),
! neighbor(house(_,_,cat), house(blue,_,_), Street),
! member(house(_,X,zebra),Street).

LOGIC-PREDS: neighboro zebrao ;
LOGIC-VARS: L R X Xs H1 H2 H3 Street ;
LOGIC-VARS: N1 N2 N3 N4 N5 N6 N7 N8 N9 N10 N11 ;
SYMBOLS: red blue ;
SYMBOLS: english spanish japanese ;
SYMBOLS: dog cat zebra ;
TUPLE: house color nationality pet ;

{ neighboro L R [ L R N1 cons cons ] } semper
{ neighboro L R [ N1 Xs cons ] } { neighboro L R Xs } si

{ zebrao X } {
{ (=) Street [ { H1 H2 H3 } >list ] }
{ membero [ T{ house f red english N1 } ] Street }
{ membero [ T{ house f N2 spanish dog } ] Street }
{ neighboro [ T{ house f N3 N4 cat } ] [ T{ house f N5 japanese N6 } ]  
Street }
{ neighboro [ T{ house f N7 N8 cat } ] [ T{ house f blue N9 N10 } ] Street }
{ membero [ T{ house f N11 X zebra } ] Street }
} si


Loading resource:work/factor-logica/factor-logica.factor
Loading resource:work/factor-logica/built-in/built-in.factor
IN: scratchpad { zebrao X } query .
{ H{ { X japanese } } H{ { X japanese } } }


--
KUSUMOTO Norio





___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Building an Image File

2019-09-11 Thread KUSUMOTO Norio
Thank you very much. The information you gave me solved my problem.

--
KUSUMOTO Norio



> 2019/09/11 0:15、Doug Coleman のメール:
> 
> make-my-image
> make-images
> 


___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] Building an Image File

2019-09-10 Thread KUSUMOTO Norio
Hello, everyone.


Is it possible to build an image file by myself, for example, by executing some 
word?
The image file I'm using seems to have gone wrong.

--
KUSUMOTO Norio





___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Transparent background texts and Windows Factor

2019-06-08 Thread KUSUMOTO Norio

> 2019/06/08 20:04、Alexander Ilin のメール:
> 
>  Then I incorporated the optimizations suggested by Jonh Benediktsson, and 
> here are the new results from commit fa57d052:
>  Opaque background: 143 ms
>  Transparent background: 150 ms
> 
>  In general, the Transparent test runs about 6-7 ms longer than the Opaque 
> test, i.e. about 4.6% slower, which is a much better performance 
> characteristic compared to the previous approaches.
> 
>  The updated code is posted here: 
> https://github.com/AlexIljin/factor/tree/win-transparent-text-background


How wonderful!

If it's this fast, it shouldn't be a problem in terms of speed to implement 
imperfectly 
transparent foreground text.

--
KUSUMOTO Norio





___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Transparent background texts and Windows Factor

2019-06-08 Thread KUSUMOTO Norio
Ouch, an e-mail wasn't sent to the mailing list because I sent it direct.
I rewrite the wrong part and send it again.

On 2019/06/05 22:24, John Benediktsson wrote:
> Or clear the cache each time, so you don’t have to be lower level code...
>> On Jun 5, 2019, at 4:24 AM, Alexander Ilin wrote: I think 
>> the pairs of {font, string} are cached and only drawn once by the GUI 
>> framework. I think you need to call the drawing code more directly to get 
>> real performance data.

Thank you, Alexander and John.
I decided to measure only internal processing time.

On my machine, my code took 9 to 10 times longer to make a text image with a 
transparent background
than it did with an opaque background.


! Copyright (C) 2019 KUSUMOTO Norio.
! See http://factorcode.org/license.txt for BSD license.
USING: kernel accessors locals math formatting ui ui.gadgets.labels
ui.commands ui.gadgets ui.gadgets.toolbar ui.gadgets.tracks ui.gestures
fonts colors tools.time memory math.ranges namespaces arrays sequences
windows.uniscribe windows.uniscribe.private ;
IN: uni-bench

TUPLE: uni-bench-gadget < track
opaque-font
transparent-font
opaque-time
transparent-time ;

:  ( -- gadget )
vertical uni-bench-gadget new-track

"monospace" >>name
T{ rgba f 0.0 0.0 0.0 1.0 } >>foreground
T{ rgba f 0.0 0.0 1.0 1.0 } >>background
36 >>size
>>opaque-font

"monospace" >>name
T{ rgba f 0.0 0.0 0.0 1.0 } >>foreground
T{ rgba f 0.0 0.0 1.0 0.0 } >>background
36 >>size
>>transparent-font
{
"  script-string>image "
""
"  Press any of the keys listed below"
""
"1: Opaque background \"\" (1000 times)"
"2: Transparent background \"\" (1000 times)  "
""
}  f track-add
""  >>opaque-time
""  >>transparent-time
dup opaque-time>> " Opaque background:" label-on-left f track-add
dup transparent-time>> " Transparent:background" label-on-left f track-add ;

:: com-benchmark-opaque-script-string>image ( gadget -- )
gadget opaque-font>> :> test-font
gc
[
1000 [
test-font ""  script-string>image drop
] times
] benchmark
gadget opaque-time>>
swap 100 / "%d ms" sprintf >>text relayout-1 ;

:: com-benchmark-transparent-script-string>image ( gadget -- )
gadget transparent-font>> :> test-font
gc
[
1000 [
test-font ""  script-string>image drop
] times
] benchmark
gadget transparent-time>>
swap 1000000 / "%d ms" sprintf >>text relayout-1 ;

uni-bench-gadget "gestures" f {
{ T{ key-down { sym "1" } } com-benchmark-opaque-script-string>image }
{ T{ key-down { sym "2" } } com-benchmark-transparent-script-string>image }
} define-command-map

MAIN-WINDOW: uni-bench { { title "Uniscribe benchmark" } }
 >>gadgets ;
--
KUSUMOTO Norio





> 2019/06/05 22:24、John Benediktsson  のメール:
> 
> Or clear the cache each time, so you don’t have to be lower level code...
> 
> 
>> On Jun 5, 2019, at 4:24 AM, Alexander Ilin  wrote:
>> 
>> I think the pairs of {font, string} are cached and only drawn once by the 
>> GUI framework.
>> I think you need to call the drawing code more directly to get real 
>> performance data.
>> 
>> 04.06.2019, 07:39, "KUSUMOTO, Norio" :
>>> My code was uploaded.
>>> 
>>> https://github.com/kusumotonorio/factor/blob/win-transparent-background-text/basis/windows/uniscribe/uniscribe.factor
>>> 
>>> I want to know how slow the code when it draws transparent background
>>> texts. So I am writing
>>> a test app to know it. But it has an issue.
>>> I try to measure time by actually drawing a label with a transparent
>>> background over and over again, and that happens very quickly.
>>> Creating an image from text takes a long time (3: and 4:) , so it should
>>> actually take longer.
>>> What's wrong with my code?
>>> 
>>> ! Copyright (C) 2019 KUSUMOTO Norio.
>>> ! See http://factorcode.org/license.txt for BSD license.
>>> USING: kernel accessors locals math formatting ui ui.gadgets.labels
>>> ui.commands ui.gadgets ui.gadgets.toolbar ui.gadgets.tracks ui.gestures
>>> fonts colors tools.time memory math.ranges namespaces arrays sequences
>>> windows.uniscribe windows.uniscribe.private ;
>>> IN: uni-ben

Re: [Factor-talk] Recourse to Composure

2019-06-06 Thread KUSUMOTO Norio
> 2019/06/06 21:15、Jack Lucas via Factor-talk 
> のメール:
> 
> (Fourth) Logic programming and basic AI.  I'll probably have to make a port 
> of mini-kanren into Factor.  

Hi,

I'm interested in Factor miniKanren. I am porting microKanren for Factor, but 
the work is 
interrupted with some difficulties. I'm starting to think that it would be 
better to port
Prolog to Factor. :-) 

--
KUSUMOTO Norio






___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Transparent background texts and Windows Factor

2019-06-03 Thread KUSUMOTO, Norio

My code was uploaded.

https://github.com/kusumotonorio/factor/blob/win-transparent-background-text/basis/windows/uniscribe/uniscribe.factor


I want to know how slow the code when it draws transparent background 
texts. So I am writing

a test app to know it. But it has an issue.
I try to measure time by actually drawing a label with a transparent 
background over and over again, and that happens very quickly.
Creating an image from text takes a long time (3: and 4:) , so it should 
actually take longer.

What's wrong with my code?


! Copyright (C) 2019 KUSUMOTO Norio.
! See http://factorcode.org/license.txt for BSD license.
USING: kernel accessors locals math formatting ui ui.gadgets.labels
ui.commands ui.gadgets ui.gadgets.toolbar ui.gadgets.tracks ui.gestures
fonts colors tools.time memory math.ranges namespaces arrays sequences
windows.uniscribe windows.uniscribe.private ;
IN: uni-bench

TUPLE: uni-bench-gadget < track
    opaque-label
    transparent-label
    opaque-time
    transparent-time ;

SYMBOL: test-strings
V{ } clone test-strings set-global
1 5000 [a,b]  [
    "%04d" sprintf test-strings get push
] each
test-strings get >array test-strings set-global

:  ( -- gadget )
    vertical uni-bench-gadget new-track
 {
 "  Press any of the keys listed below"
 ""
 "    1: Opaque background label (5000 times)"
 "    2: Transparent background label (5000 times)"
 "    3: Opaque script-string>image (5000 times)"
 "    4: Transparent script-string>image (5000 times)"
 ""
    }  f track-add

    ""  >>opaque-label
    ""  >>transparent-label
    ""  >>opaque-time
    ""  >>transparent-time

    dup opaque-label>>
    
    "monospace" >>name
    T{ rgba f 0.0 0.0 0.0 1.0 } >>foreground
    T{ rgba f 0.0 0.0 1.0 1.0 } >>background
    36 >>size
    >>font f track-add

    dup transparent-label>>
    
    "monospace" >>name
    T{ rgba f 0.0 0.0 0.0 1.0 } >>foreground
    T{ rgba f 0.0 0.0 1.0 0.0 } >>background
    36 >>size
    >>font f track-add

    dup opaque-time>> " Opaque:" label-on-left f track-add
    dup transparent-time>> " Transparent:" label-on-left f track-add ;

:: com-benchmark-opaque ( gadget -- )
    gadget opaque-label>> :> test-label
    gc
    [
    test-strings get-global [
    test-label swap >>text relayout-1
    ] each
    ] benchmark
    gadget opaque-time>>
    swap 100 / "%d ms" sprintf >>text relayout-1 ;

:: com-benchmark-transparent ( gadget -- )
    gadget transparent-label>> :> test-label
    gc
    [
    test-strings get-global [
    test-label swap >>text relayout-1
    ] each
    ] benchmark
    gadget transparent-time>>
    swap 100 / "%d ms" sprintf >>text relayout-1 ;


:: com-benchmark-opaque-script-string>image ( gadget -- )
    gadget opaque-label>> font>> :> test-font
    gc
    [
    test-strings get-global [
    test-font swap  script-string>image drop
    ] each
    ] benchmark
    gadget opaque-time>>
    swap 100 / "%d ms" sprintf >>text relayout-1 ;

:: com-benchmark-transparent-script-string>image ( gadget -- )
    gadget transparent-label>> font>> :> test-font
    gc
    [
    test-strings get-global [
    test-font swap  script-string>image drop
    ] each
    ] benchmark
    gadget transparent-time>>
    swap 100 / "%d ms" sprintf >>text relayout-1 ;


uni-bench-gadget "gestures" f {
    { T{ key-down { sym "1" } } com-benchmark-opaque }
    { T{ key-down { sym "2" } } com-benchmark-transparent }
    { T{ key-down { sym "3" } } com-benchmark-opaque-script-string>image }
    { T{ key-down { sym "4" } } 
com-benchmark-transparent-script-string>image }

} define-command-map

M: uni-bench-gadget pref-dim* drop { 300 250 } ;

MAIN-WINDOW: uni-bench { { title "Uniscribe benchmark" } }
     >>gadgets ;



On 2019/05/30 21:17, KUSUMOTO Norio wrote:
Thank you, Alexander! I will read it and study. I tried the idea I 
wrote earlier. I've only tried a little, but it seems to work well. 
Yay! <https://pbs.twimg.com/media/D70GEGkVUAUxgWb.png> -- KUSUMOTO Norio
2019/05/30 20:19、Alexander Ilin のメール: Hello! I 
think I have figured out the algorithm for the image processing. I'm 
not sure if it's the same one that you came up with. 
https://github.com/factor/factor/issues/152#issuecomment-497292323 
Also, I don't know if there are standard WinApi functions to perform 
the necessary operation, namely cop

Re: [Factor-talk] Transparent background texts and Windows Factor

2019-05-30 Thread KUSUMOTO Norio
Thank you, Alexander!
I will read it and study.

I tried the idea I wrote earlier. I've only tried a little, but it seems to 
work well.
Yay!

<https://pbs.twimg.com/media/D70GEGkVUAUxgWb.png>



--
KUSUMOTO Norio



> 2019/05/30 20:19、Alexander Ilin のメール:
> 
> Hello!
> 
>  I think I have figured out the algorithm for the image processing. I'm not 
> sure
>  if it's the same one that you came up with.
> 
>  https://github.com/factor/factor/issues/152#issuecomment-497292323
> 
>  Also, I don't know if there are standard WinApi functions to perform the
>  necessary operation, namely copying a color channel into the alpha
>  channel, but I suspect there might be, in which case we won't lose
>  performance there.
> 
> 30.05.2019, 03:50, "KUSUMOTO Norio" :
>> Although it seems that to transfer the appropriate data to the device 
>> context is
>> the 'right' solution, I have a hunch that it will be a difficult task.
>> So I am beginning to think that we should take another, a cheat, approach.
>> 
>> It's like a chroma key. Uniscribe draws text with a color background instead 
>> of
>> transparency, and a word replaces the color with transparency when converting
>> from the bitmap to an Factor's image.
>> 
>> It may be slow, but we don't have many chances to draw characters on a 
>> transparent
>> background. And for example, on a button label, once Factor creates an image 
>> with
>> such characters, Factor use the image again, so I think there are few 
>> problems.
>> 
>> This approach can localize changes. I can't define the word for image 
>> conversion to do
>> such a special action, but I think that it's not a difficult task for 
>> someone familiar with
>> image processing words.
> 
> 
> ---=--- 
> Александр
> 
> 
> 
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk



___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Transparent background texts and Windows Factor

2019-05-29 Thread KUSUMOTO Norio
Although it seems that to transfer the appropriate data to the device context 
is 
the 'right' solution, I have a hunch that it will be a difficult task.
So I am beginning to think that we should take another, a cheat, approach.

It's like a chroma key. Uniscribe draws text with a color background instead of 
transparency, and a word replaces the color with transparency when converting 
from the bitmap to an Factor's image. 

It may be slow, but we don't have many chances to draw characters on a 
transparent 
background. And for example, on a button label, once Factor creates an image 
with 
such characters, Factor use the image again, so I think there are few problems.
 
This approach can localize changes. I can't define the word for image 
conversion to do 
such a special action, but I think that it's not a difficult task for someone 
familiar with 
image processing words.


> 2019/05/30 1:59、Alexander Ilin  のメール:
> 
> Wow, you are making a very valuable contribution!
> Thank you very much for the effort you are making!
> 
> It would be really great to have a solution for this issue.
> 
> 29.05.2019, 05:39, "KUSUMOTO Norio" :
>> It seems that the direction to solve the problem is not wrong.
>> But, we will need to transfer the appropriate data with the appropriate 
>> offset to the device context
>> where Uniscribe writes a text.
>> 
>> <https://pbs.twimg.com/media/D7s4qrTXYAIk8WF.png>


--
KUSUMOTO Norio



___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Transparent background texts and Windows Factor

2019-05-28 Thread KUSUMOTO Norio
It seems that the direction to solve the problem is not wrong.
But, we will need to transfer the appropriate data  with the appropriate offset 
to the device context 
where Uniscribe writes a text.

<https://pbs.twimg.com/media/D7s4qrTXYAIk8WF.png>

--
KUSUMOTO Norio



___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Transparent background texts and Windows Factor

2019-05-28 Thread KUSUMOTO Norio
I seem to be a little too upset. I trusted machine translation too much. I'll 
fix it.


My guess seems to be correct. Uniscribe seems to be able to draw characters 
which have a transparent background on top of images transferred by BitBlt.

--
KUSUMOTO Norio



> 2019/05/28 22:27、KUSUMOTO Norio のメール:
> 
> My guess seems to be correct. Uniscribe seems to draw transparent characters 
> on top of images
> transferred via BitBlt.
> 



___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Transparent background texts and Windows Factor

2019-05-28 Thread KUSUMOTO Norio
I did it. 

My guess seems to be correct. Uniscribe seems to draw transparent characters on 
top of images
transferred via BitBlt.


USING: accessors alien.c-types alien.data colors images.viewer
io io.encodings.string io.encodings.utf16n io.styles kernel
literals math sequences ui ui.commands ui.gadgets
ui.gadgets.borders ui.gadgets.panes ui.gadgets.tracks
ui.gestures windows.gdi32 windows.offscreen windows.ole32
windows.types windows.usp10 locals fonts windows.fonts
windows.errors ;
IN: hello-uniscribe


! NOTE:  The following declarations are required in gdi32.factor
!
!FUNCTION: int SetBkMode ( HDC hdc, int iBkMode )
!FUNCTION: BOOL BitBlt ( HDC hdc, int x, int y, int cx, int cy, HDC 
hdcSrc, int x1, int y1, DWORD rop )


TUPLE: hello-gadget < track ;

:  ( -- gadget )
horizontal hello-gadget new-track
[
{ { font-size 24 } } [
"Hello" print
"Grüß dich" print
"здравствуйте" print
"こんにちは" print
"안녕하세요" print
"שָׁלוֹם " print
] with-style
] make-pane { 10 10 } 
f track-add ;

:: com-screen-shot ( gadget -- )
[ :> dc
  gadget dim>> dc
  [
  dc 0 0 gadget dim>> first2 gadget parent>> handle>> hDC>> 0 0 SRCCOPY 
BitBlt drop
  ] make-bitmap-image image-window
] with-memory-dc ;

CONSTANT: ssa-dwFlags flags{ SSA_GLYPHS SSA_FALLBACK SSA_TAB }

:: (com-screen-shot-with-text) ( gadget dim bkMode uOptions -- )
[ :> dc
  dim dc [ 
  dc sans-serif-font cache-font SelectObject win32-error=0/f
  dc T{ rgba f 0.0 1.0 1.0 0.0 } color>RGB SetBkColor drop
  dc T{ rgba f 0.0 0.0 1.0 1.0 } color>RGB SetTextColor drop
  dc bkMode SetBkMode drop

  dc 0 0 dim first2 gadget parent>> handle>> hDC>> 0 0 SRCCOPY BitBlt 
drop

  dc
  "Hello!"
  [ utf16n encode ] ! pString
  [ length ] bi ! cString
  dup 1.5 * 16 + >integer ! cGlyphs -- MSDN says this is "recommended 
size"
  -1 ! iCharset -- Unicode
  ssa-dwFlags
  0 ! iReqWidth
  f ! psControl
  f ! psState
  f ! piDx
  f ! pTabdef
  f ! pbInClass
  f void*  ! pssa
  [ ScriptStringAnalyse ] keep
  [ check-ole32-error ] [ |ScriptStringFree void* deref ] bi*
  
  0 ! iX
  0 ! iY
  uOptions
  { 0 0 } dim 
  0 ! iMinSel
  0 ! iMaxSel
  FALSE ! fDisabled
  ScriptStringOut check-ole32-error
  ] make-bitmap-image image-window
] with-memory-dc ;

: com-screen-shot-with-text-opaque ( gadget -- )
dup dim>> OPAQUE ETO_OPAQUE (com-screen-shot-with-text) ;

: com-screen-shot-with-text-transparent-1 ( gadget -- )
dup dim>> OPAQUE 0 (com-screen-shot-with-text) ;

: com-screen-shot-with-text-transparent-2 ( gadget -- )
dup dim>> TRANSPARENT ETO_OPAQUE (com-screen-shot-with-text) ;

: com-screen-shot-with-text-transparent-3 ( gadget -- )
dup dim>> TRANSPARENT 0 (com-screen-shot-with-text) ;

hello-gadget "gestures" f {
{ T{ key-down { sym "1" } } com-screen-shot }
{ T{ key-down { sym "2" } } com-screen-shot-with-text-opaque }
{ T{ key-down { sym "3" } } com-screen-shot-with-text-transparent-1 }
{ T{ key-down { sym "4" } } com-screen-shot-with-text-transparent-2 }
{ T{ key-down { sym "5" } } com-screen-shot-with-text-transparent-3 }
} define-command-map

MAIN-WINDOW: hello-uniscribe { { title "გამარჯობა, uniscribe" } }
 >>gadgets ;




> 2019/05/28 19:07、KUSUMOTO Norio のメール:
> 
> Hi Alexander,
> 
> 
>> 2019/05/28 15:20、Alexander Ilin のメール:
>> 
>> Is it possible to tell Uniscribe to render the text in white color?
>> If such text shows up on the black background, that would confirm part of 
>> the theory.
> 
> Nice Idea.
> I modified the code to whiten the device context given by with-memory-dc 
> using PatBlt.
> Uniscribe works well with transparent background text.
> The next step should be to use BitBlt.

--
KUSUMOTO Norio




___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Transparent background texts and Windows Factor

2019-05-28 Thread KUSUMOTO Norio
Hi Alexander,


> 2019/05/28 15:20、Alexander Ilin のメール:
> 
>  Is it possible to tell Uniscribe to render the text in white color?
>  If such text shows up on the black background, that would confirm part of 
> the theory.

Nice Idea.
I modified the code to whiten the device context given by with-memory-dc using 
PatBlt.
Uniscribe works well with transparent background text.
The next step should be to use BitBlt.




USING: accessors alien.c-types alien.data colors images.viewer
io io.encodings.string io.encodings.utf16n io.styles kernel
literals math sequences ui ui.commands ui.gadgets
ui.gadgets.borders ui.gadgets.panes ui.gadgets.tracks
ui.gestures windows.gdi32 windows.offscreen windows.ole32
windows.types windows.usp10 locals fonts windows.fonts
windows.errors ;
IN: hello-uniscribe


! NOTE:  The following declarations are required in gdi32.factor
!
!FUNCTION: int SetBkMode ( HDC hdc, int iBkMode )
!FUNCTION: BOOL PatBlt ( HDC hdc, int x, int y, int width, int height, 
DWORD rop )


TUPLE: hello-gadget < track ;

:  ( -- gadget )
horizontal hello-gadget new-track
[
{ { font-size 24 } } [
"Hello" print
"Grüß dich" print
"здравствуйте" print
"こんにちは" print
"안녕하세요" print
"שָׁלוֹם " print
] with-style
] make-pane { 10 10 } 
f track-add ;

:: com-screen-shot ( gadget -- )
[ :> dc
  gadget dim>> dc
  [
  dc 0 0 gadget dim>> first2  WHITENESS PatBlt drop
  ] make-bitmap-image image-window
] with-memory-dc ;

CONSTANT: ssa-dwFlags flags{ SSA_GLYPHS SSA_FALLBACK SSA_TAB }

:: (com-screen-shot-with-text) ( dim bkMode uOptions -- )
[ :> dc
  dim dc [ 
  dc sans-serif-font cache-font SelectObject win32-error=0/f
  dc T{ rgba f 0.0 1.0 1.0 0.0 } color>RGB SetBkColor drop
  dc T{ rgba f 0.0 0.0 1.0 1.0 } color>RGB SetTextColor drop
  dc bkMode SetBkMode drop

  dc 0 0 dim first2 WHITENESS PatBlt drop
  
  dc
  "Hello!"
  [ utf16n encode ] ! pString
  [ length ] bi ! cString
  dup 1.5 * 16 + >integer ! cGlyphs -- MSDN says this is "recommended 
size"
  -1 ! iCharset -- Unicode
  ssa-dwFlags
  0 ! iReqWidth
  f ! psControl
  f ! psState
  f ! piDx
  f ! pTabdef
  f ! pbInClass
  f void*  ! pssa
  [ ScriptStringAnalyse ] keep
  [ check-ole32-error ] [ |ScriptStringFree void* deref ] bi*
  
  0 ! iX
  0 ! iY
  uOptions
  { 0 0 } dim 
  0 ! iMinSel
  0 ! iMaxSel
  FALSE ! fDisabled
  ScriptStringOut check-ole32-error
  ] make-bitmap-image image-window
] with-memory-dc ;

: com-screen-shot-with-text-opaque ( gadget -- )
dim>> OPAQUE ETO_OPAQUE (com-screen-shot-with-text) ;

: com-screen-shot-with-text-transparent-1 ( gadget -- )
dim>> OPAQUE 0 (com-screen-shot-with-text) ;

: com-screen-shot-with-text-transparent-2 ( gadget -- )
dim>> TRANSPARENT ETO_OPAQUE (com-screen-shot-with-text) ;

: com-screen-shot-with-text-transparent-3 ( gadget -- )
dim>> TRANSPARENT 0 (com-screen-shot-with-text) ;

hello-gadget "gestures" f {
{ T{ key-down { sym "1" } } com-screen-shot }
{ T{ key-down { sym "2" } } com-screen-shot-with-text-opaque }
{ T{ key-down { sym "3" } } com-screen-shot-with-text-transparent-1 }
{ T{ key-down { sym "4" } } com-screen-shot-with-text-transparent-2 }
{ T{ key-down { sym "5" } } com-screen-shot-with-text-transparent-3 }
} define-command-map

MAIN-WINDOW: hello-uniscribe { { title "გამარჯობა, uniscribe" } }
 >>gadgets ;



--
KUSUMOTO Norio



> 2019/05/28 15:20、Alexander Ilin のメール:
> 
>  Is it possible to tell Uniscribe to render the text in white color?
>  If such text shows up on the black background, that would confirm part of 
> the theory.



___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Transparent background texts and Windows Factor

2019-05-28 Thread KUSUMOTO Norio
Sorry, the last sentences are wrong, so I will correct them.

What I found when I read uniscribe-factor is that a bitmap is created with the 
device context 
given by with-memory-dc. However, if you simply use that dc, the bitmap has a 
black background.

My guess is that you won't be able to create an image of a string with a 
transparent background 
unless you transfer the original window bitmap to the device context created by 
with-memory-dc.

--
KUSUMOTO Norio





> 2019/05/28 14:36、KUSUMOTO Norio  のメール:
> 
> Hello all, 
> 
> I've been researching for a while about Windows Factor's inability to 
> correctly render texts on 
> transparent backgrounds. I haven't solved the problem yet, but I've just come 
> to an idea. 
> I'd be happy to hear your opinions on that.
> 
> For example, labels for button widgets are tentatively drawn with gray 
> background text because 
> they cannot draw labels with a transparent background. I disabled this 
> behavior and tried to make 
> transparent drawing work correctly, but only on a black background. I kept 
> trying to figure 
> out what was behind the black background, but I couldn't find the widget.
> 
> That's why I came up with the idea that Uniscribe works to make the 
> background transparent, 
> but where the characters are written is black. At first it seemed like a 
> silly idea, but I wrote 
> the code to confirm it.
> 
> 
> USING: accessors alien.c-types alien.data colors images.viewer
> io io.encodings.string io.encodings.utf16n io.styles kernel
> literals math sequences ui ui.commands ui.gadgets
> ui.gadgets.borders ui.gadgets.panes ui.gadgets.tracks
> ui.gestures windows.gdi32 windows.offscreen windows.ole32
> windows.types windows.usp10 locals fonts windows.fonts
> windows.errors ;
> IN: hello-uniscribe
> 
> 
> ! NOTE:  The following declaration is required in gdi32.factor
> !
> !FUNCTION: int SetBkMode ( HDC hdc, int iBkMode )
> 
> TUPLE: hello-gadget < track ;
> 
> :  ( -- gadget )
>horizontal hello-gadget new-track
>[
>{ { font-size 24 } } [
>"Hello" print
>"Grüß dich" print
>"здравствуйте" print
>"こんにちは" print
>"안녕하세요" print
>"שָׁלוֹם " print
>] with-style
>] make-pane { 10 10 } 
>f track-add ;
> 
> :: com-screen-shot ( gadget -- )
>[ :> dc
> gadget dim>> dc [ ] make-bitmap-image image-window
>] with-memory-dc ;
> 
> CONSTANT: ssa-dwFlags flags{ SSA_GLYPHS SSA_FALLBACK SSA_TAB }
> 
> :: (com-screen-shot-with-text) ( dim bkMode uOptions -- )
>[ :> dc
>  dim dc [ 
>  dc sans-serif-font cache-font SelectObject win32-error=0/f
>  dc T{ rgba f 0.0 0.0 1.0 0.0 } color>RGB SetBkColor drop
>  dc T{ rgba f 1.0 1.0 1.0 1.0 } color>RGB SetTextColor drop
>  dc bkMode SetBkMode drop
> 
>  dc
>  "Hello!"
>  [ utf16n encode ] ! pString
>  [ length ] bi ! cString
>  dup 1.5 * 16 + >integer ! cGlyphs -- MSDN says this is "recommended 
> size"
>  -1 ! iCharset -- Unicode
>  ssa-dwFlags
>  0 ! iReqWidth
>  f ! psControl
>  f ! psState
>  f ! piDx
>  f ! pTabdef
>  f ! pbInClass
>  f void*  ! pssa
>  [ ScriptStringAnalyse ] keep
>  [ check-ole32-error ] [ |ScriptStringFree void* deref ] bi*
> 
>  0 ! iX
>  0 ! iY
>  uOptions
>  { 0 0 } dim 
>  0 ! iMinSel
>  0 ! iMaxSel
>  FALSE ! fDisabled
>  ScriptStringOut check-ole32-error
>  ] make-bitmap-image image-window
>] with-memory-dc ;
> 
> : com-screen-shot-with-text-opaque ( gadget -- )
>dim>> OPAQUE ETO_OPAQUE (com-screen-shot-with-text) ;
> 
> : com-screen-shot-with-text-transparent-1 ( gadget -- )
>dim>> OPAQUE 0 (com-screen-shot-with-text) ;
> 
> : com-screen-shot-with-text-transparent-2 ( gadget -- )
>dim>> TRANSPARENT ETO_OPAQUE (com-screen-shot-with-text) ;
> 
> : com-screen-shot-with-text-transparent-3 ( gadget -- )
>dim>> TRANSPARENT 0 (com-screen-shot-with-text) ;
> 
> hello-gadget "gestures" f {
>{ T{ key-down { sym "1" } } com-screen-shot }
>{ T{ key-down { sym "2" } } com-screen-shot-with-text-opaque }
>{ T{ key-down { sym "3" } } com-screen-shot-with-text-transparent-1 }
>{ T{ key-down { sym "4" } } com-screen-shot-with-text-transparent-2 }
>{ T{ key-down { sym 

[Factor-talk] Transparent background texts and Windows Factor

2019-05-27 Thread KUSUMOTO Norio
Hello all, 

I've been researching for a while about Windows Factor's inability to correctly 
render texts on 
transparent backgrounds. I haven't solved the problem yet, but I've just come 
to an idea. 
I'd be happy to hear your opinions on that.

For example, labels for button widgets are tentatively drawn with gray 
background text because 
they cannot draw labels with a transparent background. I disabled this behavior 
and tried to make 
transparent drawing work correctly, but only on a black background. I kept 
trying to figure 
out what was behind the black background, but I couldn't find the widget.

That's why I came up with the idea that Uniscribe works to make the background 
transparent, 
but where the characters are written is black. At first it seemed like a silly 
idea, but I wrote 
the code to confirm it.


USING: accessors alien.c-types alien.data colors images.viewer
io io.encodings.string io.encodings.utf16n io.styles kernel
literals math sequences ui ui.commands ui.gadgets
ui.gadgets.borders ui.gadgets.panes ui.gadgets.tracks
ui.gestures windows.gdi32 windows.offscreen windows.ole32
windows.types windows.usp10 locals fonts windows.fonts
windows.errors ;
IN: hello-uniscribe


! NOTE:  The following declaration is required in gdi32.factor
!
!FUNCTION: int SetBkMode ( HDC hdc, int iBkMode )

TUPLE: hello-gadget < track ;

:  ( -- gadget )
horizontal hello-gadget new-track
[
{ { font-size 24 } } [
"Hello" print
"Grüß dich" print
"здравствуйте" print
"こんにちは" print
"안녕하세요" print
"שָׁלוֹם " print
] with-style
] make-pane { 10 10 } 
f track-add ;

:: com-screen-shot ( gadget -- )
[ :> dc
 gadget dim>> dc [ ] make-bitmap-image image-window
] with-memory-dc ;

CONSTANT: ssa-dwFlags flags{ SSA_GLYPHS SSA_FALLBACK SSA_TAB }

:: (com-screen-shot-with-text) ( dim bkMode uOptions -- )
[ :> dc
  dim dc [ 
  dc sans-serif-font cache-font SelectObject win32-error=0/f
  dc T{ rgba f 0.0 0.0 1.0 0.0 } color>RGB SetBkColor drop
  dc T{ rgba f 1.0 1.0 1.0 1.0 } color>RGB SetTextColor drop
  dc bkMode SetBkMode drop

  dc
  "Hello!"
  [ utf16n encode ] ! pString
  [ length ] bi ! cString
  dup 1.5 * 16 + >integer ! cGlyphs -- MSDN says this is "recommended 
size"
  -1 ! iCharset -- Unicode
  ssa-dwFlags
  0 ! iReqWidth
  f ! psControl
  f ! psState
  f ! piDx
  f ! pTabdef
  f ! pbInClass
  f void*  ! pssa
  [ ScriptStringAnalyse ] keep
  [ check-ole32-error ] [ |ScriptStringFree void* deref ] bi*
  
  0 ! iX
  0 ! iY
  uOptions
  { 0 0 } dim 
  0 ! iMinSel
  0 ! iMaxSel
  FALSE ! fDisabled
  ScriptStringOut check-ole32-error
  ] make-bitmap-image image-window
] with-memory-dc ;

: com-screen-shot-with-text-opaque ( gadget -- )
dim>> OPAQUE ETO_OPAQUE (com-screen-shot-with-text) ;

: com-screen-shot-with-text-transparent-1 ( gadget -- )
dim>> OPAQUE 0 (com-screen-shot-with-text) ;

: com-screen-shot-with-text-transparent-2 ( gadget -- )
dim>> TRANSPARENT ETO_OPAQUE (com-screen-shot-with-text) ;

: com-screen-shot-with-text-transparent-3 ( gadget -- )
dim>> TRANSPARENT 0 (com-screen-shot-with-text) ;

hello-gadget "gestures" f {
{ T{ key-down { sym "1" } } com-screen-shot }
{ T{ key-down { sym "2" } } com-screen-shot-with-text-opaque }
{ T{ key-down { sym "3" } } com-screen-shot-with-text-transparent-1 }
{ T{ key-down { sym "4" } } com-screen-shot-with-text-transparent-2 }
{ T{ key-down { sym "5" } } com-screen-shot-with-text-transparent-3 }
} define-command-map

MAIN-WINDOW: hello-uniscribe { { title "გამარჯობა, uniscribe" } }
 >>gadgets ;


My understanding from reading Uniscribe.factor is that it renders characters in 
the device context 
given by with-memory-dc. However, if you create a bitmap from that dc, its 
background is black, 
regardless of the drawing on the current window.

My guess is that you won't be able to create an image of a string with a 
transparent background 
unless you transfer the original window bitmap to the device context created by 
with-memory-dc.

--
KUSUMOTO Norio







___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Factor UI and Input Method

2019-05-26 Thread KUSUMOTO Norio
Hello all,

It is now possible to display underlines during inline Japanese conversion on 
Mac Factor. 
I have made several other improvements and believe that I have achieved my goal.

You can see a video of the conversion and input:
https://kusumotonorio.github.io/images/factor-inline-3.mov


https://github.com/factor/factor/compare/master...kusumotonorio:cocoa-inline-input


--
KUSUMOTO Norio



> 2019/04/16 22:21、KUSUMOTO Norio のメール:
> 
> The inline input/conversion has become stable because I understood the cause 
> of
> the crash of Factor IDE.
> 
> <https://kusumotonorio.github.io/images/factor-inline-2.mov>
> 
> I have made progress towards completion, but the current implementation lacks 
> a very 
> large one.
> 
> Inline conversion uses the underline display to tell the user the target area 
> of the 
> conversion operation and the break of the conversion unit. For now, there is 
> no such 
> feedback.
> 
> It seems to me the current factor does not have the function to display the 
> underline. 
> I must think about how to realize the function.
> 
> 
> --
> KUSUMOTO Norio
> 
> 
> 
> 
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk



___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] key-up event on Windows Factor

2019-04-22 Thread KUSUMOTO Norio
Hello, all.

I wrote a new code.

The problem with the Windows backend is that when key down or key up event 
occur, 
we can not know for sure how it is actually printed by the key.

I did various trials and errors, but I was not able to realize the same 
functions 
as other platforms. So I changed my mind and I decided to ask the user to use 
what 
kind of keyboard he was using.

The original code can not be used in combination with the control key or alt key
except for the alphabet and number keys, and the key up event does not occur
with the numeric keys of the numeric keypad or symbol keys such as & and *.
The new code by default only generates the same key-down / key-up events as
the original, and behaves the same except ignoring the state of the keycaps.

In the new code, if you are using a US keyboard, when you write

USE: ui.backend.windows.keyboard.101-104

 in .factor-rc, you can solve the problem of the above original code.
Also, if you are using a keyboard for Japan, when

USE: ui.backend.windows.keyboard.106-109

is written, windows backend works in accordance with the keyboard.

If I can confirm that this code works stable, I will make a pull request. 
I'm looking forward to opinion from you.


https://github.com/kusumotonorio/factor/blob/windows-kn-plan2/basis/ui/backend/windows/windows.factor

https://github.com/factor/factor/compare/master...kusumotonorio:windows-kn-plan2



--
KUSUMOTO Norio



___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Factor UI and Input Method

2019-04-16 Thread KUSUMOTO Norio
The inline input/conversion has become stable because I understood the cause of
the crash of Factor IDE.

<https://kusumotonorio.github.io/images/factor-inline-2.mov>

I have made progress towards completion, but the current implementation lacks a 
very 
large one.

Inline conversion uses the underline display to tell the user the target area 
of the 
conversion operation and the break of the conversion unit. For now, there is no 
such 
feedback.

It seems to me the current factor does not have the function to display the 
underline. 
I must think about how to realize the function.


--
KUSUMOTO Norio




___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Cocoa in Factor

2019-04-15 Thread KUSUMOTO Norio
> How should I write NSNotFound in Factor code ?
> -1 ? Or 2 63 ^ 1 - ?

I found a way to ask it to Factor-san . :-)

 NSArray -> array "a"  -> indexOfObject:

--- Data stack:
9223372036854775807
inspect
bignum

I am concerned that different values will occur in the 32 bit environment.


> At METHOD: void setMarkedText: id text selectedRange: NSRange range ,
> I would like to write like :
> 
>   if ([text isMemberOfClass:[NSString class]]) {
>   ...
>} else {
>   ...
>}
> 
> in Factor. I wrote :
> 
>NSString -> class 
>text swap  -> isMemberOfClass: [
>text CF>string str!
>] [
>text -> string CF>string str!
>] if
> 
> But it does not seem to work well. How should I write it?


NO at Cocoa is 0, so I should write it as:

   NSString -> class 
   text swap  -> isMemberOfClass: 0 = not [

Also, for my purpose, I should use "isKindOfClass" instead of 
"isMemberOfClass".


--
KUSUMOTO Norio


> 2019/04/15 14:08、KUSUMOTO Norio  のメール:
> 
> Hello, all.
> 
> How should I write NSNotFound in Factor code ?
> -1 ? Or 2 63 ^ 1 - ?
> 
> 
> At METHOD: void setMarkedText: id text selectedRange: NSRange range ,
> I would like to write like :
> 
>   if ([text isMemberOfClass:[NSString class]]) {
>   ...
>} else {
>   ...
>}
> 
> in Factor. I wrote :
> 
>NSString -> class 
>text swap  -> isMemberOfClass: [
>        text CF>string str!
>] [
>text -> string CF>string str!
>] if
> 
> But it does not seem to work well. How should I write it?
> 
> --
> KUSUMOTO Norio
> 
> 
> 
> 
> 
> 
> 
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk



___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] Cocoa in Factor

2019-04-14 Thread KUSUMOTO Norio
Hello, all.

How should I write NSNotFound in Factor code ?
-1 ? Or 2 63 ^ 1 - ?


At METHOD: void setMarkedText: id text selectedRange: NSRange range ,
I would like to write like :

   if ([text isMemberOfClass:[NSString class]]) {
   ...
} else {
   ...
}

in Factor. I wrote :

NSString -> class 
text swap  -> isMemberOfClass: [
text CF>string str!
] [
text -> string CF>string str!
] if

But it does not seem to work well. How should I write it?

--
KUSUMOTO Norio







___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Factor UI and Input Method

2019-04-11 Thread KUSUMOTO Norio
I will post the contents written to github.


I've got stuck.
For example, I use the return key to confirm the conversion string, but I can 
not
operate well because the key input to IM such as return passes over to Factor.

I expected the key input to be received first by the IM, and the app received 
the input that was not consumed, but it seems that the IM can't receive the 
input 
unless the Factor backend sends a key-down event.

<https://user-images.githubusercontent.com/47816570/55955306-03357780-5c9c-11e9-98e8-e41b2fadaac0.png>


--
KUSUMOTO Norio






___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Factor UI and Input Method

2019-04-11 Thread KUSUMOTO Norio
> 2019/04/11 7:23、Alexander Ilin のメール:
> 
> nil is f, the canonical false value.

Thank you!

--
KUSUMOTO Norio


> 2019/04/11 7:23、Alexander Ilin のメール:
> 
> nil is f, the canonical false value.
> 
> 10.04.2019, 15:52, "KUSUMOTO Norio" :
>> Hmm, "text" may be a NSAttributedString.
>> I would like to return nil at validAttributesForMarkedText.
>> Can I express nil in the Factor code? How should I write it?
>> 
>> --
>> KUSUMOTO Norio
>> 
>>>  2019/04/10 10:29、KUSUMOTO Norio のメール:
>>> 
>>>  I will post the contents written to github.
>>> 
>>>  I think the replacement from NSTextInput to NSTextInputClient can't solve 
>>> this problem
>>>  unless its methods are implemented appropriately.
>>>  In an opposite way, even with NSTextInput, I anticipate the appropriate 
>>> implementation
>>>  of methods can solve it.
>>> 
>>>  I'm writing a experimental code for it. But I'm in trouble.
>>>  In setMarkedText:selectedRange: , I can't convert text from a NSString to 
>>> a factor string
>>>  by CF>string. I got the error "Unix signal #6 (SIGABRT)".
>>>  The word works fine in insertText: .
>>> 
>>> ! Text input
>>> METHOD: void insertText: id text
>>> [
>>> self window :> window
>>> window [
>>> text CF>string window user-input
>>> ] when
>>> ] ;
>>> 
>>> METHOD: char hasMarkedText [ 0 ] ;
>>> 
>>> METHOD: NSRange markedRange [ 0 0  ] ;
>>> 
>>> METHOD: NSRange selectedRange [ 0 0  ] ;
>>> 
>>>  ! METHOD: void setMarkedText: id text selectedRange: NSRange range [ ] ;
>>> 
>>> METHOD: void setMarkedText: id text selectedRange: Nsrange range
>>>  [
>>> self window :> window
>>> window [
>>>  ! ok --> "abc"
>>>  ! ok --> "xyz"  CF>string
>>>  ! "alien " text class-of "%s " sprintf
>>> text CF>string ! Error Unix signal #6 (SIGABRT)
>>> window world-focus user-input* drop
>>> ] when
>>>  ] ;
>>> 
>>>  --
>>>  KUSUMOTO Norio
>> 
>> ___
>> Factor-talk mailing list
>> Factor-talk@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/factor-talk
> 
> ---=--- 
> Александр
> 
> 
> 
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk



___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] key-down/up event issues on gtk backend Factor

2019-04-07 Thread KUSUMOTO Norio
Thank you for your attention, Doug.

I don't care that my code is not used as it is.
Also, I am prepared to explain why I wrote the code that way.

--
KUSUMOTO Norio





> 2019/04/08 8:21、Doug Coleman  のメール:
> 
> Hi,
> 
> I think you can still use the x11 backend on any unix system.
> 
> Try ``USE: ui.backend.x11``
> 
> Relevant line:
> basis\ui\backend\x11\x11.factor:x11-ui-backend ui-backend set-global
> 
> I'm taking a look at the Windows key changes.
> 
> Cheers,
> Doug
> 
> On Sun, Apr 7, 2019 at 4:57 PM Alexander Ilin  wrote:
> I'm very interested in these fixes (especially for the Windows platform, but 
> uniformity with other platforms is important, too), but I had no time to 
> check out the fixes over this weekend.
> Maybe next weekend.
> 
> 07.04.2019, 14:02, "KUSUMOTO Norio" :
> > Hello, all.
> >
> > I wrote the cord which fixed key-down/up event issues on gtk backend 
> > Factor. It improves:
> > - events about numeric keys on the keypad with shift,
> > - the influence by the state of caps-lock,
> > - unnecessary event generation with an individual press of shift, control 
> > or alt keys
> > - illegal "\0" event generation
> > on key-down/up events.
> >
> > I'm glad if you give an evaluation test about it.
> >
> > https://github.com/kusumotonorio/factor/blob/gtk-key-down-up/basis/ui/backend/gtk/gtk.factor
> > https://github.com/kusumotonorio/factor/blob/gtk-key-down-up/basis/ui/backend/x11/keys/keys.factor
> >
> > Comparing changes:
> > https://github.com/factor/factor/compare/master...kusumotonorio:gtk-key-down-up
> >
> > By the way, is it possibele I use x11 backend Factor on Ubuntu ?
> > I would like to see and use it.
> >
> > --
> > KUSUMOTO Norio
> >
> > ___
> > Factor-talk mailing list
> > Factor-talk@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/factor-talk
> 
> ---=--- 
>  Александр
> 
> 
> 
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk



___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] key-up event on Windows Factor

2019-03-30 Thread KUSUMOTO Norio
It seems to me key-down and key-up events are not desirable, not only in 
Windows Factor.
For example, on Mac Factor, when the "Q" key is pressed with a shift key, 
gesture-logger
reports:

  T{ key-down { sym "Q" } }
  User input: Q
  T{ key-up { sym "Q" } }

I think it should be:

  T{ key-down { mods { S+ } } { sym "q" } }
  User input: Q
  T{ key-up { mods { S+ } } { sym "q" } }


I changed key-codes which is in 
/Applications/factor/basis/ui/backend/cocoa/views/views.factor
like this:

CONSTANT: key-codes
H{
{ 29 "0" } ! <- added
{ 18 "1" } ! <- added
{ 19 "2" } ! <- added

{ 0 "a" } ! <- added
{ 11 "b" } ! <- added
{ 9 "c" } ! <- added

{ 71 "CLEAR" }
{ 36 "RET" }
{ 76 "ENTER" }
{ 53 "ESC" }
{ 48 "TAB" }
{ 51 "BACKSPACE" }
{ 115 "HOME" }
{ 117 "DELETE" }
{ 119 "END" }
{ 122 "F1" }
{ 120 "F2" }
{ 99 "F3" }
{ 118 "F4" }
{ 96 "F5" }
{ 97 "F6" }
{ 98 "F7" }
{ 100 "F8" }
{ 123 "LEFT" }
{ 124 "RIGHT" }
{ 125 "DOWN" }
{ 126 "UP" }
{ 116 "PAGE_UP" }
{ 121 "PAGE_DOWN" }
} 

Then events about "0", "1", "2", "a", "b" and "c" key are desirable for me.

In conclusion, I think all keys which can exist should be added in key-codes.


--
KUSUMOTO Norio



> 2019/03/29 10:03、KUSUMOTO Norio のメール:
> 
> Sorry, I’ll correct my message.
> 
>> 1. Why are send-key-up called by handle-wm-char?
> 
> 1. Why are send-key-down called by handle-wm-char?
> 
> --
> KUSUMOTO Norio
> 
> 
>> 2019/03/29 9:49、KUSUMOTO Norio  のメール:
>> 
>> When I read the file, I have some questions.
>> These are:
>> 1. Why are send-key-up called by handle-wm-char?
>> 2. Why doesn’t Factor handle shift key as a modifier key at key-down event?
>> --
>> KUSUMOTO Norio
> 
> 
> 
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk



___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] key-up event on Windows Factor

2019-03-28 Thread KUSUMOTO Norio
Sorry, I’ll correct my message.

> 1. Why are send-key-up called by handle-wm-char?

1. Why are send-key-down called by handle-wm-char?

--
KUSUMOTO Norio


> 2019/03/29 9:49、KUSUMOTO Norio  のメール:
> 
> When I read the file, I have some questions.
> These are:
> 1. Why are send-key-up called by handle-wm-char?
> 2. Why doesn’t Factor handle shift key as a modifier key at key-down event?
> --
> KUSUMOTO Norio



___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] key-up event on Windows Factor

2019-03-09 Thread KUSUMOTO Norio
> 2019/03/09 20:36、KUSUMOTO Norio のメール:
> 
> Yes, I can.
> 
> Windows 7 Home Premium
> Service Pack 1 32bit 
> 
> Japanese 
> 
> Japanese PS/2 keyboard (109) 
> 
> 32bit Factor  factor-windows-x86-32-0.98
> 

This PC is im my office. After returning home, I tried with bootcamp Mac,
Windows 10 Home 64bit and 64 bit Factor.
I don't have Japanese keyboard in my house. My keyboard is a HHK pro,
US keyboard which don't have a numeric pad. So I can't use 1 key 
in a numeric pad now.But when I hit dot, comma, slash and minus key etc., 
I can reproducethe issue even if I set laguage setting for English.

--
KUSUMOTO Norio




___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] key-up event on Windows Factor

2019-03-09 Thread KUSUMOTO Norio
Yes, I can.

Windows 7 Home Premium
Service Pack 1 32bit 

Japanese 

Japanese PS/2 keyboard (109) 

32bit Factor  factor-windows-x86-32-0.98



--
KUSUMOTO Norio





> 2019/03/09 15:08、John Benediktsson  のメール:
> 
> Interesting! Okay.  
> 
> Any details of the keyboard type or language settings you can share? Windows 
> 7? Is it 32-bit or 64-bit Factor?
> 
> Thanks,
> John.
> 
> On Mar 8, 2019, at 8:26 PM, KUSUMOTO Norio  wrote:
> 
>>> On my windows machine (Windows 7), when I hit 1 key which was in a separate 
>>> numeric pad, 
>>> Gesture log window showed  :
>>> 
>>> T{ key-down { sym “1” } }
>>> User input: 1 
>>> 
>>> per one hit. 
>> 
>> 
>> Normal minus, dot, comma, colon, semi-colon  key are also similar. 
>> There are not notifications about key-up.  
>> 
>> --
>> KUSUMOTO Norio
>> 
>> 
>> 
>> 
>> 
>>> 2019/03/09 13:00、KUSUMOTO Norio  のメール:
>>> 
>>> Hi, 
>>> 
>>> 
>>>> 2019/03/09 10:02、John Benediktsson  のメール:
>>>> 
>>>> If you'd like to play around with how Factor receives various inputs, 
>>>> including the keyboard events, you can run the gesture-logger debug tool.  
>>>> It prints out a log of all gestures received by the window so you can see 
>>>> mouse movement, mouse clicks, key-up, key-down, etc:
>>>> 
>>>>  IN: scratchpad "gesture-logger” run
>>> 
>>> 
>>> Oh, nice tool! I did it.
>>> 
>>> On my windows machine (Windows 7), when I hit 1 key which was in a separate 
>>> numeric pad, 
>>> Gesture log window showed  :
>>> 
>>> T{ key-down { sym “1” } }
>>> User input: 1 
>>> 
>>> per one hit. The other hand, when I hit normal 1 key, it showed :
>>> 
>>> T{ key-down { sym “1” } }
>>> User input: 1 
>>> T{ key-up { sym “1” } }
>>> 
>>> per one hit.
>> 
>> 
>> 
>> ___
>> Factor-talk mailing list
>> Factor-talk@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/factor-talk
> 
> 
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk



___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] key-up event on Windows Factor

2019-03-08 Thread KUSUMOTO Norio
> On my windows machine (Windows 7), when I hit 1 key which was in a separate 
> numeric pad, 
> Gesture log window showed  :
> 
>  T{ key-down { sym “1” } }
>  User input: 1 
> 
> per one hit. 


Normal minus, dot, comma, colon, semi-colon  key are also similar. 
There are not notifications about key-up.  

--
KUSUMOTO Norio





> 2019/03/09 13:00、KUSUMOTO Norio  のメール:
> 
> Hi, 
> 
> 
>> 2019/03/09 10:02、John Benediktsson  のメール:
>> 
>> If you'd like to play around with how Factor receives various inputs, 
>> including the keyboard events, you can run the gesture-logger debug tool.  
>> It prints out a log of all gestures received by the window so you can see 
>> mouse movement, mouse clicks, key-up, key-down, etc:
>> 
>>IN: scratchpad "gesture-logger” run
> 
> 
> Oh, nice tool! I did it.
> 
> On my windows machine (Windows 7), when I hit 1 key which was in a separate 
> numeric pad, 
> Gesture log window showed  :
> 
>  T{ key-down { sym “1” } }
>  User input: 1 
> 
> per one hit. The other hand, when I hit normal 1 key, it showed :
> 
>  T{ key-down { sym “1” } }
>  User input: 1 
>  T{ key-up { sym “1” } }
> 
> per one hit.



___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] key-up event on Windows Factor

2019-03-08 Thread KUSUMOTO Norio
Hi, 


> 2019/03/09 10:02、John Benediktsson  のメール:
> 
> If you'd like to play around with how Factor receives various inputs, 
> including the keyboard events, you can run the gesture-logger debug tool.  It 
> prints out a log of all gestures received by the window so you can see mouse 
> movement, mouse clicks, key-up, key-down, etc:
> 
> IN: scratchpad "gesture-logger” run


Oh, nice tool! I did it.

On my windows machine (Windows 7), when I hit 1 key which was in a separate 
numeric pad, 
Gesture log window showed  :

  T{ key-down { sym “1” } }
  User input: 1 

per one hit. The other hand, when I hit normal 1 key, it showed :

  T{ key-down { sym “1” } }
  User input: 1 
  T{ key-up { sym “1” } }

per one hit.


--
KUSUMOTO Norio





> 2019/03/09 10:02、John Benediktsson  のメール:
> 
> If you'd like to play around with how Factor receives various inputs, 
> including the keyboard events, you can run the gesture-logger debug tool.  It 
> prints out a log of all gestures received by the window so you can see mouse 
> movement, mouse clicks, key-up, key-down, etc:
> 
> IN: scratchpad "gesture-logger" run
> 
> I don't have a keyboard with a separate numeric pad with me to test, but I 
> find that behavior odd.  See if the gesture logger has the same behavior, and 
> also, whether a key-up is ever generated for those keys.  On some platforms, 
> you might see several key-down before a key-up for repeated keys (like 
> holding down a letter to type it several times).
> 
> Best,
> John.
> 



___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] key-up event on Windows Factor

2019-03-07 Thread KUSUMOTO Norio
Hello all,

I noticed my program didn’t execute key-up hook words which were for some keys 
in numeric keypad on my Windows machine. It’s OK on my Mac.
For example, so is the 1 key which is in numeric keypad.  But, the normal 1 key 
is OK.

When the 1 key which is in numeric keypad is hit several times, the app written 
below
shows “down down down ...”.  
But when the normal 1 key is hit, it shows “down up! down up! down up! …”.


test-key-up.factor :

USING:
kernel models namespaces accessors sequences
ui ui.gadgets ui.gestures ui.commands
ui.gadgets.worlds ui.gadgets.labels ui.gadgets.tracks ;

IN: test-key-up

TUPLE: key-status < model ;

:  ( -- model )
"" key-status new-model ;

SYMBOL: key-status-label
 key-status-label set-global

TUPLE: key-up-gadget < track ;

:  ( -- gadget )
  vertical key-up-gadget new-track

key-status-label get-global 
f track-add ;

: key-down-1 ( gadget -- )
drop
key-status-label get-global
dup value>> "down " append swap set-model ;

: key-up-1 ( gadget -- )
drop
key-status-label get-global
dup value>> "up! " append swap set-model ;

: key-up-RET ( gadget -- )
drop
"" key-status-label get-global set-model ;

key-up-gadget "gestures" f {
{ T{ key-down f f "1" } key-down-1 }
{ T{ key-up   f f "1" } key-up-1 }
{ T{ key-up   f f "RET" } key-up-RET }
} define-command-map

M: key-up-gadget pref-dim* drop { 800 50 } ;

MAIN-WINDOW: key-up-window {
{ title "key-up testhit 1 key (RET: clear)" }
{ window-controls
{ normal-title-bar close-button minimize-button } }
}  >>gadgets ;




--
KUSUMOTO Norio







___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] How to use local variable

2019-02-05 Thread 楠本紀雄 (KUSUMOTO Norio)
Hi,

Thanks a lot!
I understand how to use lexical variables because of your advice.


--
KUSUMOTO Norio



> 2019/02/05 2:50、Alexander Ilin のメール:
> 
> This will work as you expected:
> 
> USE: locals
> :: fnc ( -- ) 0 :> i! 3 [ i 1 + i! i . ] times ;
> fnc
> 
> 1
> 2
> 3
> 
> 
> 04.02.2019, 09:17, "KUSUMOTO, Norio" :
>> Hello to all,
>> 
>> I’m writing a hierarchical finite state machine library as my first Factor 
>> program.
>> It seems to me that It works for once now! But, there are some questions in 
>> my mind.
>> 
>> I could not handle local variables well, so I tried below words in a 
>> listener.
>> 
>> USE: locals
>> :: fnc ( -- ) 0 :> i 3 [ i 1 + :> i i . ] times ;
>> fnc
>> 
>> These words returned:
>> 1
>> 1
>> 1
>> 
>> Originally, I wanted to know that why the below words didn’t perform as 
>> expected.
>> 
>> USE: locals
>> :: fnc2 ( -- ) 0 :> i [ i 3 < ] [ i 1 + :> i i . ] while ;
>> 
>> It will perform as a infinite loop.
>> 
>> In these cases, how should I write them?
>> 
>> --
>> KUSUMOTO Norio
>> 
>> ___
>> Factor-talk mailing list
>> Factor-talk@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/factor-talk
> 
> ---=--- 
> Александр
> 
> 
> 
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk



___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] How to use local variable

2019-02-05 Thread 楠本紀雄 (KUSUMOTO Norio)
Hi,

Thank you for your advice!
It was very beneficial.

--
KUSUMOTO Norio



> 2019/02/04 22:19、Philip Dexter のメール:
> 
> Hi,
> 
> Check out the "Mutable bindings" example here:
> https://docs.factorcode.org/content/article-locals-examples.html
> 
> Note the use of the bang (!) when initially binding the variable and
> then again when mutating the variable.
> 
> Hope that helps!
> 
> 
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk



___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] How to use local variable

2019-02-03 Thread KUSUMOTO, Norio
Hello to all, 

I’m writing a hierarchical finite state machine library as my first Factor 
program.
It seems to me that It works for once now! But, there are some questions in my 
mind.
   
I could not handle local variables well, so I tried below words in a listener.

USE: locals
:: fnc ( -- ) 0 :> i 3 [ i 1 + :> i i . ] times ; 
fnc

These words returned:
1
1
1

Originally, I wanted to know that why the below words  didn’t perform as 
expected.

USE: locals
:: fnc2 ( -- ) 0 :> i [ i 3 < ] [ i 1 + :> i i . ] while ; 

It will perform as a infinite loop.

In these cases, how should I write them?

--
KUSUMOTO Norio



___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] send-email error

2019-01-21 Thread 楠本紀雄 (KUSUMOTO Norio)
Thank you for giving me good advice!
I could send a email with Factor.
 

--
KUSUMOTO Norio



> 2019/01/21 0:38、John Benediktsson のメール:
> 
> You need to define a smtp-config object showing what server to send email 
> through:
> 
> https://docs.factorcode.org/content/word-smtp-config%2Csmtp.html
> 
> For example, configuring to use your GMail account:
> 
> https://docs.factorcode.org/content/article-smtp-gmail.html
> 



___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk