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)
(Continue reading)

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

Antonio Menezes Leitao | 24 Jul 10:27 2014
Picon

Performance of open-output-nowhere

Hi,

While trying to benchmark some of my code, I tried to minimize the time spend on predefined IO functions, such as write-byte & friends, by using the port returned by open-output-nowhere, expecting that it would be faster than using, e.g., open-output-bytes, which has to accumulate the output.

However, contrary to my expectations, it turns out that using open-output-nowhere is 10 times slower that using open-output-bytes.

Here is one example:

#lang racket
(define (test i n p)
  (time (for ([l (in-range n)])
          (write-byte i p))))

(test 123 100000000 (open-output-bytes))
(test 123 100000000 (open-output-nowhere))

I'm getting:

cpu time: 2860 real time: 2854 gc time: 32
cpu time: 28906 real time: 28904 gc time: 125

What's causing this difference?

Best,
António.
____________________
  Racket Users list:
  http://lists.racket-lang.org/users
Picon

lexer priority

Hi,

I try to write a lexer and parser, but I cannot figure out how to set priority to lexer's tokens. My simplified lexer (shown below) has only 2 tokens BLOCK, and COMMENT. BLOCK is in fact a subset of COMMENT. BLOCK appears first in the lexer, but when I parse something that matches BLOCK, it always matches to COMMENT instead. Below is my program. In this particular example, I expect to get a BLOCK token, but I get COMMENT token instead. If I comment out  (line-comment (token-COMMENT lexeme)) in the lexer, I then get the BLOCK token.

Can anyone tell me how to work around this issue? I can only find this in the documentation
"When multiple patterns match, a lexer will choose the longest match, breaking ties in favor of the rule appearing first."

#lang racket

(require parser-tools/lex
         (prefix-in re- parser-tools/lex-sre)
         parser-tools/yacc)

(define-tokens a (BLOCK COMMENT))
(define-empty-tokens b (EOF))

(define-lex-trans number
  (syntax-rules ()
    ((_ digit)
     (re-: (uinteger digit)
           (re-? (re-: "." (re-? (uinteger digit))))))))

(define-lex-trans uinteger
  (syntax-rules ()
    ((_ digit) (re-+ digit))))

(define-lex-abbrevs
  (block-comment (re-: "; BB#" number10 ":"))
  (line-comment (re-: ";" (re-* (char-complement #\newline)) #\newline))
  (digit10 (char-range "0" "9"))
  (number10 (number digit10)))

(define my-lexer
  (lexer-src-pos
   (block-comment (token-BLOCK lexeme))
   (line-comment (token-COMMENT lexeme))
   (whitespace   (position-token-token (my-lexer input-port)))
   ((eof) (token-EOF))))

(define my-parser
  (parser
   (start code)
   (end EOF)
   (error
    (lambda (tok-ok? tok-name tok-value start-pos end-pos)
      (raise-syntax-error 'parser
 (format "syntax error at '~a' in src l:~a c:~a"
 tok-name
 (position-line start-pos)
 (position-col start-pos)))))
   (tokens a b)
   (src-pos)
   (grammar
    (unit ((BLOCK) $1)
          ((COMMENT) $1))
    (code ((unit) (list $1))
          ((unit code) (cons $1 $2))))))

(define (lex-this lexer input)
  (lambda ()
    (let ([token (lexer input)])
      (pretty-display token)
      token)))

(define (ast-from-string s)
  (let ((input (open-input-string s)))
    (ast input)))

(define (ast input)
  (my-parser (lex-this my-lexer input)))

(ast-from-string "
; BB#0:
")
____________________
  Racket Users list:
  http://lists.racket-lang.org/users
Brian Adkins | 23 Jul 02:03 2014

Unbound identifier bug in contracts?

Does this seem like a bug? I'm running DRRacket 6.0.1 on Mac OSX 10.6.8.

Given:

(define (valid? a b)
  (< a b))

Case 1 - works fine:

(define/contract (foo a b)
  (->i ([x (z) (curry valid? z)] [z any/c]) any)
  (+ a b))

Case 2 (adding a 3rd arg) - results in:
  "z10: unbound identifier;
    also, no #%top syntax transformer is bound in: z10"

(define/contract (foo a b c)
  (->i ([x (z) (curry valid? z)] [y any/c] [z any/c]) any)
  (+ a b))

Thanks,
Brian

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

Greg Hendershott | 22 Jul 21:50 2014
Picon

identifier-binding source-id vs. nominal-source-id

So for racket-mode I have a visit-definition feature. It takes you to
the definition of the symbol at point.

I'm using identifier-binding to find the file and name, then I
read-syntax the file and use syntax-case* to find the identifier, and
use its syntax srcloc.

The only issue I'm experiencing is what seems to be inconsistency (for
my purposes) in what identifier-binding reports. Code below.
Paraphrase:

For a plain provide, source-id = nominal-source-id. Great.

For a rename-out, the original definition name is source-id, and
nominal-source-id is the rename. Great.

For a define/contract, plus plain provide, same thing.

So far it seems like source-id is the definition name. Cool!

For (provide (contract-out)) --- bzzzzzt.  Now source-id is the name
of the wrapped thing (e.g. 'provide/contract-id-pc.9), and
nominal-source-id is the original definition name.  Huh?? This seems
backwards.

And worst of all is (provide (contract-out rename old new contract))
-- both a contract and a rename. In this case source-id is the
contract wrapper, nominal-source-id is the rename, and the original
definition name is... absent.  (Well, I have it -- maybe -- from the
user's symbol at point in the Emacs buffer.)

I have a sad.

I suppose I could try all 3 possibilities -- source-id,
nominal-source-id, and the symbol at point from the Emacs buffer --
until one (or none) succeeds. Is that my least-worst option?

-=-=-=-=-=-=-=-

;;; provide.rkt
#lang racket

(define (f)
  0)
(provide f)

(define (-r)
  0)
(provide (rename-out [-r r]))

(define/contract (dc)
  (-> any)
  0)
(provide dc)

(define (pc)
  0)
(provide (contract-out [pc (-> any)]))

(define (-pcr)
  0)
(provide (contract-out [rename -pcr pcr (-> any)]))

;;; some-other-file.rkt
#lang racket
(require "provide.rkt")
(pretty-print
 (for/list ([sym '(f r dc pc pcr)])
   (match (identifier-binding (namespace-symbol-≥identifier sym))
     [(list source-mpi source-id
            nominal-source-mpi nominal-source-id
            source-phase import-phase nominal-export-phase)
      (list sym "source" source-id "nominal" nominal-source-id)])))

;; ==>
;; '((f "source" f "nominal" f)
;;   (r "source" -r "nominal" r)
;;   (dc "source" dc "nominal" dc)
;;   (pc "source" provide/contract-id-pc.9 "nominal" pc)
;;   (pcr "source" provide/contract-id-pcr.13 "nominal" pcr))

-=-=-=-=-=-=-=-

p.s. This is re https://github.com/greghendershott/racket-mode/issues/39
____________________
  Racket Users list:
  http://lists.racket-lang.org/users


Gmane