Re: [Factor-talk] CONSTANT:s - foldable, flushable?

2016-05-25 Thread Alexander Ilin
Hello, John! 25.05.2016, 17:54, "John Benediktsson" :One way to work around dependencies like that is to use nested compilation units: << CONSTANT: half-bit-size 6 >><< CONSTANT: bit-size $[ 2 half-bit-size * ] >>CONSTANT: cell-height $[ 3 bit-size * ]CONSTANT: cell-width $[ 3 bit-size * ] That is very, very cool! I'll give that a try, thank you! ---=---Александр 

--
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Factor Code Analysis Tools

2016-05-25 Thread Alexander Ilin
Hello, Andrea!

25.05.2016, 19:00, "Andrea Ferretti" :
>>  Also, I seem to remember from somewhere (help system? a blog post?) about a 
>> tool that can analyze a word and find similar code elsewhere
>
> I think you refer to http://docs.factorcode.org/content/vocab-lint.html

  Wow, thanks a lot! That looks very much like what I need!

---=---
 Александр

--
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Factor Code Analysis Tools

2016-05-25 Thread Alex Vondrak
In case it helps, here's an ancient gist of mine where I did some basic
vocab dependency analysis: https://gist.github.com/ajvondrak/4158963 This
was to find circular dependencies, where loading the vocab would go into an
infinite loop. Thus I couldn't use the loaded vocab objects themselves, so
instead looked at the text of the file, which isn't necessarily accurate. I
also haven't tested this since writing it, so not sure if it still works on
the latest Factor.
On May 25, 2016 6:01 AM, "Alexander Ilin"  wrote:

> Hello!
>
> That's great, John, thanks for the pointer!
>
> 25.05.2016, 00:57, "John Benediktsson" :
>
> You can easily get usage information, for example all (loaded) words that
> call ``+``:
>
> \ + usage.
>
> There are some graphviz libraries that have been built to visualize
> various parts of the compiler and either already can, or with some work,
> use the tools.crossref vocabulary to look at word and vocab dependencies.
>
>
>
> ---=---
> Александр
>
>
>
> --
> Mobile security can be enabling, not merely restricting. Employees who
> bring their own devices (BYOD) to work are irked by the imposition of MDM
> restrictions. Mobile Device Manager Plus allows you to control only the
> apps on BYO-devices by containerizing them, leaving personal data
> untouched!
> https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
>
--
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] CONSTANT:s - foldable, flushable?

2016-05-25 Thread John Benediktsson
One way to work around dependencies like that is to use nested compilation
units:

<< CONSTANT: half-bit-size 6 >>
<< CONSTANT: bit-size $[ 2 half-bit-size * ] >>
CONSTANT: cell-height $[ 3 bit-size * ]
CONSTANT: cell-width $[ 3 bit-size * ]

That makes those constants immediately available for the other constants to
use in their literal expansions.  Doug and I have been talking about ways
to avoid this problem with his new parser, but that's for sometime after
0.98 is released.



On Wed, May 25, 2016 at 5:01 AM, Alexander Ilin  wrote:

> Hello!
>
> Initially I wanted to define all constants as dependent on each other, as
> I would do in Delphi or C++:
>
> const
> half-bit-size = 6;
> bit-size = 2 * half-bit-size;
> cell-height = 3 * bit-size;
> cell-width = 3 * bit-size;
>
> In Factor that didn't work, so I took out the half-bit-size constant into
> a separate vocab, and expressed the rest in terms of it. That was an
> inconvenience and a reduction in readability, but not an issue.
>
> The issue I'm having now is this: if I change the half-bit-size value and
> reload its vocab, the dependent constants don't get the new values until I
> reload their module as well (I have a chain of four vocabs total that
> indirectly depend on that value).
>
> I think that if those were executable words, not CONSTANT:s, then changing
> the root value would update the output of those using it, so I would not
> have to reload all modules but the first one. That would have an additional
> benefit of making it possible to update the value at run-time and not
> reload anything (make it a global variable or something).
>
> Basically, I'm exploring my options here between the benefits of the
> compile-time precalculation, and run-time re-calculations. Also, I'm
> thinking a little about the "upgrade paths" available in Factor. What does
> it take to transform a constant into a variable in a Factor program? We
> don't have as many static checks as other languages offer, so I'm trying to
> imagine the possible pitfalls and performance penalties associated with
> different approaches.
>
> Memoization is another thing I'm going to take a look at. Not for this
> particular case, but as part of learning things. Factor is my first
> functional language, mind you, so I'm not too familiar with how things are.
>
> If you have any thoughts about this, please share.
>
> 25.05.2016, 01:01, "John Benediktsson" :
>
> I don't think you should use foldable and flushable from the sounds of
> things.
>
> Foldable is used mostly to inline a computed value as a literal, and
> flushable is used to indicate a word without side effects can be optimized
> by the compiler to not be called if the output is not used.
>
> Are you running into a problem with those constants you are trying to
> solve?
>
> On Tue, May 24, 2016 at 3:54 AM, Alexander Ilin  wrote:
>
> Hello!
>
>   I have some CONSTANT: words, which are used in more CONSTANT:s
> calculated at compile-time:
>
> IN: iqlink.const
>
> ! Bits are rectangular, their size in pixels is here.
> ! All other constants are based on this one.
> CONSTANT: half-bit-size 6
>
> USING: iqlink.const ;
> IN: iqlink.cell.gadget
>
> CONSTANT: bit-size $[ half-bit-size 2 * ]
> CONSTANT: cell-half-height $[ half-bit-size 3 * ]
> CONSTANT: cell-half-width $[ half-bit-size 3 * ]
> CONSTANT: cell-height $[ half-bit-size 6 * ]
> CONSTANT: cell-width $[ half-bit-size 6 * ]
>
>   I've been reading the docs about the foldable and flushable words, and I
> don't quite understand the use cases for them. Should I use these words to
> mark my constants, or should I keep things as they are?
>
>   What if I were to change my UI to be dynamically scalable and change the
> half-bit-size value at run-time? Should I use the foldable and flushable
> then?
>
> ---=---
>  Александр
>
>
> --
> Mobile security can be enabling, not merely restricting. Employees who
> bring their own devices (BYOD) to work are irked by the imposition of MDM
> restrictions. Mobile Device Manager Plus allows you to control only the
> apps on BYO-devices by containerizing them, leaving personal data
> untouched!
> https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
> ,
>
>
> --
> Mobile security can be enabling, not merely restricting. Employees who
> bring their own devices (BYOD) to work are irked by the imposition of MDM
> restrictions. Mobile Device Manager Plus allows you to control only the
> apps on BYO-devices by containerizing them, leaving personal data
> untouched!
> https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
> ,
>
> 

Re: [Factor-talk] Factor Code Analysis Tools

2016-05-25 Thread Alexander Ilin
Hello! That's great, John, thanks for the pointer! 25.05.2016, 00:57, "John Benediktsson" :You can easily get usage information, for example all (loaded) words that call ``+``:     \ + usage. There are some graphviz libraries that have been built to visualize various parts of the compiler and either already can, or with some work, use the tools.crossref vocabulary to look at word and vocab dependencies.  ---=---Александр 

--
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] CONSTANT:s - foldable, flushable?

2016-05-25 Thread Alexander Ilin
Hello! Initially I wanted to define all constants as dependent on each other, as I would do in Delphi or C++: consthalf-bit-size = 6;bit-size = 2 * half-bit-size;cell-height = 3 * bit-size;cell-width = 3 * bit-size; In Factor that didn't work, so I took out the half-bit-size constant into a separate vocab, and expressed the rest in terms of it. That was an inconvenience and a reduction in readability, but not an issue. The issue I'm having now is this: if I change the half-bit-size value and reload its vocab, the dependent constants don't get the new values until I reload their module as well (I have a chain of four vocabs total that indirectly depend on that value). I think that if those were executable words, not CONSTANT:s, then changing the root value would update the output of those using it, so I would not have to reload all modules but the first one. That would have an additional benefit of making it possible to update the value at run-time and not reload anything (make it a global variable or something). Basically, I'm exploring my options here between the benefits of the compile-time precalculation, and run-time re-calculations. Also, I'm thinking a little about the "upgrade paths" available in Factor. What does it take to transform a constant into a variable in a Factor program? We don't have as many static checks as other languages offer, so I'm trying to imagine the possible pitfalls and performance penalties associated with different approaches. Memoization is another thing I'm going to take a look at. Not for this particular case, but as part of learning things. Factor is my first functional language, mind you, so I'm not too familiar with how things are. If you have any thoughts about this, please share. 25.05.2016, 01:01, "John Benediktsson" :I don't think you should use foldable and flushable from the sounds of things. Foldable is used mostly to inline a computed value as a literal, and flushable is used to indicate a word without side effects can be optimized by the compiler to not be called if the output is not used. Are you running into a problem with those constants you are trying to solve? On Tue, May 24, 2016 at 3:54 AM, Alexander Ilin  wrote:Hello!  I have some CONSTANT: words, which are used in more CONSTANT:s calculated at compile-time:IN: iqlink.const! Bits are rectangular, their size in pixels is here.! All other constants are based on this one.CONSTANT: half-bit-size 6USING: iqlink.const ;IN: iqlink.cell.gadgetCONSTANT: bit-size $[ half-bit-size 2 * ]CONSTANT: cell-half-height $[ half-bit-size 3 * ]CONSTANT: cell-half-width $[ half-bit-size 3 * ]CONSTANT: cell-height $[ half-bit-size 6 * ]CONSTANT: cell-width $[ half-bit-size 6 * ]  I've been reading the docs about the foldable and flushable words, and I don't quite understand the use cases for them. Should I use these words to mark my constants, or should I keep things as they are?  What if I were to change my UI to be dynamically scalable and change the half-bit-size value at run-time? Should I use the foldable and flushable then?---=--- Александр--Mobile security can be enabling, not merely restricting. Employees whobring their own devices (BYOD) to work are irked by the imposition of MDMrestrictions. Mobile Device Manager Plus allows you to control only theapps on BYO-devices by containerizing them, leaving personal data untouched!https://ad.doubleclick.net/ddm/clk/304595813;131938128;j___Factor-talk mailing listFactor-talk@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/factor-talk,--Mobile security can be enabling, not merely restricting. Employees whobring their own devices (BYOD) to work are irked by the imposition of MDMrestrictions. Mobile Device Manager Plus allows you to control only theapps on BYO-devices by containerizing them, leaving personal data untouched!https://ad.doubleclick.net/ddm/clk/304595813;131938128;j,___Factor-talk mailing listFactor-talk@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/factor-talk  ---=---Александр --
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] io.files.windows question: >>ptr

2016-05-25 Thread Alexander Ilin
Hello!

  I'm looking at these words:
  open-read
  open-write
  open-r/w
  (open-append)
  open-existing
  maybe-create-file

  Why is it that only the first two of them have "0 >>ptr" after open-file?
  I presume the ptr of the win32-file tuple is always zero on creation, but why 
such inconsistency?
  I'm brushing up the code, and I'd like to move "0 >>ptr" to opened-file, or 
remove it altogether. Or maybe add "initial: 0" to the ptr slot, if that's 
necessary or more optimal.
  Any thoughts?

---=---
 Александр

--
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk