Re: [Factor-talk] CONSTANT:s - foldable, flushable?
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___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Factor Code Analysis Tools
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. On Tue, May 24, 2016 at 7:28 AM, Alexander Ilin wrote: > Hello! > > Are there any tools that can produce/visualize a graph of vocabulary > dependencies and/or call graphs (which words use which other words)? > It would be particularly interesting to see cases when two large vocab > groups depend on each other, where making a small common ground would > decouple the two groups and prevent linking tons of unused code. > > A small subquestion of that is: is there a tool that shows all words > which use a particular word? Like, I want to see all words that use the > INVALID_HANDLE_VALUE so I can refactor them all for consistency. > > 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. Maybe > I'm reinventing a wheel, and I'd like something to show me that exactly the > same code sequence is already implemented in a library. Or maybe the same > code already exists in a thousand places and should be factored out into a > new word, something like that. Can anyone remind me what it's called? > > ---=--- > Александр > > > -- > 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] COM-ports
Have you looked at the io.serial vocabulary? On Tue, May 24, 2016 at 7:33 AM, Alexander Ilin wrote: > Hello! > > Did anyone work with COM-ports in Factor? Is there a vocab for that? > > ---=--- > Александр > > > -- > 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] Conditionally execute words in .factor-rc
Yes, a few different ways: 1) The entire file is parsed so if you have a word that is available in 0.98 but not in 0.97, you either have to call it dynamically: "vm-version" "system" lookup-word execute( -- string ) or 2) Make separate files for 0.97 and 0.98, unfortunately we don't have good version words prior to 0.98, but you could do something like this: "vm-version" "system" lookup-word [ execute( -- string ) ".factor-rc-" prepend run-file ] [ ".factor-rc-0.97" run-file ] if* On Tue, May 24, 2016 at 12:19 PM, Martin Saurer wrote: > Dear all, > > Is there a way to conditionally execute words? > > For example: In one image "fuel" is loaded. In another image "fuel" is not > loaded. > Or: In Factor 0.98 there is a word "vm-version". In Factor 0.97 there is > no such word. > > Is it possible to write a .factor-rc startup file that handles different > environments and/or > Factor versions? > > In Python I'm doing this the following way: > > if sys.version_info[0] == 2: > from BaseHTTPServer import BaseHTTPRequestHandler > from BaseHTTPServer import HTTPServer > else: > from http.serverimport BaseHTTPRequestHandler > from http.serverimport HTTPServer > > Many thanks in advance. > > Martin > > > > > -- > 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
[Factor-talk] Conditionally execute words in .factor-rc
Dear all, Is there a way to conditionally execute words? For example: In one image "fuel" is loaded. In another image "fuel" is not loaded. Or: In Factor 0.98 there is a word "vm-version". In Factor 0.97 there is no such word. Is it possible to write a .factor-rc startup file that handles different environments and/or Factor versions? In Python I'm doing this the following way: if sys.version_info[0] == 2: from BaseHTTPServer import BaseHTTPRequestHandler from BaseHTTPServer import HTTPServer else: from http.serverimport BaseHTTPRequestHandler from http.serverimport HTTPServer Many thanks in advance. Martin -- 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] COM-ports
Hello! Did anyone work with COM-ports in Factor? Is there a vocab for that? ---=--- Александр -- 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] Factor Code Analysis Tools
Hello! Are there any tools that can produce/visualize a graph of vocabulary dependencies and/or call graphs (which words use which other words)? It would be particularly interesting to see cases when two large vocab groups depend on each other, where making a small common ground would decouple the two groups and prevent linking tons of unused code. A small subquestion of that is: is there a tool that shows all words which use a particular word? Like, I want to see all words that use the INVALID_HANDLE_VALUE so I can refactor them all for consistency. 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. Maybe I'm reinventing a wheel, and I'd like something to show me that exactly the same code sequence is already implemented in a library. Or maybe the same code already exists in a thousand places and should be factored out into a new word, something like that. Can anyone remind me what it's called? ---=--- Александр -- 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] Strange Code
Thank you, John! It seemed to me that there was no point to do the dip, but now I understand that the quotation output will end up under the top stack element! Thanks again. 24.05.2016, 16:14, "John Benediktsson" : > It creates a windows-file-info TUPLE under the stack and then proceeds to get > properties from the win32 data and set them into the TUPLE. > >> On May 24, 2016, at 5:08 AM, Alexander Ilin wrote: >> >> Hello! >> >> We have the following code in io.files.info.windows: >> >> : WIN32_FIND_DATA>file-info ( WIN32_FIND_DATA -- file-info ) >> [ \ windows-file-info new ] dip >> { >> [ dwFileAttributes>> win32-file-type >>type ] >> [ dwFileAttributes>> win32-file-attributes >>attributes ] >> [ [ nFileSizeLow>> ] [ nFileSizeHigh>> ] bi >64bit >>size ] >> [ dwFileAttributes>> >>permissions ] >> [ ftCreationTime>> FILETIME>timestamp >>created ] >> [ ftLastWriteTime>> FILETIME>timestamp >>modified ] >> [ ftLastAccessTime>> FILETIME>timestamp >>accessed ] >> } cleave ; >> >> What's the point of the dip operation? ---=--- Александр -- 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] Strange Code
It creates a windows-file-info TUPLE under the stack and then proceeds to get properties from the win32 data and set them into the TUPLE. > On May 24, 2016, at 5:08 AM, Alexander Ilin wrote: > > Hello! > > We have the following code in io.files.info.windows: > > : WIN32_FIND_DATA>file-info ( WIN32_FIND_DATA -- file-info ) >[ \ windows-file-info new ] dip >{ >[ dwFileAttributes>> win32-file-type >>type ] >[ dwFileAttributes>> win32-file-attributes >>attributes ] >[ [ nFileSizeLow>> ] [ nFileSizeHigh>> ] bi >64bit >>size ] >[ dwFileAttributes>> >>permissions ] >[ ftCreationTime>> FILETIME>timestamp >>created ] >[ ftLastWriteTime>> FILETIME>timestamp >>modified ] >[ ftLastAccessTime>> FILETIME>timestamp >>accessed ] >} cleave ; > > What's the point of the dip operation? > > ---=--- > Александр > > -- > 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
[Factor-talk] Strange Code
Hello! We have the following code in io.files.info.windows: : WIN32_FIND_DATA>file-info ( WIN32_FIND_DATA -- file-info ) [ \ windows-file-info new ] dip { [ dwFileAttributes>> win32-file-type >>type ] [ dwFileAttributes>> win32-file-attributes >>attributes ] [ [ nFileSizeLow>> ] [ nFileSizeHigh>> ] bi >64bit >>size ] [ dwFileAttributes>> >>permissions ] [ ftCreationTime>> FILETIME>timestamp >>created ] [ ftLastWriteTime>> FILETIME>timestamp >>modified ] [ ftLastAccessTime>> FILETIME>timestamp >>accessed ] } cleave ; What's the point of the dip operation? ---=--- Александр -- 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] CONSTANT:s - foldable, flushable?
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