
Yea or nay? (<= 0 x .and. < x0 .and. <= x1)
as short for (and (<= 0 x) (and (< x x0) (<= x0 x1))

And (<= 0 x .and. < x0 .or. <= x1)
as short for (and (<= 0 x) (or (< x x0) (<= x0 x1))

What if the .and.
was implied/invisible? The .and.
is implied if I use a /high school math/-ish notation:
0 <= x < x0 <= x1
But this doesn’t work with .or.
:sob: :
0 <= x ((x < x0) .or. (x0 <= x1))
I just end up with lots of brackets.
I don’t know. Your proposal is very interesting. I wish I could test on students.

@soegaard2 if you asked me what (<= 0 x .and. < x0 .and. <= x1)
means without giving me any context, I would have assumed that it means (and (<= 0 x) (< 0 x0) (< 0 x1))

@alexharsanyi Copy. I want syntax that makes 0<=x<=x0<=x1 easy to enter.

Here is an implementation if anyone wants to try it out:

#lang racket/base
(require
(for-syntax racket/base syntax/parse racket/syntax racket/format racket/match
(for-syntax racket/base)))
; (<= 0 x .and. < x0) => (let ([t x]) (and (<= 0 x) (< x x0)))
(begin-for-syntax
(define-syntax def (make-rename-transformer #'define)))
(define-syntax (ddapp stx)
(define (id->string id)
(symbol->string (syntax-e id)))
(def len string-length)
(def ref string-ref)
(define (double-dot-id? id)
(and (identifier? id)
(let ([s (id->string id)])
(def n (len s))
(and (>= n 2)
(eqv? (ref s 0) #\.)
(eqv? (ref s (- n 1)) #\.)))))
(def dd? double-dot-id?)
(define (not-dd? x) (not (dd? x)))
(define (strip-dots id)
(def s (id->string id))
(def n (len s))
(format-id id "~a" (substring s 1 (- n 1))))
(syntax-parse stx
[(app) (syntax/loc stx (#%app))]
[(app f1 . args)
(def out
(let loop ([f1 #'f1] [args (syntax->list #'args)])
(match args
[(list* (? not-dd? xs) ... x (? dd? .f.) f2 ys)
(def f (strip-dots .f.))
(def t (gensym "t"))
(list #'let (list (list t x)) ; only evaluate x once
(list f
(list* f1 (append xs (list t)))
(loop f2 (append (list t) ys))))]
[(list* xs)
(list* f1 xs)])))
(datum->syntax stx out stx)]))
(ddapp + 1 2) ; 3
(ddapp * 2 3 .list. + 4 ) ; (6 7)
(ddapp <= 0 2 .and. < 3) ; #t
(ddapp <= 0 2 .and. < 4) ; #t
(ddapp <= 0 1 .and. < 2 .and. < 3) ; #t
(ddapp list 1 .list. list 2) ; ((1) (1 2))

> I want syntax that makes 0<=x<=x0<=x1 easy to enter
So (<= 0 x x0 x1)
?

some of them could be <

What about (cmp 0 <= x < x0 <= x1)
?

That looks fine.

@sorawee: that’s twice you dump my thoughts faster than I do. Mind if I borrow you for a month? :stuck_out_tongue:

I suddenly realize that <=/< </< and friends are in srfi 67.

c(a\|d)*r
is not cool anymore. We need ((<\|<=)/)*(<\|<=)
!

@samth is it correct to say TR satisfies the gradual guarantees for simply-typed programs? (I want to say why TR is gradual, and be more specific than “TR strives toward the SNAPL’15 criteria”)

TR satisfies the dynamic gradual guarantee, but not the static one — removing types in one module means you need to add them in another module in some cases

that’s dynamic for simple types, right? (excluding \forall
, and I’m not sure what else)

@sorawee At least ≤≤ ≤< <≤ and <<.


Hm.. I know a very huge (much, much larger than Racket) programming community that does “shut up and hack” and also does not use mutability… :confused:

I really like Racket’s mutability by default. But I don’t think it is at all an implication that you don’t write real code if you don’t like mutability.

@soegaard2 Thanks for posting

I hope not too many people have read it, yet. :slightly_smiling_face: I just fixed 2 serious problems: Contributors list was incomplete and the link to the paper was not working.

Funny fact, yesterday was quite late so I forgot to run the basic test to the contributors script output: is Matthew Flatt in the list of contributors. It was not so this morning I opened an email to read: “Missed Matthew Flatt from contributors.”. Doh! Of course, a few people besides Matthew were missing. Sorry for that, now fixed.