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 ]
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
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'
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
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
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
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
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
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-
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
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
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
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:
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
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
> 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
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
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.
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
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
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
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 :)
> 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
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
> 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
> 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
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
>
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
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,
> &
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,
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
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
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
;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
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-
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
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
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
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
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
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
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
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
43 matches
Mail list logo