d_run
2017-1-18 13:31:40

if you’re not on the mailing list, how does one procure stickers?


alexeld
2017-1-18 14:29:08

Hello! If I want to check the shape of JSON or XML data, I can use some kind of schema validator. I’d like to do the same kind of validation in Racket, except instead of checking the shape of JSON or XML, I’d like to check S-expressions. What would be the idiomatic Racket way for checking such a thing? A giant cond, or maybe pattern matching, … ?


fahree
2017-1-18 15:07:45

alexeld: see the recent clojure.spec


alexeld
2017-1-18 15:09:19

@fahree I guess you’re talking about -> https://clojure.org/about/spec


stamourv
2017-1-18 15:21:57

d_run: I’d ask @ben.


d_run
2017-1-18 15:22:05

ty ty


stamourv
2017-1-18 15:23:31

@alexeld: Contracts are most likely what you want.


stamourv
2017-1-18 15:24:18

To specify an sexp shape that is a list of a symbol, followed by two integers, you’d want: (list/c symbol? integer? integer?)


stamourv
2017-1-18 15:24:22

For example.


alexeld
2017-1-18 15:25:43

@stamourv Great, thank you! Would a contract also allow me to flag something like this as invalid: (foo (bar 1) (bar 2)) (repetition of more than one bar is illegal).


stamourv
2017-1-18 15:26:57

Not directly. But you could do something like: (and/c <the-shape-contract> (lambda (sexp) <function-that-checks-other-properties>))


stamourv
2017-1-18 15:27:50

What would be nice for that would be a datum-parse with datum-classes. Like syntax-parse, but for plain data. Unfortunately, that doesn’t exist.


alexeld
2017-1-18 15:30:11

@stamourv Yep, seems many of the utilities are designed to go &lt;some-non-lispy-format&gt; —&gt; s-exprs, where you prevent yourself from this mess in the first place during the translation.


alexeld
2017-1-18 15:31:22

Right now I’m recurring over the s-expr, collecting identifiers I’ve seen before, and checking if they appear again. It works, but I can absolutely see more edge cases creeping in later…


leafac
2017-1-18 15:34:34

I had to do the same thing in the past and I used syntax-parse. It turns out it handles datums just fine. They are converted to syntax objects, but nothing that a syntax-&gt;datum doesn’t solve. It is probably a bad solution, because the documentation for syntax-parse doesn’t even document this feature. But it is a solution.


stamourv
2017-1-18 15:38:11

@leafac: I’ve done that too, but it’s a bit awkward.


leafac
2017-1-18 15:41:25

@stamourv: Good to know that at least I’m not alone :slightly_smiling_face: I believe in my case it was a little less awkward because the datums I was parsing were an embedded DSL (S-expression-based representation of CSS that my program generates and I was compiling to actual CSS).


alexeld
2017-1-18 15:43:32

Thanks @leafac, I’ll check out syntax-parse. I think what’s making this a bit tricky is that I can guarantee the s-exprs I’m processing to be syntactically valid, it’s the attached meaning that’s the problem.


leafac
2017-1-18 15:45:34

Sure. But when we all find out that it was a bad idea to shoehorn syntax-parse in that way, don’t blame me. I warned you :stuck_out_tongue:


alexeld
2017-1-18 15:46:35

Gotcha! ;~)


tonyg
2017-1-18 19:17:15

@mflatt Your “pico” expander implementation https://raw.githubusercontent.com/mflatt/expander/pico/main.rkt looks like it has the quadratic behaviour that Dybvig/Hieb/Bruggeman ’92 avoids — is that right? Is a similar “lazy” approach to scope manipulation needed for the production implementation?


tonyg
2017-1-18 19:19:18

@mflatt (It’s really cool, btw. Great self-contained way of explaining the idea.)


mflatt
2017-1-18 19:19:30

@tonyg Yes; I forget the progression, but it may be that lazy propagation shows up only in the full implementation


mflatt
2017-1-18 19:21:51

To confirm, I see that the “demi” version has a FIXME comment about how laziness is needed; see apply-scope in “syntax/scope.rkt” in the full version


tonyg
2017-1-18 19:23:09

Oh I see! Silly me, I should have checked the other branches. Thanks @mflatt.


gknauth
2017-1-18 19:58:16

@gknauth has joined the channel


leif
2017-1-18 20:38:08

@mflatt Did you make any changes to the bytecode verifier lately?


leif
2017-1-18 20:38:27

I ask because in the current HEAD, the following runs correctly, but after its compiled it claims to be ill-formed bytecode:


leif
2017-1-18 20:38:46

leif
2017-1-18 20:39:12

In version 6.7 it seems to be working fine though.


leif
2017-1-18 20:39:31
#lang racket/base

(define ill
  (let ((base (string-append "a")))
    (λ (x) (string-append base x))))

(ill "b")

leif
2017-1-18 20:41:20

Oh, I do get this issue on 6.7, but not 6.6


leif
2017-1-18 20:41:36

So I think this merits a mailing list post


leif
2017-1-18 21:23:58

@mflatt hmm…I think its ad230d2c that might have been where the issue started



mflatt
2017-1-18 22:23:38

@leif looking at that now


leif
2017-1-18 22:27:13

thanks


stamourv
2017-1-19 01:56:38

@asumu: Do you still have your instance of rudybot running somewhere?


stamourv
2017-1-19 01:56:54

If so, it should probably join slack via the IRC gateway. :)


stamourv
2017-1-19 01:57:01

CC: @offby1


asumu
2017-1-19 01:57:12

Not anymore. The machine it was hosted on no longer exists.


stamourv
2017-1-19 01:57:32

Unfortunate.


asumu
2017-1-19 01:58:12

(I have the dockerfile that builds and boots it somewhere though)


stamourv
2017-1-19 01:58:43

Promising!