Hendrik Boom | 2 Dec 05:24 2010

Re: metacircular interpreter, lexical scope, environment

On Wed, Dec 01, 2010 at 08:12:17PM -0800, YC wrote:
> Thanks Hendrik for both responses - please see inline.
> 
> On Wed, Dec 1, 2010 at 7:23 PM, Hendrik Boom <hendrik@...> wrote:
> 
> >
> > The immutable hash table doesn't work well for lexically scoped
> > variables.
> >
> > You can end up with multiple simultaneous bindings of the same
> > variable in different contexts.  Look up the Knuth Man-or-boy problem,
> > for example, in http://en.wikipedia.org/wiki/Man_or_boy_test
> 
> 
> But isn't that what's called for in a chained environment?  The inner can
> see the outer bindings if not shadowed, but not vice versa.
> 
> 
> > Subsituting them away is a correct, but slow way of implementing lexical
> > scoping.  It was invented in the days when mathematicians were inventing
> > formal logic, and computers weren't around yet -- more as a way of
> > preciely defining concepts tha a way of being practical.  It had a clear
> > meaning before side-effects became commonplace.
> 
> 
> So what would be a fast way?
> 
> 
> > But the activation frame doesn't have to be on the stack.  It could,
> > say, be om the heap.
(Continue reading)

Hendrik Boom | 2 Dec 05:25 2010

Re: metacircular interpreter, lexical scope, environment

On Wed, Dec 01, 2010 at 10:34:48PM -0500, David Van Horn wrote:
> On 12/1/10 10:14 PM, Hendrik Boom wrote:
>> On Wed, Dec 01, 2010 at 09:09:04PM -0500, David Van Horn wrote:
>>> On 12/1/10 9:03 PM, YC wrote:
>>>> Thanks - I have read the substitution part of PLAI and thought of using
>>>> substitution as well, but it seems that substitution does not constitute
>>>> the full solution:
>>>>
>>>>      * it only work with side-effect free code
>>>
>>> This is not entirely true, but substitution and effects are subtle.
>>
>> The actual prblem is that the parameter is reevaluated every time it's
>> used in teh called function.  THis lacke efficiency, but occasionally
>> (as in Algol 60's call-by-name it's exactly what you need,)
>>
>>>
>>>>      * it does not address closure
>>>
>>> You don't need closures in a substitution model.
>>
>> No, as long as you take care to use systematic renaming of variables.
>
> You luck out and get to avoid this issue if you implement a  
> call-by-value language.

You still have it if parameters can be functions.

-- hendrik
(Continue reading)

Ryan Culpepper | 2 Dec 07:22 2010

Re: metacircular interpreter, lexical scope, environment

Hendrik Boom wrote:
> On Wed, Dec 01, 2010 at 08:12:17PM -0800, YC wrote:
>> Thanks Hendrik for both responses - please see inline.
>>
>> On Wed, Dec 1, 2010 at 7:23 PM, Hendrik Boom <hendrik@...> wrote:
>>
>>> The immutable hash table doesn't work well for lexically scoped
>>> variables.
>>>
>>> You can end up with multiple simultaneous bindings of the same
>>> variable in different contexts.  Look up the Knuth Man-or-boy problem,
>>> for example, in http://en.wikipedia.org/wiki/Man_or_boy_test
>>
>> But isn't that what's called for in a chained environment?  The inner can
>> see the outer bindings if not shadowed, but not vice versa.
>>
>>
>>> Subsituting them away is a correct, but slow way of implementing lexical
>>> scoping.  It was invented in the days when mathematicians were inventing
>>> formal logic, and computers weren't around yet -- more as a way of
>>> preciely defining concepts tha a way of being practical.  It had a clear
>>> meaning before side-effects became commonplace.
>>
>> So what would be a fast way?
>>
>>
>>> But the activation frame doesn't have to be on the stack.  It could,
>>> say, be om the heap.
>>
>> Yes agreed - I don't mean the frames need to be held on "the stack" - I
(Continue reading)

Bojan Nikolic | 1 Dec 09:15 2010
Picon

Re: Exploratory programming?


Richard Lawrence <richard.lawrence@...> writes:

> [1] I have so far mostly stayed away from DrRacket, because I know Emacs

I've been using geiser recently (https://github.com/jaor/geiser) -- it
is already quite usable for the type of exploration that you mention
(e.g., listing all exported procedures in a module) and seems to be
evolving rapidly.

--

-- 
Bojan Nikolic          ||          http://www.bnikolic.co.uk

xiaohan song | 2 Dec 13:56 2010
Picon

I can't input anything using keyboard in DrRacket

I am running Ubuntu 10.04.1 LTS on my pc

and I can't input anything using my keyboard in DrRacket
I thought it might be the *.sh file
so I compile the source code myself
But it doesn't work either
Whatever I press, it responses nothing
What should I do ?

Forgive my poor English
<div>
<p>I am running Ubuntu 10.04.1 LTS on my pc</p>
<div>and&nbsp;I can't input anything using my keyboard in DrRacket</div>
<div>I thought it might be the *.sh file</div>
<div>so I compile the source code myself</div>
<div>But it doesn't work either</div>
<div>Whatever I press, it responses nothing</div>
<div>What should I do ?</div>
<div><br></div>
<div>Forgive my poor English</div>
</div>
Matthias Felleisen | 2 Dec 14:58 2010

Re: Exploratory programming?


+1 

On Dec 1, 2010, at 11:12 PM, Ryan Culpepper wrote:

> My $0.02: Most of the time when I hit the docs for a function, all of the information I need is in the blue box:
usually I'm looking at the contracts, but the argument labels help me when I forget the order things go in.
I'd be happy with a tool that showed just the contents of the blue boxes, formatted as text.
> 
> At the repl, (blue-box id)---names changed to protect the unimplemented---should print out the header
and contract information associated with id. Perhaps (blue-box "id") should print out the blue-box
information and require line for everything matching "id" exactly. And other search options as needed.
> 
> In DrRacket, there should be a way of getting the same information in an on-demand panel (like the
find/replace panel or error-during-check-syntax panel). It must be available without running Check
Syntax, however, through some combination of search, caching, heuristics, and mind-reading.
> 
> It would be great if it were also available in emacs/quack etc.
> 
> Ryan
> 
> 
> Eli Barzilay wrote:
>> Two hours ago, Greg Hendershott wrote:
>>>> I wonder whether help could display contracts if the module use
>>>> provide/contract to export f.
>>> I like this idea.
>> I don't think that combining all of these is right.  To go over the
>> various pieces there are three that are very different:
>> 1. (help id) -- opens a browser window on the documentation for `id'
>> 2. there's the description of which module some identifier is coming
>>   from, where was it defined, and what name was it defined as (some
>>   of it is what check-syntax shows, and also what my interactive
>>   ,describe command does)
>> 3. and there's the description of a value
>> The first is very different from the other two -- I often want to see
>> #2 but don't want a browser window, or if I want to look at the docs
>> then I don't need #2.  So lumping them together doesn't sound right.
>> So it might make a little more sense to bundle all of the light-weight
>> quick output features, like #2 and #3, but they're very different from
>> each other -- #2 is syntactic and #3 uses the value.  So merging them
>> into a single facility can be confusing.
>> [Re python, my guess was that it's more limited in having no
>> syntactic-level tool -- and I do see that things like help(+) or
>> help(if) don't work.  And BTW, after only a few experiments, python's
>> `help' looks like a mess: help(3) is the same as help(int), help("3")
>> does some search, etc etc.  Hardly looks like a good tool to
>> imitate...]
>>> Maybe go a step further and allow per-parameter doc-string-ettes?
>>> Because seeing
>>> 
>>>  get-pure-port: (url? (listof string?) . -> . input-port?)
>>> 
>>> Might still be too opaque. "What is this (listof string?) you speak
>>> of?", sayeth the aspiring Racketeer on the PLimoTh PLanTation.
>>> 
>>> Whereas if contracts could have optional doc-string-ettes:
>>> 
>>>  (url? ["URL"] (listof string?) ["headers"] . -> . input-port?)
>>> 
>>> Then help could display something very close indeed to the shaded
>>> blue box summary on docs.racket.org.
>> Ideally, the documentation could be rendered in some way that could be
>> displayed in text, but that will take some work.  And that's still
>> different from a simpler doc-string thing.
> 
> _________________________________________________
> For list-related administrative tasks:
> http://lists.racket-lang.org/listinfo/users

jvjulien | 2 Dec 15:20 2010
Picon

pb with play-sound procedure

hello,

I upload a game (dynablaster) in planet http://planet.racket-lang.org/display.ss?package=dynablaster.plt&owner=jeeve
(in local disk, the sound is OK)

but when we use it via Planet, play-sound procedure don't find the sound file

play-sound: file not found: "medias/explode.wav"  *

thanks for your help

jeeve
Hendrik Boom | 2 Dec 15:27 2010

Re: metacircular interpreter, lexical scope, environment

On Wed, Dec 01, 2010 at 11:22:49PM -0700, Ryan Culpepper wrote:
> Hendrik Boom wrote:
>>
>> Yes, that's the fast way.  It can be made faster in a compiler, where  
>> you can compile the exact list steps through the chain of frames 
>> instead of looking up names at run-time.
>
> It's easy to "compile away" the name lookup even in an interpreter by  
> having a pre-pass* replace variable references with their "lexical  
> addresses" (see also "rib-cage environment"). That seems to be a very  
> common exercise in interpreter-based PL classes.

Yes.

>
> In fact, lexical variables are so easy to analyze that you can try other  
> representations too. For example, you can annotate every lambda  
> expression with its free lexical variables and create flat closures. But  
> beware of variable mutation in that case!

That's why you haave to have a location somewhere that contains the 
variable's value, and let your closures point to it.

-- hendrik

>
> Ryan
>
> *Arguably, this is a very small, simple compiler.

Yes.  The boundary between compilation and choosing an in-memory 
representation for interpretation is vague.

Jay McCarthy | 2 Dec 15:56 2010
Picon

Re: pb with play-sound procedure

I have not looked at your code but I am guessing you need define-runtime-path

Sent from my iPhone

On Dec 2, 2010, at 7:20 AM, jvjulien@... wrote:

> hello,
> 
> I upload a game (dynablaster) in planet http://planet.racket-lang.org/display.ss?package=dynablaster.plt&owner=jeeve
> (in local disk, the sound is OK)
> 
> but when we use it via Planet, play-sound procedure don't find the sound file
> 
> play-sound: file not found: "medias/explode.wav"  *
> 
> thanks for your help
> 
> jeeve
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
Richard Lawrence | 2 Dec 18:30 2010
Picon

Re: Exploratory programming?

Bojan Nikolic <bojan@...> writes:

> I've been using geiser recently (https://github.com/jaor/geiser) -- it
> is already quite usable for the type of exploration that you mention
> (e.g., listing all exported procedures in a module) and seems to be
> evolving rapidly.

Looks cool, thanks for the pointer!

Richard


Gmane