Alexander D. Knauth | 28 Jul 02:10 2014

module-level definitions vs. local definitions and how binding works

It seems like “hygienic reader extensions” still work when a module-level definition conflicts with it, but it seems like if it’s a local binding the local binding overrides the one in the reader extension.  

For example:
#lang rackjure
;; this works:
(define lambda "module-level-whatever")
#λ(void %1) ; #<procedure>
;; this doesn't work
(let ([lambda "local-whatever"]
      [%1 void]
      [define-syntax void]
      [% void])
  #λ(void %1)) ; application: not a procedure;
;              ;   expected a procedure that can be applied to arguments
;              ;   given: "local-whatever"
;              ;   arguments…:

Why does it work at the module-level and not within a let? 

Is this a bug, or should reader extensions not be used this way, or what?  

What’s going on here?


____________________
  Racket Users list:
  http://lists.racket-lang.org/users
Henry Lenzi | 27 Jul 05:10 2014
Picon

Use of map and eval to evaluate symbol in namespace

#lang racket

#|

Dear Racketeers -

I would like to create a little function
that would write a line of a medical recipe.

I would pass to "read" a shorthand form,
and the program would expand the text. Like so:

When I answer "hctz25" and "30", it would print:
"Hydrochlorothiazide 25mg ----------- 30 pills".

But I'm facing problems related to:
 - use of "map" with "eval" in the definition area (namespace issues...)
See below.
|#

(require scheme/base) ; Is this necessary?
(define this-namespace (make-base-namespace))

(define hctz25 "Hydroclorothiazide 25mg")
(define  line "-----------")
(define pl "pills")

(define *med-name* 'NIL) ; *med-name* has global scope - this is on purpose
(define *med-name-str* "") ; *med-name-str* has global scope

(define (ask-med-name)
  (print "Medication") (newline)
  (set! *med-name* (read))
  (set! *med-name-str* (symbol->string *med-name*)))

(define *quant* 0) (define *quant-str* " ")

(define (ask-quant)
  (print "Quantity") (newline)
  (and
   (set! *quant* (read)) (unless (number? *quant*) (error "It's not a
number!")))
  (set! *quant-str* (number->string *quant*)))

(define (ask)
  (ask-med-name)
  (ask-quant))
(ask)

#|
Where's the problem?
In the REPL, I can do this:

> (map eval '((eval *med-name*) line *quant-str* pl))
'("Hydrochlorothiazide 25mg" "-----------" "30" "pills")

or this:

> (string-join (map eval '((eval *med-name*) line *quant-str* pl)))

"Hydrochlorothiazide 25mg ----------- 30 pills"

But, because of the namespace issues associated with "eval", I'm not
able to do it in the definition area.

I have no clue as to what the syntax should be.

Thanks for any help.

Henry Lenzi

|#
____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Dmitry Pavlov | 25 Jul 19:06 2014
Picon

Re: How does DrRacket determine encoding?

Matthew,

I just checked again and suddenly DrRackets saves to UTF-8 on
both machines. Lo let us just say that I am hallucinating and
forget it until I run against a reproducible case. Sorry.

Regards,

Dmitry

On 07/25/2014 08:57 PM, Matthew Flatt wrote:
> I would have said that DrRacket always uses UTF-8. Maybe I'm
> forgetting/missing something, though, so I'll give Robby a chance to
> reply to the list (when the sun is back up in his part of the world).
>
> At Fri, 25 Jul 2014 19:12:13 +0400, Dmitry Pavlov wrote:
>> Hello,
>>
>> I have a Racket on Windows XP machine and
>> a Racket on a Windows Server machine.
>>
>> I type some cyrillic text into DrRacket on XP, save the file,
>> and the resulting file has the CP1251 encoding.
>>
>> I type some cyrillic text into DrRacket on Windows Server,
>> save the file, and the resulting file has the UTF-8 encoding.
>>
>> notepad.exe tends to save to CP1251 on both machines.
>> HKEY_LOCAL_MACHINE\SYSTEM\\\CurrentControlSet\\Control\\Nls\\CodePage\\ACP
>> is "1251" on both machines.
>>
>> How do I programmatically predict which encoding DrRacket
>> will choose?
>>
>>
>> Regards,
>>
>> Dmitry
>> ____________________
>>    Racket Users list:
>>    http://lists.racket-lang.org/users
>
>

____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Dmitry Pavlov | 25 Jul 17:12 2014
Picon

How does DrRacket determine encoding?

Hello,

I have a Racket on Windows XP machine and
a Racket on a Windows Server machine.

I type some cyrillic text into DrRacket on XP, save the file,
and the resulting file has the CP1251 encoding.

I type some cyrillic text into DrRacket on Windows Server,
save the file, and the resulting file has the UTF-8 encoding.

notepad.exe tends to save to CP1251 on both machines.
HKEY_LOCAL_MACHINE\SYSTEM\\\CurrentControlSet\\Control\\Nls\\CodePage\\ACP
is "1251" on both machines.

How do I programmatically predict which encoding DrRacket
will choose?

Regards,

Dmitry
____________________
  Racket Users list:
  http://lists.racket-lang.org/users

dfeltey | 25 Jul 08:10 2014

Re: Redex: exponential runtime with certain judgments

I'm attaching a model of the simply typed lambda calculus which demonstrates the issue. The file includes a
language definition, the necessary judgment forms, and a few macros for generating and timing programs
of a given size.

I hope this helps.
Thanks
Dan 

----- Original Message -----
From: "Robby Findler" <robby@...>
To: "Daniel Feltey" <dfeltey@...>
Cc: "Racket Users" <users@...>
Sent: Friday, July 25, 2014 1:16:10 AM GMT -05:00 US/Canada Eastern
Subject: Re: [racket] Redex: exponential runtime with certain judgments

It's hard for me to see what exactly is going on -- would you have the
time to make a simple form of your judgment form and an input that
demonstrates the issue?

Thanks,
Robby

On Thu, Jul 24, 2014 at 11:53 PM, Daniel Feltey <dfeltey@...> wrote:
> I've been implementing a type system with subtyping using Redex's judgment forms and noticed that
checking whether my typing judgment would hold was taking longer than seemed reasonable (5 - 10 minutes in
some cases).
>
> Ultimately I tracked the bug down to a clause in the subtyping judgment that had the form:
>
> (< tau tau)
>
> Where tau is the grammar term that could represent any type in my language, and both uses of tau are in input
positions. Removing this rule brought down the 10 minute runtime mentioned above to under half a second.
>
> Is this behavior expected in the case of judgment-form clauses similar to the above, it seemed natural to
me to include a rule like this in my subtyping judgment and I definitely didn't expect this to be the main
reason for my model performing so poorly.
>
> Thanks
> Dan
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users
Attachment (bad-redex.rkt): application/octet-stream, 4191 bytes
____________________
  Racket Users list:
  http://lists.racket-lang.org/users
Daniel Feltey | 25 Jul 06:53 2014

Redex: exponential runtime with certain judgments

I've been implementing a type system with subtyping using Redex's judgment forms and noticed that
checking whether my typing judgment would hold was taking longer than seemed reasonable (5 - 10 minutes in
some cases). 

Ultimately I tracked the bug down to a clause in the subtyping judgment that had the form:

(< tau tau)

Where tau is the grammar term that could represent any type in my language, and both uses of tau are in input
positions. Removing this rule brought down the 10 minute runtime mentioned above to under half a second. 

Is this behavior expected in the case of judgment-form clauses similar to the above, it seemed natural to me
to include a rule like this in my subtyping judgment and I definitely didn't expect this to be the main
reason for my model performing so poorly. 

Thanks
Dan
____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Spencer Florence | 25 Jul 03:48 2014

Re: DrRacket, OSX, and xattr

The overwrite/revert prompts suddenly decided to stop (they had been happening all day...). I'll report back if I can reproduce them again.


On Thu, Jul 24, 2014 at 8:27 PM, Robby Findler <robby-5YcgHWA4rVlh5c2UlzYQwQ@public.gmane.orgwestern.edu> wrote:
I don't think that that's what's causing the overwrite/revert prompts.
There is definitely a bug there and I would love to know what's going
on, but DrRacket uses file-or-directory-modify-seconds to determine
whether or not to prompt, and setting this metadata doesn't change the
result of that function. Below is the test I used.

Robby

#lang racket/gui
(define fn "/Users/robby/x.rkt")
(call-with-output-file fn
  (λ (port) (write (random) port))
  #:exists 'truncate)
(define-values (_ type) (file-creator-and-type fn))
(list (file-or-directory-modify-seconds fn) (current-seconds))
(sleep 2)
(list (file-or-directory-modify-seconds fn) (current-seconds))
(file-creator-and-type fn #"DrSc" type)
(list (file-or-directory-modify-seconds fn) (current-seconds))



On Thu, Jul 24, 2014 at 6:45 PM, Spencer Florence
<florence-angj7XTnwNpXfO9P/gJGhg@public.gmane.org> wrote:
> Two reasons:
>
> 1. DrRacket isn't always the default file association on my mac.
> 2. Something keeps butchering the xattrs (My guess is dropbox) so DrRacket
> keeps prompting me to overwrite the file on save and revert the file on run
> (more or less every time I do either). This is recent, but I'm not sure what
> changed. The only thing I remember updating recently is DrRacket, but who
> knows what is updating in the background.
>
> Either way it seems like xattrs causing overwrite/revert prompts is bad
> behavior, regardless if saving new xattrs is correct. It seems a bit like
> saying "the file was modified because you added the setuid bit... do you
> want to overwrite or revert?". The file wasn't modified, the file system
> metadata was.
>
>
>
> On Thu, Jul 24, 2014 at 6:25 PM, Robby Findler <robby-5YcgHWA4rVnfxgxxWyf0drK6bRJNSFrb@public.gmane.org>
> wrote:
>>
>> It is setting itself as the owner of the file so that subsequent
>> double-clicks on the file will open the file in DrRacket.
>>
>> This was the recommended behavior back in the day before you could
>> associate extensions with applications (I think).
>>
>> Why do you want to disable it?
>>
>> Robby
>>
>> On Thu, Jul 24, 2014 at 3:43 PM, Spencer Florence
>> <florence <at> northwestern.edu> wrote:
>> > Hi all,
>> >
>> > Whenever I save a file with DrRacket on OSX, it always sets some
>> > extended
>> > attributes on the file. Specifically it sets:
>> >
>> > [snips:pl7/examples] xattr -l somefile.rkt
>> > com.apple.FinderInfo:
>> > 00000000  54 45 58 54 44 72 53 63 00 00 00 00 00 00 00 00
>> > |TEXTDrSc........|
>> > 00000010  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>> > |................|
>> > 00000020
>> >
>> > In addition if I clear the xattr's (via xattr -c) DrRacket treats this
>> > as an
>> > external write to the file and prompts me to overwrite on save and
>> > revert on
>> > run. Is this behavior intended? It seems odd given that DrRacket doesn't
>> > do
>> > this with normal attributes (permission, suid bit, etc.) If it is
>> > intended
>> > what is the rational and can I disable it?
>> >
>> > --Spencer
>> >
>> >
>> >
>> > ____________________
>> >   Racket Users list:
>> >   http://lists.racket-lang.org/users
>> >
>> ____________________
>>   Racket Users list:
>>   http://lists.racket-lang.org/users
>
>
>
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users
>

____________________
  Racket Users list:
  http://lists.racket-lang.org/users
Alexander D. Knauth | 25 Jul 03:24 2014

How to make an identifier that will have a certain binding no matter what phase level it's referenced at?

How can I make an identifier that will have a certain binding no matter what phase level it's referenced at?

For example if I’m making a reader extension that will produce a lambda expression, how do I make it so that the lambda expression will be able to exist at any phase level?

For example this program using #lang rackjure doesn’t work:
#lang rackjure
(require (for-meta 1 racket/base)
         (for-meta 2 racket/base)
         (for-meta 3 racket/base)
         (for-meta 4 racket/base)
         )
                                                                                             
#λ(* 2 %) ; works, produces approx. (lambda (%) (* 2 %))
(begin-for-syntax
  (begin-for-syntax
    #λ(* 2 %) ; lambda: unbound identifier at phase 2;
    ;         ;   also, no #%app syntax transformer is bound in: lambda
    ))

Is there any way to construct an identifier that would be bound to lambda from racket/base no matter what phase level it’s used in?


____________________
  Racket Users list:
  http://lists.racket-lang.org/users
Spencer Florence | 24 Jul 22:43 2014

DrRacket, OSX, and xattr

Hi all,

Whenever I save a file with DrRacket on OSX, it always sets some extended attributes on the file. Specifically it sets:

[snips:pl7/examples] xattr -l somefile.rkt
com.apple.FinderInfo:
00000000  54 45 58 54 44 72 53 63 00 00 00 00 00 00 00 00  |TEXTDrSc........|
00000010  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  |................|
00000020

In addition if I clear the xattr's (via xattr -c) DrRacket treats this as an external write to the file and prompts me to overwrite on save and revert on run. Is this behavior intended? It seems odd given that DrRacket doesn't do this with normal attributes (permission, suid bit, etc.) If it is intended what is the rational and can I disable it?

--Spencer


____________________
  Racket Users list:
  http://lists.racket-lang.org/users
Asumu Takikawa | 24 Jul 22:32 2014

Catching lifts and let

Hi all,

I have a question about syntax lifting and catching those lifts. Here's
an example program that illustrates my concern:

  #lang racket

  ;; do the lifting
  (define-syntax (m stx)
    (syntax-local-lift-expression #'(+ 1 1)))

  ;; catch the lift, try to put definitions in a let
  (define-syntax (catch stx)
    (syntax-case stx ()
      [(_ body ...)
       (syntax-case (local-expand/capture-lifts #'(body ...) (syntax-local-context) null)
         (define-values begin)
         [(begin (define-values (x ...) e ...) ... exp)
          #'(let () (define-values (x ...) e ...) ... exp)])]))

  (catch (+ 1 (m)))

I'd like this program to work and produce `3` in the end, but it produces an
unbound identifier error.

The trouble is that when a syntax lift is done, the identifier produced
by the lift is a top-level identifier and gets wrapped with #%top. That
means that putting the caught definitions in a `let` can't work, because
those become local let-bindings.

In the example above, the relevant excerpt of the expansion is this:

  (letrec-values (((lifted.0) (#%app + '1 '1))) ; does not bind below
    (#%app (#%app + '1 (#%top . lifted.0))))

Does the design of syntax lifting preclude this kind of macro
interaction?

Cheers,
Asumu
____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Sebastian Erdweg | 24 Jul 17:20 2014
Picon

Call for Talk Proposals: Domain-Specific Language Design and Implementation 2014

*********************************************************************
CALL FOR TALK PROPOSALS

DSLDI 2014

Second Workshop on
Domain-Specific Language Design and Implementation

October 20/21, 2014
Portland, USA
Co-located with SPLASH/OOPSLA

http://2014.splashcon.org/track/dsldi2014
*********************************************************************

Deadline for talk proposals: August 27, 2014

If designed and implemented well, domain-specific languages (DSLs)
combine the best features of general-purpose programming languages
(e.g., performance) with high productivity (e.g., ease of
programming).

*** Workshop Goal ***

The goal of the DSLDI workshop is to bring together researchers and
practitioners interested in sharing ideas on how DSLs should be
designed, implemented, supported by tools, and applied in realistic
application contexts. We are both interested in discovering how
already known domains such as graph processing or machine learning can
be best supported by DSLs, but also in exploring new domains that
could be targeted by DSLs. More generally, we are interested in
building a community that can drive forward the development of modern
DSLs.

*** Workshop Format ***

DSLDI is a single-day workshop and will consist of a series of short
talks whose main goal is to trigger exchange of opinion and
discussions. The talks should be on the topics within DSLDI's area of
interest, which include but are not limited to the following ones:

* DSL implementation techniques, including compiler-level and
runtime-level solutions
* utilization of domain knowledge for driving optimizations of DSL
implementations
* utilizing DSLs for managing parallelism and hardware heterogeneity
* DSL performance and scalability studies
* DSL tools, such as DSL editors and editor plugins, debuggers,
refactoring tools, etc.
* applications of DSLs to existing as well as emerging domains, for
example graph processing, image processing, machine learning,
analytics, robotics, etc.
* practitioners reports, for example descriptions of DSL deployment in
a real-life production setting

*** Call for Submissions ***

We solicit talk proposals in the form of short abstracts (max. 2
pages). A good talk proposal describes an interesting position,
demonstration, or early achievement. The submissions will be reviewed
on relevance and clarity, and used to plan the mostly interactive
sessions of the workshop day. Publication of accepted abstracts and
slides on the website is voluntary.

* Deadline for talk proposals: August 27, 2014
* Notification: September 12, 2014
* Workshop: October 19 or 20, 2014
* Submission website: https://www.easychair.org/conferences/?conf=dsldi2014

*** Workshop Organization ***

Organizers

* Sebastian Erdweg, TU Darmstadt, Germany
* Adam Welc, Oracle Labs, USA

Program committee

* Martin Erwig, Oregon State University, USA
* Matthew Flatt, University of Utah, USA
* Klaus Ostermann, University of Marburg, Germany
* Tiark Rompf, EPFL/Oracle Labs, Switzerland
* Tijs van der Storm, CWI, Netherlands
* Juha-Pekka Tolvanen, University of Jyväskylä/Metacase, Finland
* Emina Torlak, University of California, Berkeley, USA
* Laurence Tratt, King's College London, UK
* Markus Völter, itemis/independent, Germany
* Guido Wachsmuth, TU Delft, Netherlands

_______________________________________________
ecoop-info mailing list
ecoop-info@...
http://web.satd.uma.es/mailman/listinfo/ecoop-info

____________________
  Racket Users list:
  http://lists.racket-lang.org/users


Gmane