Re: [Factor-talk] problems with sequences

2007-01-12 Thread Alex Chapman
I implemented something similar when I wrote libs/gap-buffer. It's called 'circular' and wraps an underlying sequence, allowing indexing to start from any point in the sequence and wrap around. TUPLE: circular start ; C: circular ( seq -- circular ) 0 over set-circular-start [ set-delegate ]

Re: [Factor-talk] rows-score

2007-02-22 Thread Alex Chapman
Thanks Ed, I've made all the changes you suggested and pushed them to http://wrunt.net/repos. The only change players of tetris will see is that 'd' and 'e' rotate left, and 'f' and 'u' rotate right ('e' and 'u' are the dvorak equivalents of 'd' and 'f'). Alex On 2/10/07, Eduardo Cavazos <[EMAIL

Re: [Factor-talk] libs/vocabs and vocabulary roots

2007-03-01 Thread Alex Chapman
Converting the existing user contributed code base (apps libs demos) is really trivial with libs/vocabs. Most of the work will be simply removing load.factor files. Some complex vocabs like tetris and xml would have to rename vocabularies, mainly replacing - with . and moving each vocab into it'

[Factor-talk] trouble bootstrapping

2007-11-20 Thread Alex Chapman
Hi, I'm having trouble bootstrapping the latest git on osx: git pull make clean make macosx-x86-32 wget http://factorcode.org/images/latest/boot.x86.32.image ./factor -i=boot.x86.32.image *** Data GC (0 minor, 0 cards) Loading P" resource:core/bootstrap/stage2.factor" Loading P" resource:core/co

Re: [Factor-talk] trouble bootstrapping

2007-11-20 Thread Alex Chapman
ory in one of the roots. Windows git > has an error where it won't delete the directories; I didn't know it > happened on Mac too. > > On Nov 20, 2007, at 4:24 PM, Alex Chapman wrote: > > > Hi, > > > > I'm having trouble bootstrapping the latest g

Re: [Factor-talk] origin of the ! comment character?

2007-12-13 Thread Alex Chapman
What about including mutation information in the stack comment? So for instance, sequences:copy would be: : copy ( src i dest! -- ) ... And if something has a side-effect on something not on the stack then it can have some other notation: : set ( value variable -- !) ... By setting these co

Re: [Factor-talk] origin of the ! comment character?

2007-12-13 Thread Alex Chapman
I'll have a tinker if I get time between jamshred and playing with semantic networks and morse code, not to mention my non-factor life :) On 14/12/2007, Slava Pestov <[EMAIL PROTECTED]> wrote: > > > On 14-Dec-07, at 12:23 AM, Alex Chapman wrote: > > > What about incl

Re: [Factor-talk] flags

2008-01-19 Thread Alex Chapman
Hi Ed, That's great. The idiom for bitoring multiple flags has always bugged me, and doing it at compile time is an added bonus. Alex On 19/01/2008, Eduardo Cavazos <[EMAIL PROTECTED]> wrote: > > Hello, > > In C, it's common to have various values that you combine via '|'. In most > of > the C i

Re: [Factor-talk] First impressions

2008-01-28 Thread Alex Chapman
On 29/01/2008, Daniel Ehrenberg <[EMAIL PROTECTED]> wrote: > > On Jan 28, 2008 4:32 PM, Jorge Acereda MaciĆ” <[EMAIL PROTECTED]> wrote: > > - Why does it use getters and setters instead of explicit words? > > (i.e, "my-tuple-field / set-my-tuple-field" instead of "my-tuple- > > field get / my-tuple-

Re: [Factor-talk] Introduction to Factor

2008-03-09 Thread Alex Chapman
Hi Stephen, Take a look at the 'lines' word (type '\ lines help' in your listener). This will give you a sequence of strings, which you can then use { "XX" } split on to get the separate parts of the data. Factor's sequences vocabulary is amazingly useful. Remember that strings are sequences i

Re: [Factor-talk] A note about Dan's unicode efforts

2008-03-10 Thread Alex Chapman
Hey Ed, I don't feel as strongly about this as you seem to, but I actually quite like the idea of having to explicitly state what encoding I want to read or write a file in. Otherwise it just seems to be 'programming by coincidence' when the default of utf8 happens to be what you wanted. I don't wa

Re: [Factor-talk] A note about Dan's unicode efforts

2008-03-10 Thread Alex Chapman
Hi William, On 11/03/2008, William Tanksley, Jr <[EMAIL PROTECTED]> wrote: > > I feel really stupid ... I tried to look up to verify > how to properly apply it (specifically, I wanted to look up the right > conventions for naming things like set-codec; I'm a newbie), and I > simply can't find it

[Factor-talk] deployment not working?

2008-05-08 Thread Alex Chapman
Hi Slava, I've tried to deploy Tetris on mac, but it doesn't seem to work. It creates Tetris.app, which crashes straight away. Is there anything obvious I'm missing? I've put my generated Tetris.app in my home dir on factorcode.orgif it's useful. Also, I found a small bug in the deployment docs:

[Factor-talk] jamshred updates

2008-05-08 Thread Alex Chapman
Hi All, I've updated Jamshred a bit. It's now sort of playable as it has collision detection between the player and the walls of the tunnel. There are still a few bugs though, including the occasional hang of factor on startup. To try it, pull from git://factorcode.org/git/wrunt.git, then: USE: jam

Re: [Factor-talk] deployment not working?

2008-05-09 Thread Alex Chapman
ECTED]> Date: 2008/5/9 Subject: Re: [Factor-talk] deployment not working? To: factor-talk@lists.sourceforge.net This should be fixed now. Slava On May 8, 2008, at 2:44 AM, Alex Chapman wrote: Hi Slava, I've tried to deploy Tetris on mac, but it doesn't seem to work. It creates Tet

Re: [Factor-talk] jamshred updates

2008-05-09 Thread Alex Chapman
> On May 8, 2008, at 2:48 AM, Alex Chapman wrote: > > Hi All, > I've updated Jamshred a bit. It's now sort of playable as it has collision > detection between the player and the walls of the tunnel. There are still a > few bugs though, including the occasio

Re: [Factor-talk] deployment not working?

2008-05-09 Thread Alex Chapman
Never mind, I found the problem. I just had to copy extra/jamshred/sound/bang.wav to Jamshred.app/Contents/Resources/extra/jamshred/sound/ 2008/5/9 Alex Chapman <[EMAIL PROTECTED]>: > Thanks Slava, it worked after I added 'ui' to the USING: clause of > strip-cocoa.fact

Re: [Factor-talk] jamshred updates

2008-05-11 Thread Alex Chapman
Hi Slava, The unit test is fixed. I know collisions are a bit weird, but at least the basics work. I'll do some fine tuning to make it feel a bit better. Alex 2008/5/10 Slava Pestov <[EMAIL PROTECTED]>: > > > Hi Alex, > > Thanks for fixing the issue. Collision detection still seems a bit > weird.

Re: [Factor-talk] Communication from the KLF

2008-06-29 Thread Alex Chapman
Hi, Let me make this even more concrete. The double-quote has a 2 keystroke > cost. This is something that bugs me too. Four keystrokes is an especially high cost for very short strings. What if we had an alternative syntax for strings that don't contain spaces? Something like 'foo would be syno

Re: [Factor-talk] Communication from the KLF

2008-06-29 Thread Alex Chapman
2008/6/30 Chris Double <[EMAIL PROTECTED]>: > On Mon, Jun 30, 2008 at 11:07 AM, Alex Chapman <[EMAIL PROTECTED]> > wrote: > > This is something that bugs me too. Four keystrokes is an especially high > > cost for very short strings. What if we had an alternative syn

[Factor-talk] pastebin

2008-09-12 Thread Alex Chapman
Hi All, Is it possible to get the latest pastebin? I fired up webapps.pastebin with something like: "pastebin.db" sqlite-db [ { entity paste annotation } [ ensure-table ] each ] with-db "pastebin.db" sqlite-db main-responder set [ 8080 httpd ] in-thread It works (mostly), but it's nowhere

[Factor-talk] Hats: useful or just silly?

2008-10-13 Thread Alex Chapman
quot; >o bar o> . And to pass a single slot to be changed by some word that expects a hat: foo new bar-hat eat-hat What do you think? Am I off my rocker, or is this idea worth exploring? Is at already part of core somewhere, and you're all shaking your heads at my folly? Alex :)

Re: [Factor-talk] Idiomatic Factor

2008-11-18 Thread Alex Chapman
> Factor can tell you, try the following: > \ sum see > > Which prints the following: > USING: math ; > IN: sequences > : sum ( seq -- n ) 0 [ + ] binary-reduce ; > So the shortest solution is: : sequence-sum ( seq -- sum ) sum ; inline Which is pretty much pointless. If the 'sum' library word d

Re: [Factor-talk] Idiomatic Factor

2008-11-18 Thread Alex Chapman
Hi Mayson, In this case it's not necessary to use a variable. Factor's stack is more than sufficient for a problem like this. There's also a word that will help you: reduce. Try \ reduce help in the listener and I think you'll find the problem a lot easier. If you were using a variable, then at s

Re: [Factor-talk] DWIM

2008-11-19 Thread Alex Chapman
> Restarts were invoked adding vocabularies to the search path. > To avoid doing this in the future, add the following USING: > and IN: forms at the top of the source file: > > USING: accessors arrays colors kernel math math.geometry.rect > math.vectors namespaces sequences ui ui.gadgets > ui.gadge

Re: [Factor-talk] What does this message mean? :warnings - print 117 semantic warnings.

2008-11-20 Thread Alex Chapman
> Slava, generally speaking, can all these warnings possibly be cleaned > up? Or are some of them "unfixable"? > Some of them are unfixable without redesigning code. For example, in the lists.lazy vocabulary, many of the tuples have a slot which contains a quot (lazy-from-by is an example). This m

Re: [Factor-talk] Class names

2008-11-30 Thread Alex Chapman
Hi, I just realized there are two issues here. > > 1) Having a convention for class names > 2) Making it safe to define words that shadow class names > > I'm not really interested in 1) because it doesn't seem useful to me > to know that something if something is a class or not. Mousing over a >

[Factor-talk] UNUSE:?

2008-11-30 Thread Alex Chapman
Hi All, Sometimes using the listener I'll accidentally USE the wrong vocab to get a word I want. Is there any way to un-USE this vocab? Often the quickest way is to quit Factor and start again (or start a new listener), but that's ugly. What I'd like is a way to continuously use a listener session

Re: [Factor-talk] UNUSE:?

2008-11-30 Thread Alex Chapman
Great :) Any chance you'll be adding that to the syntax vocab? 2008/12/1 Slava Pestov <[EMAIL PROTECTED]> > : UNUSE: scan vocab-words use get delq ; parsing > > On Sun, Nov 30, 2008 at 6:28 PM, Alex Chapman <[EMAIL PROTECTED]> > wrote: > > Hi All, > &

Re: [Factor-talk] Class names

2008-11-30 Thread Alex Chapman
2008/12/1 Slava Pestov <[EMAIL PROTECTED]> > On Sun, Nov 30, 2008 at 6:19 PM, Alex Chapman <[EMAIL PROTECTED]> > wrote: > > And then we have words. These are also symbols, but when executed they do > > something arbitrary. This could include pushing their own symbol,

Re: [Factor-talk] Macro puzzle

2009-02-15 Thread Alex Chapman
Hi Matt, > BTW, I would still like to see a precise definition of "static stack > effect." Briefly, a word with a static stack effect has the same stack effect every time it is run. For example, drop ( x -- ). This is in contrast to words with a dynamic stack effect, such as call, whose stack eff

Re: [Factor-talk] Hats: useful or just silly?

2009-04-14 Thread Alex Chapman
d off. The couchdb bindings work but are incomplete, and the tests only work if there is a local couchdb daemon running. Alex 2008/10/18 Slava Pestov > On Mon, Oct 13, 2008 at 11:52 PM, Alex Chapman > wrote: > > Hi All, > > > > I've pushed a new vocabulary to my r

Re: [Factor-talk] playing sounds

2009-04-15 Thread Alex Chapman
Hi, In getting jamshred runnable again I had to fix openal, so I thought I'd do synth and morse while I was at it. All four are working again and the changes can be pulled from factorcode.org/git/wrunt.git. At first I couldn't find jamshred -- the directory unmaintained/jamshred was empty. I was a

Re: [Factor-talk] playing sounds

2009-04-16 Thread Alex Chapman
;d be glad to contribute for what I can). > > Diego > > > On Thu, Apr 16, 2009 at 6:05 AM, Alex Chapman > wrote: > > Hi, > > In getting jamshred runnable again I had to fix openal, so I thought I'd > do > > synth and morse while I was at it. All four

[Factor-talk] defining computed constants at parse time

2009-04-19 Thread Alex Chapman
Hi All, Sometimes I want to define an object in my program which is intended to be a constant, but isn't a literal. For example, in the morse vocab I want to define morse-code-table, a biassoc which allows lookups of ascii characters to morse codes and vice versa. One way I could do this: : morse-

Re: [Factor-talk] defining computed constants at parse time

2009-04-19 Thread Alex Chapman
gt; > Take a look at Joe's extra/literals. You can do something like: > > CONSTANT: morse-code-table $[ H{ { CHAR: a ".-" } } >biassoc ] > > Doug > > > On Apr 19, 2009, at 9:18 PM, Alex Chapman wrote: > > > Hi All, > > > > Sometimes I w

Re: [Factor-talk] playing sounds

2009-04-19 Thread Alex Chapman
t; > I've merged your changes. "SOS" play-as-morse works on my MacBook :-) > > Slava > > On Wed, Apr 15, 2009 at 11:05 PM, Alex Chapman > wrote: > > Hi, > > In getting jamshred runnable again I had to fix openal, so I thought I'd > do > > s

Re: [Factor-talk] Changes to core/

2009-05-25 Thread Alex Chapman
Hi Doug, This clamp functionality is already present in math.ranges as clamp-to-range: ( scratchpad ) 100 -20 0 [a,b] clamp-to-range . 0 ( scratchpad ) 100 20 0 [a,b] clamp-to-range . 20 ( scratchpad ) 100 120 0 [a,b] clamp-to-range . 100 Not as clean obviously, but more general. Maybe clamp-to-r

Re: [Factor-talk] Changes to core/

2009-05-25 Thread Alex Chapman
Actually, a code upgrade system would have to work on the textual representation of code, because old code won't necessarily parse. 2009/5/26 Alex Chapman > I guess at some point a language reaches a tipping point where changes for > the better (or simpler) actually cost more than th

Re: [Factor-talk] Changes to core/

2009-05-25 Thread Alex Chapman
I guess at some point a language reaches a tipping point where changes for the better (or simpler) actually cost more than they're worth. Maybe there's another way around this problem though. Things that break old code are: 1. Vocab renaming, 2. Moving a word from one vocab to another, 3. Removing

Re: [Factor-talk] Circular Lists and rotate-circular?

2009-06-09 Thread Alex Chapman
Hi Charles, It looks like you've found a bug. From basis/circular/circular.factor: : circular-wrap ( n circular -- n circular ) [ start>> + ] keep [ seq>> length rem ] keep ; inline : rotate-circular ( circular -- ) [ start>> 1 + ] keep circular-wrap (>>start) ; Looks like this secon

Re: [Factor-talk] Circular Lists and rotate-circular?

2009-06-09 Thread Alex Chapman
Looks like you beat me to it Slava :) Was your fix the one I suggested? 2009/6/10 Slava Pestov > Hi Charles, > > Looks like rotate-circular is broken. Unfortunately it didn't have > unit tests and wasn't used anywhere else in the library, so nobody > noticed until now. I pushed a patch fixing th

[Factor-talk] fun cheating in word puzzles with Factor

2010-03-19 Thread Alex Chapman
Hi anyone who's interested, I was frustrated by a word puzzle in a newspaper which in Factor can be stated as: Find a permutation of the string "mtnymisei" which is a valid English word. I gave up doing it in my head so I opened up Factor to solve it for me. I needed a list of valid English word