[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: data structure in LL
At 06:10 PM 12/10/2001 -0500, Matthias Felleisen wrote:
> > Date: Mon, 10 Dec 2001 09:19:31 -0800 (PST)
> > From: Morgan McGuire <firstname.lastname@example.org>
> > Before I met Python, Matlab was my scripting language of choice.
> > Recalling this leads me to new definition of lightweight language, or
> > at least "scripting language"...
> > A lightweight language has one data structure and uses it well.
> > Perl, TCL - String
> > Python, Scheme - List
> > Matlab - Matrix
> > All of these (well, I don't actually know TCL and Perl) offer other
> > data types, but if you use the predominant data type things go much
> > more smoothly. The key is that when there is one form of I/O, you can
> > hook lots of things together easily. As pointed out at the conference,
> > this trades short term ease of use against long-term maintainability.
>1. For Scheme, I would say S-expression because people may think
> "homogeneous list" if you don't.
>2. The classification also gives rise to an interesting semantic
> how much structure do you get from the dominant data structure?
> or conversely, how much effort is it to extract values from the
> data structure?
> If you use strings, you need parsing to get to the same point
> as S-expressions.
> I suggest that this implies Scheme's has more LL-power than Perl.
This does. It's based on a fallacy, though, so luckily for perl the point's
Perl's dominant data structure could be considered either the hash, the
string, or the array, depending on which facet of it you're looking at.
>3. Conjecture: Perl will eventually have S-expressions, too.
> They are more important than continuations.
I think we've already got them. Lists can't be in lists, but we fake it
pretty well with arrays. The s-exp
("foo" "bar" (1 2 3))
["foo", "bar", [1, 2, 3]]
in perl. Rather than a list with an embedded list, it's an array with an
embedded array. Output from subs could be embedded there, but I don't know
enough Lisp/Scheme to do it properly.
These aren't lazy or anything, at least not in perl. Could be in perl 6,
but I'd doubt it. (There are issues with laziness and active data and side
effects and lexical stack snooping, all of which give me a monster headache)
And thanks for the nudge--I was fuzzy on s-expressions until now. (You
folks'll make a scheme programmer out of me yet)
--------------------------------------"it's like this"-------------------
Dan Sugalski even samurai
email@example.com have teddy bears and even
teddy bears get drunk