Hi Alex,

> Your
> code caches the table in a variable, but you haven't set a scope on the
> variable (using with-scope or with-variable etc.). Maybe it should be a
> global since it's constant, or better yet, if you can enter a literal
> biassoc instead of using >biassoc then it will be constructed at parse time.
> Yet another way of caching it would be using MEMO:.

I guess there's nothing in the syntax vocab for building a literal
biassoc, but maybe this could do the trick:

! maybe something like this would be generally useful
SYNTAX: BA{ \ } [ >hashtable >biassoc ] parse-literal ;

CONSTANT: code-table BA{
  { "A" ".-" } { "B" "-..." } { ... ... }
}

> I'll merge our two versions when I get the chance.

That's awesome! ;-)

> The next step is to turn
> the sound of morse code into a string of dots, dashes, spaces and slashes.
> Does that sound hard to you? It does to me :)

It sounds hard to me too! :-( At the moment, I have no idea how to
implement such a thing, but we can try something out in a future
release.

------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to