Some inquiries about Dylan tutorials and documentation 
Author Message
 Some inquiries about Dylan tutorials and documentation

  Hi again.  Just wondering a few things, I
notice that most if not all the tutorials and
documentation, that I could find online, which I
am sure isn't all of them, seems to be directed
towards either Pascal and C/C++ people.  Now some
of them I can follow, even with my little
understanding in Java, upto a point, then I begin
to get puzzled.

  What I would like to see, and in my green-horn
opinion, would be a great asset, to increasing
Dylan's popularity, is for some of the more
experienced Dylan Veterans, to perhaps write up a
few low-experience based tutorials, say something
between "hello world", and "Server
applications".  Now I know many of you have full
time careers and like myself, full time families,
but I'm only suggesting examples a less then 100
lines of code or perhaps less then 50 lines and 1
or 2 of them from each veteran. Just basic
foundation type tutorials/examples, nothing like
3D graphics, or High-level Game mechcanics.
Perhaps just simple things like the old "coffee
game", or "string manipulation" type
applications. Now perhaps a few examples
incorporating OOP features, or GUI would be
terrific as well, though these would require more
effort and time to complete.

  Also please understand, that I am not trying to
demand, command, or to gripe about the
tutorials/examples, that I do find being directed
only towards the adept OOP programmer.  From what
I do understand from reading them, many were well
thought out, and concised. Its just that as a
newbie as I am, little steps work best, instead
of large leaps.  Thank you.

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Sun, 08 Sep 2002 03:00:00 GMT  
 Some inquiries about Dylan tutorials and documentation

Quote:

> What I would like to see, and in my green-horn
> opinion, would be a great asset, to increasing
> Dylan's popularity, is for some of the more
> experienced Dylan Veterans, to perhaps write up a
> few low-experience based tutorials, say something
> between "hello world", and "Server
> applications". Now I know many of you have full
> time careers and like myself, full time families,
> but I'm only suggesting examples a less then 100
> lines of code or perhaps less then 50 lines and 1
> or 2 of them from each veteran. Just basic
> foundation type tutorials/examples, nothing like
> 3D graphics, or High-level Game mechcanics.

Have you seen Chris Double's examples? I believe they go some way to
answering your request.
http://www.*-*-*.com/

Also, I'm teaching a course on Dylan at the Northern {*filter*}ia Community
College (thanks, Chris, for plugging me on your dylan page).  The
course will focus more on efficient programming than on platform
specific examples (trans.:  no gui stuff), so it may not be to your
taste and needs, but it is, indeed, an introduction to Dylan that will
get you way past "Hello, world!".
http://www.*-*-*.com/ (follow the link at the
bottom of the page).

Sincerely,
Doug Auclair

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Sun, 08 Sep 2002 03:00:00 GMT  
 Some inquiries about Dylan tutorials and documentation

Quote:


> > ... What I would like to see ... is ... a few low-experience based
> > tutorials, say something between "hello world", and "Server
> > applications".

> Here's a deal for you: find an example you like -- in any other language
> -- and I'll happily translate it into Dylan for you.

Me too!  (I.e., I'll do some translation work.)


Sun, 08 Sep 2002 03:00:00 GMT  
 Some inquiries about Dylan tutorials and documentation
If this offer goes for anyone, I'd love to see the following Perl code
translated.

sub Template {
    local(*FILE);         # filehandle
    local($file);         # file path
    local($HTML);         # HTML data

    $file = $_[0] || die "Template : No template file specified\n";

    open(FILE, "<$file") || die "Template : Couldn't open $file : $!\n";
    while (<FILE>) { $HTML .= $_; }
    close(FILE);

    $HTML =~ s/<!-- \\$(\\w+) -->/${$1}/g;

return $HTML;

Quote:
}

It basically looks through an html document for Perl variables and
replaces them with their values as computed by perl. Pretty slick when
creating dynamic web pages.

James

Quote:



> > > ... What I would like to see ... is ... a few low-experience based
> > > tutorials, say something between "hello world", and "Server
> > > applications".

> > Here's a deal for you: find an example you like -- in any other language
> > -- and I'll happily translate it into Dylan for you.

> Me too!  (I.e., I'll do some translation work.)



Sun, 08 Sep 2002 03:00:00 GMT  
 Some inquiries about Dylan tutorials and documentation

Quote:



> > If this offer goes for anyone, I'd love to see the following Perl code
> > translated.

> > [snip]

> > It basically looks through an html document for Perl variables and
> > replaces them with their values as computed by perl. Pretty slick when
> > creating dynamic web pages.

> Can't be done -- [...] Your "${$1}" is a use of eval.

Something with an equivalent meaning can be, of course. Such as:

  define method expand-template(template :: <string>,
                                symbol-table :: <string-table>)
   => (html :: <string>)
    for (template-var :: <string> in symbol-table.key-sequence,
         html = template then substring-replace(html,
                                                template-var,
                                                symbol-table[template-var]))
    finally
      html
    end for;
  end method expand-template;

So if the symbol-table contained the (key,value) pair ("foo", "bar"),
then calling expand-template on "foofoofoo" would return "barbarbar".

Using an explicit table of expansions is IMO better style, since
changing the variable names shouldn't affect the output of the
program. Plus when your template language grows into a full
programming language (and this always happens -- witness PHP), you'll
be in a better position to write an interpreter with comprehensible
behavior. :)

(I don't think this is the most efficient possible implementation of
expand-template, though, since the time it takes is linear in the
number of entries in symbol-table -- can anyone think of a better one
off-hand, including a suggestion to use xformat?)

Neel



Sun, 08 Sep 2002 03:00:00 GMT  
 Some inquiries about Dylan tutorials and documentation

Quote:

> I don't think this is the most efficient possible implementation of
> expand-template, though, since the time it takes is linear in the
> number of entries in symbol-table -- can anyone think of a better one
> off-hand, including a suggestion to use xformat?

I went through this in a different ({*filter*} 4GL non-oop lacking even basic
data structures) language and eventually dealt with it by "chunkifying"
all templates once at startup. That way expansion became, essentially,
linear in the number of variables in each template. (I say essentially
because I implemented conditionals so that the branch not taken does not
add to expansion time, and loops where of course each iteration adds to
expansion time.)

This dramatically increased performance for longer templates by greatly
reducing the repetitive scanning of the template for variable
occurences, even completely eliminating scanning of the plain HTML
portions.

The data structure was simple:

An array of texts, odd entries containing plain HTML and even ones
containing variables (or "commands" in the little language). (With rare
empty entries to keep things in synch.) This allows the expansion to
walk down the array alternating between copying the HTML out and looking
up the variable and copying out its value (or starting a branch or
loop).

A corresponding array of ints where for any text entry that was a
command that marked the beginning of a block, the int array contained
the index of the entry that ended the block. This allows both for
directly skipping over unsatisfied conditionals without walking through
their contents looking for the close of the block, and for easy
implementation of loops by recursively calling the expand procedure on
the subset of the arrays that form the loop body.

Quote:
> Plus when your template language grows into a full
> programming language (and this always happens -- witness PHP), you'll
> be in a better position to write an interpreter with comprehensible
> behavior.

Might as well plan from the start on having it happen. In my case I
think it took me well under an hour to realize that I was going to need
a dinky language rather than just text substitutions. (It's pretty
obvious. You need iteration to display a selection from a database. And
you need branching. And you need formatting options.)

In a more full-feature language like Dylan, what I'd do to the templates
would at least be a true tokenizing, probably more like a full parse.
Instead of just chunking the template into texts and variable names,
resolve variable names to as direct as possible of a reference to the
values, resolve commands to references to methods and parse their
arguments. Instead of a flat pair of arrays, a parse tree structure.

Of course, I'd try to avoid adding "eval" to my language ;-)



Sun, 08 Sep 2002 03:00:00 GMT  
 Some inquiries about Dylan tutorials and documentation

Quote:

>   Hi again.  Just wondering a few things, I
> notice that most if not all the tutorials and
> documentation, that I could find online, which I
> am sure isn't all of them, seems to be directed
> towards either Pascal and C/C++ people.  Now some
> of them I can follow, even with my little
> understanding in Java, upto a point, then I begin
> to get puzzled.

>   What I would like to see, and in my green-horn
> opinion, would be a great asset, to increasing
> Dylan's popularity, is for some of the more
> experienced Dylan Veterans, to perhaps write up a
> few low-experience based tutorials, say something
> between "hello world", and "Server
> applications".

Here's a deal for you: find an example you like -- in any other language
-- and I'll happily translate it into Dylan for you.

-- Bruce



Mon, 09 Sep 2002 03:00:00 GMT  
 Some inquiries about Dylan tutorials and documentation

Quote:

> Now perhaps a few examples incorporating OOP features, or GUI would
> be terrific as well, though these would require more effort and time
> to complete.

Have you looked at the book 'Dylan Programming'? It is a good
book to learn Dylan from. It doesn't cover DUIM (the GUI) but does
cover OOP, and example projects, etc. It's available at Amazon.com I
think and http://www.functionalobjects.com has copies I think. It's
also included in the help file of functional developer.

Chris.
--
http://www.double.co.nz/dylan



Mon, 09 Sep 2002 03:00:00 GMT  
 Some inquiries about Dylan tutorials and documentation

Quote:

> If this offer goes for anyone, I'd love to see the following Perl code
> translated.

> sub Template {
>     local(*FILE);         # filehandle
>     local($file);         # file path
>     local($HTML);         # HTML data

>     $file = $_[0] || die "Template : No template file specified\n";

>     open(FILE, "<$file") || die "Template : Couldn't open $file : $!\n";
>     while (<FILE>) { $HTML .= $_; }
>     close(FILE);

>     $HTML =~ s/<!-- \\$(\\w+) -->/${$1}/g;

> return $HTML;
> }

> It basically looks through an html document for Perl variables and
> replaces them with their values as computed by perl. Pretty slick when
> creating dynamic web pages.

Can't be done -- Dylan deliberately doesn't have the capability commonly
known as "eval" (e.g. in Lisp and in Perl as well), becuase Dylan is
intended to be able to be compiled into a binary that doesn't have to
contain the entire interpreter and eval requires that the whole
development system is thee at runtime.

Your "${$1}" is a use of eval.

The same applies, of course, to writing this script in C, Pascal, Java or
any other traditional compiled language.

-- Bruce



Mon, 09 Sep 2002 03:00:00 GMT  
 Some inquiries about Dylan tutorials and documentation

Quote:

> Using an explicit table of expansions is IMO better style, since
> changing the variable names shouldn't affect the output of the
> program. Plus when your template language grows into a full
> programming language (and this always happens -- witness PHP), you'll
> be in a better position to write an interpreter with comprehensible
> behavior. :)

Of course the argument that Perl (and Lisp) people would make is that
when the template language grows you'll use the interpreter with
comprehensible behaviour that you already have to hand, thanks to EVAL.
Of course the perl people are wrong about the `comprehensible
behaviour' bit...

--tim



Mon, 09 Sep 2002 03:00:00 GMT  
 Some inquiries about Dylan tutorials and documentation
And can anyone offer example code of the html breakdown and reconstitution
code that wraps around the template code?
I'm facing a similar problem at the moment with a toy XML parser, and
Dylan's treatment of <string> as just a typeof <collection> is confusing.
:-)

- Rob.

Quote:

> > I don't think this is the most efficient possible implementation of
> > expand-template, though, since the time it takes is linear in the
> > number of entries in symbol-table -- can anyone think of a better one
> > off-hand, including a suggestion to use xformat.

--

MacOS wonderfulness for The Hitch Hiker's Guide to the Galaxy Game.
"Arthur bought the Apple anyway."-So Long & Thanks For All The Fish.


Mon, 09 Sep 2002 03:00:00 GMT  
 Some inquiries about Dylan tutorials and documentation

Quote:


> > Using an explicit table of expansions is IMO better style, since
> > changing the variable names shouldn't affect the output of the
> > program. Plus when your template language grows into a full
> > programming language (and this always happens -- witness PHP), you'll
> > be in a better position to write an interpreter with comprehensible
> > behavior. :)

> Of course the argument that Perl (and Lisp) people would make is that
> when the template language grows you'll use the interpreter with
> comprehensible behaviour that you already have to hand, thanks to EVAL.
> Of course the perl people are wrong about the `comprehensible
> behaviour' bit...

heh.

I don't see any reason to *need* an interpreted language for this sort of
thing.  Sure, it's often more convenient to embed bits of code in an html
document than to embed bits of html in a program, but all tat means is
that you should use some sort of pre-processor tool that can extract those
bits of code and make a pogram from them and compile it.

-- Bruce



Mon, 09 Sep 2002 03:00:00 GMT  
 Some inquiries about Dylan tutorials and documentation

Quote:

> I don't see any reason to *need* an interpreted language for this sort of
> thing.  

Just to be clear, I didn't particularly mean an interpreted language
(although I did mention EVAL, I know).  I really meant a language
where you can say something like (funcall (compile nil (read ...))).
(Although in real life you want to do something like: (funcall (compile
nil (safe-read ...)))).

--tim



Mon, 09 Sep 2002 03:00:00 GMT  
 
 [ 18 post ]  Go to page: [1] [2]

 Relevant Pages 

1. Anyone know of good Dylan tutorial?

2. Anyone know of good Dylan tutorial?

3. Dylan tutorial update

4. Draft Dylan Tutorial

5. Comparing and Contrasting Common Lisp, Scheme, and Dylan tutorial

6. Comparing and Contrasting Common Lisp, Scheme, and Dylan tutorial

7. Comparing and Contrasting Common Lisp, Scheme, and Dylan tutorial

8. PB32 Tutorial Books/Documentation needed

9. Bobo Documentation and Tutorial Available

10. Numerical Python Documentation and Tutorial

11. mod_ruby documentation/tutorial...

 

 
Powered by phpBB® Forum Software