Re: [Factor-talk] Factor 0.99 now available
Congratz on the release ! It's very nice to see the continued involvement in Factor :) Jon On Thu, Aug 24, 2023 at 6:30 PM John Benediktsson wrote: > > "I hear and I forget. I see and I remember. I do and I understand." - > Confucius > > I’m very pleased to announce the release of Factor 0.99! You can find download > links on the Factor website: > > https://factorcode.org > > This release is brought to you with over 4,100 commits by the following > individuals: > > Abtin Molavi, Ales Huzik, Alex null Maestas, Alexander Ilin, Alexandre > Rousseau, Aleksander Sabak, Arnaut Daniel, Ashish Kurmi, Benjamin Pollack, > Cat Stevens, Cecilia Knäbchen, Chris Double, Craig Allen, Dave Carlton, > David Flores, David Mindlin, Doug Coleman, Dusk Banks, Fred Alger, > Giftpflanze, Ikko Ashimine, Jack Lucas, John Benediktsson, Jon Harper, > Justin Hill, KUSUMOTO Norio, Keldan Chapman, Kevin Cope, Konrad Hinsen, > Kye > Shi, Mark Sweeney, Mohamed Akram, Nandeeka Nayak, Niklas Larsson, Raghu > Ranganathan, Rudi Grinberg, Samuel Tardieu, Sebastian Strobl, Sergii > Fesenko, Silvio Mayolo, Steve Ayerhart, Zoltán Kéri, @Capital-EX, > @inivekin, @mariari, @nicolas-p, @nomennescio, @timor > > Besides some bug fixes and library improvements, I want to highlight the > following changes: > > * Added a Guided Tour of Factor > * Upgraded to Unicode 15 > * The fixups vocabulary makes upgrading easier when words are renamed > * Windows binaries now include OpenSSL 3.1.2 and SQLite 3.42.0 for > convenience > * Re-added some support for FreeBSD > * Improved non-English text entry on macOS > * Removed support for 32-bit macOS > * File editors are now specified using EDITOR: syntax > * Switched to newer ucrtbase.dll on Windows > * Support disassembly using Capstone in addition to Udis86 > * String literals must be separated by whitespace — "hello"length and > "foo""bar"append are no longer accepted by the parser > * The fry and locals syntax words are now in syntax for use in all > vocabularies > * Any word can be referred to by it’s fully-qualified name (e.g., math:+ or > xml.writer:pprint-xml) > * The Emacs “FUEL” and VIM plugins have been updated > > Some possible backwards compatibility issues: > > * Moved colors.constants and colors.hex to colors vocabulary > * Merged io.binary.fast into io.binary > * Merged io.directories.{hierarchy,search} into io.directories > * Merged io.encodings.utf16n into io.encodings.utf16 > * Renamed math.ranges to ranges > * Renamed ranges words from [a,b] to [a..b] > * Changed FUNCTION: syntax to not require a semi-colon at the end > * Renamed exists? to file-exists? > * Renamed vector dot product from v. to vdot > * Renamed short to index-or-length > * Renamed various sorting words to be more simple > * Improved icons and other UI images on retina displays > * URL query strings only split on ampersand (?a=b=d) not semi-colon > (?a=b;c=d) > * Renamed some words in interval-sets to prefix interval-… > * Renamed contents to read-contents > * Renamed lines to read-lines > * Renamed selections to all-selections > * Renamed intersection to intersect-all > * Merged json.reader and json.writer into json vocabulary > * Merged bson.reader and bson.writer into bson vocabulary > * Moved talks to separate factor-talks repository > * Renamed ui.backend.gtk to ui.backend.gtk2 to prepare for newer GTK support > > For more details, please see the full announcement at: > > https://re.factorcode.org/2023/08/factor-0-99-now-available.html > > > > ___ > 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] Handling keyboard input
Hi, in terminals, the application interacts with text streams (0 stdin, 1 stdout, 2 stderr, and optionally others with higher numbers) so all you can get is text (including control characters). You can find documentation here https://docs.factorcode.org/content/article-streams.html . You should be able to write a program to solve https://rosettacode.org/wiki/Keyboard_input/Obtain_a_Y_or_N_response from https://docs.factorcode.org/content/article-stream-examples.html for example. This is very mature. To work with keyboard key codes (which can represent modifiers like control or alt) in the terminal, you need a more general library. Factor has ncurses bindings which look like it should work on windows mac and linux: https://docs.factorcode.org/content/vocab-curses.html if that's what you're looking for. To work with keyboard key codes in a graphical window, you can use the UI support in the library: https://docs.factorcode.org/content/article-ui.html and more precisely https://docs.factorcode.org/content/article-ui-gestures.html and https://docs.factorcode.org/content/article-keyboard-gestures.html . You can get a feel of what kind of event you can receive by running the run-gesture-logger from extra/gesture-logger/gesture-logger.factor . Here's the output from a short session I just did: (random pressing keys on my keyboard and moving the cursor with the focus on the the black window opened by factor to have focus on it: T{ key-down } T{ key-up { mods { A+ } } } lose-focus gain-focus lose-focus gain-focus T{ key-down } T{ key-up { mods { C+ } } } T{ key-down } T{ key-down { sym "A" } } T{ key-up { sym "A" } } T{ key-up } T{ key-down } T{ key-up } T{ key-down { sym "D" } } T{ key-up { sym "D" } } T{ key-down { sym "A" } } T{ key-up { sym "A" } } T{ key-down } T{ key-up } T{ key-down { sym "RET" } } T{ key-up { sym "RET" } } T{ key-down { sym "BACKSPACE" } } T{ key-up { sym "BACKSPACE" } } mouse-enter motion motion motion motion motion mouse-leave lose-focus ) Hope that helps, feel free to ask more questions ! Cheers, Jon On Mon, Mar 20, 2023 at 4:58 PM Cleverson Casarin Uliana wrote: > > Hi, > Have you implemented keyboard handling in a terminal like the Windows > command prompt? In the factor library, there is e.g. extra/key-handlers, > but it seems quite sparse. > > In Rosetta Code there is no related tasks implemented as well; see for > example the Keyboard Input related tasks at: > https://rosettacode.org/w/index.php?title=Category:Programming_Tasks=Four+is+magic#mw-pages > > I'd like something similar to 8th in this respect, see: > https://8th-dev.com/manual.html#key-codes > > P.S.: Apologies to the moderator for sending a message from the wrong > address earlier. > > Greetings, > Cleverson > > > ___ > 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] Port on Z80 computers.
Hi Yves, Unfortunately, I think that factor is not the language you are looking for. Although it has the same concatenative style as forth, it's not at all a lightweight language like forth. The runtime requires an OS for many things. It's a general purpose high level language with garbage collection, cooperative threading, many functional programming operations, runtime JIT code generation, etc. I'd be very surprised if you could run it on anything with less than 64Mb of ram (I personally ran it on a robotino which had linux and 256Mb of ram, and there it ran great). So targeting a 4MHz cpu with 128 kb of ram is out of reach I'm afraid. Cheers, Jon On Wed, Nov 24, 2021 at 9:30 AM yves gerey wrote: > > Bonjour, noob here, but [Z80 connaisseur](http://orgams.wikidot.com/)! > > I'd like to port a lightweight language to a Z80-based computer older than > you (the Amstrad CPC 6128), and to CP/M as well if there is interest. > * Sub-goal: porting a vm. > * Main-goal: having the whole toolchain on the native machine (no > cross-compilation) > More context > [here](https://www.pouet.net/topic.php?which=12155=1#c571455). > > Factor is a pretty interesting candidate. My main concern is that it wouldn't > be high-level enough! If I had to juggle with the stack, I might do it in > assembler directly. > > My first questions are: > - Is there already related work? (my google-fu wasn't strong enough) > - Is anyone interested to work on that with me? (I'm an outgoing introvert, > according to my dog). Following Erdòs, I believe that programming is the > perfect social activity for asocials (ok, just kidding, I don't mean to > reinforce stereotypes). > > Cheers! > > -- > -- > λves > ___ > 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] May 5th
sure ! How long have they been working on it ? How much time do they have left ? Jon On Thu, Apr 22, 2021 at 1:51 AM cat via Factor-talk wrote: > > I'm interested! > > > > ‐‐‐ Original Message ‐‐‐ > On Tuesday, April 20, 2021 12:04 PM, John Benediktsson > wrote: > > Hi everyone, > > We have a team of college students from Harvey Mudd College working on some > improvements to the Factor web frameworks, specifically implementing a Factor > native GZIP vocabulary and a HTTP/2 web server. > > They are going to discuss and present their results on May 5th at 9am PST > online via a Zoom session. It would be nice if anyone with interest would > come and listen and perhaps ask them about their work and future steps. > > Please write me back directly if you would like an invitation to this session. > > Best, > John. > > > ___ > 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 validate different formats in an array?
You can see some solutions for AoC problems on the factor pastebin: https://paste.factorcode.org/ For day4, there are 2 examples, using 1&& ( https://docs.factorcode.org/content/word-1&&,combinators.short-circuit.html) or EBNF semantic actions ( https://docs.factorcode.org/content/article-peg.ebnf.semantic-action.html ). Please add your own :) Jon On Mon, Dec 7, 2020 at 5:18 AM Woosuk Kwak wrote: > > Thanks, call(...) is exactly what I needed. And yes, that's the intended > stack effect, and 2all? works for my purpose. > > It would be helpful if the help page for 'call' mentions 'call(' as an > alternative where it doesn't work. > > On Mon, Dec 7, 2020, 12:05 PM John Benediktsson wrote: >> >> You should be able to call dynamic quots by specifying their stack effect in >> the call, assuming your quotations take one input and produce a Boolean >> >> [ call( elt — ? ) ] 2map >> >> Or even use 2all? If you want to know if an input array passes all the tests. >> >> >> >> > On Dec 6, 2020, at 6:11 PM, bubbler9...@gmail.com wrote: >> > >> > >> > Hi, >> > >> > I'm currently solving problems on Advent of Code 2020 >> > (adventofcode.com/2020) and Rosalind (rosalind.info) in Factor. >> > I encountered an interesting problem in AoC2020 Day4 Part2: the main part >> > of the problem is, given an array of 7 strings, validate them for seven >> > different conditions, i.e. test item 0 for condition 0, item 1 for >> > condition 1, etc. >> > I initially thought pushing an array of 7 functions and doing "[ call ] >> > 2map" should work, but it didn't. I "solved" the problem by extracting the >> > 7 strings on the stack (using "7 firstn"), using spread, and collecting >> > them back (using "7 narray"). Is there a better way to achieve this? >> > >> > The full code can be found here: >> > github.com/Bubbler-4/factor-problem-solving/blob/main/aoc2020/day4/day4.factor >> > ___ >> > 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] Peg Parsing Files
I didn't know about the seekable streams implementation in factor: https://docs.factorcode.org/content/article-stream-protocol.html We have: "/tmp/toto" ascii stream-seekable? f "/tmp/toto" (file-reader) t ! it works, stream-seek can rewind or fast forward and stream-read1 will get the bytes For some variable length encodings (utf8), seeking is going to be pretty expensive, but for ascii it's transparent so maybe it should work in ? Anyway you're right, although the peg vocabulary currently uses the sequence protocol (mainly through slices from what I see), maybe it could be rewritten to use the seekable stream protocol ? Still seems like quite a lot of work though. Jon On Sat, Nov 21, 2020 at 11:49 PM Alexander Ilin wrote: > > What's the problem backtracking through a file? Streams can have arbitrary > positioning. > > Alternatively, there must be a simple way to "wrap" a random access file > stream with an array-like interface, right? Don't we have a class like that > somewhere? > > Like the reverse of and ? > > I will definitely use the tokenizers, thanks. > > 22.11.2020, 01:34, "Jon Harper" : > > What you are describing reminds me of the built-in nesting of parsers with > the ebnf tokenizer : > https://docs.factorcode.org/content/article-peg.ebnf.tokenizers.html > > Not sure if it's really applicable to your use case though. > > > As for streams, aren't packrat parsers backtracking (with memoization)? So no? > > > > ___ > 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] Peg Parsing Files
What you are describing reminds me of the built-in nesting of parsers with the ebnf tokenizer : https://docs.factorcode.org/content/article-peg.ebnf.tokenizers.html Not sure if it's really applicable to your use case though. As for streams, aren't packrat parsers backtracking (with memoization)? So no? Le sam. 21 nov. 2020 à 18:15, Alexander Ilin a écrit : > I have another question to follow this up. I want to create a multilayer > parser. > The first layer would read a bunch of textual log files (with date-time in > their names) and search for various types of events using PEG patterns per > line and skipping noise. This would produce a stream of interesting events. > The next layer of parsing will process this stream searching for higher > level patterns that can be folded into, say, meta-events comprised of a > tree of sub-events detected on the first parsing level. This layer will > produce an AST that can be queried by the user to find out details about > various aspects of what actually happened. > So, the question is, is it possible to use the peg vocab to create this > layered parsing architecture, where the first layer would consume a stream > of file input, and the second would consume a stream of tokens from the > first layer? > > 21.11.2020, 02:17, "Alexander Ilin" : > > Hello! > > I see that the peg vocab operates on strings. Can it operate on streams? > I want to parse some log files, and thought it would make sense not to > load them all at once. > Especially since I want to stream multiple files concatenated as one. > > ---=--- > Александр > > > > ___ > 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] ?change-value for assocs
I think Alex wanted the conditional execution of the quot. if the key doesn't exist in the assoc, change-at provides f as value, but still stores the newvalue in the assoc at the given key. Jon On Mon, Aug 17, 2020 at 6:18 PM John Benediktsson wrote: > > https://docs.factorcode.org/content/word-change-at,assocs.html > > On Aug 17, 2020, at 8:31 AM, Alexander Ilin wrote: > > Hello! > > I came up with this code, because I could not quickly find an existing word > for this. > Did I miss it? If not, would it be a useful addition to the assocs vocab? > > ! If key exists in the assoc, change its value with quot. > : ?change-value ( assoc key quot: ( value -- value' ) -- assoc' ) >[ swap pick set-at ] compose [ 2dup of ] dip [ drop ] if* ; inline > > ! Usage example: > : ?decode-opt ( assoc -- assoc' ) >"opt" [ string>options ] ?change-value ; > > > ---=--- > Александр > > > > ___ > 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] Package Factor into a DLL
There's https://docs.factorcode.org/content/article-embedding.html (I never tried it) Le sam. 18 juil. 2020 à 13:12, Alexander Ilin a écrit : > Hello! > > Is it possible to create a DLL in Factor and define exported functions > that can be called from other Windows processes who load that DLL? > > ---=--- > Александр > > > > ___ > 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] She-bang
It's in the docs, maybe not prominent enough though: https://docs.factorcode.org/content/article-cookbook-scripts.html at the bottom of the page Jon On Tue, Apr 21, 2020 at 2:14 AM Alexander Ilin wrote: > > Thanks for the quick reply! I think it should be in the docs, but either it's > self-evident and not worth mentioning, or I failed to find it. > I was searching around the command-line parameters (-e, -run, etc.) > > 21.04.2020, 02:15, "John Benediktsson" : > > Yes, if you put a she-bang at the top you can just run it. > > > > $ cat hello > > #!/path/to/factor > > USE: io ; > > “HELLO WORLD” print > > > > $ ./hello > > > >> On Apr 20, 2020, at 4:10 PM, Alexander Ilin wrote: > >> > >> Hey, guys! > >> > >> I could not find this in the help. Does Factor support she-bang style > >> scripts? > >> > >> ---=--- > >> Александр > >> > >> ___ > >> 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] Co-operative threading
Last time I checked ( https://github.com/factor/factor/issues/1129 ), named pipes support wasn't ideal in factor.. Even if you don't use with-file-reader and call open and read directly, you won't get cooperative threading. You can get it from stdin and stdout because there's special support for that, or from sockets. Jon On Sun, Sep 15, 2019 at 10:08 AM murray.calavera--- via Factor-talk wrote: > > I don't think that's true, if that were the case it would be constantly > printing to stdout. > It's a fifo file created with mkfifo, as soon as data is read from it the > data is no longer in the file. Fifos are automatically closed after one > process(e.g. echo) writes to it, so I have to reopen it so I can echo to it > multiple times. > > But I think I worked out the problem thanks to your comment, I think it's > because with-file-reader blocks without yielding. > > ‐‐‐ Original Message ‐‐‐ > On Sunday, September 15, 2019 3:10 AM, Alexander Ilin > wrote: > > You open a file, read one line, then reopen the file and do the same again. > Since you are reopening the stream, there's always data available, thus there > is no reason to yield. > > 14.09.2019, 21:04, "murray.calavera--- via Factor-talk" > : > > Hello all, > > I'm a bit confused about how threads work with IO in factor. > > > This: https://docs.factorcode.org/content/article-threads.html seems to imply > that functions such as readln will yield to other threads unless data is > available on a stream, but the following program only ever reads from the > fifo: > > > USING: kernel threads io io.files io.encodings.utf8 ; > IN: test > > : read-fifo ( -- ) > "fifo" utf8 [ readln print flush ] with-file-reader read-fifo ; > > : read-stdin ( -- ) > readln print flush read-stdin ; > > [ read-fifo ] "fifo-thread" spawn drop > read-stdin > > > > What am I misunderstanding here? > > Thanks. > > Murray. > > > ,, > > ___ > 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] Updating factor
Regarding unit tests, I think there was some cleanup recently and everything is now done in the factor temp directory. Le 29 janv. 2017 10:56, "Alexander Ilin"a écrit : > Hello, Tim! > > 29.01.2017, 12:35, "Timothy Hobbs" : > > I tried to follow > > http://docs.factorcode.org/content/article-first-program-start.html and > > > > "palindrome" scaffold-work > > > > Tries to write to the "factor-install-dir/work" directory. This failed, > > because that directory was read only. Is work the only directory that > > factor tries to write to? Can I change the path to the work directory? > > First of all, there are other scaffold-* words, which will write to > other respective directories. It is entirely up to you whether to use those > words, or not. By calling those words you are explicitly asking Factor to > create new files in its subfolders. > > Second, I'm sure there are some unit-tests that would create temporary > files. You don't have to run those, unless you make changes to the Factor > itself (if you do, you need full write access anyway). > > To have write permissions to the work folder, you could make it a > symbolic link to a location that you prefer, like something in your home > directory. > > You could avoid using all of the above and create your own folder > wherever you want, add it to the global .factor-roots file, and put your > new vocabs in there instead of the work directory. > > http://docs.factorcode.org/content/article-vocabs.roots.html > http://docs.factorcode.org/content/article-.factor-roots.html > > Question: why was the work directory read-only? What OS are you on? > > ---=--- > Александр > > > -- > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > ___ > Factor-talk mailing list > Factor-talk@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/factor-talk > -- Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] unclip performance on ranges
Hi, instead of creating range-unclip, a simpler idea is to use unclip-slice. this article has some insights regarding unclip vs unclip-slice : http://docs.factorcode.org/content/article-sequences-slices.html You can also look at the word next-prime from math.primes http://docs.factorcode.org/content/word-next-prime,math.primes.html Usually, we do not add the recursive declaration to non-combinators recursive words (see http://docs.factorcode.org/content/word-recursive,syntax.html ) I'm not sure if creating specialized words to unclip (or more generally create new ranges from previous ranges) is useful, because most of the time you have one range on which you iterate, not recursive creations of ranges. You can use unclip-slice, cut-slice etc for that. Regarding your problem, here's a solution for posterity :) A very simple prototype implementation could be: USE: math.primes : gap ( gap from to -- pair/f ) primes-between dup rest zip [ first2 swap - = ] with find nip ; It's too simple because it computes all the primes until the end in a vector and then looks for the gap. Here's a more complex version with locals to compute primes and check for the gap on the fly: :: gap ( gap from to -- pair/f ) from 1 - next-prime dup next-prime [ 2dup [ swap - gap = ] [ to > ] bi or ] [ nip dup gap 1 - + next-prime ] until dup to > [ 2array ] [ 2drop f ] if ; I think it could be made simpler but didn't try very hard. Jon Jon On Thu, Jan 26, 2017 at 6:59 AM, Alexander Ilinwrote: > Hello, fede s! > > I'm guessing, unclipping a range (which is a small tuple) produces a huge > array of integers. > > It feels like In this algorithm you don't need any arrays at all, a simple > iteration would suffice. Plus, you don't need to check all the numbers with > prime?, only the odd ones, so unlcip is doubly unfit here as the propulsion > engine. > > The idea of doing the special range-unclip is fine. Although the current > implementation never ends producing the "first" elements, even after the > range is exhausted. This is due to the possibility of having ranges with > negative step slot, as in `5 -5 [a,b]`. The regular `unclip` on the other > hand, throws an error when applied to an empty sequence. > > I've looked at the code, and I don't see a way to override the word unclip > to work on ranges in the more optimal way that you suggest. Maybe some > specialized words like range-unclip could be added to math.ranges? > > 23.01.2017, 02:24, "fede s" : > > Hi, I noticed this Q in StackExchange http://codereview. > stackexchange.com/questions/153288/codewars-gap-in-primes > and attempted a (naive) solution for the problem: > > : next-prime ( range -- rest prime? ) > dup empty? > [ f ] > [ unclip dup prime? > [ drop next-prime ] unless > ] if ; recursive > > :: check-gap ( gap prev rest last -- g p r l ? ) > gap prev rest last > prev last - gap = ; > > : (primes-gap) ( gap range last -- n1? n2? ) > swap next-prime dup > [ check-gap > [ nip rot drop ] > [ [ drop ] 2dip (primes-gap) ] > if ] > [ 4 ndrop f f ] if ; recursive > > : primes-gap ( gap from to -- n1? n2? ) > [a,b] next-prime over > [ (primes-gap) ] > [ 3drop f f ] if ; > > > For that version, > [ 8 3,000,000 4,000,000 primes-gap [ . ] bi@ ] time > gave 59 seconds on my system, most spent on unclip. > > I changed: > > : range-unclip ( r -- r' 1st ) > [ first 1 + ] [ last [a,b] ] [ first ] tri ; > > : next-prime ( range -- rest prime? ) > dup empty? > [ f ] > [ range-unclip dup prime? > [ drop next-prime ] unless > ] if ; recursive > > which gave only "Running time: 0.000342938 seconds" > > Factor 0.98 x86.64 (1777, heads/master-ed29fbd93f, Mon Aug 8 20:45:47 > 2016) > [Microsoft Visual C++ 190023506] on windows 7 > > I know there have been some changes since then, and that I'm probably > doing things in a very sub-optimal way, but thought that there may still be > something of value here. > > > > > ---=--- > Александр > > > > -- > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > ___ > Factor-talk mailing list > Factor-talk@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/factor-talk > > -- Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Ratio vs. Float
A classic workaround when = is not what you want in unit tests is to do the work in the quotation and return a boolean (or anything for which = works) and use { t } as the expected output. Le 20 janv. 2017 00:08, "Alexander Ilin" <ajs...@yandex.ru> a écrit : > Thank you, Jon, now I understand what the problem is. > Unfortunately, in my case I can't use `number=` because the comparison is > done by the unit-test word. > In the following code the first test succeeds, but the second one fails: > > ``` > { 15 } [ 10 20 middle ] unit-test > { -40.5 } [ -50 -31 middle ] unit-test > ``` > > 20.01.2017, 01:30, "Jon Harper" <jon.harpe...@gmail.com>: > > Hi, > you have to use number= to compare numbers with different types. > http://docs.factorcode.org/content/word-number=,math.html > > Jon > > Jon > > On Thu, Jan 19, 2017 at 10:50 PM, Alexander Ilin <ajs...@yandex.ru> wrote: > > Hello! > > I'm a bit confused. Why is following not true? > > `81/2 40.5 =` > > ---=--- > Александр > > > -- > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > ___ > Factor-talk mailing list > Factor-talk@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/factor-talk > > , > > > -- > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > , > > ___ > Factor-talk mailing list > Factor-talk@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/factor-talk > > > > ---=--- > Александр > > > > -- > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > ___ > Factor-talk mailing list > Factor-talk@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/factor-talk > > -- Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Ratio vs. Float
Hi, you have to use number= to compare numbers with different types. http://docs.factorcode.org/content/word-number=,math.html Jon Jon On Thu, Jan 19, 2017 at 10:50 PM, Alexander Ilinwrote: > Hello! > > I'm a bit confused. Why is following not true? > > `81/2 40.5 =` > > ---=--- > Александр > > > -- > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > ___ > Factor-talk mailing list > Factor-talk@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/factor-talk > -- Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
[Factor-talk] EBNF peg parser ensuring full parse
Hi list, when using the peg.* parsing words to parse a sequence of elements, what is the best way to detect invalid input ? By default the parsing stops when rules don't match (end of input, or bad input), For example, consider the following case: "abaXbba" [EBNF rule= ("a" | "b")* EBNF] ! V{ "a" "b" "a" } "abaabba" [EBNF rule= ("a" | "b")* EBNF] ! V{ "a" "b" "a" "a" "b" "b" "a" } Sometimes, in the first case, you want the parsing to throw, or to return a boolean or return the remaining text to parse. The following works, but uses low level words: "abbaXbba" (parse) [ ast>> ] [ remaining>> empty? ] bi The following also works (I think) "abaXbba" [EBNF rule= ("a" | "b" | . => [[ "invalid" throw ]] )* EBNF] or with lookahead "abaXbba" [EBNF rule= ("a" | "b")* !(.) EBNF] Those two work, but then you can't use the same parser for both behaviors, and they use "advanced" (actions or lookahead) features for a simple task. Should we add words to do this more easily ? maybe : parse* ( string parser -- ast remaining ) : parse-all ( string parser -- ast ) ! throws when remaining not empty Maybe EBNF: can define several words ? (but it's bad for grepability...) Or maybe just document the existing solution with and remaining>> What do you think ? Cheers, Jon -- Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] slice>seq
dup seq>> like would work i guess. Or if you want an array, >array ? Jon Le 10 janv. 2017 22:01, "Alexander Ilin"a écrit : Hello! What's the word to convert a `slice` into a real chunk of its underlying sequence? I'm looking for something like this: : slice>seq ( slice -- seq ) [ from>> ] [ to>> ] [ seq>> ] subseq ; ---=--- Александр -- Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today. http://sdm.link/xeonphi ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today. http://sdm.link/xeonphi___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] PDF
Hi, there is http://docs.factorcode.org/content/vocab-pdf.html and its children. I haven't used it, but it is for example used to generate the docs in pdf using pdf streams. Jon Le 20 déc. 2016 08:39, "Alexander Ilin"a écrit : Hello! Is there a way to generate PDF documents from within Factor? ---=--- Александр -- Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today.http://sdm.link/intel ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today.http://sdm.link/intel___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Floats
It's in math.functions: ~ Le 13 déc. 2016 18:57, "Alexander Ilin"a écrit : > Hello! > > Is there a word for comparing two floats with a given precision? > > ---=--- > Александр > > > -- > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > ___ > Factor-talk mailing list > Factor-talk@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/factor-talk > -- Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Libudis86.dll (Was: TYPED: Declarations)
All things in factor carry their type with them at runtime. For everything but integers, this is done by manipulating pointers to the thing instead and requiring an alignment of the address of the thing. This means that a pointer to this thing will have its lower bits with a value of 0 (the number of bits depends on the alignment. In factor, everything is aligned to 16 bytes, so 4 bits are 0). This is not much of a cost because most things (think tuples, arrays, etc) are bigger then 16 bytes, and you want stuff to be aligned for performance anyway. So since the lower bits always have a value of 0, you can actually put any value in there an just ignore it when following the pointer. For integers only, you don't manipulate pointers, you manipulate the value. When you are doing operations on integers, you need to shift right to get the value (and throw away the tag), do the operation, then shift left and re add the tag. You then notice that if you choose the tag 0 for integers, you don't have to re-add the tag because shifting left inserts zeroes. And you also notice that "( (a >> 4) + (b >> 4) ) << 4" is "a + b" (except when there is an overflow) because of the maths properties (distribution of * to +). So for many operations on integers (like +), you can just do them directly on the tagged (= shifted) integer. Hopefully I didn't make too many mistakes in my explanation, anyone feel free to correct me if I'm wrong :) Jon On Fri, Nov 25, 2016 at 12:24 PM, Alexander Ilin <ajs...@yandex.ru> wrote: > Hi! > > I have no idea what integer tagging is, but it's great that there is no > bug. > > To all: I still have the 32-bit buld of the DLL, which I'd like to make > available on the Factor Downloads page. > > 25.11.2016, 11:57, "Jon Harper" <jon.harpe...@gmail.com>: > > Hi, > It's actually the correct data. > All integers are shifted by 4 (hence the 28/60 discussions). The tag of > integers was chosen to be 0 so that some operations (like +) dont' have to > shift before and after. But some operations do have to shift their > arguments to their actual values first. > > If you do : testshift ( n m -- k ) { fixnum fixnum } declare shift ; > you'll see that the second argument is shifted before the shift > instruction is called. > > Or > : test2shift ( n -- n ) 2 shift ; > Should have the correct constant somwhere. > > Le 25 nov. 2016 09:23, "Alexander Ilin" <ajs...@yandex.ru> a écrit : > > Thank you, John, that was very helpful! > > > P.S., I think 32-bit libudis86.dll exists somewhere, and I know 32-bit > libudis86 is supported on other OS's. > > I have found the sources here: https://github.com/vmt/udis86 > > I happen to have VS2010, so I managed to build both 64- and 32-bit > versions of the DLL, v1.7.2. I can contribute those if you tell me the way. > BTW, for some reason my 64-bit build DLL file is smaller than the one at > http://downloads.factorcode.org/dlls/64/ > Maybe that's good. > > Anyway, when testing the thing under 32-bit I found an issue, of which I'm > not sure whether it's ours or theirs: > > IN: scratchpad : test2+ ( n -- n ) 2 + ; > IN: scratchpad \ test2+ disassemble > 083c2c10: a300106907mov [0x7691000], eax > 083c2c15: 83c604add esi, 0x4 > 083c2c18: c7062000 mov dword [esi], 0x20 ! > This should be > 0x02 > 083c2c1e: a300106907mov [0x7691000], eax > 083c2c23: ba2d2c3c08mov edx, 0x83c2c2d (test + 0x1d) > 083c2c28: e903465bffjmp 0x7977230 (+) > 083c2c2d: add [eax], al > 083c2c2f: add [eax], al > 083c2c31: add [eax], al > 083c2c33: add [eax], al > 083c2c35: add [eax], al > 083c2c37: add [eax], al > 083c2c39: add [eax], al > 083c2c3b: add [eax], al > 083c2c3d: add [eax], al > 083c2c3f: 00invalid > > The same issue is present in the 64-bit build of the libudis86.dll > downloaded from http://downloads.factorcode.org/dlls/64/ > > It can also be reproduced using their command-line client: > > echo a3 00 10 69 07 83 c6 04 c7 06 20 00 00 00 | udcli -x > a300106907 mov [0x7691000], eax > 0005 83c604 add esi, 0x4 > 0008 c7062000 mov dword [esi], 0x20 > All three lines of the above output have half-bytes swapped in the > mnemonics (0x20 instead of 0x2, 0x4 instead of 0x40, etc.). > > This begs the question: do we supply bad data to the disassembler, or does > disassembler misinterprets what we give it? > > ---=--- > Александр > > > > -- > > __
Re: [Factor-talk] Libudis86.dll (Was: TYPED: Declarations)
Hi, It's actually the correct data. All integers are shifted by 4 (hence the 28/60 discussions). The tag of integers was chosen to be 0 so that some operations (like +) dont' have to shift before and after. But some operations do have to shift their arguments to their actual values first. If you do : testshift ( n m -- k ) { fixnum fixnum } declare shift ; you'll see that the second argument is shifted before the shift instruction is called. Or : test2shift ( n -- n ) 2 shift ; Should have the correct constant somwhere. Le 25 nov. 2016 09:23, "Alexander Ilin"a écrit : Thank you, John, that was very helpful! > P.S., I think 32-bit libudis86.dll exists somewhere, and I know 32-bit libudis86 is supported on other OS's. I have found the sources here: https://github.com/vmt/udis86 I happen to have VS2010, so I managed to build both 64- and 32-bit versions of the DLL, v1.7.2. I can contribute those if you tell me the way. BTW, for some reason my 64-bit build DLL file is smaller than the one at http://downloads.factorcode.org/dlls/64/ Maybe that's good. Anyway, when testing the thing under 32-bit I found an issue, of which I'm not sure whether it's ours or theirs: IN: scratchpad : test2+ ( n -- n ) 2 + ; IN: scratchpad \ test2+ disassemble 083c2c10: a300106907mov [0x7691000], eax 083c2c15: 83c604add esi, 0x4 083c2c18: c7062000 mov dword [esi], 0x20 ! > This should be 0x02 083c2c1e: a300106907mov [0x7691000], eax 083c2c23: ba2d2c3c08mov edx, 0x83c2c2d (test + 0x1d) 083c2c28: e903465bffjmp 0x7977230 (+) 083c2c2d: add [eax], al 083c2c2f: add [eax], al 083c2c31: add [eax], al 083c2c33: add [eax], al 083c2c35: add [eax], al 083c2c37: add [eax], al 083c2c39: add [eax], al 083c2c3b: add [eax], al 083c2c3d: add [eax], al 083c2c3f: 00invalid The same issue is present in the 64-bit build of the libudis86.dll downloaded from http://downloads.factorcode.org/dlls/64/ It can also be reproduced using their command-line client: > echo a3 00 10 69 07 83 c6 04 c7 06 20 00 00 00 | udcli -x a300106907 mov [0x7691000], eax 0005 83c604 add esi, 0x4 0008 c7062000 mov dword [esi], 0x20 All three lines of the above output have half-bytes swapped in the mnemonics (0x20 instead of 0x2, 0x4 instead of 0x40, etc.). This begs the question: do we supply bad data to the disassembler, or does disassembler misinterprets what we give it? ---=--- Александр -- ___ 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] Parsing Ratios
Hi, the code for parsing ratios is in https://github.com/factor/ factor/blob/master/core/math/parser/parser.factor It's called by string>number (or base>) see ->numerator ->denominator ?make-ratio ?add-ratio Cheers, Jon On Thu, Nov 24, 2016 at 6:38 PM, Alexander Ilinwrote: > Hello! > > Ideas of some custom parsing words still intrigues me. > > Could someone tell me where is the code that parses ratios? > > ---=--- > Александр > > > -- > ___ > 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] GC Bug? (Was: Out Of Memory)
Found the discussion about 32bit array : https://github.com/factor/factor/issues/1566 Also what's happening in your case is that the heap size grows when the arrays are allocated. If you gc, you will get rid of the arrays, but the heap doesn't shrink. So you can reallocate more arrays, but the factor process still uses as much ram. Note that if the arrays are prettyprinted in the listener, you need to "restart listener" and then gc so that they can be collected. On my machine, I see: 8 10^ 0 ! 10% MEM 8 10^ 0 ! 20% MEM restart listener gc ! %20 MEM 8 10^ 0 ! 20% MEM 8 10^ 0 ! 20% MEM 8 10^ 0 ! 30% MEM Jon On Thu, Nov 24, 2016 at 5:33 PM, Alexander Ilin <ajs...@yandex.ru> wrote: > Hello! > > OK, opening the console I also see the message "fatal_error: Out of memory > in VirtualAlloc". > > I did it this way: `6 [ 25 2^ 0 ] times` > > Now I have some further questions. > > When I do `5 [ 25 2^ 0 ] times` I see the factor.com process > eating up ~930 Mb of memory. > > Why is it that after restarting and doing `5 [ 25 2^ 0 ] times > clear gc` it still remains with ~930 Mb of memory? > > Why didn't `gc` release the unused and unreferenced memory back to the > system? > > More importantly, if I do `25 2^ 0 ` once more, it crashes, i.e. > the allocated memory remains unavailable, even though it should have been > collected by the GC. > > Is there a more aggressive version of the `gc` command? > > The `clear` command makes sure the empty allocated arrays don't show up in > (and get referenced by) the UI. Or am I missing something. > > The question is quite practical for me, as when I work with big data sets > I also see that GC keeps hogging the memory I don't use anymore, which > leads to crashes in the long (and even not so long) run. > > 24.11.2016, 19:16, "Jon Harper" <jon.harpe...@gmail.com>: > > That's because you are running a 32 bit factor. Try allocating many > arrays, at some point your OS should return an error to factor at > https://github.com/factor/factor/blob/master/vm/os-windows.cpp#L97 > > Also what you are seeing is expected, the array size is limited to > most-positive-fixnum/2, which is not a problem on 64bits (2^58-1 ~ 10^17 ) > but is kind of limiting on 32 bits (2^26-1 = 67 million ~= 10^8). There was > discussions about this but I can't find it anymore... > > Jon > > On Thu, Nov 24, 2016 at 4:45 PM, Alexander Ilin <ajs...@yandex.ru> wrote: > > Hello! > > Unfortunately, I can't reproduce this in Win8.1 GUI listener: > > IN: scratchpad 50 2^ 0 > Cannot convert to fixnum: 1125899906842624 > > IN: scratchpad 25 2^ 0 > (success) > > IN: scratchpad 26 2^ 0 > Invalid array size: 67108864 > Maximum: 67108863 > 24.11.2016, 17:06, "Jon Harper" <jon.harpe...@gmail.com>: > > Hi, > more precisely, the process is aborted (uses the vm 'fatal_error()' > function): > > $ ./factor -run=listener > Factor 0.98 x86.64 (1781, heads/master-d4528c36da, Tue Aug 16 17:00:11 > 2016) > [Clang (GCC 4.2.1 Compatible Ubuntu Clang 3.4 (tags/RELEASE_34/final))] on > linux > IN: scratchpad 50 2^ 0 > fatal_error: Out of memory in mmap: 0x2018a82000 > [ ... ] > Aborted (core dumped) > > > > Jon > > On Thu, Nov 24, 2016 at 4:15 AM, Björn Lindqvist <bjou...@gmail.com> > wrote: > > Hi, > > It shouldn't crash exactly, but it does terminate the process with an > "Out of memory" error. > > 2016-11-23 20:43 GMT+01:00 Alexander Ilin <ajs...@yandex.ru>: > > Hello! > > > > What happens if Factor is out of memory? > > Does it throw an exception and aborts the current operation? Or does > it simply crash the instance? > > For me it simply crashes, which is not very nice. > > > ---=--- > Александр > > > > -- > > ___ > 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] Out Of Memory
That's because you are running a 32 bit factor. Try allocating many arrays, at some point your OS should return an error to factor at https://github.com/factor/factor/blob/master/vm/os-windows.cpp#L97 Also what you are seeing is expected, the array size is limited to most-positive-fixnum/2, which is not a problem on 64bits (2^58-1 ~ 10^17 ) but is kind of limiting on 32 bits (2^26-1 = 67 million ~= 10^8). There was discussions about this but I can't find it anymore... Jon On Thu, Nov 24, 2016 at 4:45 PM, Alexander Ilin <ajs...@yandex.ru> wrote: > Hello! > > Unfortunately, I can't reproduce this in Win8.1 GUI listener: > > IN: scratchpad 50 2^ 0 > Cannot convert to fixnum: 1125899906842624 > > IN: scratchpad 25 2^ 0 > (success) > > IN: scratchpad 26 2^ 0 > Invalid array size: 67108864 > Maximum: 67108863 > 24.11.2016, 17:06, "Jon Harper" <jon.harpe...@gmail.com>: > > Hi, > more precisely, the process is aborted (uses the vm 'fatal_error()' > function): > > $ ./factor -run=listener > Factor 0.98 x86.64 (1781, heads/master-d4528c36da, Tue Aug 16 17:00:11 > 2016) > [Clang (GCC 4.2.1 Compatible Ubuntu Clang 3.4 (tags/RELEASE_34/final))] on > linux > IN: scratchpad 50 2^ 0 > fatal_error: Out of memory in mmap: 0x2018a82000 > [ ... ] > Aborted (core dumped) > > > > Jon > > On Thu, Nov 24, 2016 at 4:15 AM, Björn Lindqvist <bjou...@gmail.com> > wrote: > > Hi, > > It shouldn't crash exactly, but it does terminate the process with an > "Out of memory" error. > > 2016-11-23 20:43 GMT+01:00 Alexander Ilin <ajs...@yandex.ru>: > > Hello! > > > > What happens if Factor is out of memory? > > Does it throw an exception and aborts the current operation? Or does > it simply crash the instance? > > For me it simply crashes, which is not very nice. > > > ---=--- > Александр > > > > -- > > ___ > 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] Out Of Memory
Hi, more precisely, the process is aborted (uses the vm 'fatal_error()' function): $ ./factor -run=listener Factor 0.98 x86.64 (1781, heads/master-d4528c36da, Tue Aug 16 17:00:11 2016) [Clang (GCC 4.2.1 Compatible Ubuntu Clang 3.4 (tags/RELEASE_34/final))] on linux IN: scratchpad 50 2^ 0 fatal_error: Out of memory in mmap: 0x2018a82000 [ ... ] Aborted (core dumped) Jon On Thu, Nov 24, 2016 at 4:15 AM, Björn Lindqvistwrote: > Hi, > > It shouldn't crash exactly, but it does terminate the process with an > "Out of memory" error. > > 2016-11-23 20:43 GMT+01:00 Alexander Ilin : > > Hello! > > > > What happens if Factor is out of memory? > > Does it throw an exception and aborts the current operation? Or does > it simply crash the instance? > > For me it simply crashes, which is not very nice. > > > > ---=--- > > Александр > > > > > -- > > ___ > > Factor-talk mailing list > > Factor-talk@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/factor-talk > > > > -- > mvh/best regards Björn Lindqvist > > > -- > ___ > 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] Reading clipboard in a Factor script ?
It should work with my suggestion, I had tested it on ubuntu : #! /home/jon/factor/factor USING: ui.clipboards ui io namespaces kernel system ; "B4: " print clipboard get [ clipboard-contents print ] when* flush [ "AF: " print clipboard get clipboard-contents print flush 0 exit ] with-ui Cheers Jon On Thu, Nov 10, 2016 at 4:55 PM, Georg Simonwrote: > Am Thu, 10 Nov 2016 07:32:52 -0800 > schrieb John Benediktsson : > > My platform is Linux. Trying > --- > USING: > namespaces prettyprint ui.backend.gtk ui.clipboards > ; > init-clipboard clipboard get clipboard-contents . > --- > I get > --- > (process:6199): Gtk-CRITICAL **: IA__gtk_clipboard_get_for_display: > assertion 'display != NULL' failed > > (process:6199): Gtk-CRITICAL **: IA__gtk_clipboard_get_for_display: > assertion 'display != NULL' failed > > (process:6199): Gtk-CRITICAL **: IA__gtk_clipboard_wait_for_text: > assertion 'clipboard != NULL' failed f > --- > Will try Jon's suggestion now. > > > Right now they are commingled and clipboard use typically requires > > the UI to be initialized. > > > > But this works, for example on Mac as a script: > > > > USING: io namespaces ui.backend.cocoa ui.clipboards ; > > > > init-clipboard clipboard get clipboard-contents . > > > > What platform are you trying to make this work on? > > > -- > Developer Access Program for Intel Xeon Phi Processors > Access to Intel Xeon Phi processor-based developer platforms. > With one year of Intel Parallel Studio XE. > Training and support from Colfax. > Order your platform today. http://sdm.link/xeonphi > ___ > Factor-talk mailing list > Factor-talk@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/factor-talk > -- Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today. http://sdm.link/xeonphi___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Reading clipboard in a Factor script ?
You need to initialize the UI. the with-ui ( http://docs.factorcode.org/content/word-with-ui%2Cui.html ) word does that. Note that with-ui setups an event loop and doesn't finish until the event-loop exists (when you close the last window), so you can call exit directly to force it to exit. Maybe you could minimize the UI initialization and not setup the event-loop by looking at the with-ui word implementation and calling the correct words, but that would be harder. Jon On Thu, Nov 10, 2016 at 4:00 PM, Georg Simonwrote: > In the Listener > > ```clipboard get clipboard-contents``` > > leaves the clipboard content on the stack. > > In a Factor script I get an error. Because UI is not running I think. > > Is there a way to read the clipboard content in a Factor script ? > > Georg > > > -- > Developer Access Program for Intel Xeon Phi Processors > Access to Intel Xeon Phi processor-based developer platforms. > With one year of Intel Parallel Studio XE. > Training and support from Colfax. > Order your platform today. http://sdm.link/xeonphi > ___ > Factor-talk mailing list > Factor-talk@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/factor-talk > -- Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today. http://sdm.link/xeonphi___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Questions of a newcomer
Hi Peter, On Mon, Nov 7, 2016 at 3:07 PM,wrote: > Hello, > > I am tinkering with factor and was wondering if it is OK to pick your > brains here? As I play around with the language questions come up that > are probably easy for you to answer. I don't see much action on the > #concatenative IRC channel so I thought the maling list might be a > better place? > > Questions are always welcome. The mailing list or #concatenative on IRC are both good places to ask. Several people read the logs of #concatenative and may answer your questions some time after you sent it, so don't give up. As a starter: > > - I see a common pattern in definitions of using `dip` instead of > `swap`. Is there some special reason for that? Is it more performant? I > know the words aren't interchangeable but e.g. `with-directory-files` > has `[ [ "" directory-files ] ] dip` which as far as I can tell is > equivalent to `[ "" directory-files ] swap`. I saw this pattern in more > definitions. > I guess it's a matter of personal style. I would argue that the 'meaning' of swap ( x y -- y x ) is that there's the same importance on pushing y down the stack than on puling x up the stack. Whereas [ y ] dip would focus more putting y down the stack. Regarding the performance, you can often see for yourself using the optimized. word of compiler.tree.debugger. You could even install libudis and use the disassemble word of tools.disassembler. I would be surprised if the performance of swap vs dip mattered in a real application. > > - is there any sequence generator/iterator vocabulary? Something that > gives or computes values on demand. One can find it in many languages > with a bit different flavor, e.g. Scheme, Rust, Python. I saw that there > is lists.lazy which can serve a similar purpose but is a bit more heavy > weight in some cases. Maybe this isn't needed in factor at all and you > use a different pattern to solve a similar problem? > I've seen discussions on this mailing list about the extra/cursors vocabulary about that. I've never used it though. For example Joe talked about it in 2009: https://sourceforge.net/p/factor/mailman/message/23878123 Cheers, Jon -- Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today. http://sdm.link/xeonphi___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] restricting ratio literals
I think there is value in having such in important word (string>number) have a documented behavior. Right now it's hard to document all the things that are correctly parsed by this word... Jon On Wed, Oct 26, 2016 at 9:40 AM, Björn Lindqvist <bjou...@gmail.com> wrote: > Imho, choose based on what makes the implementation better. If the > parser can be written in a simpler (and probably faster) way by > dropping support for ratios in uncommon bases, then let's do it. Tbh, > I don't think any ratios other than those on the format int1/int2 > needs to be supported. > > 2016-10-24 19:23 GMT+02:00 Jon Harper <jon.harpe...@gmail.com>: > > Hi list, > > I'm reading the questions at https://github.com/factor/factor/pull/1362 > > again > > > > I think we should only allow ratio literals in base 10. Currently we > support > > 0xc+b/a or 0o4+7/3 or 0b1101+1101/110 but it looks ugly. > > > > What do you think ? > > > > Jon > > > > > -- > > Check out the vibrant tech community on one of the world's most > > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > > ___ > > Factor-talk mailing list > > Factor-talk@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/factor-talk > > > > > > -- > mvh/best regards Björn Lindqvist > > > -- > The Command Line: Reinvented for Modern Developers > Did the resurgence of CLI tooling catch you by surprise? > Reconnect with the command line and become more productive. > Learn the new .NET and ASP.NET CLI. Get your free copy! > http://sdm.link/telerik > ___ > Factor-talk mailing list > Factor-talk@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/factor-talk > -- The Command Line: Reinvented for Modern Developers Did the resurgence of CLI tooling catch you by surprise? Reconnect with the command line and become more productive. Learn the new .NET and ASP.NET CLI. Get your free copy! http://sdm.link/telerik___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] restricting ratio literals
I would say no prefix at all for ratios, only base 10. Also do people in the US consider 1+13/2 a number? Or is it really only written as 7+1/2? I think the number literals should only express what people consider as numbers. They should not replace arbitrary mathematical operations (like your 60/2.5 example) which are folded by the compiler anyway. What do you think? Le 25 oct. 2016 02:22, "John Benediktsson" <mrj...@gmail.com> a écrit : Those examples do look ugly -- maybe base 10 ratios only is not a bad idea. But would it support the 0d prefix? e.g. ``0d1+1/3``? On Mon, Oct 24, 2016 at 10:23 AM, Jon Harper <jon.harpe...@gmail.com> wrote: > Hi list, > I'm reading the questions at https://github.com/factor/factor/pull/1362 > again > > I think we should only allow ratio literals in base 10. Currently we > support > 0xc+b/a or 0o4+7/3 or 0b1101+1101/110 but it looks ugly. > > What do you think ? > > Jon > > > -- > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > ___ > Factor-talk mailing list > Factor-talk@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/factor-talk > > -- The Command Line: Reinvented for Modern Developers Did the resurgence of CLI tooling catch you by surprise? Reconnect with the command line and become more productive. Learn the new .NET and ASP.NET CLI. Get your free copy! http://sdm.link/telerik ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- The Command Line: Reinvented for Modern Developers Did the resurgence of CLI tooling catch you by surprise? Reconnect with the command line and become more productive. Learn the new .NET and ASP.NET CLI. Get your free copy! http://sdm.link/telerik___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
[Factor-talk] restricting ratio literals
Hi list, I'm reading the questions at https://github.com/factor/factor/pull/1362 again I think we should only allow ratio literals in base 10. Currently we support 0xc+b/a or 0o4+7/3 or 0b1101+1101/110 but it looks ugly. What do you think ? Jon -- Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
[Factor-talk] Restricting number bases conversion to 36
Hi list, >From the docs, http://docs.factorcode.org/content/article-number-strings.html "Integers can be converted to and from arbitrary bases." Indeed, we have: IN: scratchpad 1835084090 9830 >base print i♥u and it round trips fine ! IN: scratchpad 1835084090 9830 [ >base ] [ base> ] bi . 1835084090 So that's a bit silly and I think we could limit like most other languages the base to 36 and throw invalid-radix like we do for bases < 2 . What do you think ? Jon -- Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Decimal equivalent of 0b 0o 0x ?
According to https://rosettacode.org/wiki/Non-decimal_radices/Input at least perl 6, ruby and zkl have it. Jon On Fri, Oct 21, 2016 at 2:47 PM, Jon Harper <jon.harpe...@gmail.com> wrote: > Hi list, > what do you think about adding support for a new '0d' prefix to input > numbers in base 10 ? It's rare in other programming languages (I know > verilog has it in addtion to 'h and 'b) but the symmetry can be nice in > some cases. > > Of course it would *not* replace the normal way of writing numbers, simply > allow to emphasize that the number is in base 10.. It's useful when > switching frequently between bases. > > So string>number would accept "0d99" for 99. number>string would not > change. > > Cheers, > Jon > -- Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
[Factor-talk] Decimal equivalent of 0b 0o 0x ?
Hi list, what do you think about adding support for a new '0d' prefix to input numbers in base 10 ? It's rare in other programming languages (I know verilog has it in addtion to 'h and 'b) but the symmetry can be nice in some cases. Of course it would *not* replace the normal way of writing numbers, simply allow to emphasize that the number is in base 10.. It's useful when switching frequently between bases. So string>number would accept "0d99" for 99. number>string would not change. Cheers, Jon -- Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Could not initialize OpenAL
Openal works for me on Ubuntu 14.04 Le 12 sept. 2016 08:32, "Alexander Ilin"a écrit : Hello! Win 8x64, Factor 32-bit. I'm trying to run some demos, and they say I need alut.dll and openal32.dll, both of which I've downloaded and placed in the Factor.exe folder. When I click some of the buttons on the `"demos" run` page I see some modules loading, and then "Could not initialize OpenAL" with the Abort option. Is it just me, or do some other people have the same issue? The demos that fail are: balloon-bomber, jamshred, space-invaders. ---=--- Александр -- ___ 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] paste.factorcode.org
Hey, trying to write a new paste on http://paste.factorcode.org , I'm getting 404 Not found Anyone knows what's up ? Jon -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
[Factor-talk] prettyprinter number-base float errors
Hi list, I'm working on factor's number parsing/printing. I'd like some inputs on the following problem: Basically the problem can be seen from this paste: http://pastebin.com/jxV8UKG2 : setting number-base to 2 or 8 gives pprint-errors for floats. So we have the number-base variable in prettyprint.config to chose the prettyprinter base for numbers. For reals, it supports 2 8 10 and 16. For floats, only 10 and 16. Since 99804fd054d5, using an unsupported base throws an exception instead of defaulting to base 10. What should we do ? - go back to the previous behavior: default to base 10 ? - add new variables to configure rationals (integers + ratios) and floats separately? - allow floats to be printed in base 2 and 8 ? (for info the parser supports it: 0b1.1p0 0o1.4p0 0x1.8p0 all parse to 1.5) - a mix of the previous ? What do you think ? Jon -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Why doesn't my Factor receive the Insert key ?
Hi, see this related issue: https://github.com/factor/factor/issues/1656 The following patch adds INSERT for gtk and x11: diff --git a/basis/ui/backend/gtk/gtk.factor b/basis/ui/backend/gtk/gtk.factor index a10ad51..043db47 100644 --- a/basis/ui/backend/gtk/gtk.factor +++ b/basis/ui/backend/gtk/gtk.factor @@ -110,6 +110,7 @@ CONSTANT: action-key-codes H{ { $ GDK_KEY_BackSpace "BACKSPACE" } { $ GDK_KEY_Tab "TAB" } +{ $ GDK_KEY_Insert "INSERT" } { $ GDK_KEY_ISO_Left_Tab "TAB" } { $ GDK_KEY_Return "RET" } { $ GDK_KEY_KP_Enter "ENTER" } diff --git a/basis/ui/backend/x11/x11.factor b/basis/ui/backend/x11/x11.factor index ef22ab9..e55eb87 100644 --- a/basis/ui/backend/x11/x11.factor +++ b/basis/ui/backend/x11/x11.factor @@ -120,6 +120,7 @@ CONSTANT: key-codes { 0xFF56 "PAGE_DOWN" } { 0xFF57 "END" } { 0xFF58 "BEGIN" } +{ 0xFF63 "INSERT"} { 0xFFBE "F1"} { 0xFFBF "F2"} { 0xFFC0 "F3"} Jon On Tue, Aug 16, 2016 at 12:42 PM, Georg Simonwrote: > Hello! > > I use Xubuntu and the window manager awesome (awesomewm.org). > > When I run extra/gesture-logger/gesture-logger.factor > and press the insert key I only get > > T{ key-down } > T{ key-up } > > The home key for example produces > > T{ key-down { sym "HOME" } } > T{ key-up { sym "HOME" } } > > Is it possible to use the insert key too ? > > > -- > ___ > 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] Formatting Durations
Regarding over engineering, I think that the composability of factor's libraries make the object allocations worth it. See https://docs.factorcode.org/content/article-cookbook-philosophy.html "Object allocation is very cheap. Don't be afraid to create tuples [...]". However, the restriction to timestamps with TYPED: was added exactly (see b059ade5eda) to prevent using those words on durations. That's because their internal state doesn't behave like timestamps and you must call the duration>XX words instead of accessing the slots directly: 3600 seconds (timestamp>hms) 00:00:3600 3600 seconds duration>hm "01:00" It looks like we could have more duration>XXX formatting words ? Also, in calendar.format, write-gmt-offset and write-rfc3339-gmt-offset access the slots directly. So now we have: 2010 10 10 10 10 10 1 hours timestamp>rfc822 "Sun, 10 Oct 2010 10:10:10 +0100" 2010 10 10 10 10 10 3600 seconds timestamp>rfc822 . "Sun, 10 Oct 2010 10:10:10 +" Bug of feature ? :) Jon On Wed, Jul 20, 2016 at 10:07 AM, Alexander Ilinwrote: > Hello! > > On the second thought, that may be overengineering a bit. After all, do > I need to create a duration object and a string stream (within a namespace > to override output-stream) just to do some string manipulation? Here's a > solution with smaller overhead : > > : seconds>hms ( n -- str ) > 60 /mod round [ 60 /mod round ] dip 3array [ pad-00 ] map ":" join ; > > 20.07.2016, 10:44, "Alexander Ilin" : > > Hello! > > > > I'm measuring some processes, which take anywhere from seconds to > hours to run. > > I record the number of seconds in a DB for future reference. > > When presenting the data to the user (myself) I want to see a hh:mm:ss > string instead of thousands of seconds. > > > > Is there a way to format a duration tuple in such a way? The closest > thing I found is timestamp>hms, which does exactly what I want, but it is > TYPED:, and only accepts timestamps. Can I add the following word to the > calendar.format, or is there a better way? > > > > TYPED: duration>hms ( duration: duration -- str ) > > [ (timestamp>hms) ] with-string-writer ; > > > > ---=--- > > Александр > > > > > -- > > What NetFlow Analyzer can do for you? Monitors network bandwidth and > traffic > > patterns at an interface-level. Reveals which users, apps, and protocols > are > > consuming the most bandwidth. Provides multi-vendor support for NetFlow, > > J-Flow, sFlow and other flows. Make informed decisions using capacity > planning > > reports.http://sdm.link/zohodev2dev > > ___ > > Factor-talk mailing list > > Factor-talk@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/factor-talk > > ---=--- > Александр > > > -- > What NetFlow Analyzer can do for you? Monitors network bandwidth and > traffic > patterns at an interface-level. Reveals which users, apps, and protocols > are > consuming the most bandwidth. Provides multi-vendor support for NetFlow, > J-Flow, sFlow and other flows. Make informed decisions using capacity > planning > reports.http://sdm.link/zohodev2dev > ___ > Factor-talk mailing list > Factor-talk@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/factor-talk > -- What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports.http://sdm.link/zohodev2dev___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] slot fill in tuple border
Looking at the code, it's used to compute the size of the child gadget when the border doesn't have it's preferred dimension. fill should be a pair of numbers between 0 and 1 which represent how the extra space is shared between the border and the child gadget on each axis. You can see it in action by resizing the windows produced by the following code: "{ 0 0 } fill" COLOR: blue >>interior { 50 50 } COLOR: red >>interior "foo" open-window "{ 1 1 } fill" COLOR: blue >>interior { 50 50 } COLOR: red >>interior "foo" open-window Cheers, Jon Jon On Wed, Jul 6, 2016 at 10:25 AM, Georg Simonwrote: > What kind of child gadget did you use ? > I experimented with a label as child gadget and could not find any > effect. > > Am Wed, 6 Jul 2016 00:21:54 -0400 > schrieb Mike Maul : > > > Well experimentally it seems to affect the spacing between the child > > gadget and the border. I've only seen it affect the y axis. I've been > > trying to grok the factor ui lately. It seems quite powerful and fun > > but the lack of examples and docs is making it a bit of a tough slog. > > Though it does seem quite logical and natural once you start > > understanding parts of it. > > > > On Tue, Jul 5, 2016 at 10:08 AM, Georg Simon > > wrote: > > > > > Hi, > > > what is the purpose of the slot fill in the tuple border ? > > > > > > > > > > -- > > > Attend Shape: An AT Tech Expo July 15-16. Meet us at AT Park in > > > San Francisco, CA to explore cutting-edge tech and listen to tech > > > luminaries present their vision of the future. This family event > > > has something for everyone, including kids. Get more information > > > and register today. http://sdm.link/attshape > > > ___ > > > Factor-talk mailing list > > > Factor-talk@lists.sourceforge.net > > > https://lists.sourceforge.net/lists/listinfo/factor-talk > > > > > > > -- > Attend Shape: An AT Tech Expo July 15-16. Meet us at AT Park in San > Francisco, CA to explore cutting-edge tech and listen to tech luminaries > present their vision of the future. This family event has something for > everyone, including kids. Get more information and register today. > http://sdm.link/attshape > ___ > Factor-talk mailing list > Factor-talk@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/factor-talk > -- Attend Shape: An AT Tech Expo July 15-16. Meet us at AT Park in San Francisco, CA to explore cutting-edge tech and listen to tech luminaries present their vision of the future. This family event has something for everyone, including kids. Get more information and register today. http://sdm.link/attshape___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Inverse of string-lines
Also watch out for different line endings on different OSes :) Here's a discussion about string-lines, split-lines etc https://github.com/factor/factor/issues/1546 Jon On Tue, May 10, 2016 at 5:19 PM, John Benediktssonwrote: > I've wanted to rename string-lines to split-lines but I keep getting talked > out of it :-) > >> On May 10, 2016, at 7:55 AM, Alexander Ilin wrote: >> >> Hello, John! >> >> 10.05.2016, 17:12, "John Benediktsson" : >>> "\n" join >> >> 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 > > -- > 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] OpenGL gadget question
On Mon, Apr 25, 2016 at 1:46 PM, Alexander Ilin <ajs...@yandex.ru> wrote: > 24.04.2016, 23:17, "Jon Harper" <jon.harpe...@gmail.com>: >> Also, the opengl matrix stacks were part of the "fixed function >> pipeline". It was totally removed in openGL 4 and replaced by the >> programmable shaders. You can read about it on Joe's blog: >> http://duriansoftware.com/joe/An-intro-to-modern-OpenGL.-Table-of-Contents.html I'm no openGL expert, so for anyone, feel free to correct me if I'm wrong. Also, those functions were removed from the openGL spec in version 3.1, not 4, my bad. > But what does it mean practically? Practically, it means you need system libraries documented on this page: https://concatenative.org/wiki/view/Factor/Requirements All these are pretty portable, so don't be afraid to depend on them. >When I'm programming in Factor's GUI, am I using OpenGL 4 or an earlier >version? openGL is a standard, which is different from an implementation. I don't think factor uses any functions from openGL 3 or 4 for the default UI tools. The extra/gpu vocab does use openGL3.1 functions so it's available if you need it. > Is it dependent on the host system libraries and/or capabilities support? Factor builds it's UI on several components. For example, on linux it uses gtk to open windows, opengl to draw stuff, pango to render text. All these are system libraries. So for openGL, it will use the libGL.so of your system. It expects that this libGL.so will have the functions it needs (for example glPushMatrix). > Is there a way to find out? On linux, you can check that by running the nm program: $ nm -D "/usr/lib/x86_64-linux-gnu/libGL.so.352.21" | grep glPushMatrix 000cd0a0 T glPushMatrix > Or does it mean I can just forget that do-matrix exists and not use it, > ever? You can totally forget about do-matrix ! It's here to help when building hierarchical structures (so for example factor uses it for the gadget hierarchies, where children are drawn inside the parent). But you don't have to. Cheers, Jon -- Find and fix application performance issues faster with Applications Manager Applications Manager provides deep performance insights into multiple tiers of your business applications. It resolves application problems quickly and reduces your MTTR. Get your free trial! https://ad.doubleclick.net/ddm/clk/302982198;130105516;z ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] OpenGL gadget question
Also, the opengl matrix stacks were part of the "fixed function pipeline". It was totally removed in openGL 4 and replaced by the programmable shaders. You can read about it on Joe's blog: http://duriansoftware.com/joe/An-intro-to-modern-OpenGL.-Table-of-Contents.html Jon On Sun, Apr 24, 2016 at 8:45 PM, Jon Harper <jon.harpe...@gmail.com> wrote: > Hi, > do-matrix is a very thin wrapper around glPushMatrix and glPopMatrix > (https://www.opengl.org/sdk/docs/man2/xhtml/glPushMatrix.xml), so for > a theoretical explanation, I suggest you read about linear algebra > (how a matrix can represent a linear transformation such as a > translation, a rotation, a projection, etc) and the openGL matrix > stacks used in the rendering pipeline (how opengl transforms your > coordinates). But to explain everything, you will need more than a few > words... > > From a more practical point of view, the do-matrix call in tetris > means that the effects of the call to "glScalef" (in "scale-board") > end after do-matrix returns. Note that since factor also uses > do-matrix to call the draw-gadget* word, it would have ended after > draw-gadget* returned anyway. > > Also, if you don't use openGL functions that modify the current matrix > (see > http://docs.factorcode.org/content/article-opengl-modeling-transformations.html), > the do-matrix word doesn't do anything for you. > > Hope that helps, > Jon > > Jon > > > On Sun, Apr 24, 2016 at 7:22 PM, Alexander Ilin <ajs...@yandex.ru> wrote: >> Thanks fore the reply! >> >> Could someone explain to me in a few words what is do-matrix used for? >> I'm not sure I need it, I just copied the code from the tetris example. >> >> 24.04.2016, 19:51, "John Benediktsson" <mrj...@gmail.com>: >>> You can log to the terminal/console standard output using: >>> >>> [ "foo" . ] with-global >>> >>> The problem with your listener output issue is probably pref-dim is called >>> before the new window opens and draw-gadget is called after and the >>> output-stream (initially set to the listener) is rebound to something other >>> than the listener you expect it to be. >>> >>> You could also save the listener output stream somewhere: >>> >>> SYMBOL: my-output-stream >>> >>> output-stream get my-output-stream set-global >>> >>> Then use it to make sure output goes to the right place: >>> >>> my-output-stream [ "foo" . ] with-output-stream >>> >>> There are other ways maybe to make that cleaner but if you only need debug >>> output that should fix it for you. >>> >>>> M: iqlink-gadget draw-gadget* >>>> drop [ origin get { 5 5 } gl-fill-rect ] do-matrix "draw-gadget*" . >>>> gl-error ; >> >> ---=--- >> Александр >> >> -- >> Find and fix application performance issues faster with Applications Manager >> Applications Manager provides deep performance insights into multiple tiers >> of >> your business applications. It resolves application problems quickly and >> reduces your MTTR. Get your free trial! >> https://ad.doubleclick.net/ddm/clk/302982198;130105516;z >> ___ >> Factor-talk mailing list >> Factor-talk@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/factor-talk -- Find and fix application performance issues faster with Applications Manager Applications Manager provides deep performance insights into multiple tiers of your business applications. It resolves application problems quickly and reduces your MTTR. Get your free trial! https://ad.doubleclick.net/ddm/clk/302982198;130105516;z ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] OpenGL gadget question
Hi, do-matrix is a very thin wrapper around glPushMatrix and glPopMatrix (https://www.opengl.org/sdk/docs/man2/xhtml/glPushMatrix.xml), so for a theoretical explanation, I suggest you read about linear algebra (how a matrix can represent a linear transformation such as a translation, a rotation, a projection, etc) and the openGL matrix stacks used in the rendering pipeline (how opengl transforms your coordinates). But to explain everything, you will need more than a few words... From a more practical point of view, the do-matrix call in tetris means that the effects of the call to "glScalef" (in "scale-board") end after do-matrix returns. Note that since factor also uses do-matrix to call the draw-gadget* word, it would have ended after draw-gadget* returned anyway. Also, if you don't use openGL functions that modify the current matrix (see http://docs.factorcode.org/content/article-opengl-modeling-transformations.html), the do-matrix word doesn't do anything for you. Hope that helps, Jon Jon On Sun, Apr 24, 2016 at 7:22 PM, Alexander Ilinwrote: > Thanks fore the reply! > > Could someone explain to me in a few words what is do-matrix used for? > I'm not sure I need it, I just copied the code from the tetris example. > > 24.04.2016, 19:51, "John Benediktsson" : >> You can log to the terminal/console standard output using: >> >> [ "foo" . ] with-global >> >> The problem with your listener output issue is probably pref-dim is called >> before the new window opens and draw-gadget is called after and the >> output-stream (initially set to the listener) is rebound to something other >> than the listener you expect it to be. >> >> You could also save the listener output stream somewhere: >> >> SYMBOL: my-output-stream >> >> output-stream get my-output-stream set-global >> >> Then use it to make sure output goes to the right place: >> >> my-output-stream [ "foo" . ] with-output-stream >> >> There are other ways maybe to make that cleaner but if you only need debug >> output that should fix it for you. >> >>> M: iqlink-gadget draw-gadget* >>> drop [ origin get { 5 5 } gl-fill-rect ] do-matrix "draw-gadget*" . >>> gl-error ; > > ---=--- > Александр > > -- > Find and fix application performance issues faster with Applications Manager > Applications Manager provides deep performance insights into multiple tiers of > your business applications. It resolves application problems quickly and > reduces your MTTR. Get your free trial! > https://ad.doubleclick.net/ddm/clk/302982198;130105516;z > ___ > Factor-talk mailing list > Factor-talk@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/factor-talk -- Find and fix application performance issues faster with Applications Manager Applications Manager provides deep performance insights into multiple tiers of your business applications. It resolves application problems quickly and reduces your MTTR. Get your free trial! https://ad.doubleclick.net/ddm/clk/302982198;130105516;z ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] ./build.sh
With the move, everyone with a checkout older than 2016-03-15 (5dd6435511af) will have: $ ./build-support/factor.sh update [ ... snip ... git pul that removes the build-support.sh script ] build-support/_update.sh: line 3: /home/jon/factor/build-support/factor.sh: No such file or directory $ # now use ./build.sh I guess it's ok, it's the only way to get rid of the build-support folder entirely, but I'm just leaving a trace that this is normal on this list. Jon On Tue, Mar 15, 2016 at 11:28 AM, John Benediktssonwrote: > Hi, > > I just moved the files in build-support up a level and renamed them, so now > instead of: > > $ ./build-support/factor.sh update > > You can just do: > > $ ./build.sh update > > And similarly moved build-support/factor.cmd to build.cmd for the Windows > users. > > It's a bit of a breaking change for those of us whose fingers have memorized > the old location, but it's a lot cleaner looking and less typing. > > If you have any problems, please let me know. Also, if you have a > suggestion for a cooler name than "build.sh" or "build.cmd", please let me > know. > > Thanks, > John. > > -- > Transform Data into Opportunity. > Accelerate data analysis in your applications with > Intel Data Analytics Acceleration Library. > Click to learn more. > http://pubads.g.doubleclick.net/gampad/clk?id=278785231=/4140 > ___ > Factor-talk mailing list > Factor-talk@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/factor-talk > -- Transform Data into Opportunity. Accelerate data analysis in your applications with Intel Data Analytics Acceleration Library. Click to learn more. http://pubads.g.doubleclick.net/gampad/clk?id=278785231=/4140 ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
[Factor-talk] bit-arrays docs
>From the docs: http://docs.factorcode.org/content/article-bit-arrays.html "Bit arrays play a special role in the C library interface; they can be used to pass binary data back and forth between Factor and C. See Passing pointers to C functions." Is this still true ? If so, then there should be a mention of bit-arrays in addition to byte-arrays in the linked article http://docs.factorcode.org/content/article-c-pointers.html ? Jon -- Transform Data into Opportunity. Accelerate data analysis in your applications with Intel Data Analytics Acceleration Library. Click to learn more. http://pubads.g.doubleclick.net/gampad/clk?id=278785231=/4140 ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] move collect-by out of math.statistics
Doug said "I'd rather move words to core/ before releasing if we know they belong there." I think they belong there :) So let's do this ? We can move the sequence>hashtable stuff to core/hashtables/hashtables.factor next to associate ? We can change assoc-combine to : assoc-combine ( seq -- union ) -H{ } clone [ assoc-union! ] reduce ; +[ f ] [ unclip clone swap [ assoc-union! ] reduce ] if-empty ; Then we need to change the callers who could have an empty seq, or who need the output to be a hashtable even though the sequence doesn't have hashtables Maybe also add hashtable-combine to be the old assoc-combine and use it where the input seq could be empty, or the elements were not hashtabes ? Also maybe change assoc-refine ? +: assoc-intersect! ( assoc1 assoc2 -- intersection ) +swap [ nip key? ] curry assoc-filter! ; + : assoc-refine ( seq -- assoc ) -[ f ] [ [ ] [ assoc-intersect ] map-reduce ] if-empty ; +[ f ] [ unclip clone swap [ assoc-intersect! ] reduce ] if-empty ; Jon On Thu, Feb 18, 2016 at 11:45 PM, Jon Harper <jon.harpe...@gmail.com> wrote: > Yes I was thinking the same thing but then saw: > : assoc-combine ( seq -- union ) > H{ } clone [ assoc-union! ] reduce ; > > Le 18 févr. 2016 9:30 PM, "John Benediktsson" <mrj...@gmail.com> a écrit : >> >> I'm not a fan of the >hashtable methods, mostly because 'assocs' vocab >> doesn't really "know" about hashtables, it provides the generic interface >> (with the exception of assoc-combine). >> >> On Thu, Feb 18, 2016 at 11:48 AM, Jon Harper <jon.harpe...@gmail.com> >> wrote: >>> >>> As a proof of concept, this patch bootstraps fine: >>> http://paste.factorcode.org/paste?id=3841 >>> there may be other places where USE: math.statistics should be >>> replaced with USE: assocs, I haven't checked. >>> >>> bootstrap image size is increased by 7ko : +0.1% >>> (even 7ko is a lot for such a small change, maybe I made a mistake ?) >>> >>> Also, maybe define all variants (for example sequence-index>assoc! >>> doesn't exist) ? >>> Jon >>> >>> >>> On Thu, Feb 18, 2016 at 7:47 PM, John Benediktsson <mrj...@gmail.com> >>> wrote: >>> > That's true that "core" is really a bootstrap idea, but on the other >>> > hand it >>> > would be nice to have all useful sequences words in "sequences" and >>> > same for >>> > "assocs". >>> > >>> > Something we can tackle with the new parser after the release. >>> > >>> > >>> > On Feb 18, 2016, at 10:42 AM, Doug Coleman <doug.cole...@gmail.com> >>> > wrote: >>> > >>> > Words in core/ are only supposed to be there if other vocabularies in >>> > core/ >>> > use them, or if they're really useful. I'd rather move words to core/ >>> > before >>> > releasing if we know they belong there. >>> > >>> > On Thu, Feb 18, 2016 at 10:20 AM, John Benediktsson <mrj...@gmail.com> >>> > wrote: >>> >> >>> >> I think that sounds like a good idea, @erg? >>> >> >>> >> There are also some good words in sequences.extras and assocs.extras >>> >> that >>> >> at some point I'd like to "promote" to core/basis. But I'm putting >>> >> that off >>> >> until after the next release. >>> >> >>> >> >>> >> On Thu, Feb 18, 2016 at 10:15 AM, Jon Harper <jon.harpe...@gmail.com> >>> >> wrote: >>> >>> >>> >>> Hi list, >>> >>> >>> >>> currently we have collect-by ( >>> >>> >>> >>> http://docs.factorcode.org/content/word-collect-by,math.statistics.html >>> >>> ) (and sequence>hashtable, sequence>assoc and some other mostly >>> >>> generic words) in math.statistics. They are a bit hard to find. >>> >>> >>> >>> Looking at the code, it looks like it would be a very small change to >>> >>> move them to core/assocs.factor >>> >>> >>> >>> This way, they would be close to to assoc>map ( >>> >>> http://docs.factorcode.org/content/word-assoc-map,assocs.html ), or >>> >>> and we could link put them in the "Associative mapping combinators" >>> >>> article >>> >>> http://docs.factorcode.org/content/artic
Re: [Factor-talk] How would I solve this better in Factor?
Hi, when I'm writing a unoptimized solution to a problem, I usually go top down, thinking about what l lists I have to build and transform. I try to split code into words with names instead of adding comments. I try to use the conventions ( http://docs.factorcode.org/content/article-conventions.html ). Also, I try to follow this quote from http://docs.factorcode.org/content/article-cookbook-philosophy.html: "If you find yourself writing a heavily nested loop which performs several steps on each iteration, there is almost always a better way. Break the problem down into a series of passes over the data instead, gradually transforming it into the desired result with a series of simple loops. Factor the loops out and reuse them." cheers, Jon On Sat, Feb 27, 2016 at 6:43 AM, Sankaranarayanan Viswanathan <rationalrev...@gmail.com> wrote: > Wow, your words are simple and fit in single lines. Do you write pseudo > code that is more expressible in factor or do you write traditional > imperative style pseudo code and then translate them to a factor > representation? > > Thanks, > Sankar > > On 2/25/16 12:01 PM, Jon Harper wrote: >> "Hi, >> I wrote a basic o(n^4) solution to see how simple it could get. The >> code looks nice to me, but it's sllw :) like 1 hour on the 3200 >> chars string.. http://paste.factorcode.org/paste?id=3843 >> >> I noticed we have 1 function in common : remove-after-underscore. You >> can can see how head and when* make my implementation shorter (and >> more readable?) >> >> Cheers, >> Jon >> >> >> On Wed, Feb 24, 2016 at 5:50 AM, Sankaranarayanan Viswanathan >> <rationalrev...@gmail.com> wrote: >>> Hi, >>> >>> It had been awhile since I wrote any Factor code, so I was trying to >>> solve the following problem from reddit's dailyprogrammer subreddit: >>> http://bit.ly/1OtP8Qj >>> >>> The solution I came up with in Factor looks like this: >>> http://bit.ly/1PY8j98 >>> >>> I struggled quite a lot coming up with this. Mainly in keeping things in >>> my head and figuring out what I needed to do to bring the stack in order >>> for the operations I was attempting.. >>> >>> Coming from an iterative programming background (with a little bit of >>> exposure to functional programming), I find it quite hard to formulate >>> solutions in Factor. Can someone help me with tips on how they approach >>> writing code in Factor? What is your though process to turn a given >>> pseudo code into a factor program? >>> >>> For example, my pseudo code for the main portion of this problem (the >>> find-match function) was as follows: >>> >>> let buff = "" >>> let match = (indx=0, length=-1) >>> for each char c in input: >>> find count(c) in buff >>> if count == 2 >>> append c to buff >>> check if str(first c to end) is longest and update match >>> remove chars in buff before second c occurrence >>> else if count == 1 >>> append c to buff >>> check if str(first c to end) is longest and update match >>> remove chars in buff before first c occurrence >>> else >>> append c to buff >>> discard buff and return match >>> >>> Any pointers is greatly appreciated. >>> >>> Thanks, >>> Sankar >>> >>> >>> -- >>> Site24x7 APM Insight: Get Deep Visibility into Application Performance >>> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month >>> Monitor end-to-end web transactions and take corrective actions now >>> Troubleshoot faster and improve end-user experience. Signup Now! >>> http://pubads.g.doubleclick.net/gampad/clk?id=272487151=/4140 >>> ___ >>> Factor-talk mailing list >>> Factor-talk@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/factor-talk >> >> -- >> Site24x7 APM Insight: Get Deep Visibility into Application Performance >> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month >> Monitor end-to-end web transactions and take corrective actions now >> Troubleshoot faster and improve end-user experience. Sign
Re: [Factor-talk] How would I solve this better in Factor?
"Hi, I wrote a basic o(n^4) solution to see how simple it could get. The code looks nice to me, but it's sllw :) like 1 hour on the 3200 chars string.. http://paste.factorcode.org/paste?id=3843 I noticed we have 1 function in common : remove-after-underscore. You can can see how head and when* make my implementation shorter (and more readable?) Cheers, Jon On Wed, Feb 24, 2016 at 5:50 AM, Sankaranarayanan Viswanathanwrote: > Hi, > > It had been awhile since I wrote any Factor code, so I was trying to > solve the following problem from reddit's dailyprogrammer subreddit: > http://bit.ly/1OtP8Qj > > The solution I came up with in Factor looks like this: > http://bit.ly/1PY8j98 > > I struggled quite a lot coming up with this. Mainly in keeping things in > my head and figuring out what I needed to do to bring the stack in order > for the operations I was attempting.. > > Coming from an iterative programming background (with a little bit of > exposure to functional programming), I find it quite hard to formulate > solutions in Factor. Can someone help me with tips on how they approach > writing code in Factor? What is your though process to turn a given > pseudo code into a factor program? > > For example, my pseudo code for the main portion of this problem (the > find-match function) was as follows: > > let buff = "" > let match = (indx=0, length=-1) > for each char c in input: > find count(c) in buff > if count == 2 > append c to buff > check if str(first c to end) is longest and update match > remove chars in buff before second c occurrence > else if count == 1 > append c to buff > check if str(first c to end) is longest and update match > remove chars in buff before first c occurrence > else > append c to buff > discard buff and return match > > Any pointers is greatly appreciated. > > Thanks, > Sankar > > > -- > Site24x7 APM Insight: Get Deep Visibility into Application Performance > APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month > Monitor end-to-end web transactions and take corrective actions now > Troubleshoot faster and improve end-user experience. Signup Now! > http://pubads.g.doubleclick.net/gampad/clk?id=272487151=/4140 > ___ > Factor-talk mailing list > Factor-talk@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/factor-talk -- Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=272487151=/4140 ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
[Factor-talk] github repo
I noticed the github repo moved from slavapestov/factor to factor/factor, everything (pull requests, issues, etc) should go there now ? Also there's still one pull request on slavapestov/factor. Jon -- Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=272487151=/4140 ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] CHAR: question
You can see from the definition that is uses the name>char-hook, which then uses the name>char word to lookup names, which in the end reads and caches the basis/unicode/data/UnicodeData.txt file. Jon On Mon, Feb 22, 2016 at 3:22 PM, John Benediktsson <mrj...@gmail.com> wrote: > CHAR: works with all named Unicode code points. In the listener use tab > completion to see, for example: > > CHAR: ex > > Where is press the tab key for tab completion. > > > >> On Feb 22, 2016, at 6:07 AM, Alexander Ilin <ajs...@yandex.ru> wrote: >> >> Hello, Jon! >> >> Thank you for the reply! >> >> I've looked through the documentation you suggested, and that's exactly >> what I need. >> >> I have a follow-up question regarding CHAR:. In the documentation there is >> a line in the Examples section: >> >> CHAR: exclamation-mark >> >> It works. However I can't seem to find the definition of the >> exclamation-mark word. I made a search in file contents, and it seems to >> only exist in the core\syntax\syntax-docs.factor, and in the factor.image >> files. >> >> Where does it come from? Because I'd like to see the full list of words >> available for use with CHAR:. >> >> Thanks. >> >> 22.02.2016, 16:52, "Jon Harper" <jon.harpe...@gmail.com>: >>> Hi, >>> >>> The exact answer would be >>> http://docs.factorcode.org/content/article-literals.html , for >>> example: >>> CONSTANT: CR-char-code 13 >>> CONSTANT: LF-char-code 10 >>> { 13 13 10 10 } ${ CR-char-code } ${ LF-char-code } replace >>> >>> However, in this case you can also use the "CHAR:" parsing word >>> { 13 13 10 10 } { CHAR: \r } { CHAR: \n } replace >>> >>> regards, >>> Jon >>> Jon >>> >>>> On Mon, Feb 22, 2016 at 2:25 PM, Alexander Ilin <ajs...@yandex.ru> wrote: >>>> Hello! >>>> >>>>The following code works the way I want it to: >>>> >>>> { 13 13 10 10 } { 13 } { 10 } replace >>>> -> { 10 10 10 10 } >>>> >>>>But when I tried to use named constants, it no longer works: >>>> >>>> CONSTANT: CR-char-code 13 >>>> CONSTANT: LF-char-code 10 >>>> { 13 13 10 10 } { CR-char-code } { LF-char-code } replace >>>> -> { 13 13 10 10 } >>>> >>>>I realized, that probably the issue is that by constructing sequences >>>> with { } I somehow didn't give the words a chance to push their values >>>> instead of themselves. >>>> >>>>What would be the correct way to use named constants for such a use >>>> case? >>>> >>>> ---=--- >>>> Александр >>>> >>>> >>>> -- >>>> Site24x7 APM Insight: Get Deep Visibility into Application Performance >>>> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month >>>> Monitor end-to-end web transactions and take corrective actions now >>>> Troubleshoot faster and improve end-user experience. Signup Now! >>>> http://pubads.g.doubleclick.net/gampad/clk?id=272487151=/4140 >>>> ___ >>>> Factor-talk mailing list >>>> Factor-talk@lists.sourceforge.net >>>> https://lists.sourceforge.net/lists/listinfo/factor-talk >>> >>> -- >>> Site24x7 APM Insight: Get Deep Visibility into Application Performance >>> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month >>> Monitor end-to-end web transactions and take corrective actions now >>> Troubleshoot faster and improve end-user experience. Signup Now! >>> http://pubads.g.doubleclick.net/gampad/clk?id=272487151=/4140 >>> ___ >>> Factor-talk mailing list >>> Factor-talk@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/factor-talk >> >> ---=--- >> Александр >> >> -- >> Site24x7 APM Insight: Get Deep Visibility into Application Performance >> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month >> Monitor end-to-en
Re: [Factor-talk] CONSTANT: question
Hi, The exact answer would be http://docs.factorcode.org/content/article-literals.html , for example: CONSTANT: CR-char-code 13 CONSTANT: LF-char-code 10 { 13 13 10 10 } ${ CR-char-code } ${ LF-char-code } replace However, in this case you can also use the "CHAR:" parsing word { 13 13 10 10 } { CHAR: \r } { CHAR: \n } replace regards, Jon Jon On Mon, Feb 22, 2016 at 2:25 PM, Alexander Ilinwrote: > Hello! > > The following code works the way I want it to: > > { 13 13 10 10 } { 13 } { 10 } replace > -> { 10 10 10 10 } > > But when I tried to use named constants, it no longer works: > > CONSTANT: CR-char-code 13 > CONSTANT: LF-char-code 10 > { 13 13 10 10 } { CR-char-code } { LF-char-code } replace > -> { 13 13 10 10 } > > I realized, that probably the issue is that by constructing sequences with > { } I somehow didn't give the words a chance to push their values instead of > themselves. > > What would be the correct way to use named constants for such a use case? > > ---=--- > Александр > > -- > Site24x7 APM Insight: Get Deep Visibility into Application Performance > APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month > Monitor end-to-end web transactions and take corrective actions now > Troubleshoot faster and improve end-user experience. Signup Now! > http://pubads.g.doubleclick.net/gampad/clk?id=272487151=/4140 > ___ > Factor-talk mailing list > Factor-talk@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/factor-talk -- Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=272487151=/4140 ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] adding http proxy support
On Fri, Feb 19, 2016 at 4:05 PM, Jon Harper <jon.harpe...@gmail.com> wrote: > So right now the ssl/tls is an optional dependency for the http > client. If we want to keep it that way, then I think the best solution > is to split io.sockets.secure into an io.sockets.secure-api which > defines the hooks and io.sockets.secure-loader that requires the > correct vocabulary based on the OS. See this paste for a patch: > http://paste.factorcode.org/paste?id=3842 (I haven't updated all the > files using io.sockets.secure, just enough to compile what was loaded > in my image) Or simply add new hooks in io.sockets that are implemented in io.sockets.secure for the functionnality that we need optional: http://paste.factorcode.org/paste?id=3842#1651 I'm going to do that for now since it's such a minimal change.. -- Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=272487151=/4140 ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] adding http proxy support
I worked on this, and now I have to so something about the dependency on io.sockets.secure vocabulary (I need to use send-secure-handshake from http://docs.factorcode.org/content/article-ssl-upgrade.html for https over a proxy) So right now the ssl/tls is an optional dependency for the http client. If we want to keep it that way, then I think the best solution is to split io.sockets.secure into an io.sockets.secure-api which defines the hooks and io.sockets.secure-loader that requires the correct vocabulary based on the OS. See this paste for a patch: http://paste.factorcode.org/paste?id=3842 (I haven't updated all the files using io.sockets.secure, just enough to compile what was loaded in my image) But do we want to keep it as an optional dependency for the http client ? Note that ssl/tls is *not* optional for other vocabularies: clients: smtp, imap servers: io.servers, furnace.auth And the next questions are, do we want to make it optional for the other clients ? Optional for the servers ? Jon On Fri, Feb 5, 2016 at 6:33 PM, John Benediktsson <mrj...@gmail.com> wrote: > Sounds good! Maybe you can make a pull request and we can figure that out > later. > > > On Fri, Feb 5, 2016 at 8:05 AM, Jon Harper <jon.harpe...@gmail.com> wrote: >> >> I don't really know, but >> >> http://stackoverflow.com/questions/15460819/what-is-the-difference-between-connection-and-proxy-connection-in-http-header >> says that "Connection" and "Proxy-Connection" are the same, and factor >> sends "Connection: close", curl send "Proxy-Connection: Keep-Alive" >> and wget sends nothing.. That's why I wanted to know if someone who >> know HTTP well had comments... Also the port in the "Host" header is >> omitted by factor but set by wget and curl >> Jon >> >> >> On Fri, Feb 5, 2016 at 4:58 PM, John Benediktsson <mrj...@gmail.com> >> wrote: >> > Looks like curl sends a Proxy-Connection, which since you know you're >> > using >> > a proxy you could set in the request? >> > >> > On Fri, Feb 5, 2016 at 7:32 AM, Jon Harper <jon.harpe...@gmail.com> >> > wrote: >> >> >> >> I had environnement variables in mind as well but forgot to show them >> >> in >> >> the examples. So the full list would be: >> >> >> >> ! at factor startup >> >> ./factor -http.proxy=http://localhost:3128 >> >> or http_proxy="http://localhost:3128; ./factor >> >> >> >> ! using variables >> >> or "http://localhost:3128; "http.proxy" set-global >> >> or "http://localhost:3128; "http.proxy" [ ... http-get ] with-variable >> >> >> >> ! Manually making the request >> >> or ... URL" http://localhost:3128; >>proxy >> >> >> >> >> >> >> >> I also looked into https, it worked with send-secure-handshake >> >> (http://docs.factorcode.org/content/article-ssl-upgrade.html ), here's >> >> a >> >> proof of concept patch: http://paste.factorcode.org/paste?id=3826#1645 >> >> However, looking at the http headers, they are different than what wget >> >> or >> >> curl sends, so I'm not sure if it's correct yet (it worked with squid >> >> as the >> >> proxy and https//www.google.fr/ as the server). Can anyone comment on >> >> whether everything's ok ? >> >> >> >> >> >> >> >> Le 4 févr. 2016 18:01, "John Benediktsson" <mrj...@gmail.com> a écrit : >> >> > >> >> > It might be nicer to use environment variables rather than python >> >> > string >> >> > global variables, for example how Python does it: >> >> > >> >> > $ http_proxy=http://10.0.0.1 python -c "import urllib; print >> >> > urllib.getproxies()" >> >> > {'http': 'http://10.0.0.1'} >> >> > >> >> > We could also get fancier and have OS specific lookup like Python >> >> > does >> >> > for OS X and Windows as a fallback: >> >> > >> >> > https://docs.python.org/2/library/urllib.html#urllib.getproxies >> >> > >> >> > >> >> > On Thu, Feb 4, 2016 at 8:48 AM, Jon Harper <jon.harpe...@gmail.com> >> >> > wrote: >> >> >> >> >> >> Hi list, >> >> >> I'm planning to add http proxy support to http.client. Here's the >> >> >> A
Re: [Factor-talk] move collect-by out of math.statistics
Yes I was thinking the same thing but then saw: : assoc-combine ( seq -- union ) H{ } clone [ assoc-union! ] reduce ; Le 18 févr. 2016 9:30 PM, "John Benediktsson" <mrj...@gmail.com> a écrit : > I'm not a fan of the >hashtable methods, mostly because 'assocs' vocab > doesn't really "know" about hashtables, it provides the generic interface > (with the exception of assoc-combine). > > On Thu, Feb 18, 2016 at 11:48 AM, Jon Harper <jon.harpe...@gmail.com> > wrote: > >> As a proof of concept, this patch bootstraps fine: >> http://paste.factorcode.org/paste?id=3841 >> there may be other places where USE: math.statistics should be >> replaced with USE: assocs, I haven't checked. >> >> bootstrap image size is increased by 7ko : +0.1% >> (even 7ko is a lot for such a small change, maybe I made a mistake ?) >> >> Also, maybe define all variants (for example sequence-index>assoc! >> doesn't exist) ? >> Jon >> >> >> On Thu, Feb 18, 2016 at 7:47 PM, John Benediktsson <mrj...@gmail.com> >> wrote: >> > That's true that "core" is really a bootstrap idea, but on the other >> hand it >> > would be nice to have all useful sequences words in "sequences" and >> same for >> > "assocs". >> > >> > Something we can tackle with the new parser after the release. >> > >> > >> > On Feb 18, 2016, at 10:42 AM, Doug Coleman <doug.cole...@gmail.com> >> wrote: >> > >> > Words in core/ are only supposed to be there if other vocabularies in >> core/ >> > use them, or if they're really useful. I'd rather move words to core/ >> before >> > releasing if we know they belong there. >> > >> > On Thu, Feb 18, 2016 at 10:20 AM, John Benediktsson <mrj...@gmail.com> >> > wrote: >> >> >> >> I think that sounds like a good idea, @erg? >> >> >> >> There are also some good words in sequences.extras and assocs.extras >> that >> >> at some point I'd like to "promote" to core/basis. But I'm putting >> that off >> >> until after the next release. >> >> >> >> >> >> On Thu, Feb 18, 2016 at 10:15 AM, Jon Harper <jon.harpe...@gmail.com> >> >> wrote: >> >>> >> >>> Hi list, >> >>> >> >>> currently we have collect-by ( >> >>> >> http://docs.factorcode.org/content/word-collect-by,math.statistics.html >> >>> ) (and sequence>hashtable, sequence>assoc and some other mostly >> >>> generic words) in math.statistics. They are a bit hard to find. >> >>> >> >>> Looking at the code, it looks like it would be a very small change to >> >>> move them to core/assocs.factor >> >>> >> >>> This way, they would be close to to assoc>map ( >> >>> http://docs.factorcode.org/content/word-assoc-map,assocs.html ), or >> >>> and we could link put them in the "Associative mapping combinators" >> >>> article >> >>> http://docs.factorcode.org/content/article-assocs-combinators.html >> >>> >> >>> What do you think ? >> >>> >> >>> Jon >> >>> >> >>> >> >>> >> -- >> >>> Site24x7 APM Insight: Get Deep Visibility into Application Performance >> >>> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month >> >>> Monitor end-to-end web transactions and take corrective actions now >> >>> Troubleshoot faster and improve end-user experience. Signup Now! >> >>> http://pubads.g.doubleclick.net/gampad/clk?id=272487151=/4140 >> >>> ___ >> >>> Factor-talk mailing list >> >>> Factor-talk@lists.sourceforge.net >> >>> https://lists.sourceforge.net/lists/listinfo/factor-talk >> >> >> >> >> >> >> >> >> >> >> -- >> >> Site24x7 APM Insight: Get Deep Visibility into Application Performance >> >> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month >> >> Monitor end-to-end web transactions and take corrective actions now >> >> Troubleshoot faster and improve end-user experience. Si
Re: [Factor-talk] move collect-by out of math.statistics
As a proof of concept, this patch bootstraps fine: http://paste.factorcode.org/paste?id=3841 there may be other places where USE: math.statistics should be replaced with USE: assocs, I haven't checked. bootstrap image size is increased by 7ko : +0.1% (even 7ko is a lot for such a small change, maybe I made a mistake ?) Also, maybe define all variants (for example sequence-index>assoc! doesn't exist) ? Jon On Thu, Feb 18, 2016 at 7:47 PM, John Benediktsson <mrj...@gmail.com> wrote: > That's true that "core" is really a bootstrap idea, but on the other hand it > would be nice to have all useful sequences words in "sequences" and same for > "assocs". > > Something we can tackle with the new parser after the release. > > > On Feb 18, 2016, at 10:42 AM, Doug Coleman <doug.cole...@gmail.com> wrote: > > Words in core/ are only supposed to be there if other vocabularies in core/ > use them, or if they're really useful. I'd rather move words to core/ before > releasing if we know they belong there. > > On Thu, Feb 18, 2016 at 10:20 AM, John Benediktsson <mrj...@gmail.com> > wrote: >> >> I think that sounds like a good idea, @erg? >> >> There are also some good words in sequences.extras and assocs.extras that >> at some point I'd like to "promote" to core/basis. But I'm putting that off >> until after the next release. >> >> >> On Thu, Feb 18, 2016 at 10:15 AM, Jon Harper <jon.harpe...@gmail.com> >> wrote: >>> >>> Hi list, >>> >>> currently we have collect-by ( >>> http://docs.factorcode.org/content/word-collect-by,math.statistics.html >>> ) (and sequence>hashtable, sequence>assoc and some other mostly >>> generic words) in math.statistics. They are a bit hard to find. >>> >>> Looking at the code, it looks like it would be a very small change to >>> move them to core/assocs.factor >>> >>> This way, they would be close to to assoc>map ( >>> http://docs.factorcode.org/content/word-assoc-map,assocs.html ), or >>> and we could link put them in the "Associative mapping combinators" >>> article >>> http://docs.factorcode.org/content/article-assocs-combinators.html >>> >>> What do you think ? >>> >>> Jon >>> >>> >>> -- >>> Site24x7 APM Insight: Get Deep Visibility into Application Performance >>> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month >>> Monitor end-to-end web transactions and take corrective actions now >>> Troubleshoot faster and improve end-user experience. Signup Now! >>> http://pubads.g.doubleclick.net/gampad/clk?id=272487151=/4140 >>> ___ >>> Factor-talk mailing list >>> Factor-talk@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/factor-talk >> >> >> >> >> -- >> Site24x7 APM Insight: Get Deep Visibility into Application Performance >> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month >> Monitor end-to-end web transactions and take corrective actions now >> Troubleshoot faster and improve end-user experience. Signup Now! >> http://pubads.g.doubleclick.net/gampad/clk?id=272487151=/4140 >> ___ >> Factor-talk mailing list >> Factor-talk@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/factor-talk >> > > -- > Site24x7 APM Insight: Get Deep Visibility into Application Performance > APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month > Monitor end-to-end web transactions and take corrective actions now > Troubleshoot faster and improve end-user experience. Signup Now! > http://pubads.g.doubleclick.net/gampad/clk?id=272487151=/4140 > > ___ > Factor-talk mailing list > Factor-talk@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/factor-talk > > > -- > Site24x7 APM Insight: Get Deep Visibility into Application Performance > APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month > Monitor end-to-end web transactions and take corrective actions now > Troubleshoot faster and improve end-user experience. Signup Now! > http://pubads.g.do
[Factor-talk] move collect-by out of math.statistics
Hi list, currently we have collect-by ( http://docs.factorcode.org/content/word-collect-by,math.statistics.html ) (and sequence>hashtable, sequence>assoc and some other mostly generic words) in math.statistics. They are a bit hard to find. Looking at the code, it looks like it would be a very small change to move them to core/assocs.factor This way, they would be close to to assoc>map ( http://docs.factorcode.org/content/word-assoc-map,assocs.html ), or and we could link put them in the "Associative mapping combinators" article http://docs.factorcode.org/content/article-assocs-combinators.html What do you think ? Jon -- Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=272487151=/4140 ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] adding http proxy support
I don't really know, but http://stackoverflow.com/questions/15460819/what-is-the-difference-between-connection-and-proxy-connection-in-http-header says that "Connection" and "Proxy-Connection" are the same, and factor sends "Connection: close", curl send "Proxy-Connection: Keep-Alive" and wget sends nothing.. That's why I wanted to know if someone who know HTTP well had comments... Also the port in the "Host" header is omitted by factor but set by wget and curl Jon On Fri, Feb 5, 2016 at 4:58 PM, John Benediktsson <mrj...@gmail.com> wrote: > Looks like curl sends a Proxy-Connection, which since you know you're using > a proxy you could set in the request? > > On Fri, Feb 5, 2016 at 7:32 AM, Jon Harper <jon.harpe...@gmail.com> wrote: >> >> I had environnement variables in mind as well but forgot to show them in >> the examples. So the full list would be: >> >> ! at factor startup >> ./factor -http.proxy=http://localhost:3128 >> or http_proxy="http://localhost:3128; ./factor >> >> ! using variables >> or "http://localhost:3128; "http.proxy" set-global >> or "http://localhost:3128; "http.proxy" [ ... http-get ] with-variable >> >> ! Manually making the request >> or ... URL" http://localhost:3128; >>proxy >> >> >> >> I also looked into https, it worked with send-secure-handshake >> (http://docs.factorcode.org/content/article-ssl-upgrade.html ), here's a >> proof of concept patch: http://paste.factorcode.org/paste?id=3826#1645 >> However, looking at the http headers, they are different than what wget or >> curl sends, so I'm not sure if it's correct yet (it worked with squid as the >> proxy and https//www.google.fr/ as the server). Can anyone comment on >> whether everything's ok ? >> >> >> >> Le 4 févr. 2016 18:01, "John Benediktsson" <mrj...@gmail.com> a écrit : >> > >> > It might be nicer to use environment variables rather than python string >> > global variables, for example how Python does it: >> > >> > $ http_proxy=http://10.0.0.1 python -c "import urllib; print >> > urllib.getproxies()" >> > {'http': 'http://10.0.0.1'} >> > >> > We could also get fancier and have OS specific lookup like Python does >> > for OS X and Windows as a fallback: >> > >> > https://docs.python.org/2/library/urllib.html#urllib.getproxies >> > >> > >> > On Thu, Feb 4, 2016 at 8:48 AM, Jon Harper <jon.harpe...@gmail.com> >> > wrote: >> >> >> >> Hi list, >> >> I'm planning to add http proxy support to http.client. Here's the API >> >> I thought of, please feel free to give some feedback :) >> >> >> >> - add a "proxy" slot to the request object. (Or maybe subclass request >> >> as client-request and only add that slot to client ? I think that >> >> would be better for maintenance, but it's a bigger change. What do you >> >> think ?) >> >> >> >> - use string global variables (*not* SYMBOL:, so that one can set it >> >> from the command line) or set the request slot directly so that one >> >> can do: >> >> ./factor -http.proxy=http://localhost:3128 >> >> or "http://localhost:3128; "http.proxy" set-global >> >> or "http://localhost:3128; "http.proxy" [ ... http-get ] with-variable >> >> or ... URL" http://localhost:3128; >>proxy >> >> >> >> - the "http.proxy", "https.proxy" and "no_proxy" variables are used to >> >> fill the proxy slot of the request when using (so >> >> http-get, etc all have it) >> >> >> >> - use the "http_proxy" "https_proxy" "no_proxy" environnement variable >> >> as a last resort. I don't know about windows and macosx ? >> >> >> >> As far as the code for *http* (not https) access goes, I think the >> >> following patch is all that there is to do (it's missing checking the >> >> non proxy host list, and setting the http or https proxy depending on >> >> the url) ? http://paste.factorcode.org/paste?id=3826 >> >> >> >> For https, I need to do an HTTP connect first, then send regular http >> >> request I think. Will try that later. >> >> >> >> Cheers, >> >> Jon >> >> >> >> >> >> -
Re: [Factor-talk] adding http proxy support
I had environnement variables in mind as well but forgot to show them in the examples. So the full list would be: ! at factor startup ./factor -http.proxy=http://localhost:3128 or http_proxy="http://localhost:3128; ./factor ! using variables or "http://localhost:3128; "http.proxy" set-global or "http://localhost:3128; "http.proxy" [ ... http-get ] with-variable ! Manually making the request or ... URL" http://localhost:3128; >>proxy I also looked into https, it worked with send-secure-handshake ( http://docs.factorcode.org/content/article-ssl-upgrade.html ), here's a proof of concept patch: http://paste.factorcode.org/paste?id=3826#1645 However, looking at the http headers, they are different than what wget or curl sends, so I'm not sure if it's correct yet (it worked with squid as the proxy and https//www.google.fr/ as the server). Can anyone comment on whether everything's ok ? Le 4 févr. 2016 18:01, "John Benediktsson" <mrj...@gmail.com> a écrit : > > It might be nicer to use environment variables rather than python string global variables, for example how Python does it: > > $ http_proxy=http://10.0.0.1 python -c "import urllib; print urllib.getproxies()" > {'http': 'http://10.0.0.1'} > > We could also get fancier and have OS specific lookup like Python does for OS X and Windows as a fallback: > > https://docs.python.org/2/library/urllib.html#urllib.getproxies > > > On Thu, Feb 4, 2016 at 8:48 AM, Jon Harper <jon.harpe...@gmail.com> wrote: >> >> Hi list, >> I'm planning to add http proxy support to http.client. Here's the API >> I thought of, please feel free to give some feedback :) >> >> - add a "proxy" slot to the request object. (Or maybe subclass request >> as client-request and only add that slot to client ? I think that >> would be better for maintenance, but it's a bigger change. What do you >> think ?) >> >> - use string global variables (*not* SYMBOL:, so that one can set it >> from the command line) or set the request slot directly so that one >> can do: >> ./factor -http.proxy=http://localhost:3128 >> or "http://localhost:3128; "http.proxy" set-global >> or "http://localhost:3128; "http.proxy" [ ... http-get ] with-variable >> or ... URL" http://localhost:3128; >>proxy >> >> - the "http.proxy", "https.proxy" and "no_proxy" variables are used to >> fill the proxy slot of the request when using (so >> http-get, etc all have it) >> >> - use the "http_proxy" "https_proxy" "no_proxy" environnement variable >> as a last resort. I don't know about windows and macosx ? >> >> As far as the code for *http* (not https) access goes, I think the >> following patch is all that there is to do (it's missing checking the >> non proxy host list, and setting the http or https proxy depending on >> the url) ? http://paste.factorcode.org/paste?id=3826 >> >> For https, I need to do an HTTP connect first, then send regular http >> request I think. Will try that later. >> >> Cheers, >> Jon >> >> -- >> Site24x7 APM Insight: Get Deep Visibility into Application Performance >> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month >> Monitor end-to-end web transactions and take corrective actions now >> Troubleshoot faster and improve end-user experience. Signup Now! >> http://pubads.g.doubleclick.net/gampad/clk?id=272487151=/4140 >> ___ >> Factor-talk mailing list >> Factor-talk@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/factor-talk > > > > -- > Site24x7 APM Insight: Get Deep Visibility into Application Performance > APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month > Monitor end-to-end web transactions and take corrective actions now > Troubleshoot faster and improve end-user experience. Signup Now! > http://pubads.g.doubleclick.net/gampad/clk?id=272487151=/4140 > ___ > Factor-talk mailing list > Factor-talk@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/factor-talk > -- Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=272487151=/4140___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
[Factor-talk] adding http proxy support
Hi list, I'm planning to add http proxy support to http.client. Here's the API I thought of, please feel free to give some feedback :) - add a "proxy" slot to the request object. (Or maybe subclass request as client-request and only add that slot to client ? I think that would be better for maintenance, but it's a bigger change. What do you think ?) - use string global variables (*not* SYMBOL:, so that one can set it from the command line) or set the request slot directly so that one can do: ./factor -http.proxy=http://localhost:3128 or "http://localhost:3128; "http.proxy" set-global or "http://localhost:3128; "http.proxy" [ ... http-get ] with-variable or ... URL" http://localhost:3128; >>proxy - the "http.proxy", "https.proxy" and "no_proxy" variables are used to fill the proxy slot of the request when using (so http-get, etc all have it) - use the "http_proxy" "https_proxy" "no_proxy" environnement variable as a last resort. I don't know about windows and macosx ? As far as the code for *http* (not https) access goes, I think the following patch is all that there is to do (it's missing checking the non proxy host list, and setting the http or https proxy depending on the url) ? http://paste.factorcode.org/paste?id=3826 For https, I need to do an HTTP connect first, then send regular http request I think. Will try that later. Cheers, Jon -- Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=272487151=/4140 ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] OpenGL - How to draw lines interactively
There's opengl.gl-line, used for exemple in ./extra/rosetta-code/animate-pendulum/animate-pendulum.factor Jon On Sun, Nov 29, 2015 at 2:07 PM, Georg Simonwrote: > I already have a gadget which responds to gestures. > > Which are the best words to use OpenGL for drawing simple lines one by > one? > > ui.gadgets.canvas vocabulary ? > make-canvas-dlist delete-canvas-dlist cycle ? > > Where should I start to read ? > maze vocabulary ? > > Thank you, Georg > > -- > ___ > 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] Problem drawing an image in a new window
There's an image-gadget implementation from images.viewer, maybe you should start from that and expand to get all the functionnality you need ? IN: scratchpad "resource:./misc/icons/factor_48...@2x.png" gadget. "resource:./misc/icons/factor_48...@2x.png" "image" open-window Jon On Sun, Nov 29, 2015 at 1:37 PM, Sankaranarayanan Viswanathanwrote: > Hi, > > Hi, i'm facing a problem drawing textures in a new window. when I > create the gadget and add it to the listener using gadget. the image > shows corretly, when I create the gadget and use open-window, the > image does not show up on the new window. > > Sample code below: > > TUPLE: i-gadget < gadget > image texture ; > > : ( path -- gadget ) > [ i-gadget new ] dip load-image >>image ; > > M: i-gadget pref-dim* > image>> dim>> [ 20 + ] map ; > > M: i-gadget graft* > dup find-gl-context > dup image>> { 0 0 } >>texture drop ; > > M: i-gadget ungraft* > dup find-gl-context > dup texture>> dispose > f >>texture drop ; > > M: i-gadget draw-gadget* > [ { 10 10 } ] dip texture>> [ draw-texture ] > curry with-translation ; > > ! In the listener > > "vocab:images/sprites/game_drop.png" gadget. > > ! the above works and shows the image in the listener > > "vocab:images/sprites/game_drop.png" "i-gadget" open-window > > ! the above opens a new window but the image does not show > > What could I be missing? > > Thanks, > Sankar > > > -- > ___ > 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] Mutation on tuple instances
On Thu, Nov 26, 2015 at 5:28 PM, Sankaranarayanan Viswanathanwrote: > Hi, > > I'm having trouble understanding the behavior below: > > Running the code below on the listener: > > TUPLE: test a b c ; > : ( -- t ) { 1 2 } { 3 4 } { 5 6 } test boa ; > : f1 ( -- ) . ; > : f2 ( -- ) a>> [ [ 10 0 ] dip set-nth ] [ [ 20 1 ] dip set-nth ] bi ; > > f1 > ! outputs T{ test { a { 1 2 } } { b { 3 4 } } { c { 5 6 } } } > > f2 f1 > ! outputs T{ test { a { 10 20 } } { b { 3 4 } } { c { 5 6 } } } > > Why is the mutation on a separate tuple instance impacting another? The mutation on the second tuple is "affecting" the first tuple because they both have references to the same arrays. > Am I doing something incorrectly? When you write "{ 1 2 }" in the source code, only one array is created. The idiom if you need separate objects each time the function runs is to use "{ 1 2 } clone". I didn't find where this is described with a quick search in the docs , but one place where this is mentioned is at the end of the vector article http://docs.factorcode.org/content/article-vectors.html " If you don't care about initial capacity, an elegant way to create a new vector is to write: V{ } clone " Cheers, Jon -- Go from Idea to Many App Stores Faster with Intel(R) XDK Give your users amazing mobile app experiences with Intel(R) XDK. Use one codebase in this all-in-one HTML5 development environment. Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs. http://pubads.g.doubleclick.net/gampad/clk?id=254741551=/4140 ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Mutation on tuple instances
Ah there it is: http://docs.factorcode.org/content/article-syntax-literals.html " If a quotation contains a literal object, the same literal object instance is used each time the quotation executes; that is, literals are “live”. Using mutable object literals in word definitions requires care, since if those objects are mutated, the actual word definition will be changed, which is in most cases not what you would expect. Literals should be cloned before being passed to a word which may potentially mutate them. " Jon On Thu, Nov 26, 2015 at 5:50 PM, Jon Harper <jon.harpe...@gmail.com> wrote: > On Thu, Nov 26, 2015 at 5:28 PM, Sankaranarayanan Viswanathan > <rationalrev...@gmail.com> wrote: >> Hi, >> >> I'm having trouble understanding the behavior below: >> >> Running the code below on the listener: >> >> TUPLE: test a b c ; >> : ( -- t ) { 1 2 } { 3 4 } { 5 6 } test boa ; >> : f1 ( -- ) . ; >> : f2 ( -- ) a>> [ [ 10 0 ] dip set-nth ] [ [ 20 1 ] dip set-nth ] bi ; >> >> f1 >> ! outputs T{ test { a { 1 2 } } { b { 3 4 } } { c { 5 6 } } } >> >> f2 f1 >> ! outputs T{ test { a { 10 20 } } { b { 3 4 } } { c { 5 6 } } } >> >> Why is the mutation on a separate tuple instance impacting another? > The mutation on the second tuple is "affecting" the first tuple > because they both have references to the same arrays. > >> Am I doing something incorrectly? > When you write "{ 1 2 }" in the source code, only one array is > created. The idiom if you need separate objects each time the function > runs is to use "{ 1 2 } clone". > > I didn't find where this is described with a quick search in the docs > , but one place where this is mentioned is at the end of the vector > article http://docs.factorcode.org/content/article-vectors.html > " > If you don't care about initial capacity, an elegant way to create a > new vector is to write: > V{ } clone > " > > Cheers, > Jon -- Go from Idea to Many App Stores Faster with Intel(R) XDK Give your users amazing mobile app experiences with Intel(R) XDK. Use one codebase in this all-in-one HTML5 development environment. Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs. http://pubads.g.doubleclick.net/gampad/clk?id=254741551=/4140 ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] The iota test
The graphical listener is simply not meant to be used like this. You can see that the command line listener (or a factor script, or a deployed program) has no problem outputting million of lines with ./factor -run=listener Jon On Fri, Oct 9, 2015 at 5:34 PM, Alexander Ilinwrote: > Hello! > > Is it just me, or do you also can see this issue? > > I downloaded the latest development build for Windows: > factor-windows-x86-32-2015-09-29-16-12.zip > > It reports this on startup: Factor 0.98 x86.32 (1717, > heads/master-9a5cd7d13d, Tue Sep 29 16:12:54 2015) > [Microsoft Visual C++ 190022816] on windows > > Now, the iota test. I run in the Listener: > > 100 iota [ . ] each > > Expected result: a window with a million lines in ascending order, the last > one being 99 OR an Out of Memory exception. > > Actual result: the application crashes. > > Memory use goes up from about 200 Mb to 780 Mb at the time of crash. > > ---=--- > Александр > > -- > ___ > 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] Ctrl+Break
I don't use windows normally, but I did a quick test and it worked. Double click factor.com or run it from a terminal, enter "[ t ] loop" in the listener and then ctrl-c and t in the terminal and it interrupts. For example, if you do "[ 1 seconds sleep t ] loop" and do the same factor will most likely die. Similarly, if you do this with code that's doing a lot of IO, it probably won't work because the exception will happen in the wrong thread. Jon On Fri, Oct 2, 2015 at 1:34 PM, Alexander Ilin <ajs...@yandex.ru> wrote: > Are we still talking about Factor on Windows? > > 02.10.2015, 13:11, "Jon Harper" <jon.harpe...@gmail.com>: >> You can also hit CTRL-C on the terminal, then press 't' to throw an >> exception in factor. If the listener is doing a busy loop, it will get the >> exception and it should work. If the exception goes to another thread >> because the listener thread yields, it can kill the whole process, so you >> have to use with care.. > > ---=--- > Александр > > -- > ___ > 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] Ctrl+Break
You can also hit CTRL-C on the terminal, then press 't' to throw an exception in factor. If the listener is doing a busy loop, it will get the exception and it should work. If the exception goes to another thread because the listener thread yields, it can kill the whole process, so you have to use with care.. Jon On Thu, Oct 1, 2015 at 11:30 PM, Alexander Ilinwrote: > Hello! > > You could have that as a library function, not necessarily written in > Factor. > > The Listener already catches and handles all exceptions raised by > running user code, am I right? > > 02.10.2015, 00:19, "John Benediktsson" : > > you can open another listener and suspend the thread of the first > > > > we don't have a way to kill threads: > > > > https://github.com/slavapestov/factor/issues/1387 > > > > or wait/join threads: > > > > https://github.com/slavapestov/factor/issues/1407 > > > > On Thu, Oct 1, 2015 at 2:12 PM, Alexander Ilin wrote: > >> Hello! > >> > >> 01.10.2015, 22:33, "HP wei" : > >>> I try to hit Control-C but it continues to run. > >>> *** How to exit a running words ? > >> > >> HP wei raises a very good point. Is there a way to interrupt an > infinite loop or a long-running word? > >> > >> If such a mechanism is not there in Factor UI, I could share a way to > implement it (Windows-specific). > >> > >> It involves running a native background thread with the Ctrl+Break > hotkey globally hooked. When the hotkey is triggered, the main thread is > interrupted by setting its exception flag. All words running from the > Scratchpad should expect this special kind of exception. I'm not too good > with Factor yet, so I could not implement this without some serious > help/pointers, but I can share the details of the same mechanism > implemented elsewhere (an open-source run-time environment). > >> > >> ---=--- > >> Александр > >> > >> > -- > >> ___ > >> 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] ALUT.dll
For windows users, we try to host all the dlls on: - for 32bit http://downloads.factorcode.org/dlls/ - for 64bit http://downloads.factorcode.org/dlls/64/ Regards, Jon On Thu, Sep 17, 2015 at 9:46 AM, Alexander Ilinwrote: > Hello! > > I was trying to load the Lunar Rescue game in Factor, but stumbled upon > the ALUT.dll dependency. > After some search on the 'net I found what it stands for, and even > installed OpenAL v1.1, but I could not find ALUT binaries for Windows. > Does anyone know of an official/reliable place to get them? > > ---=--- > Александр > > > -- > Monitor Your Dynamic Infrastructure at Any Scale With Datadog! > Get real-time metrics from all of your servers, apps and tools > in one place. > SourceForge users - Click here to start your Free Trial of Datadog now! > http://pubads.g.doubleclick.net/gampad/clk?id=241902991=/4140 > ___ > Factor-talk mailing list > Factor-talk@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/factor-talk > -- Monitor Your Dynamic Infrastructure at Any Scale With Datadog! Get real-time metrics from all of your servers, apps and tools in one place. SourceForge users - Click here to start your Free Trial of Datadog now! http://pubads.g.doubleclick.net/gampad/clk?id=241902991=/4140___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Recursion
> > On Tue, Sep 15, 2015 at 6:38 AM, Alexander Ilinwrote: > >> >> Is it possible that the recursive call to the numbers-game-loop would >> eventually overflow the call stack? >> >> And this article talks about it: http://docs.factorcode.org/content/article-tail-call-opt.html Jon -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] newbie question: how to collect info from a stream
Hi, Here's a simple example: https://github.com/slavapestov/factor/blob/master/extra/tzinfo/tzinfo.factor It uses with-file-reader ( http://docs.factorcode.org/content/word-with-file-reader,io.files.html ) to bind the file stream to the default input stream. It then calls read and its variants and when the whole file is parsed stores the result in an object. Regards, Jon Jon On Tue, Sep 1, 2015 at 12:31 PM, HP Weiwrote: > I am just starting to learn factor. > > In ocaml or python, when I open a file stream, I usually set up an object > with an accumulator class variable where I collect the selected info while > walking through the stream (file). > > I am trying to look at various places to find an equivalent way of doing > this > [ or the natural way (folding?) of achieving the goal ] in factor. > Could you please help me out ? > > thanks > HP > > > > -- > ___ > 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] Why does editor pass some handled gestures?
Nice investigation. This should go in the docs somewhere, particularly that parents gadget must pass gestures to the parent for the actions to work. For example in http://docs.factorcode.org/content/article-action-gestures.html ? diff --git a/basis/ui/gestures/gestures-docs.factor b/basis/ui/gestures/gestures-docs.factor index a12ec35..f7e034f 100644 --- a/basis/ui/gestures/gestures-docs.factor +++ b/basis/ui/gestures/gestures-docs.factor @@ -430 +430 @@ ARTICLE: action-gestures Action gestures -The following keyboard gestures, if not handled directly, send action gestures: +The following keyboard gestures, if not handled directly by any gadget in the hierarchy until reaching the world, are re-sent as action gestures to the first gadget: Also, in worlds.factor: action-gestures [ [ [ { C+ } ] dip f key-down ] [ '[ _ send-action ] ] bi* ] H{ } assoc-map-as so macos has the some actions with the command keys from ./basis/ui/backend/cocoa/views/views.factor and also the actions from the control key resent by the world ? Maybe add a note for that describing the exact mechanism.. I haven't read the code and don't have a mac to confirm how it works, but is it something like Additionally, On Mac OS X, action gestures are directly sent when using the Command key or Menu Items ? Jon On Mon, Aug 24, 2015 at 12:08 PM, Georg Simon georg.si...@auge.de wrote: As far as I understand the answer to my question is as follows : editor passes C+c, C+s, and so on to it's parent. All parents should pass them too. In world waits a gesture-handler. It handles keypresses for which action gestures exist. The corresponding action gesture is sent to editor. editor either handles the action gesture or passes it to it's parent. http://paste.factorcode.org/paste?id=3608 -- ___ 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] Why does editor pass some handled gestures?
Hi Georg, You have 2 problems in IN: scratchpad T{ key-down f f C+c } editor get-gesture-handler . f First, see http://docs.factorcode.org/content/article-keyboard-gestures.html for the correct syntax: IN: scratchpad T{ key-down f { C+ } l } editor get-gesture-handler . [ \ select-line invoke-command ] Second, copy paste has a mechanism to work as C+c on linux/windows and Cmd+c on mac: see http://docs.factorcode.org/content/article-action-gestures.html and http://docs.factorcode.org/content/word-action-modifier,ui.gestures.html (The docs are a little light on this point though..) IN: scratchpad \ copy-action editor get-gesture-handler . [ \ com-copy invoke-command ] Hope that helps! Jon On Wed, Aug 19, 2015 at 7:01 AM, Georg Simon georg.si...@auge.de wrote: Thank you. What you describe is what I use. And I do not want an editor that always passes gestures. But now it comes to C+c, C+v, C+x, C+y, and C+z. There is no gesture-handler in editor for them: IN: scratchpad T{ key-down f f C+c } editor get-gesture-handler . f But they work. They work as expected as copy, paste, cut, redo, and undo. And they are documented in http://docs.factorcode.org/content/article-gadgets-editors-commands.html How can I detect in my program that C+c works but for instance C+d not? Am Tue, 18 Aug 2015 07:37:24 -0700 schrieb John Benediktsson mrj...@gmail.com: If you look at the docs for handle-gesture, it says Outputs f if the gesture was handled, and t if the gesture should be passed on to the gadget's parent.. http://docs.factorcode.org/content/word-handle-gesture,ui.gestures.html I would guess it's because your editor is wrapped by a main-gadget and any actions that are ui.commands are handled by the editor and not passed to the parent gadget. https://github.com/slavapestov/factor/blob/master/basis/ui/gadgets/editors/editors.factor#L425 So, left is handled (meaning ``f`` don't pass to parent): IN: scratchpad T{ key-down f f LEFT } editor get-gesture-handler . [ \ previous-character invoke-command ] IN: scratchpad T{ key-down f f LEFT } editor handle-gesture . f But, up is not (because it isn't a multiline-editor): IN: scratchpad T{ key-down f f UP } editor get-gesture-handler . f IN: scratchpad T{ key-down f f UP } editor handle-gesture . t If you want an editor that always passes gestures, then... TUPLE: my-editor editor ; : my-editor ( -- editor ) my-editor new-editor ; M: my-editor handle-gesture call-next-method drop t ; Hope that helps! On Mon, Aug 17, 2015 at 10:55 PM, Georg Simon georg.si...@auge.de wrote: Ubuntu 14.04.2 LTS Factor 0.98 x86.64 (1565, heads/master-0-g592764d, Wed Dec 24 04:52:05 2014) [GCC 4.8.2] on linux In the test program http://paste.factorcode.org/paste?id=3590 BACKSPACE and DELETE don't appear in the terminal as they are handled by editor. UP and DOWN appear in the terminal as they are not handled by editor. But C+c and C+v appear in the terminal although they are handled by editor. In my application I can catch them separately when I know they are handled by editor. But is there a better way? -- ___ 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] Why does numberstring append .0 on my German system ?
For info, it works directly on x86 linux Jon On Fri, Aug 14, 2015 at 6:17 AM, Georg Simon georg.si...@auge.de wrote: For me the need lies in the future. I am using a Factor written todo list editor, primarily to learn to use the Factor UI. I now add deadlines. So I want to display numbers in a Factor table. It would have been proper to display them locale dependant, but it is not necessary for now. Am Fri, 14 Aug 2015 00:01:20 +0200 schrieb Jon Harper jon.harpe...@gmail.com: So I looked into this, trying to solve it by calling printf through the FFI with a locale setup and cleanup. The difficulty comes from the fact that printf is a variadic function.. Factor's ffi doesn't support them, at least no in a cross platform manner, right? So a workaround could be to wrap printf in C many times, compile that to a shared library and call the different wrappers with the FFI depending on the number of arguments and their types, but it would be nicer to have a better support of variadic functions. Anyway, it (kind of) worked on linux x86_64 with the following code: http://paste.factorcode.org/paste?id=3584 Since printf is a variadic function, you have to use FUNCTION-ALIAS to create functions with the correct number of arguments and the correct types. So for example, FUNCTION-ALIAS: mysnprintf-int2 int snprintf ( char* result, size_t size, c-string format, int d, int d2 ) would work too. However, passing floats didn't work on linux x86_64, because the system V AMD64 ABI says that the number of float arguments must be in RAX before calling the function, and factor always sets this to 0. With the following diff, it worked for 1 float: in cpu/x86/64/64.factor (and basis/cpu/x86/64/64.factor ??) -M: x86.64 %prepare-var-args ( -- ) RAX RAX XOR ; +M: x86.64 %prepare-var-args ( -- ) RAX 1 MOV ; I don't know how hard it would be to generate the correct value for RAX for variable arguments. Also, I'm not sure if it works better for other ABI/platforms. Do you think that's something worth investigating ? Jon On Wed, Aug 12, 2015 at 7:10 AM, Georg Simon georg.si...@auge.de wrote: Am Tue, 11 Aug 2015 09:02:33 -0700 schrieb John Benediktsson mrj...@gmail.com: Thank you. So I didn't overlook existing locales support. Properly supporting locales, even in a small way, would be a good thing to add. Factor is currently locale-independent, partly because of a desire for homoiconicity, and partly because it prevents things like tests that break depending on the system locale[1]. We have discussed adding a locale vocabulary or a with-locale combinator that can influence presentation of numbers and strings, maybe looking at how other languages work[2]. Probably we'd want to keep the math.parser locale independent, but provide ways for things like present / printf to be locale-aware. If this is an issue for something you are building, you could use alien.ffi to call sprintf or use C++ stringstream or something and call the library from Factor, or do something slow like this, calling out to Python: : format-with-locale ( n locale -- s ) swap [ python , -c , import locale; locale.setlocale(locale.LC_ALL, \%s\); print(locale.format(\%%f\, %s)) sprintf , ] { } make B utf8 [ readln ] with-process-reader ; IN: scratchpad 1.5 fr_FR format-with-locale . 1,50 --- [1] https://github.com/slavapestov/factor/issues/905 [2] https://docs.python.org/3/library/locale.html -- ___ 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] gcc versions
Hi, for info, we can't compile the factor vm with the default compiler (gcc 4.7.2) of debian oldstable wheezy anymore. First, it has a false compilation error ( https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54277): g++ -c -x c++-header -Wall -DFACTOR_VERSION=0.98 -DFACTOR_GIT_LABEL=heads/master-5ba44b37bc82bfdea706c16f33b3bbc13b9ca87c -fomit-frame-pointer -Wl,--no-as-needed -m32 -O3 -g -std=c++11 -o vm/master.hpp.gch vm/master.hpp In file included from vm/master.hpp:112:0: vm/free_list_allocator.hpp: In lambda function: vm/free_list_allocator.hpp:137:35: error: no matching function for call to ‘factor::mark_bits::marked_p(factor::cell) const’ vm/free_list_allocator.hpp:137:35: note: candidate is: In file included from vm/master.hpp:109:0: vm/mark_bits.hpp:81:8: note: bool factor::mark_bits::marked_p(factor::cell) near match vm/mark_bits.hpp:81:8: note: no known conversion for implicit ‘this’ parameter from ‘const factor::mark_bits*’ to ‘factor::mark_bits*’ The following patch workarounds error: diff --git a/vm/free_list_allocator.hpp b/vm/free_list_allocator.hpp index 65e6851..461004c 100644 --- a/vm/free_list_allocator.hpp +++ b/vm/free_list_allocator.hpp @@ -137 +137 @@ void free_list_allocatorBlock::compact(Iterator iter, Fixup fixup, -if (!state.marked_p(block_addr)) +if (!this-state.marked_p(block_addr)) Even with the workaround, when then have g++ -c -Wall -DFACTOR_VERSION=0.98 -DFACTOR_GIT_LABEL=heads/master-5ba44b37bc82bfdea706c16f33b3bbc13b9ca87c -fomit-frame-pointer -Wl,--no-as-needed -m32 -O3 -g -std=c++11 -o vm/compaction.o vm/compaction.cpp vm/compaction.cpp: In lambda function: vm/compaction.cpp:165:1: internal compiler error: in get_expr_operands, at tree-ssa-operands.c:1035 Please submit a full bug report, with preprocessed source if appropriate. See file:///usr/share/doc/gcc-4.7/README.Bugs for instructions. Jon -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] gcc versions
So if the fix is correct, then we are all good. The implicit this fix doesn't change anything: With Wheezy's clang, it has no effect: it always segfaults during the precompilation of master.hpp With Wheezy's gcc, it goes from a false negative error during the precompilation of master.hpp to a segfault during the compilation of compaction.cpp Also, there are tons of other implicit this uses. This one just happens to be in a lambda and calling a non const method of this. I'm not sure we want to support 2012's compilers ? Jon On Fri, Aug 14, 2015 at 7:54 PM, Doug Coleman doug.cole...@gmail.com wrote: Interesting. Both versions work with my clang. ergmac:factor erg$ [master*] clang --version Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn) Target: x86_64-apple-darwin14.4.0 Thread model: posix So if the fix is correct, then we are all good. Doug On Fri, Aug 14, 2015 at 10:51 AM, Jon Harper jon.harpe...@gmail.com wrote: Well that's GCC 4.7.2 https://gcc.gnu.org/gcc-4.7/ September 20, 2012 Gcc did fix this in GCC 4.7.3 https://gcc.gnu.org/gcc-4.7/ April 11, 2013 Also, clang does not error on the implicit this, but crashes hard earlier than gcc :) $ clang --version Debian clang version 3.0-6.2 (tags/RELEASE_30/final) (based on LLVM 3.0) Target: i386-pc-linux-gnu Thread model: posix $ CC=clang CXX=clang++ make make `./build-support/factor.sh make-target` [...snip...] 1. vm/free_list_allocator.hpp:124:57: current parser token ';' 2. vm/free_list_allocator.hpp:1:1: parsing namespace 'factor' 3. vm/free_list_allocator.hpp:123:68: parsing function body 'sweep' 4. vm/free_list_allocator.hpp:123:68: in compound statement ('{}') clang: error: unable to execute command: Segmentation fault 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] gcc versions
I started this discussion because I thought that not everybody was aware of the impact of the recent c++11 changes. We now have stronger requirements than most projects, but this also means we have cleaner c++ code :) I think that's worth it. I'll test with different gcc and clang versions so we can add a check in factor.sh. Note: Wheezy is now oldstable, so has been obsolete for 4 months (it still gets security fixes until february 2016, and after that debian's LTS until 2018). Jon On Fri, Aug 14, 2015 at 7:54 PM, John Benediktsson mrj...@gmail.com wrote: Are we using too-bleeding-edge C++ features? Is the suggestion maybe we scale down to some subset compilers have had working for 3-4 years? On Aug 14, 2015, at 10:51 AM, Jon Harper jon.harpe...@gmail.com wrote: Well that's GCC 4.7.2 https://gcc.gnu.org/gcc-4.7/ September 20, 2012 Gcc did fix this in GCC 4.7.3 https://gcc.gnu.org/gcc-4.7/ April 11, 2013 Also, clang does not error on the implicit this, but crashes hard earlier than gcc :) $ clang --version Debian clang version 3.0-6.2 (tags/RELEASE_30/final) (based on LLVM 3.0) Target: i386-pc-linux-gnu Thread model: posix $ CC=clang CXX=clang++ make make `./build-support/factor.sh make-target` [...snip...] 1. vm/free_list_allocator.hpp:124:57: current parser token ';' 2. vm/free_list_allocator.hpp:1:1: parsing namespace 'factor' 3. vm/free_list_allocator.hpp:123:68: parsing function body 'sweep' 4. vm/free_list_allocator.hpp:123:68: in compound statement ('{}') clang: error: unable to execute command: Segmentation fault 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] Why does numberstring append .0 on my German system ?
So I looked into this, trying to solve it by calling printf through the FFI with a locale setup and cleanup. The difficulty comes from the fact that printf is a variadic function.. Factor's ffi doesn't support them, at least no in a cross platform manner, right? So a workaround could be to wrap printf in C many times, compile that to a shared library and call the different wrappers with the FFI depending on the number of arguments and their types, but it would be nicer to have a better support of variadic functions. Anyway, it (kind of) worked on linux x86_64 with the following code: http://paste.factorcode.org/paste?id=3584 Since printf is a variadic function, you have to use FUNCTION-ALIAS to create functions with the correct number of arguments and the correct types. So for example, FUNCTION-ALIAS: mysnprintf-int2 int snprintf ( char* result, size_t size, c-string format, int d, int d2 ) would work too. However, passing floats didn't work on linux x86_64, because the system V AMD64 ABI says that the number of float arguments must be in RAX before calling the function, and factor always sets this to 0. With the following diff, it worked for 1 float: in cpu/x86/64/64.factor (and basis/cpu/x86/64/64.factor ??) -M: x86.64 %prepare-var-args ( -- ) RAX RAX XOR ; +M: x86.64 %prepare-var-args ( -- ) RAX 1 MOV ; I don't know how hard it would be to generate the correct value for RAX for variable arguments. Also, I'm not sure if it works better for other ABI/platforms. Do you think that's something worth investigating ? Jon On Wed, Aug 12, 2015 at 7:10 AM, Georg Simon georg.si...@auge.de wrote: Am Tue, 11 Aug 2015 09:02:33 -0700 schrieb John Benediktsson mrj...@gmail.com: Thank you. So I didn't overlook existing locales support. Properly supporting locales, even in a small way, would be a good thing to add. Factor is currently locale-independent, partly because of a desire for homoiconicity, and partly because it prevents things like tests that break depending on the system locale[1]. We have discussed adding a locale vocabulary or a with-locale combinator that can influence presentation of numbers and strings, maybe looking at how other languages work[2]. Probably we'd want to keep the math.parser locale independent, but provide ways for things like present / printf to be locale-aware. If this is an issue for something you are building, you could use alien.ffi to call sprintf or use C++ stringstream or something and call the library from Factor, or do something slow like this, calling out to Python: : format-with-locale ( n locale -- s ) swap [ python , -c , import locale; locale.setlocale(locale.LC_ALL, \%s\); print(locale.format(\%%f\, %s)) sprintf , ] { } make B utf8 [ readln ] with-process-reader ; IN: scratchpad 1.5 fr_FR format-with-locale . 1,50 --- [1] https://github.com/slavapestov/factor/issues/905 [2] https://docs.python.org/3/library/locale.html -- ___ 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] Why does numberstring append .0 on my German system ?
This is being fixed. Meanwhile, you can adjust your locale settings to workaround: LC_CTYPE=C ./factor Should work. If not, you can try LC_ALL=C Jon Le 11 août 2015 9:30 AM, Georg Simon georg.si...@auge.de a écrit : IN: scratchpad 1.5 numberstring . 1,5.0 I would have expected 1,5 -- ___ 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] Why does numberstring append .0 on my German system ?
Sorry, it's LC_NUMERIC, not LC_CTYPE. Also, the objective is really to always have 1.5 in the listener because we want an homoiconic language, so the listener ouptut numbers in source code format which is locale independant. Le 11 août 2015 10:12 AM, Georg Simon georg.si...@auge.de a écrit : Thank you. LC_CTYPE=C does not help. LC_ALL=C gives 1.5 instead of 1,5 My system is Ubuntu 14.04.2 LTS . But I can just wait for the fix. Georg Am Tue, 11 Aug 2015 09:37:31 +0200 schrieb Jon Harper jon.harpe...@gmail.com: This is being fixed. Meanwhile, you can adjust your locale settings to workaround: LC_CTYPE=C ./factor Should work. If not, you can try LC_ALL=C Jon Le 11 août 2015 9:30 AM, Georg Simon georg.si...@auge.de a écrit : IN: scratchpad 1.5 numberstring . 1,5.0 I would have expected 1,5 -- ___ 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] new parser
Hi Doug, so I guess everyone has been teased with all the clues about the new parser :) 1fcf96cada0737 says something else soon., https://github.com/slavapestov/factor/issues/1398 mentions it, etc. Could you share your plans for the new parser ? How will it be different, what will it improve, etc ? Thanks, Jon -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] nested nil lists
yes. Which is the same as ```nil 1list```. Jon On Fri, Jul 3, 2015 at 11:40 AM, Iain Gray iaing...@ednet.co.uk wrote: is nil nil cons ok? On 3 Jul 2015, at 10:14, Iain Gray iaing...@ednet.co.uk wrote: in Scheme I can evaluate (list ‘()) to get ‘(()) as a nested null list Factor supplies nil (+nil+) but I can’t seem to get the above using cons, 1list etc. is this not the natural way to do this in Factor? -- Don't Limit Your Business. Reach for the Cloud. GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today. https://www.gigenetcloud.com/ ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Don't Limit Your Business. Reach for the Cloud. GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today. https://www.gigenetcloud.com/ ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Don't Limit Your Business. Reach for the Cloud. GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today. https://www.gigenetcloud.com/___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] displaying Lisp like nested lists
Looking at listarray, : listarray ( list -- array ) [ ] lmaparray ; You can adapt it to recurse on lists: IN: scratchpad : deeplistarray ( list -- array ) [ dup list? [ deeplistarray ] when ] lmaparray ; IN: scratchpad 1 nil cons 2 nil cons nil cons nil cons cons deeplistarray . { { 1 } { { 2 } } } Hope that helps, Jon Jon On Mon, Jun 29, 2015 at 5:03 PM, Iain Gray iaing...@ednet.co.uk wrote: that gave me { ~cons-state~ ~cons-state~ } On 29 Jun 2015, at 15:22, John Benediktsson mrj...@gmail.com wrote: I think you need one more cons at the end, but listarray should work fine recursively. On Mon, Jun 29, 2015 at 5:37 AM, Iain Gray iaing...@ednet.co.uk wrote: I make a list with 1 nil cons 2 nil cons nil cons nil cons but listarray displays only top level, can it descend recursively? -- Monitor 25 network devices or servers for free with OpManager! OpManager is web-based network management software that monitors network devices and physical virtual servers, alerts via email sms for fault. Monitor 25 devices for free with no restriction. Download now http://ad.doubleclick.net/ddm/clk/292181274;119417398;o ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Monitor 25 network devices or servers for free with OpManager! OpManager is web-based network management software that monitors network devices and physical virtual servers, alerts via email sms for fault. Monitor 25 devices for free with no restriction. Download now http://ad.doubleclick.net/ddm/clk/292181274;119417398;o___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Monitor 25 network devices or servers for free with OpManager! OpManager is web-based network management software that monitors network devices and physical virtual servers, alerts via email sms for fault. Monitor 25 devices for free with no restriction. Download now http://ad.doubleclick.net/ddm/clk/292181274;119417398;o ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Monitor 25 network devices or servers for free with OpManager! OpManager is web-based network management software that monitors network devices and physical virtual servers, alerts via email sms for fault. Monitor 25 devices for free with no restriction. Download now http://ad.doubleclick.net/ddm/clk/292181274;119417398;o___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Exporting a C API
This sounds like mixing the features from: - http://docs.factorcode.org/content/article-embedding.html which initializes everything, but then requires the compiler to use a string - factor eval - string call. - http://docs.factorcode.org/content/article-alien-callback.html which allows to directly call into factor code with C function calls. But looking at callbacks.hpp in vm/, it says that callbacks are The callback heap is not saved in the image. Running GC in a new session after saving the image will deallocate any code heap entries that were only reachable from the callback heap in the previous session when the image was saved. So I'm not sure if that means you need the compiler to recompile the callbacks each time factor is started ? Jon On Mon, Feb 9, 2015 at 8:07 PM, John Benediktsson mrj...@gmail.com wrote: Should be possible as the FFI supports calls and callbacks, but I'm not aware of anyone who has tried. Love the idea, though! On Sat, Feb 7, 2015 at 6:22 AM, Marmaduke Woodman mmwood...@gmail.com wrote: Hi I'm curious as to the feasability of exporting a C API for a library written in Factor. From the FFI docs, I expect that it would be possible for a small stub library in C to initialize the VM and populate a table of alien callbacks which could be used from another language... in theory. Does anyone have any experience with this? Thanks Marmaduke -- Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] ! Comments
You're missing a whitespace between x and your closing parenthesis in : dice5 ( -- x) The error message should be better... Jon On Thu, Jan 29, 2015 at 12:04 PM, Alexander Iljin ajs...@yandex.ru wrote: Hello! I was trying to create a vocabulary: USING: random ; IN: dice7 ! Output a random number 1..5. : dice5 ( -- x) random-unit 5 * floor 1 + ; ! : dice7 () 7 random-units [ 5 * ] each 6 [ + ] times 5 / ; As you can see, dice7 is a work in progress and is commented out with the bang character. Or so I thought. However, trying to load the vocabulary produces an error message: IN: scratchpad Command: refresh-all Loading resource:work/dice7/dice7.factor dice7: resource:work/dice7/dice7.factor 7: : dice5 ( -- x) random-unit 5 * floor 1 + ; 9: ! : dice7 () 7 random-units [ 5 * ] each 6 [ + ] times 5 / ; ^ No word named “dice7” found in current vocabulary search path Is there something special about a colon after the bang? Or am I using it wrong? ---=--- Александр -- Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] ndrop
Hi Alexander, The input quotations to “while” don't match their expected effects Input Expected Got [ dup 0 ] ( ..a -- ..b ? ) ( x -- x x ) [ 1 - swap drop ] ( ..b -- ..a ) ( x x -- x ) Regarding the first line: These two lines can not be interpreted separately, as you'll se below. Input Expected Got [ dup 0 ] ( ..a -- ..b ? ) ( x -- x x ) I read it as a boolean is expected at the stack top, but some other value was found. The first line means starting from a number of elements on the stack (represented as ..a), there should be ..b elements and a boolean on the stack. In your case, based on the Got column, it means ..a is 1 element, and ..b and the boolean are 2 elements (so ..b is 1 element). It doesn't say anything about the types of the elements. How can that be if the last function is , and it does return a boolean. The error is not about the types of the elements (using '?' does mean the type should be a boolean, but it is just a convention). The two lines can't be read separately: quoting from the docs ( http://docs.factorcode.org/content/article-effects-variables.html) : the number of inputs or outputs represented by a particular .. name must match among all of the quotations. So the error is about the fact that the second line forces ..b to represent 2 elements, which contradicts the first line where ..b must represent 1 element. I read it as you can't reduce the stack size inside the loop body. Why not? Words must have a known fixed stack effect. This is a design decision. The number of inputs and outputs is fixed, must be declared and must match the result inferred from the body of the word. This is explained in http://docs.factorcode.org/content/article-cookbook.html and its linked articles (for example http://docs.factorcode.org/content/article-effects.html). However, there is some more advanced stuff to this: - Some flexibilty is allowed for inline words (see http://docs.factorcode.org/content/article-effects-variables.html) which allows them to have a stack effect depending on their inputs. Still the resulting stack effect must be fixed at each call site. - Also, ndrop already exists in the library: http://docs.factorcode.org/content/word-ndrop,generalizations.html The key to make it work is to use macros ( http://docs.factorcode.org/content/article-macros.html). 1 ndrop is changed into [ drop ] [ call ] keep drop, 2 ndrop is changed into [ drop ] [ call ] keep [ call ] keep drop, etc. You can see it by entering [ drop ] 2 call-n in the graphical listener and pressing CTRL-m. But this means the argument to ndrop must be a known at compile time so that the macro expansion succeeds. For example: : foo ( x x -- ) 1 1 + ndrop ; ! error, Cannot apply “call-n” to a run-time computed value : bar ( x x -- ) 2 ndrop ; ! OK Hope that helps, cheers, Jon -- Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Standalone executables in Windows
Looks like this thread: http://sourceforge.net/p/factor/mailman/message/6098094/ The tools now produce a single executable (the image is embedded in the executable). It also allows to strip unused vocabularies to reduce the size of the executable. But it's still the same tools that was cited in the 2007 thread. Cheers, Jon Le 7 janv. 2015 22:42, Björn Lindqvist bjou...@gmail.com a écrit : Hi John, Last I tried which was a while ago, deploying executables on Windows worked fine. Doesn't it anymore? See http://docs.factorcode.org/content/article-tools.deploy.usage.html for docs. 2015-01-07 13:10 GMT+01:00 John Sampson jrs@ntlworld.com: In 2007 there was a thread on this subject. Daniel Ehrenberg gave a link to a factorcode.org faq page, but this is now broken (404 error). It was stated that a tool for making standalone executables was in development - is it in existence? Regards John Sampson -- mvh/best regards Björn Lindqvist http://www.bjornlindqvist.se/ -- Dive into the World of Parallel Programming! The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Dive into the World of Parallel Programming! The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Model activation sequence
Hi Mark, I'm basing my remarks on https://github.com/hyphz/fr8x-editor/tree/257e244c3a20175a5c88d8c2f776999897025776 Like you said, for the arrow to work, it needs to be activated. In your program the activation of the arrow is done by the open-window which calls the graft method of the checkbox holding your partmodel. So I guess you should move your code around to not depend on the data of the arrow until all the models have been activated. Maybe you can just remove the call to partmodel-fetch in new-partmodel, are they really needed ? The ui starts fines without them. Hope that helps, Jon Jon On Fri, Jan 2, 2015 at 1:08 AM, Mark Green m...@antelope.nildram.co.uk wrote: Hi folks, After my previous post about a model which could extract a part of a complex structure inside another model, I had a go at it myself as follows: TUPLE: partmodel model master extractor updater ; : partmodel-fetch ( partmodel -- ) dup [ master value ] [ extractor ] bi call( master -- part ) swap set-model ; : new-partmodel ( master extractor updater class -- partmodel ) f swap new-model swap updater swap extractor [ add-dependency ] [ swap master ] 2bi dup partmodel-fetch ; M: partmodel model-changed nip partmodel-fetch ; M: partmodel update-model dup master locked? [ Warning: partmodel failing to update master . drop ] [ dup [ master value ] [ value ] [ updater ] tri call( mastervalue newslavevalue -- ) master [ [ update-model ] [ notify-connections ] bi ] with-locked-model ] if ; : partmodel ( master extractor updater -- partmodel ) partmodel new-partmodel ; : nthmodel ( master index -- partmodel ) [ '[ _ swap nth ] ] [ '[ _ rot set-nth ] ] bi partmodel ; Notice that I ended up having to roll my own notification inside update-model because using set-model doesn't seem appropriate given that the reference to the higher level structure will not change and most of the functions for updating parts of complex structures act in place and pop the old reference form the stack. The problem however occurs when I create a partmodel whose master is an arrow. In this case, even when I add it to a UI element, the arrow does not seem to be activated and does not fetch its value. This seems odd as the partmodel should have the arrow added to its dependency list in new-partmodel before being activated itself. Am I doing something terribly wrong? Mark -- Dive into the World of Parallel Programming! The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Dive into the World of Parallel Programming! The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Model activation sequence
Actually, the call to activate-model is just before the call to the gadget's graft* method, but the point remains the same Jon On Sat, Jan 3, 2015 at 8:02 PM, Jon Harper jon.harpe...@gmail.com wrote: Hi Mark, I'm basing my remarks on https://github.com/hyphz/fr8x-editor/tree/257e244c3a20175a5c88d8c2f776999897025776 Like you said, for the arrow to work, it needs to be activated. In your program the activation of the arrow is done by the open-window which calls the graft method of the checkbox holding your partmodel. So I guess you should move your code around to not depend on the data of the arrow until all the models have been activated. Maybe you can just remove the call to partmodel-fetch in new-partmodel, are they really needed ? The ui starts fines without them. Hope that helps, Jon Jon On Fri, Jan 2, 2015 at 1:08 AM, Mark Green m...@antelope.nildram.co.uk wrote: Hi folks, After my previous post about a model which could extract a part of a complex structure inside another model, I had a go at it myself as follows: TUPLE: partmodel model master extractor updater ; : partmodel-fetch ( partmodel -- ) dup [ master value ] [ extractor ] bi call( master -- part ) swap set-model ; : new-partmodel ( master extractor updater class -- partmodel ) f swap new-model swap updater swap extractor [ add-dependency ] [ swap master ] 2bi dup partmodel-fetch ; M: partmodel model-changed nip partmodel-fetch ; M: partmodel update-model dup master locked? [ Warning: partmodel failing to update master . drop ] [ dup [ master value ] [ value ] [ updater ] tri call( mastervalue newslavevalue -- ) master [ [ update-model ] [ notify-connections ] bi ] with-locked-model ] if ; : partmodel ( master extractor updater -- partmodel ) partmodel new-partmodel ; : nthmodel ( master index -- partmodel ) [ '[ _ swap nth ] ] [ '[ _ rot set-nth ] ] bi partmodel ; Notice that I ended up having to roll my own notification inside update-model because using set-model doesn't seem appropriate given that the reference to the higher level structure will not change and most of the functions for updating parts of complex structures act in place and pop the old reference form the stack. The problem however occurs when I create a partmodel whose master is an arrow. In this case, even when I add it to a UI element, the arrow does not seem to be activated and does not fetch its value. This seems odd as the partmodel should have the arrow added to its dependency list in new-partmodel before being activated itself. Am I doing something terribly wrong? Mark -- Dive into the World of Parallel Programming! The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Dive into the World of Parallel Programming! The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Dealing with parts of a model
Hi Mark, model-field can't work with arrows. Among other reasons, in your case the arrow is not activated when it's data is used to intialize the editor string (that's why you see them empty). The model given to model-field isn't meant to be updated by the caller anyway: it's value is used as an initialization of the editor-string, but after that only the editor-gadget should update the input model when the field is edited. Maybe you should think of your problem the other way around: instead of having data in your structure and creating arrows from pieces of it, wrap all the data in your structure in models and pass those models to the UI ? The UI will then update your structure when the user edits fields. Regards, Jon Jon On Tue, Dec 30, 2014 at 9:16 PM, Mark Green m...@antelope.nildram.co.uk wrote: Hi, I hope everyone had a good Christmas. I'm still struggling a bit with how to create a UI that alters parts of a structure. So far I can store the structure as a whole in the model slot of the containing pane, and I can create arrow models for the individual controls to refer to. The problem is writing changes back again, since the arrow model does not propagate changes back across itself. I see there is a double-ended arrow model in extra called illusion, but it seems to depend on the arrow operation being invertible which extraction of part of a sequence (for example) is not. It is however mergable in that the data from the lower level model could be re-incorporated into the higher level model given knowledge of them both. Does anything support this? Also, does model-field work correctly? When I try to create one, it seems to come up blank and editable, even if the arrow model contains data and is not writable. Mark -- Dive into the World of Parallel Programming! The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Dive into the World of Parallel Programming! The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] A stub of a package manager
Is a DSL better than a standard configuration data format ? For example, I worked on yaml serialization/deserialization ( http://docs.factorcode.org/content/article-yaml.html) because jckarter was using it in https://gist.github.com/jckarter/3440892 so now this is available. Jon Jon On Wed, Dec 17, 2014 at 7:13 PM, mr wzrd wzr...@gmail.com wrote: On 12/17/2014 09:20 AM, Andrea Ferretti wrote: Hi, following this [small discussion](https://news.ycombinator.com/item?id=8750720) I thought I might give a try at designing a simple package manager. Neat idea. One of the benefits to the one big tree that we have right now is that we guarantee to update your code as the standard library changes or improves. Regardless of whether a package manager is necessary or proper at the moment, it demonstrates that the complex trappings of modern software can be implemented in our simple stack-based-language. - mrw -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151iu=/4140/ostg.clktrk ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151iu=/4140/ostg.clktrk___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Output parameters in alien
On Mon, Dec 1, 2014 at 5:24 PM, Andrea Ferretti ferrettiand...@gmail.com wrote: Just to be sure: with-out-parameters takes care of freeing the underlying alien, right? Yes, with-out-parameters allocates on the call stack, runs the quotation, copies the data from the call stack to a new garbage collected object on the heap, then the stack is cleaned up. So utf8 alienstring never sees the original stack allocation, it sees a normal value on the heap that gets garbage collected eventually. Note however that using the call stack for large allocations is not a good idea (the default call stack seems to be 512kb on 32bit and 1024kb on 64bit, can be modified with -callstack command line option) Also, call stack overflows are checked when calling words : foo ( n -- n ) [ 0 ] [ 1 - foo ] if-zero 1 + ; 10 foo ! call stack overflow But it's not checked in with-out-parameters: : foo ( -- char-array ) { { char 2 } } [ drop ] with-out-parameters ; foo ! memory protection fault, kind of correctly handled but with bigger allocations is crashes the whole factor process. Regards, Jon -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=157005751iu=/4140/ostg.clktrk___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Output parameters in alien
John provided an alternative, but here are the explanations of the errors you got: On Fri, Nov 28, 2014 at 5:14 PM, Andrea Ferretti ferrettiand...@gmail.com wrote: { { c-string } } [ hello world swap example_cp ] with-out-parameters The syntax of with-out-parameters is an array of elements, which are either a c-type, or a triple { c-type intial: value }. So in your case, it should have been { c-string } [ hello world swap example_cp ] with-out-parameters I get index out of bounds: 0 which seems reasonable, since I pass an empty c-string. But if I try something like { { c-string initial: hello earth } } [ hello world swap example_cp ] with-out-parameters I get local-allocation-error. The FFI only works with the optimizing compiler, so this code should be defined in a word, not run in the interactive listener. You can define the word in a source file, or directly in the listener and then call it just after you defined it Cheers, Jon -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=157005751iu=/4140/ostg.clktrk___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Output parameters in alien
After investigating a bit, it might be possible? If someone more knowledgeable about the ffi could comment on the following: FUNCTION: char* strcpy ( char * , c-string ) ; : foo ( -- ) { { { char 2 } initial: B{ 0x41 0 } } } [ B strcpy drop ] with-out-parameters utf8 alienstring print ; : bar ( -- ) { { { char 2 } initial: B{ 0x41 0 } } } [ drop ] with-out-parameters utf8 alienstring print ; foo ! prints B bar ! prints A If there is no syntactic sugar yet for passing strings with with-out-parameters, it might be interesting to add it I guess PS: typed this manually, sorry if there are typos :) Jon Le 28 nov. 2014 20:43, Jon Harper jon.harpe...@gmail.com a écrit : John provided an alternative, but here are the explanations of the errors you got: On Fri, Nov 28, 2014 at 5:14 PM, Andrea Ferretti ferrettiand...@gmail.com wrote: { { c-string } } [ hello world swap example_cp ] with-out-parameters The syntax of with-out-parameters is an array of elements, which are either a c-type, or a triple { c-type intial: value }. So in your case, it should have been { c-string } [ hello world swap example_cp ] with-out-parameters I get index out of bounds: 0 which seems reasonable, since I pass an empty c-string. But if I try something like { { c-string initial: hello earth } } [ hello world swap example_cp ] with-out-parameters I get local-allocation-error. The FFI only works with the optimizing compiler, so this code should be defined in a word, not run in the interactive listener. You can define the word in a source file, or directly in the listener and then call it just after you defined it Cheers, Jon -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=157005751iu=/4140/ostg.clktrk___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] column-titles disappear for tables without scroller
Looking at scrollers.factor, it looks like this was intended.. Factor's GUI was developed mainly for the factor tools (listener, help browser etc.) so the features they don't use might not implemented. But you can kind of get it working with the following patch (creating the headers gadget yourself and put it in a pack): http://paste.factorcode.org/paste?id=3356 Cheers, Jon On Fri, Sep 19, 2014 at 8:51 PM, Georg Simon georg.si...@auge.de wrote: I had to put the table into a scroller to make my column-titles visible. The example below opens two windows. On my system the column title is only visible in the second window. Is that intended? - USING: kernel models ui ui.gadgets.scrollers ui.gadgets.tables ; IN: test-voc M: trivial-renderer column-titles drop { Text } ; : main ( -- ) [ { { first line } { second line } } model trivial-renderer table without scroller open-window { { first line } { second line } } model trivial-renderer table scroller with scroller open-window ] with-ui ; MAIN: main -- Slashdot TV. Video for Nerds. Stuff that Matters. http://pubads.g.doubleclick.net/gampad/clk?id=160591471iu=/4140/ostg.clktrk ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Slashdot TV. Video for Nerds. Stuff that Matters. http://pubads.g.doubleclick.net/gampad/clk?id=160591471iu=/4140/ostg.clktrk___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Can't open graphical listener in Ubuntu 12.04
Le 16 sept. 2014 23:17, John Porubek jporu...@gmail.com a écrit : Do I need to restart after making a change like removing a *.so file, or can I just run ldconfig with no flags? Running ldconfig as root is sufficient for the next programs you start. I didn't give the full story when I first described what is happening. Sometimes, right after a boot or restart, the GUI listener will work for a while. However, if I restore a minimized window later on, the GUI listener disappears. Subsequent attempts to re-open the listener produce the results I originally described. Hmmm, that doesn't look like a factor bug... FWIW, the latest results from $ ldconfig -p | grep libGL\. : libGL.so.1 (libc6, OS ABI: Linux 2.4.20) = /usr/lib/i386-linux-gnu/mesa/libGL.so.1 libGL.so (libc6, OS ABI: Linux 2.4.20) = /usr/lib/i386-linux-gnu/mesa/libGL.so libGL.so (libc6, OS ABI: Linux 2.4.20) = /usr/lib/i386-linux-gnu/libGL.so This is the same as before, after I put the removed link back, minus the extraneous stuff. The bottom link points to the one above it, which in turn points to the one above it. The top one points to mesa/libGL.so.1.2 This looks normal. I couldn't find glxgears or the package mesa-utils. Are these in Factor? No, glxgears is a standard program. On ubuntu it comes in mesa-utils (see http://packages.ubuntu.com/trusty/amd64/mesa-utils/filelist), what distro are you using? Cheers, Jon -- Want excitement? Manually upgrade your production database. When you want reliability, choose Perforce. Perforce version control. Predictably reliable. http://pubads.g.doubleclick.net/gampad/clk?id=157508191iu=/4140/ostg.clktrk___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Can't open graphical listener in Ubuntu 12.04
Does glxgears from the package mesa-utils work (it should show colored gears rotating)? What does the following command output ? $ ldconfig -p | grep libGL\. Jon On Fri, Sep 12, 2014 at 10:50 PM, John Porubek jporu...@gmail.com wrote: On Fri, Sep 12, 2014 at 3:23 PM, John Porubek jporu...@gmail.com wrote: bjourne suggested Maybe dpkg-reconfigure --all can solve it, so I'm running that now. Minor datapoint - dpkg-reconfigure didn't affect the problem. -- Want excitement? Manually upgrade your production database. When you want reliability, choose Perforce Perforce version control. Predictably reliable. http://pubads.g.doubleclick.net/gampad/clk?id=157508191iu=/4140/ostg.clktrk ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Want excitement? Manually upgrade your production database. When you want reliability, choose Perforce Perforce version control. Predictably reliable. http://pubads.g.doubleclick.net/gampad/clk?id=157508191iu=/4140/ostg.clktrk___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] how to calculate count of days
On Fri, Sep 5, 2014 at 9:52 AM, Alex Vondrak ajvond...@gmail.com wrote: On Thu, Sep 4, 2014 at 4:06 PM, Jon Harper jon.harpe...@gmail.com wrote: How about: : today ( -- timestamp ) now midnight instant gmt-offset ; inline Or really just : today ( -- timestamp ) gmt midnight ; inline No, this is not the correct date. 2014-09-05 01:00:00+02:00 is the same instant as 2014-09-04 23:00:00Z (ie now and gmt would return those timestamps if invoked at the same time), but the date is not the same: 09-05 and 09-04 (and the correct one is really 09-05 when you are in the +2 timezone) I guess less drastic would be for `ymdtimestamp` to just use local time; right now it's defined with `date-gmt`: http://docs.factorcode.org/content/word-%28ymd__gt__timestamp%29%2Ccalendar.format.html I know John mentioned it, but I'm not sure why that shouldn't just be `date`, since most other things appear to use local time as well (per the above). But then things go wrong in the rare cases when you change your timezone. -- Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] how to calculate count of days
On Fri, Sep 5, 2014 at 6:19 PM, Alex Vondrak ajvond...@gmail.com wrote: I also realize now that this date vs datetime distinction was what Jon was suggesting, whereas I thought he was talking about have one version normalize to local time, have the other normalize to GMT (like Date.current Date.today in Rails). Yes, that's indeed what I meant. Not sure if another tuple would be clearer, or if a strongly documented convention is enough.. Fair enough. I think changing timezones is less of a deal-breaker than `ymdtimestamp` `timestampymd` not being inverses of each other (without intervening GMT conversion), though. Well, changing `ymdtimestamp` to assume a locale timezone makes them inverse only if the orginal timestamp was in the local timezone (ie breaks for GMT timestamp or any other timezone). The advantage would be that most of the other words in the vocab return timestamps in the local timezone so it would work most of the time. I guess a solution to both problems could be just having more robust parsing that could translate strings with GMT offsets. Many RFCs abound with date formats. We have `timestamprfc3339` and `rfc3339timestamp` which support timezones. The strings look like 2014-09-05T01:00:00+02:00 Cheers, Jon -- Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] how to calculate count of days
Georg's problem comes from the fact that ymdtimestamp represents a date by midnight gmt, whereas today represents it by midnight in the local timezone. The API should make it clear how we represent dates (ie whole days, which are not even the same 24 hours in different time zones) with timestamp objects. I think midnight gmt is better because two objects returned by today on the same date in different timezones should be equal. And this matches ymdtimestamp. How about: : today ( -- timestamp ) now midnight instant gmt-offset ; inline However, the big negative impact of this representation is that comparing a timestamp representing a date and a timestamp representing an instant becomes meaningless (ie not all timestamps in a day are before or after a timestamp representing a date), wherease before, it was only meaningless if the timezone had changed (rare, but it still happens...). Since it was already dangerous, it doesn't seem like a big deal. Using this new convention to represent dates coherently in the whole calendar vocab has too many implications to describe everything in one email (changing yesterday, tomorow, date, monday, and many more I guess). If backwards compatibility is an issue, we can always create new words instead of changing the existing ones (ie leave today as it is, and create today-date). What do you think? Cheers, Jon -- Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] minimum of two timestamps with side-effect ?
Hi Georg, Your understanding is correct. This is a bug which was reported and fixed ( https://github.com/slavapestov/factor/pull/1004 ). You can try the developpment version to get the fix. Regards, Jon Le 21 août 2014 16:46, Georg Simon georg.si...@auge.de a écrit : I want to determine the earlier of two timestamps. Using min I got strange results. The first of the two timestamps is altered. It seems to be altered by gmt: IN: scratchpad today dup 1 days time+ --- Data stack: T{ timestamp f 2014 8 21 0 0 0 ~duration~ } T{ timestamp f 2014 8 22 0 0 0 ~duration~ } IN: scratchpad 2dup min --- Data stack: T{ timestamp f 2014 8 20 22 0 0 ~duration~ } T{ timestamp f 2014 8 22 0 0 0 ~duration~ } T{ timestamp f 2014 8 20 22 0 0 ~duration~ } What do I understand wrong ? -- Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/ ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk