Re: [Factor-talk] MS-SQL

2010-03-10 Thread Paul Moore
On 10 March 2010 10:51, Paul Moore wrote: > I think there's an odbc vocabulary in Factor. Hmm, looks like I may have been wrong. I was working from http://www.bluishcoder.co.nz/2007/01/odbc-interface-for-factor.html but that looks like it's out of date as I can't find anyth

Re: [Factor-talk] MS-SQL

2010-03-10 Thread Paul Moore
On 10 March 2010 10:16, Ben Schlingelhof wrote: > Hi there, > > first a big thank you to everyone, factor is just getting better and > better and I'm still moistly in love with it. > I've managed to use it in my job as a data-mining tool and the results > are rather pleasing. Unfortunately I'm bou

Re: [Factor-talk] HTML parsing vocabulary

2010-03-08 Thread Paul Moore
On 8 March 2010 19:16, Doug Coleman wrote: > Hi Paul, > > There's an html parser with a word that should do exactly what you want > already. > > USE: html.parser.analyzer > "http://reddit.com"; scrape-html find-hrefs Ah, got it. That looks like just what I want! Thanks a lot. Paul. ---

[Factor-talk] HTML parsing vocabulary

2010-03-08 Thread Paul Moore
Is there a HTML parsing vocabulary for Factor? I guess I might be able to get away with read-xml at a pinch, but given the state of most HTML out there, I'd feel safer not assuming anything stronger than I have to... I searched the documentation but couldn't see anything immediately (plenty for wri

Re: [Factor-talk] Adding a stack effect to a quotation

2010-02-26 Thread Paul Moore
On 26 February 2010 20:04, Daniel Ehrenberg wrote: > A good starting point is the article, "Combinator stack effects" Ah, I follow now. I had read that article before, but the implications hadn't sunk in. Thanks, Paul -

Re: [Factor-talk] Adding a stack effect to a quotation

2010-02-26 Thread Paul Moore
On 26 February 2010 19:31, Daniel Ehrenberg wrote: > One solution to the whole set of incompatiblities between call and > call( would be to eliminate call in favor of call(, eliminating the > combinator inlining system in the process. In my opinion, this would > make the whole language much cleane

Re: [Factor-talk] Modern posting netiquette?

2010-02-26 Thread Paul Moore
On 26 February 2010 16:28, Terrence Brannon wrote: > I'm wondering about the most polite way to list code when you need > help. Before hyperlinks, you had to inline all the code. But I think > that hampers readability of the document as a whole. I am starting to > prefer a markdown way of writing

[Factor-talk] Printable factor documentation

2010-02-22 Thread Paul Moore
Is there any printable version of the factor documentation available? Something like PDF, that I can browse offline? Thanks, Paul -- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed comp

Re: [Factor-talk] A Comparison of Perl and Factor versions of a module to supply random Latin text

2010-02-22 Thread Paul Moore
On 22 February 2010 16:42, Terrence Brannon wrote: > What follows is a comparison of the Perl and Factor programs which generate > random text that looks like Latin. Nice discussion! [...] > : getwords ( n -- array ) wordlist swap sample ; > > The Perl routine is named "words" yet it returns a s

Re: [Factor-talk] Playing with python-like iterators (and efficiency of continuations)

2009-10-31 Thread Paul Moore
2009/10/31 Joe Groff : > On Oct 31, 2009, at 4:46 PM, Paul Moore wrote: > >> I'm playing with the idea of iterators and generators from Python. >> Basically, an iterator is an object that supports a single operation, >> next, which produces the iterator's next

Re: [Factor-talk] Playing with python-like iterators (and efficiency of continuations)

2009-10-31 Thread Paul Moore
2009/10/31 Daniel Ehrenberg : > 1. Exceptions would be a slow (in the current implementation) and > messy way to signal the end of an iteration. Exceptions should be used > for things that aren't likely to happen, and this is something likely. That's what I thought. Exceptions are cheap in Python,

[Factor-talk] Playing with python-like iterators (and efficiency of continuations)

2009-10-31 Thread Paul Moore
I'm playing with the idea of iterators and generators from Python. Basically, an iterator is an object that supports a single operation, next, which produces the iterator's next value. Iterators can be created from sequences in the obvious way by iterating through the items. Python also supports g

Re: [Factor-talk] windows pipe race condition? (native threads)

2009-10-30 Thread Paul Moore
2009/10/30 Phil Dawes : > Hi Paul > > Paul Moore wrote: >> >> Hmm, this is really far more complex than I can follow, but rather >> than using factor-level pipes, why not create pure win32 handle level >> pipes, then wrap them using opened-file in the target VM

Re: [Factor-talk] windows pipe race condition?

2009-10-29 Thread Paul Moore
2009/10/29 Phil Dawes : > Hi Paul, Hi Everyone, > > It turned out to be a problem with io-completion-ports: > io.pipes.windows.nt registers the completion port with the parent vm on > creation. I then pass the write handle to the child vm thread, and when > it writes the completion event still fire

Re: [Factor-talk] windows pipe race condition?

2009-10-28 Thread Paul Moore
2009/10/28 Paul Moore : > Yes, the default pipe creation in io.pipes.windows.nt makes the pipe > handles non-inheritable. Rather than hacking the security attributes, > you could use DuplicateHandle (from windows.kernel32) to create an > inheritable copy of the handle. That should

Re: [Factor-talk] windows pipe race condition?

2009-10-28 Thread Paul Moore
2009/10/28 Paul Moore : > 2009/10/28 Phil Dawes : >> Hi Slava, Hi everyone, >> >> I've got the native thread message passing working really well on Linux, >> you can just do a '[ blah ] spawn-vm'. >> >> Unfortunately I'm having problems

Re: [Factor-talk] windows pipe race condition?

2009-10-28 Thread Paul Moore
2009/10/28 Phil Dawes : > Hi Slava, Hi everyone, > > I've got the native thread message passing working really well on Linux, > you can just do a '[ blah ] spawn-vm'. > > Unfortunately I'm having problems doing the same thing with io.pipes on > windows. Here's a boiled down test case 'pipe-race.fac

[Factor-talk] Minor change to peg.expr

2009-10-27 Thread Paul Moore
As it stands, the peg.expr vocabulary doesn't understand bracketed expressions like "(3+2)". The attached patch (sorry, I don't use git) fixes this and adds a unit test. Hope it's useful. Paul. expr.factor.diff Description: Binary data ---

Re: [Factor-talk] messaging between native vm threads

2009-10-27 Thread Paul Moore
2009/10/27 Phil Dawes : > Paul Moore wrote: >> Hmm, no I thought I understood this, but I don't really. You're saying >> that the current API is something along the lines of >> >>     create-vm ( startup-args -- ) >> >> How's that an

Re: [Factor-talk] messaging between native vm threads

2009-10-26 Thread Paul Moore
2009/10/25 Phil Dawes : > I like the on-demand idea but unfortunately at the moment all we have is > the ability to pass startup args to the new vm. So vm A creates vm B and > gets to pass some (command line) args to it, there's no mechanism where > A can ask for a new pipe handle from B. Hmm, no

Re: [Factor-talk] messaging between native vm threads

2009-10-25 Thread Paul Moore
2009/10/25 Phil Dawes : > I like the on-demand idea but unfortunately at the moment all we have is > the ability to pass startup args to the new vm. So vm A creates vm B and > gets to pass some (command line) args to it, there's no mechanism where > A can ask for a new pipe handle from B. > > Of co

Re: [Factor-talk] messaging between native vm threads

2009-10-25 Thread Paul Moore
2009/10/25 Phil Dawes : > Hi Slava, > > Slava Pestov wrote: >> No native mutex is needed if you have a pair of pipes between every >> two VMs that need to communicate. Then, one VM thread writes to the >> pipe, another VM thread reads from it. Since a VM thread is so >> heavy-weight (it has its own

Re: [Factor-talk] os threading locks vocab

2009-10-21 Thread Paul Moore
2009/10/21 Doug Coleman : > I think it makes sense to totally separate out all of the new > threading from the green threads implementation like we do for native/ > libc io so we can bootstrap with either one until all of the issues > are resolved.  The current API can probably be a starting point,

Re: [Factor-talk] What does "the recursive word loop digs arbitrarily deep into the stack" mean?

2009-10-16 Thread Paul Moore
2009/10/16 Slava Pestov : > On Fri, Oct 16, 2009 at 7:56 AM, Paul Moore wrote: >> Blast, I missed that. Thanks. That's probably because this code was >> last checked before the stricter stack checking came in, and one of >> the warnings I was ignoring wasn'

Re: [Factor-talk] What does "the recursive word loop digs arbitrarily deep into the stack" mean?

2009-10-16 Thread Paul Moore
2009/10/16 Slava Pestov : > Hi Paul, > > If you press F3 to list all compile errors, you'll notice that > do-backtrack also failed to compile. > > : do-backtrack ( vm backtrack -- vm ) >  [ pc>> >>pc ] [ pos>> >>pos ] [ cap>> >>cap ] 2tri 2drop > ; inline > > Indeed, this word does not leave the vm

Re: [Factor-talk] What does "the recursive word loop digs arbitrarily deep into the stack" mean?

2009-10-16 Thread Paul Moore
2009/10/16 Slava Pestov : > Can you post your entire program? I can, but it'll have to wait until this evening. Or you can get the nearly-up-to-date version from bitbucket: http://bitbucket.org/pmoore/factor-peg/src/a5109e0ac892/lpeg.factor - it's missing a few fixes ("parsing" and "peek" being th

Re: [Factor-talk] What does "the recursive word loop digs arbitrarily deep into the stack" mean?

2009-10-16 Thread Paul Moore
2009/10/15 Slava Pestov : > Hi Paul, > > The code looks wrong. If pop-backtrack takes a vm instance, what does > terminate-vm receive? pop-backtrack has stack effect ( vm -- vm backtrack_or_f ), do-backtrack has stack effect ( vm backtrack -- vm ) and terminate-vm has stack effect ( vm -- vm ). So

[Factor-talk] What does "the recursive word loop digs arbitrarily deep into the stack" mean?

2009-10-15 Thread Paul Moore
When I'm updating some code from an older version of Factor, I get the error "the recursive word loop digs arbitrarily deep into the stack". The code in question is : pop-fails ( vm -- vm ) [ dup pc>> fail = ] [ pop-backtrack [ do-backtrack ] [ terminate-vm ] if* ] while ; inline As far as

Re: [Factor-talk] Request for testing: math.vectors.simd

2009-09-23 Thread Paul Moore
2009/9/23 Slava Pestov : > In particular I'd be interested if someone with SSE1 and SSE2 would test. Is it in the Windows binary version yet? (I'm assuming not, as that is from the 21st). Once there's a binary with it in I'll test (SSE2) but I can't build my own at the moment, sorry. Paul. -

Re: [Factor-talk] Is it possible to define new literal forms?

2009-09-17 Thread Paul Moore
2009/9/17 Slava Pestov : > On Thu, Sep 17, 2009 at 12:04 PM, Paul Moore wrote: >> That's OK - a definite "no" was one of the possible responses I asked >> for, so thanks :-) >> >> Out of interest, is this just a design decision, or are there >> fu

Re: [Factor-talk] Is it possible to define new literal forms?

2009-09-17 Thread Paul Moore
2009/9/17 Slava Pestov : > On Thu, Sep 17, 2009 at 11:33 AM, Paul Moore wrote: >> Look at it another way - if the 3/4 rational number syntax wasn't >> already part of factor, would I be able to add it in user code? The >> fact that the syntax isn't defined in math.r

Re: [Factor-talk] Is it possible to define new literal forms?

2009-09-17 Thread Paul Moore
2009/9/17 Joe Groff : > On Sep 17, 2009, at 11:53 AM, Paul Moore wrote: > >> The background is that I'm playing with ideas around game simulation >> programs, where die rolls are a common need. I can obviously write a >> word dieroll ( n m -- roll ) to roll n m-sided

[Factor-talk] Is it possible to define new literal forms?

2009-09-17 Thread Paul Moore
This is mostly just curiosity, but is it possible to hook into Factor's parser/lexer to define new forms of literal? I know it's possible to write parsing words like V{ but I'm more interested in "standalone" forms like rationals 2/3. From what I can tell, rational syntax is hard-wired into Factor'

Re: [Factor-talk] Looks like the latest Win32 binaries require SSE3

2009-09-17 Thread Paul Moore
2009/9/17 Slava Pestov : > On Thu, Sep 17, 2009 at 6:14 AM, Paul Moore wrote: >> Hmm, I tried to download the clean image and bootstrap from that using >> factor.com from the binary build. That didn't work... > > I just tested it. It works if you download the

Re: [Factor-talk] Looks like the latest Win32 binaries require SSE3

2009-09-17 Thread Paul Moore
2009/9/17 Ben Schlingelhof : > Had the same problem here, but bootstrapping worked just fine. So you > probably don't need to build from source. The bootstrap error dump is > rather nondescript though, no idea what went wrong there. Hmm, I've downloaded the following binaries: 2009-08-27-16-03 20

[Factor-talk] Looks like the latest Win32 binaries require SSE3

2009-09-17 Thread Paul Moore
I just downloaded the latest factor build and tried it. I get >Factor\factor.com This image was built to use SSE3 but your CPU only supports SSE2. You will need to bootstrap Factor again. Looks like I need to build it myself, then :-( Could the requirements on the download page be updated? Hmm,

Re: [Factor-talk] Factor on windows

2009-08-21 Thread Paul Moore
2009/8/21 Amit Dev : > Actually I had downloaded the binary. Since it didn't work by itself, I > tried with the boot image. > Is there a way to get the binary work? Works for me (although I usually use factor.exe rather than factor.com - why are you using the .com version?) I'm on Vista. Could yo

Re: [Factor-talk] Windows binary

2009-07-31 Thread Paul Moore
2009/7/31 Slava Pestov : > Hi all, > > A Windows binary just uploaded: > > http://builds.factorcode.org/download?os=winnt&cpu=x86.32 Wow! Somewhere between the last binary I picked up (April or so) and now Factor got a serious facelift! The new version looks very nice :-) Paul. -

Re: [Factor-talk] Looks like the Windows binaries are failing

2009-07-31 Thread Paul Moore
2009/7/30 Darrin Thompson : > On Thu, Jul 30, 2009 at 10:48 AM, Paul Moore wrote: >> [1] Simulate dealing and scoring a cribbage hand, many millions of >> times. Gather stats on the distributions of the results. Bonus points >> for making the hand generation and scoring pr

Re: [Factor-talk] Looks like the Windows binaries are failing

2009-07-30 Thread Paul Moore
2009/7/30 Slava Pestov : > Hi Paul, > > Tests were failing on Windows because some compiler changes I was > working on resulted in an image size increase. I wanted to postpone > looking at this until the compiler was done, but this took longer than > I hoped. Indeed, with my recent improvements the

Re: [Factor-talk] Looks like the Windows binaries are failing

2009-07-30 Thread Paul Moore
2009/7/30 Darrin Thompson : > On Thu, Jul 30, 2009 at 8:51 AM, Paul Moore wrote: >> The last successful Windows binary appears to be from 25 June. Is this >> a known issue? (I was interested in trying out some of the fancy new >> optimisations Slava's been blogging a

[Factor-talk] Looks like the Windows binaries are failing

2009-07-30 Thread Paul Moore
The last successful Windows binary appears to be from 25 June. Is this a known issue? (I was interested in trying out some of the fancy new optimisations Slava's been blogging about recently...) Paul -- Let Crystal Report

Re: [Factor-talk] Defining enumerations

2009-01-28 Thread Paul Moore
2009/1/28 Slava Pestov : > One thing I noticed about your code is that you're using stack > shufflers in a few places where you could use combinators. [...] > Also, generally words should not leave their inputs on the stack, with > only a few exceptions (like tuple setters that are generated for yo

Re: [Factor-talk] Defining enumerations

2009-01-28 Thread Paul Moore
2009/1/28 Slava Pestov : > That's a pretty decent speedup. On my machine, I'm now getting run times of 0.39 seconds, vs 0.14 for C - that's under 3x C's speed, which is pretty incredible for high-level code like this! Thanks for all the hints. Paul. --

Re: [Factor-talk] Defining enumerations

2009-01-28 Thread Paul Moore
2009/1/28 Slava Pestov : > Hi Paul, > > I got a 2x speedup by making two changes. Excellent! > 1) adding some type declarations to the vm and insn tuples: I was thinking of that - I wasn't sure if the optimizer used type information like that. I just haven't had time to try it out over the last

Re: [Factor-talk] Defining enumerations

2009-01-25 Thread Paul Moore
2009/1/25 Slava Pestov : > Perhaps you can share your code and I might be able to give additional > hints. I'm really keen on closing this 10x performance gap with C. No problem. I'd not done so before purely because I didn't want to just dump a "please fix my code" posting on the list :-) I've u

Re: [Factor-talk] Defining enumerations

2009-01-24 Thread Paul Moore
2009/1/21 Slava Pestov : > One other thing to try: declare any words which operate on your VM > tuple 'inline', then supposing the exec word has effect ( vm insn -- > vm ), put hints on it: > > HINTS: exec vm instruction ; I'm slightly confused between this and the documentation, which seems to im

Re: [Factor-talk] Locals Usage

2009-01-24 Thread Paul Moore
2009/1/23 William Tanksley, Jr : > DARN! That discussion was on the 'concatenative' mailing list, not on > factor-talk. [...] > Seriously, though, I feel stupid. Sorry. Here (after my .sig) is a repost. Interesting. No problem about the mistake, it's easy enough to do. And a Google search for "ban

Re: [Factor-talk] Locals Usage

2009-01-23 Thread Paul Moore
2009/1/23 William Tanksley, Jr : > It was a recent discussion on this group -- either search your gmail > (which I see you're using), or use sourceforge's email list search. Hmm, couldn't find it searching for "nowak" or "banana". And my personal gmail archive isn't particularly old, so I don't ha

Re: [Factor-talk] Defining enumerations

2009-01-23 Thread Paul Moore
2009/1/21 Slava Pestov : > Hi Paul, > > If you're looking to make instruction dispatch fast in your VM, one > thing worth trying is to use a 'case' indexed by enum elements. Hmm, that's actually very slightly *slower* than a generic-based approach. (Generics are 1.2s, case-based version 1.5s on a

Re: [Factor-talk] Locals Usage

2009-01-23 Thread Paul Moore
2009/1/23 William Tanksley, Jr : > Out of curiosity, what did you think of Nowak's "banana notation" (| > |) for his spread-like combinator? (The major difference between > spread and his combinator is that his combinator doesn't allow the > quotations to access each other's results.) I vaguely re

Re: [Factor-talk] Defining enumerations

2009-01-21 Thread Paul Moore
2009/1/21 Slava Pestov : > Have you seen C-ENUM: in alien.syntax? No, I hadn't. Thanks for the pointer. It's nice to see that it's quite similar to mine :-) > This word is in alien.syntax > because we generally only use it when interfacing with C libraries. If > you just need symbolic constants (

[Factor-talk] Defining enumerations

2009-01-20 Thread Paul Moore
I couldn't find any way in Factor to define an enumeration, as in C - a series of symbolic names for consecutive numbers. I may well have missed one, but after a bit of digging in the documentation, I decided it was probably easy enough to define my own. So I did :-) If this is of any use to anyon

Re: [Factor-talk] Parsing - retain stack overflow

2009-01-18 Thread Paul Moore
2009/1/18 Chris Double : >> Hmm, that took a couple of minutes then crashed factor! > > What does 'crashed factor' mean? I suspect it means you get an out of > memory error or something? Basically the process just disappeared. I didn't see a message before it went. I should probably try the comman

Re: [Factor-talk] Parsing - retain stack overflow

2009-01-18 Thread Paul Moore
2009/1/18 Chris Double : > On Sun, Jan 18, 2009 at 11:33 AM, Paul Moore wrote: >> I wrote the following parser in factor: >> >> EBNF: omega >> omega = 'O' 'm' 'e' 'g' 'a' | . omega >> ;EBNF > > I can't

[Factor-talk] Parsing - retain stack overflow

2009-01-17 Thread Paul Moore
I'm interested in PEG parsers, as the implementation for the language Lua is impressively fast. When I saw that factor had a PEG parser library included, I was curious to see how it would compare. As a performance test, I tried to implement a search for the word "Omega" in the text of the King Jame

[Factor-talk] Printable version of the documentation

2009-01-17 Thread Paul Moore
Is there any way of producing a printable version of (some or all of) the Factor documentation? I guess printing off *-docs.factor from the distribution, plus chunks of basis\help, would be a start, but it's a bit markup-heavy. Page-by-page prints of the HTML is a bit time consuming, as well. Than

Re: [Factor-talk] Editor integration on Windows

2009-01-16 Thread Paul Moore
2009/1/16 Doug Coleman : > Hi Paul, > > For some reason I thought I pushed a fix for this already. The > problem is that Windows 64 has both "Program files" and "Program files > (x86)" but the shell32 API errors out on Windows 32 if you try to look > up the second program files directory. The err

[Factor-talk] Editor integration on Windows

2009-01-16 Thread Paul Moore
I'm having trouble getting editor integration working. I'm running on Windows XP, and got the Factor binary from a couple of days ago. I have gvim and Scite both installed and available from my PATH. I don't have a COM-enabled version of gvim installed. When I try to edit a file from within the Fa

Re: [Factor-talk] Concurrent web requests in factor

2009-01-15 Thread Paul Moore
2009/1/15 Slava Pestov : > Hi Paul, > > What you're looking for is Factor's concurrency library. For example, > using the concurrency.combinators vocab, you can do Thanks. I had found that, but I was concerned that the co-operative threading might mean that blocking web requests could block my app

[Factor-talk] Concurrent web requests in factor

2009-01-15 Thread Paul Moore
I'm trying to write a small program in factor that requests multiple web pages from a server. However, the server can take a substantial time returning a page, so I'd like the requests to run concurrently. A few tests with future and http-get seem to indicate that http-get blocks, and as a result