Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Are there design patterns for novices in Intercal?

24 views
Skip to first unread message

spartan.the

unread,
Jun 4, 2010, 5:15:32 PM6/4/10
to
Hi, folks,

I am quite new to Intercal (2 months of hands-on, honestly) so PLEASE
excuse me if my question seems a bit naive.

See subject.

I found some recommended free patterns book specific to Intercal at
http://www.intercaltg.com/special/freepattern-1.html. But...
PLEASE..., I am not an expert to start with Teddy Bear pattern if I
don't know the basics.

Could you PLEASE give a link with examples how to implement Factory
and Singletronin Intercal?

ais523

unread,
Jun 7, 2010, 8:02:10 AM6/7/10
to
On Jun 4, 10:15 pm, "spartan.the" <spartan....@gmail.com> wrote:
> Hi, folks,
>
> I am quite new to Intercal (2 months of hands-on, honestly) so PLEASE
> excuse me if my question seems a bit naive.
>
> See subject.
>
> I found some recommended free patterns book specific to Intercal athttp://www.intercaltg.com/special/freepattern-1.html. But...

> PLEASE..., I am not an expert to start with Teddy Bear pattern if I
> don't know the basics.
>
> Could you PLEASE give a link with examples how to implement Factory
> and Singletronin Intercal?

Hmm, I'm not entirely sure how to answer that.

Singleton is easy, at least. It should be pretty clear with a moment's
thought, or attempt to implement, that in INTERCAL implementing
Singleton is easier than /not/ implementing it; creating one code
construct that acts vaguely like an object is a lot easier than
creating several. In fact, it is easier still not to create the
object, or equivalent, at all and just use global variables; while
design pattern advocates might claim this is missing the point, I
contend that in INTERCAL at least, doing things that way will be both
easier to read and more efficient.

As for a Factory, you have to consider what you actually want to
build. In INTERCAL, probably the most interesting thing you might want
to generate like that is statements. Unfortunately, unless you use an
expansion library, you'll need several blocks of code to serve as a
pool to dynamically allocate statement implementations from, and thus
have a rather small limit of statements to generate; proper garbage
collection, though, can help with code reuse in this sense. (I've had
some thoughts along the lines of using multithreading in order to
expand this number indefinitely; those who have tried to imply the way
I think from the way I write code, possibly a null set, would know
that I consider multithreading the answer to more or less every
problem INTERCAL offers. Unfortunately, in this case some sort of
language construct support would probably be needed, due to WHILE
loops having not enough local state, and multiple COME FROM having too
much.) This approach should be recommended in order to abstract away
the messy details of setting up local-applicable global state and then
generating the right sort of computed CREATE, which is hard to get
right at the best of times (now is not the best of times for me to
concentrate on INTERCAL, so no code is provided). As a bonus, it
should nest indefinitely (or until you run out of unallocated code),
thus allowing the creation of FactoryFactories or whatever.

--
ais523

spartan.the

unread,
Jun 15, 2010, 5:10:33 PM6/15/10
to
On Jun 7, 3:02 pm, ais523 <ais...@bham.ac.uk> wrote:
(who cares: if INTERCAL is write-only why saints and prophets should
ever read it?)

Your answer is "just as reliable" as opposed to "fully
reliable" (duhh...copied a wise man). I start diving into "increase
your karma for $5" trance to fully understand your writings for a
month or so.

0 new messages