Re: [racket-users] how do you read, manipulate, debug scope sets?

2019-05-06 Thread Matthew Butterick

> On May 6, 2019, at 7:53 AM, zeRusski  wrote:
> 
> Are there any tutorials that show you how to use things documented in Syntax
> Transformers chapter of the Reference?
> 
> How do you debug these scope games?

I agree there is something of a gap in the Racket docs / tooling, because 
scopes are a relatively recent addition to the macro expander. You might  want 
to take a look at the `scope-operations` and `debug-scopes` packages.

[1] https://docs.racket-lang.org/scope-operations/index.html 


[2] https://docs.racket-lang.org/debug-scopes/index.html 


-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Redex compatible closure of mutually defined nonterminals

2019-05-06 Thread William J. Bowman
I took a quick look at the implementation of `cross` and `compatible-closure`,
and couldn't make sense of any of it.
For now, I guess I'll manually write out the contexts, and discuss a feature
request.

I spoke to Max a bit about what a compatible closure "ought" to be for mutually
defined syntax.
I think right now, Redex is doing the "wrong" thing.
Suppose I have some relation "->" on my nonterminals `v` and `t`.
Right now, `compatible-closure` is computing something like this:

  t -> t'
  v = v'
  
  t v -> t' v'

That is, to compute the congruence rule for the `(t v)`, we lift the relation
`->` to apply under `T`, but it appears to compute the simplest possible
relation on `v`: syntactic identity.
This is the reason I don't get reduction of `t`s under a `thunk`.

Instead, it "ought" to compute these rules:

  (extending t -> t to closure)
  t -> t'
  v -> v'
  
  t v -> t' v'

  ...

  (generated definition of v -> v)

  t -> t'
  
  λ x. t -> λx. t'

This lifts `->` to `v` while computing the closure of `->`.
I think this should be the default behavior of `compatible-closure` on mutually
defined nonterminals.

I think in general, we actually want something more: for mutually defined
syntax/judgments, I might want to define `->t` and `->v` (generally, `->ᵢ ...`),
and compute the closure of `->` w.r.t. `t` and the closure of `->v`.
This would require a lot more changes and different interface, I think.
A quick version would give the user access to computed contexts, allowing
`(cross t)` (or something) in language definitions.
Then, we could implement this easily enough in user libraries.

--
William J. Bowman

On Fri, May 03, 2019 at 10:09:45PM -0400, William J. Bowman wrote:
> I can't seem to use (cross t).
> If it were as easy as (C ::= (cross t) (cross v)), I'd be sufficiently happy.
> But alas:
>   https://github.com/racket/redex/issues/92
>   https://github.com/racket/redex/issues/54
>   https://github.com/racket/redex/pull/147
> 
> I'll see about tweaking Redex, but now I'm wondering what to call this
> "closure".
> To me, it's the obvious compatible closure, but apparently not.
> (It's the one the paper I'm reading calls "the congruence closure", as far as 
> I
> can tell; the definition is missing, hence my Redex modeling.)
> 
> --
> William J. Bowman
> 
> On Fri, May 03, 2019 at 09:00:34PM -0500, Robby Findler wrote:
> > There isn't a simple way to do that using the exported  stuff currently but
> > those nonterminals are hiding inside and one could expose them in the
> > pattern language I think. (TT is accessible via (cross t) I think.)
> > definitely requires fiddling with intervals but the work would be more
> > exposing and documenting and the like, not really deep changes.
> > 
> > But there may be a clever way to make it work with the existing APIs? I am
> > not sure.
> > 
> > Robby
> > 
> > On Fri, May 3, 2019 at 8:38 PM William J. Bowman 
> > wrote:
> > 
> > > Ah, I see.
> > > Those are the VT and TT I want, but then I also want to define:
> > >
> > > (C ::= VT TT)
> > >
> > > and take the context-closure of C.
> > > (see attached)
> > >
> > > Can I get my hands on the generated VT and TT easily, or would I need to
> > > tweak
> > > Redex internals to automate this?
> > >
> > > --
> > > William J. Bowman
> > >
> > > On Fri, May 03, 2019 at 07:52:09PM -0500, Robby Findler wrote:
> > > > (thunk TT) isn't a TT, tho? It will reduce only in a TT.
> > > >
> > > > Robby
> > > >
> > > > On Fri, May 3, 2019 at 7:16 PM William J. Bowman 
> > > > 
> > > wrote:
> > > > >
> > > > > That looks like the contexts I want, but it doesn't seem to reduce
> > > under a (thunk TT) in my example model.
> > > > >
> > > > > --
> > > > > Sent from my phoneamajig
> > > > >
> > > > > > On May 3, 2019, at 20:02, Robby Findler 
> > > wrote:
> > > > > >
> > > > > > Redex, when asked to create the compatible closure, creates a 
> > > > > > context
> > > > > > and then uses that. In this case, it will create a context something
> > > > > > like this:
> > > > > >
> > > > > > TT ::= hole | (\ (x) TT) | (TT v) | (t VT) | (force VT) | (return 
> > > > > > VT)
> > > > > > VT ::= (thunk TT)
> > > > > >
> > > > > > If you want something else (I'm not sure of an algorithm to handle
> > > > > > this kind of thing without coming with something like that), it 
> > > > > > might
> > > > > > be simplest to write out the contexts that you want directly and use
> > > > > > context-closure.
> > > > > >
> > > > > > Robby
> > > > > >
> > > > > >> On Fri, May 3, 2019 at 6:42 PM William J. Bowman <
> > > w...@williamjbowman.com> wrote:
> > > > > >>
> > > > > >> Hello all,
> > > > > >>
> > > > > >> I'm trying to define a model in Redex where values and terms are
> > > separate
> > > > > >> nonterminals, and then define a reduction relation using
> > > `compatible-closure`
> > > > > >> to lift the small steps to the, well, compatible closure.
> > > > > >> Unfortunately, it doesn't do what I expect, pres

Re: [racket-users] https://lists.racket-lang.org/ is throwing a security exception

2019-05-06 Thread Stephen Chang
https for lists.racket-lang is not working at the moment. Sorry for
the inconvenience. The server hosting lists.racket-lang went down
recently. A partial temporary non-https version is up but https hasnt
been enabled yet.

On Mon, May 6, 2019 at 12:48 PM David Storrs  wrote:
>
> I'm not sure if this is relevant or not, but figured I'd mention it.  Is that 
> supposed to be working, or is it obsolete?  It does turn up in Google 
> searches, so maybe worth thinking about.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] https://lists.racket-lang.org/ is throwing a security exception

2019-05-06 Thread David Storrs
I'm not sure if this is relevant or not, but figured I'd mention it.  Is
that supposed to be working, or is it obsolete?  It does turn up in Google
searches, so maybe worth thinking about.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] how do you read, manipulate, debug scope sets?

2019-05-06 Thread Matthias Felleisen



> On May 6, 2019, at 10:53 AM, zeRusski  wrote:
> 
> Suddenly I find myself playing games with hygiene and not really knowing the 
> rules.


Hygiene is a default not an absolute. The idea of hygiene is that, unless the 
macro writer goes out of his way, the expander assumes that identifiers coming 
from the macro’s input and those introduced by the macro (AND identifiers 
defined and used in the context of the macro definition vs identifiers defined 
in the macro’s use context .. which is not your current problem) are not 
related. 

If you, as a macro writer, wish to break this default assumption, you need to 
work for it. 

The macro system allows certain manipulations of scope. You have discovered 
syntax-local-introduce and its use for flipping scopes. And yes, there are more 
games you can play and you may wish to explore those but they are not for 
situations like yours. [In your specific example, I think it is often better to 
pass the identifier into the macro.] For examples, you may wish to look at 
Alexis’s Hackett implementation. Not all of what you asked for is doable, and I 
can’t even imagine you’d need all of these. 

— Matthias


-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Packed struct in FFI

2019-05-06 Thread Андрей Кравчук
Ohh, how could I miss it. Thanks a lot!

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] how do you read, manipulate, debug scope sets?

2019-05-06 Thread zeRusski
I wrote a macro which introduced an implicit binding <~ so that it could be 
used
in expressions at the use-site. Initially did it with

#+begin_src racket
  ;; inside syntax-parse
  (datum->syntax this-syntax #'<~)
#+end_src

followed by macro introduced expr that binds it, then the use-site 
macro-input
that uses it. Think (let/ec <~ macro-input-body).

Worked just fine when tested at top-level or module begin or in expression
position, but then suddenly broke when I wrote another define-like macro 
whose
body expanded into the macro above. Turns out scopes of <~ at use-site and 
one I
introduced in a macro didn't match, at least that's what I surmount from the
message below. I was originally going to ask if someone could teach me to 
read
these messages, but then I found ~syntax-debug-info~ in docs :) and IIUC the
message below tells me there are two identifier bindings where the error 
occurs
whose scope-sets share some scopes namely "common scopes ...", but neither 
one's
scope-set is a subset of the other hence the error. Am I reading it right?

#+begin_src racket
; /Users/russki/Code/tilda/prelude/tilda.rkt:303:20: <~: unbound identifier
;   in: <~
;   context...:
;#(2212719 use-site) #(2212754 intdef) #(2212808 local)
;#(2212809 intdef) [common scopes]
;   other binding...:
;local
;#(2212718 macro) [common scopes]
;   common scopes...:
;#(2198084 module) #(2198091 module tilda) #(2212726 local)
;#(2212727 intdef) #(2212737 local) #(2212738 intdef) #(2212741 local)
;#(2212742 intdef) #(2212745 local) #(2212746 intdef) #(2212749 local)
;#(2212750 intdef) #(2212753 local)
#+end_src

I fixed the above with some guesswork that amounted to replacing 
datum->syntax
with

#+begin_src racket
  (syntax-local-introduce #'<~)
#+end_src

which IIUC simply flips the scopes so now <~ is use-site and may as well be 
part
of the macro input. Right?

Suddenly I find myself playing games with hygiene and not really knowing the
rules.

Are there any tutorials that show you how to use things documented in Syntax
Transformers chapter of the Reference?

How do you debug these scope games?

How do you introduce or capture identifier bindings (break hygiene)?

Can you temporarily unbind an identifier (for the extent of some expr), so
basically remove or trim some scopes from identifiers that occur in macro 
input? I
suppose there are several possible cases here: 
- trim or replace scopes of ids whose sets match those at use-site, 
guessing this
  won't unbind "shadowing" identifiers (let or define introduced in your 
macro
  input) i.e. those with extra scopes in addition to use-site,
- how do we deal with those, could we trim ids whose scope sets are 
supersets of
  use-site?
- assuming I know how to do the above, do I walk the syntax tree and trim 
those
  scopes every time I find matching id or is there a better way?

At this point I'd like to better understand how to manipulate sets of 
scopes and
verify the result. Could someone kindly teach me or point out good reads or
examples?

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Packed struct in FFI

2019-05-06 Thread Matthew Flatt
At Mon, 6 May 2019 07:39:22 -0700 (PDT), Андрей Кравчук wrote:
> I'm writing bindings for C library that contains some struct declared 
> with __attribute__((packed)). How do I mirror such struct in the bindings? 
> I wasn't been able to find any reference to packed structs in FFI 
> documentation.

Use `#:alignment 1` in `define-cstruct`.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Packed struct in FFI

2019-05-06 Thread Андрей Кравчук
Hello!
I'm writing bindings for C library that contains some struct declared 
with __attribute__((packed)). How do I mirror such struct in the bindings? 
I wasn't been able to find any reference to packed structs in FFI 
documentation.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] 2nd Call for Contributions: Summer BOB 2019 [Aug 21, Berlin, deadline May 17]

2019-05-06 Thread Michael Sperber


Racket talks are very welcome at BOB!

  Summer BOB Conference 2019
 "What happens when we use what's best for a change?"
http://bobkonf.de/2019-summer/cfc.html
  Berlin, August 21
  co-located with ICFP 2019
Call for Contributions
Deadline: May 17, 2019


You are engaged in software development or software architecture, and
have an interesting story to tell about an advanced tools, technique,
language or technology that you're using? Or a gnarly problems that
these tools fail to address but should?

Summer BOB is a one-time-only event, in the spirit of the spectacular
Winter BOB. The International Conference on Functional Programming is
coming to town, and Summer BOB will be right in the middle of it, on
the last day of ICFP proper, prior to all the workshops. Summer BOB
will feature two tracks: one from practitioners, and one from
researchers, and foster communication and cross-pollination between
these communities.

If you share our vision and want to contribute,
submit a proposal for a talk!

NOTE: The conference fee will be waived for presenters. Travel
expenses will not be covered (for exceptions see "Speaker Grants").

Topics
--

We are looking for talks about best-of-breed software technology, e.g.:

- functional programming
- persistent data structures and databases
- types
- formal methods for correctness and robustness
- abstractions for concurrency and parallelism
- metaprogramming
- probabilistic programming
- math and programming
- controlled side effects
- beyond REST and SOAP
- effective abstractions for data analytics
- … everything really that isn’t mainstream, but you think should be.

Presenters should provide the audience with information that is
practically useful for software developers.

We're especially interested in experience reports.  Other topics are
also relevant, e.g.:

- demos and how-tos
- reports on problems that cutting-edge languages and tools should address but 
don't
- overviews of a given field

Requirements


We accept proposals for presentations of 45 minutes (40 minutes talk +
5 minutes questions), as well as 90 minute tutorials for
beginners. The language of presentation should be either English.

Your proposal should include (in your presentation language of choice):

- An abstract of max. 1500 characters.
- A short bio/cv
- Contact information (including at least email address)
- A list of 3-5 concrete ideas of how your work can be applied in a developer's 
daily life
- additional material (websites, blogs, slides, videos of past presentations, …)
- Don't be confused: The system calls a submission event.

Submit here
---

https://bobcfc.active-group.de/bob2019-summer/cfp

Speaker Grants
--

BOB has Speaker Grants available to support speakers from groups
under-represented in technology. We specifically seek women speakers
and speakers who are not be able to attend the conference for
financial reasons.  Shepherding

The program committee offers shepherding to all speakers. Shepherding
provides speakers assistance with preparing their sessions, as well as
a review of the talk slides. 

Organisation


- Direct questions to contact at bobkonf dot de
- Proposal deadline: May 17, 2019
- Notification: May 31, 2019
- Program: June 14, 2019

Program Committee
-

- Matthias Fischmann, zerobuzz UG
- Matthias Neubauer, SICK AG
- Nicole Rauch, Softwareentwicklung und Entwicklungscoaching
- Michael Sperber, Active Group
- Stefan Wehr, factis research

Scientific Advisory Board

- Annette Bieniusa, TU Kaiserslautern
- Torsten Grust, Uni Tübingen
- Peter Thiemann, Uni Freiburg

More information here: http://bobkonf.de/2019-summer/programmkomitee.html


-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Stack trace

2019-05-06 Thread Sam Tobin-Hochstadt
If you record, say, the 100 most recent function calls and their
arguments, then you should be able to maintain proper space use as
well as provide as much information as needed.

Sam

On Sat, May 4, 2019 at 5:45 PM Matthias Felleisen
 wrote:
>
>
>
> On May 3, 2019, at 4:17 AM, Mark Engelberg  wrote:
>
> f tracing is not easily available in BSL, my ideal would be that every error 
> prints out not only the function/line where the error occurred, but also the 
> input(s) to the function which triggered the error.  (Example: a function 
> containing a cond, and every branch tests as false, so it reports an error -- 
> but it currently doesn't tell you what the input was which caused all the 
> cases to fall through).  Even without a full stacktrace, that would be 
> incredibly useful. It gives you something to reason about, something to build 
> a failing test case which you can then try to fix. Any preferences or 
> settings that can be tweaked to achieve something like this? I showed my 
> student how to build an else case with (error x) to print the value of input 
> x if all the cases fall through, but would prefer a more automatic approach.
>
>
>
> Hi Mark,
>
> I think this is a good idea. and we should be able to implement this, but I 
> am not sure yet that we can do it w/o abandoning PITCH (proper implementation 
> of tail-calls, extra H). Perhaps function calls could store their inputs in 
> the continuation marks that John’s stepper places on the stack and a 
> re-defined error could retrieve them from there.
>
> Having these arguments, students could then formulate test cases and thus 
> debug their functions.
>
> For now, I think adding the ‘else’ case with error is the best idea (of 
> course, not doable if there’ no ‘else’).
>
> — Matthias
>
> p.s. But please do teach your students the design recipe so that they have a 
> test suite available no matter what.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.