Re: [Factor-talk] Factor 0.99 now available

2023-08-29 Thread Jon Harper
lexandre > 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, Joh

Re: [Factor-talk] Handling keyboard input

2023-03-21 Thread Jon Harper
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

Re: [Factor-talk] Port on Z80 computers.

2021-11-24 Thread Jon Harper
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

Re: [Factor-talk] May 5th

2021-04-22 Thread Jon Harper
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

Re: [Factor-talk] How to validate different formats in an array?

2020-12-07 Thread Jon Harper
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 (

Re: [Factor-talk] Peg Parsing Files

2020-11-22 Thread Jon Harper
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, "Jo

Re: [Factor-talk] Peg Parsing Files

2020-11-21 Thread 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

Re: [Factor-talk] ?change-value for assocs

2020-08-17 Thread Jon Harper
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: > >

Re: [Factor-talk] Package Factor into a DLL

2020-07-18 Thread Jon Harper
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

Re: [Factor-talk] She-bang

2020-04-21 Thread Jon Harper
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 >

Re: [Factor-talk] Co-operative threading

2019-09-17 Thread Jon Harper
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

Re: [Factor-talk] Updating factor

2017-01-29 Thread Jon Harper
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 > >

Re: [Factor-talk] unclip performance on ranges

2017-01-26 Thread Jon Harper
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

Re: [Factor-talk] Ratio vs. Float

2017-01-19 Thread Jon Harper
; { -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

Re: [Factor-talk] Ratio vs. Float

2017-01-19 Thread Jon Harper
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 wrote: > Hello! > > I'm a bit confused. Why is following not true? > > `81/2 40.5 =` >

[Factor-talk] EBNF peg parser ensuring full parse

2017-01-17 Thread Jon Harper
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"

Re: [Factor-talk] slice>seq

2017-01-10 Thread Jon Harper
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

Re: [Factor-talk] PDF

2016-12-20 Thread Jon Harper
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

Re: [Factor-talk] Floats

2016-12-13 Thread Jon Harper
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? > > ---=--- > Александр > > > -- >

Re: [Factor-talk] Libudis86.dll (Was: TYPED: Declarations)

2016-11-25 Thread Jon Harper
i, 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

Re: [Factor-talk] Libudis86.dll (Was: TYPED: Declarations)

2016-11-25 Thread Jon Harper
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

Re: [Factor-talk] Parsing Ratios

2016-11-24 Thread Jon Harper
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 Ilin wrote:

Re: [Factor-talk] GC Bug? (Was: Out Of Memory)

2016-11-24 Thread Jon Harper
emory 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 re

Re: [Factor-talk] Out Of Memory

2016-11-24 Thread Jon Harper
nately, 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, "

Re: [Factor-talk] Out Of Memory

2016-11-24 Thread Jon Harper
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

Re: [Factor-talk] Reading clipboard in a Factor script ?

2016-11-10 Thread Jon Harper
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

Re: [Factor-talk] Reading clipboard in a Factor script ?

2016-11-10 Thread Jon Harper
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

Re: [Factor-talk] Questions of a newcomer

2016-11-07 Thread Jon Harper
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 >

Re: [Factor-talk] restricting ratio literals

2016-10-26 Thread Jon Harper
> > 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 >

Re: [Factor-talk] restricting ratio literals

2016-10-25 Thread Jon Harper
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 0

[Factor-talk] restricting ratio literals

2016-10-24 Thread Jon Harper
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

[Factor-talk] Restricting number bases conversion to 36

2016-10-24 Thread Jon Harper
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 .

Re: [Factor-talk] Decimal equivalent of 0b 0o 0x ?

2016-10-21 Thread Jon Harper
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 > num

[Factor-talk] Decimal equivalent of 0b 0o 0x ?

2016-10-21 Thread Jon Harper
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

Re: [Factor-talk] Could not initialize OpenAL

2016-09-12 Thread Jon Harper
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

[Factor-talk] paste.factorcode.org

2016-09-11 Thread Jon Harper
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] prettyprinter number-base float errors

2016-09-11 Thread Jon Harper
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

Re: [Factor-talk] Why doesn't my Factor receive the Insert key ?

2016-08-16 Thread Jon Harper
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 +++

Re: [Factor-talk] Formatting Durations

2016-07-20 Thread Jon Harper
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

Re: [Factor-talk] slot fill in tuple border

2016-07-06 Thread Jon Harper
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

Re: [Factor-talk] Inverse of string-lines

2016-05-10 Thread Jon Harper
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 Benediktsson wrote: > I've wanted to rename string-lines to

Re: [Factor-talk] OpenGL gadget question

2016-04-25 Thread Jon Harper
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 openG

Re: [Factor-talk] OpenGL gadget question

2016-04-24 Thread Jon Harper
r 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

Re: [Factor-talk] OpenGL gadget question

2016-04-24 Thread Jon Harper
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

Re: [Factor-talk] ./build.sh

2016-03-19 Thread Jon Harper
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 $ #

[Factor-talk] bit-arrays docs

2016-03-19 Thread Jon Harper
>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

Re: [Factor-talk] move collect-by out of math.statistics

2016-03-08 Thread Jon Harper
oc ) -[ 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

Re: [Factor-talk] How would I solve this better in Factor?

2016-02-29 Thread Jon Harper
e 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: >> &

Re: [Factor-talk] How would I solve this better in Factor?

2016-02-25 Thread Jon Harper
"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

[Factor-talk] github repo

2016-02-23 Thread Jon Harper
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

Re: [Factor-talk] CHAR: question

2016-02-22 Thread Jon Harper
tor.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, >>> >

Re: [Factor-talk] CONSTANT: question

2016-02-22 Thread Jon Harper
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 } {

Re: [Factor-talk] adding http proxy support

2016-02-19 Thread Jon Harper
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

Re: [Factor-talk] adding http proxy support

2016-02-19 Thread Jon Harper
t; > 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 &qu

Re: [Factor-talk] move collect-by out of math.statistics

2016-02-18 Thread Jon Harper
> 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: >

Re: [Factor-talk] move collect-by out of math.statistics

2016-02-18 Thread Jon Harper
t; 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. >> &g

[Factor-talk] move collect-by out of math.statistics

2016-02-18 Thread Jon Harper
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

Re: [Factor-talk] adding http proxy support

2016-02-05 Thread Jon Harper
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

Re: [Factor-talk] adding http proxy support

2016-02-05 Thread Jon Harper
p://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.getpro

[Factor-talk] adding http proxy support

2016-02-04 Thread Jon Harper
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

Re: [Factor-talk] OpenGL - How to draw lines interactively

2015-11-29 Thread Jon Harper
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 Simon wrote: > I already have a gadget which responds to gestures. > > Which are the best words to use OpenGL for drawing

Re: [Factor-talk] Problem drawing an image in a new window

2015-11-29 Thread Jon Harper
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

Re: [Factor-talk] Mutation on tuple instances

2015-11-26 Thread Jon Harper
On Thu, Nov 26, 2015 at 5:28 PM, Sankaranarayanan Viswanathan 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 ( -- ) . ; > :

Re: [Factor-talk] Mutation on tuple instances

2015-11-26 Thread Jon Harper
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...@gma

Re: [Factor-talk] The iota test

2015-10-09 Thread Jon Harper
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 Ilin

Re: [Factor-talk] Ctrl+Break

2015-10-02 Thread Jon Harper
indows? > > 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

Re: [Factor-talk] Ctrl+Break

2015-10-02 Thread Jon Harper
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

Re: [Factor-talk] ALUT.dll

2015-09-17 Thread Jon Harper
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 Ilin wrote: > Hello! > > I was trying to load the Lunar Rescue

Re: [Factor-talk] Recursion

2015-09-15 Thread Jon Harper
> > On Tue, Sep 15, 2015 at 6:38 AM, Alexander Ilin wrote: > >> >> 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

Re: [Factor-talk] newbie question: how to collect info from a stream

2015-09-01 Thread Jon Harper
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

Re: [Factor-talk] Why does editor pass some handled gestures?

2015-08-24 Thread Jon Harper
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

Re: [Factor-talk] Why does editor pass some handled gestures?

2015-08-19 Thread Jon Harper
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

Re: [Factor-talk] Why does numberstring append .0 on my German system ?

2015-08-14 Thread Jon Harper
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

[Factor-talk] gcc versions

2015-08-14 Thread Jon Harper
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

Re: [Factor-talk] gcc versions

2015-08-14 Thread Jon Harper
, 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

Re: [Factor-talk] gcc versions

2015-08-14 Thread Jon Harper
-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

Re: [Factor-talk] Why does numberstring append .0 on my German system ?

2015-08-13 Thread Jon Harper
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

Re: [Factor-talk] Why does numberstring append .0 on my German system ?

2015-08-11 Thread Jon Harper
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

Re: [Factor-talk] Why does numberstring append .0 on my German system ?

2015-08-11 Thread Jon Harper
: 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

[Factor-talk] new parser

2015-08-07 Thread Jon Harper
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

Re: [Factor-talk] nested nil lists

2015-07-03 Thread Jon Harper
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

Re: [Factor-talk] displaying Lisp like nested lists

2015-06-29 Thread Jon Harper
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 }

Re: [Factor-talk] Exporting a C API

2015-02-10 Thread Jon Harper
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

Re: [Factor-talk] ! Comments

2015-01-29 Thread Jon Harper
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

Re: [Factor-talk] ndrop

2015-01-28 Thread Jon Harper
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

Re: [Factor-talk] Standalone executables in Windows

2015-01-07 Thread Jon Harper
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

Re: [Factor-talk] Model activation sequence

2015-01-03 Thread Jon Harper
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

Re: [Factor-talk] Model activation sequence

2015-01-03 Thread Jon Harper
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

Re: [Factor-talk] Dealing with parts of a model

2015-01-03 Thread Jon Harper
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

Re: [Factor-talk] A stub of a package manager

2014-12-17 Thread Jon Harper
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,

Re: [Factor-talk] Output parameters in alien

2014-12-01 Thread Jon Harper
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

Re: [Factor-talk] Output parameters in alien

2014-11-28 Thread Jon Harper
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,

Re: [Factor-talk] Output parameters in alien

2014-11-28 Thread Jon Harper
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

Re: [Factor-talk] column-titles disappear for tables without scroller

2014-09-20 Thread Jon Harper
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

Re: [Factor-talk] Can't open graphical listener in Ubuntu 12.04

2014-09-16 Thread Jon Harper
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

Re: [Factor-talk] Can't open graphical listener in Ubuntu 12.04

2014-09-13 Thread Jon Harper
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

Re: [Factor-talk] how to calculate count of days

2014-09-05 Thread Jon Harper
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

Re: [Factor-talk] how to calculate count of days

2014-09-05 Thread Jon Harper
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

Re: [Factor-talk] how to calculate count of days

2014-09-04 Thread Jon Harper
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

Re: [Factor-talk] minimum of two timestamps with side-effect ?

2014-08-21 Thread Jon Harper
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

  1   2   3   >