[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: call/cc
> -----Original Message-----
> From: Guy Steele - Sun Microsystems Labs
[mailto:gls@labean.East.Sun.COM]
> Sent: Tuesday, December 18, 2001 5:01 AM
> To: gls@labean.East.Sun.COM; kragen@pobox.com; pixel@mandrakesoft.com;
> David.Simmons@smallscript.net
> Cc: ll1-discuss@ai.mit.edu
> Subject: RE: call/cc
>
>
> From: "David Simmons" <David.Simmons@smallscript.net>
> Date: Mon, 17 Dec 2001 15:58:33 -0800
> ...
> > For a really good test that will provide better separation
> > of the languages, try curried addition of first one parameter,
> > then the other, plus 1:
> >
> > (((lambda (x) (lambda (y) (+ x y 1))) 3) 5) Scheme, 24 tokens
> >
> > --Guy
>
> SmallScript (superset of Smalltalk):
>
> [:x|[:y|x+y+1]](3)(5) "13 tokens"
>
> -- Dave S. [SmallScript LLC]
>
> How is that 13 tokens? I'm a little unclear on how you would
> count ":x|" and ":y|", but surely
>
> [ [ x + y + 1 ] ] ( 3 ) ( 5 )
>
> is already 15 tokens, so the whole thing must be somewhere
> between 17 and 21 tokens? If 21, then it saves two "lambda"s
> and a pair of parens over Lisp, then loses one back by needing
> a second "+".
>
> --Guy
Hi Guy.
I was taking my token count from the SmallScript parse tree.
TBlock [:x...]
TVar :x|
TBlock [:y...]
TVar :y|
TVarRef x
TMsg #+...
TVarRef y
...stopped indenting TMsg #+...
...mail will TLiteral 1
...screw up TParenExpr (3)
TLiteral 3
TParenExpr (5)
TLiteral 5
I now see how you are counting (lexer) tokens. Which means 13 is the
wrong count. On that measure, as you suggest, it would make the count
21.
1 [
2 :
3 x
4 |
5 [
6 :
7 y
8 |
9 x
10 +
11 y
12 +
13 1
14 ]
15 ]
16 (
17 3
18 )
19 (
20 5
21 )
OTOH, SmallScript doesn't really provide anything equivalent to the
simplicity or generality of s-expressions. Which is where, I suspect,
scheme would crush SmallScript in a more general form of this kind of a
comparison.
-- Dave S. [SmallScript LLC]
SmallScript for the AOS & .NET Platforms
David.Simmons@SmallScript.com | http://www.smallscript.org
- Follow-Ups:
- RE: call/cc
- From: "David Simmons" <David.Simmons@smallscript.net>
- References:
- RE: call/cc
- From: Guy Steele - Sun Microsystems Labs <gls@labean.East.Sun.COM>