Alex Shinn | 28 May 15:38 2016
Picon

Second CFP for Scheme and Functional Programming Workshop 2016

SECOND NOTICE
Call For Presentations

17th Annual Scheme and Functional Programming Workshop
WEBSITE: http://scheme2016.snow-fort.org/
LOCATION: Nara, Japan (Co-located with ICFP 2016)
DATE: 18 September 2016

========================================================================

The 2016 Scheme and Functional Programming Workshop is calling for
submissions.  This year we are accepting general presentation
proposals in addition to papers.

Submissions related to Scheme, Racket, Clojure, and functional
programming are welcome and encouraged. Topics of interest include
but are not limited to:

Program-development environments, debugging, testing
Implementation (interpreters, compilers, tools, benchmarks, etc.)
Syntax, macros, hygiene
Distributed computing, concurrency, parallelism
Probabilistic computing
Interoperability with other languages, FFIs
Continuations, modules, object systems, types
Theory, formal semantics, correctness
History, evolution and standardization of Scheme
Applications, experience and industrial uses of Scheme
Education
Scheme pearls (elegant, instructive uses of Scheme)
(Continue reading)

bug in TR or just limitation?

I have a funny case in TR where occurrence typing loses information about the type of a term:

#lang typed/racket

(: expand (Sexp -> Sexp))
(define (expand s)
  (match s
    [(list (? symbol? id) a ...)
     s]))

This fails to type check, because the occurrence of ’s’ in the rhs of the match is no longer known to be an
Sexp. Specifically, I get the message:

Type Checker: type mismatch
  expected: Sexp
  given: (Pairof
          Symbol
          (U Null (Pairof Sexp (U Null (Pairof Sexp (Listof Any)))))) in: s

I understand that the (Pairof …) type arises from the expansion of match, but it seems unfortunate that TR
can’t compute the intersection of the two types known to hold for ’s’ to arrive at 

(Pairof Symbol (U Null (Pairof Sexp (U Null (Pairof Sexp (Listof Sexp))))))

… which is a subtype of Sexp, and therefore legal to return as an Sexp.

Is there perhaps a hinting mechanism by which I could suggest to TR that it look at the original type known to
be associated with ’s’? Or perhaps there’s a depth limit on the intersection computation that
I’m running into? Or perhaps I’m misunderstanding the situation entirely?

(Continue reading)

Braids Constance | 27 May 06:11 2016
Picon

Good examples of in-code documentation?

i'm trying to find good examples of something that... might not exist.

i want to document my code at the definition of each new form, similar to, say, javadoc.  i'd rather not write a
separate document.  i looked for examples in the racket 6.5 sources. 
"syntax/parse/private/litconv.rkt" taught me how to do multi-line comments, but it looks
unstructured.  the scribble manual was full of jargon and not particularly helpful for anything lower
than collection-level.

what are some good resources?  i'm hoping for example code.

--

-- 
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+unsubscribe@...
For more options, visit https://groups.google.com/d/optout.
Jos Koot | 26 May 22:35 2016
Picon

check-duplicates

Hi,
 
(member #f '(#f)) -> (#f)
(member #f '(#t)) -> #f
 
Nice and clear, but:
 
(check-duplicates '(#f #f)) -> #f
(check-duplicates '(#f #t)) -> #f
 
check-duplicates gives no clear answer when #f is duplicated.
 
I propose to modify check-duplicates such as to make a distinction between
(check-duplicates '(#f #f)) and (check-duplicates '(#f #t)).
 
May be cumbersome when many people already use check-duplicates, though,
for I see no way to repair this with backward compatibility.
 
Thanks, Jos
 

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.

Sam Tobin-Hochstadt | 25 May 23:13 2016
Picon
Picon
Gravatar

Re: for/list vs map in Typed Racket

You can write `(NonemptyListof a)` as

    (define-type (NonemptyListof a) (Cons a (Listof a)))

Sam

On Wed, May 25, 2016 at 5:08 PM, Daniel Prager
<daniel.a.prager@...> wrote:
> Thank-you Matthias
>
> On Wed, May 25, 2016 at 10:46 PM, Matthias Felleisen <matthias@...u>
> wrote:
>>
>>
>> 1. You had a } mistake.
>
>
> I see it now.
>
> By putting an extra ) at the end of the λ I committed an arity error.
>
> I could have seen this in DrRacket if I formatted as you did, with the
> separate arguments to map on distinct lines: indentation would have given
> the hint.
>
> In regular Racket this kind of error passes compile, but there's a nice
> arity error at run-time.
>
> Typed Racket gives a confusing error at type-check time instead.
>
> How difficult would it be to have compile time arity checks be prior to type
> checking in TR? The idea being to give simpler error messages where
> possible.
>
>
>> 3. I provided a pack of type (: pack (All (a) (Listof a) -> (Listof
>> (Listof a))))
>
>
>>
>> 4. When you run this now, (first ys) may raise a run-time exception (just
>> like in ML).
>
>
> If pack is "correctly" implemented this should not be possible, but I take
> it this is not expressible using Typed Racket types.
>
> You'd want something like:
>
> (: pack (All (a) (Listof a) -> (Listof ("NonemptyListof" a))))
>
> Shades of dependent types?
>
> Dan

--

-- 
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+unsubscribe@...
For more options, visit https://groups.google.com/d/optout.

Daniel Prager | 24 May 23:50 2016
Picon

for/list vs map in Typed Racket

The following program works in Typed Racket, but if you comment out the for/list in (encode ...) and uncomment the seemingly equivalent map it fails to type check.

Why the discrepancy and how do the experienced Typed Racketeers diagnose and fix these sorts of issues?


Thanks

Dan


P.S. These are taken from Nintey-nine Lisp Problems:


#lang typed/racket

(require typed/test-engine/racket-tests)

;P09 (**) Pack consecutive duplicates of list elements into sublists.
(: pack : (All (a) (Listof a) -> (Listof (Listof a))))
(define (pack xs)
  (cond [(null? xs) null]
        [(null? (rest xs)) (list xs)]
        [else (let ([packed (pack (rest xs))]
                    [head (first xs)])
                (if (equal? (first xs) (second xs))
                    (cons (cons head (first packed))
                          (rest packed))
                    (cons (list head) packed)))]))
                          
(check-expect (pack '(a a a a b c c a a d e e e e))
              '((a a a a) (b) (c c) (a a) (d) (e e e e)))


;P10 (*) Run-length encoding of a list.
(: encode : (All (a) (Listof a) ->
                 (Listof (List Nonnegative-Integer a))))
(define (encode xs)
  #;(map (λ (ys) (list (length ys) (first ys))) (pack xs))
  (for/list ([ys (pack xs)])
    (list (length ys) (first ys))))

(check-expect (pack '(a a a a b c c a a d e e e e))
              '((a a a a) (b) (c c) (a a) (d) (e e e e)))


(test)

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Hendrik Boom | 23 May 21:20 2016

coloured text in scribble

Can someone give me an example of coloured text in scribble?

-- hendrik

--

-- 
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+unsubscribe@...
For more options, visit https://groups.google.com/d/optout.

new user, simple question: cannot run simple example: (cons 1 2)

I just downloaded DrRacket, and it mostly works for me.

However, I tried an example:

(cons 1 2)

And get this error message:

cons: second argument must be a list, but received 1 and 2

----

The example here:

http://download.racket-lang.org/releases/6.5/doc/guide/Pairs__Lists__and_Racket_Syntax.html?q=cons

says that (cons 1 2) is OK. 

What is the problem?

--

-- 
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+unsubscribe@...
For more options, visit https://groups.google.com/d/optout.
Tim Brown | 23 May 18:13 2016
Picon
Gravatar

Arrows and syntax parameters

Folks,

I have a simple anaphoric macro, `awhen`, defined as:

-----------------------------------------------------------------------
#lang racket
(require racket/stxparam)

(define-syntax-parameter it
  (λ (stx) (raise-syntax-error #f "use of “it” outside anaphor" stx)))

(define-syntax (awhen stx)
  (syntax-case stx ()
    [(_awhen test body0 body ...)
     #'(let ((t test))
         (syntax-parameterize ([it (syntax-id-rules () [_ t])])
           (when t body0 body ...)))]))

(awhen 32
       (displayln it) ;; [W]
       (awhen 42
              (displayln it))) ;; [X]
-----------------------------------------------------------------------

When I hover over `awhen` in DrRacket, an arrow comes from that
(define-syntax (awhen ...) ...) line, and ends at the instance of
`awhen` I’m over-hovering. The other `awhen` glows green.

When I hover over `it` [W] in DrRacket, an arrow comes from that
(define-syntax-parameter it ...) line, and ends at the instance of `it`
I’m bothering. The other `it` glows green.

I want to tweak the arrows so that when I hover over the first `it` at
[W] I get an arrow pointing wither from 32 (the test) or its `awhen`.

And vice-versa when I hover over an `awhen`.

So I try:
-----------------------------------------------------------------------
(define-syntax (a2when stx)
  (syntax-case stx ()
    [(_a2when test body0 body ...)
     (syntax-property
      #'(let ((t test))
          (syntax-parameterize ([it (syntax-id-rules () [_ t])])
            (when t body0 body ...)))
      'sub-range-binders
      (list
       (vector
        ;; 2 is the length of the identifier "it", 6 of "a2when"
        (syntax-local-introduce #'it) 0 2 0.5 0.5
        (syntax-local-introduce #'_a2when) 0 6 0.5 0.5)))]))

(a2when 32 ;; [P]
        (displayln it) ;; [Y]
        (a2when 42 ;; [Q]
                (displayln it))) ;; [Z]
-----------------------------------------------------------------------

Which has done wonders for my arrows in the past!
But... hovering over either `awhen2` makes all the `awhen2` glow; and
sends arrows out to both `it`, as well as the `it` at [W] and [X]
(I’ve concatenated both code snippets in my source).

I hover over `it` at [Y], and I get all my `it` glowing (and I mean
ALL of them); and arrows into the `it` from the syntax parameter and
BOTH `awhen2`.

Is it possible to get DrRacket to put arrows between [P]->[Y] and
[Q]->[Z] ?

Thanks,

Tim

-- 
Tim Brown CEng MBCS <tim.brown@...>
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
                City Computing Limited · www.cityc.co.uk
      City House · Sutton Park Rd · Sutton · Surrey · SM1 2AE · GB
                T:+44 20 8770 2110 · F:+44 20 8770 2130
────────────────────────────────────────────────────────────────────────
City Computing Limited registered in London No:1767817.
Registered Office: City House, Sutton Park Road, Sutton, Surrey, SM1 2AE
VAT No: GB 918 4680 96

--

-- 
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+unsubscribe@...
For more options, visit https://groups.google.com/d/optout.

Matthew Eric Bassett | 23 May 12:54 2016
Picon

Weirdness with typed racket and hashes

Hi all,

I noticed something weird today when playing around with typed racket (and
flirting with the idea of using it in production).

If I do something like:

-> (ann (cons 'a 1) (Pairof Any Any))
- : (Pairof Any Any)
'(a . 1)

That works as expected.  As does:

-> (define t (cons 'a 1))
-> (ann t (Pairof Any Any))
- : (Pairof Any Any)
'(a . 1)

Now, if I do

-> (ann (hash 'a 1 'b "cat") (HashTable Any Any))
- : (HashTable Any Any)
'#hash((a . 1) (b . "cat"))

That also works as expected.  Things get weird if I do:

-> (define t* (hash 'a 1 'b "cat"))
-> (ann t* (HashTable Any Any))

This gives a type mismatch error:

; readline-input:30:5: Type Checker: type mismatch
;   expected: (HashTable Any Any)
;   given: (HashTable Symbol (U String One))
;   in: t*

Am I being completely daft here?  Is there some hidden knowledge
required to use
hash tables here?

Note that the following also does not work:

-> (ann t* (HashTable Symbol (U String Integer)))
; readline-input:31:5: Type Checker: type mismatch
;   expected: (HashTable Symbol (U Integer String))
;   given: (HashTable Symbol (U String One))
;   in: t*

Regards,

Matthew Eric

-- 
Matthew Eric Bassett | http://mebassett.info

--

-- 
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+unsubscribe@...
For more options, visit https://groups.google.com/d/optout.
Hendrik Boom | 22 May 19:46 2016

trying to get pregenerated html into scribble

I'm trying to include output from another program into a scribble document.
That other program produces HTML.

So what I want is, for this text, use some kind of element that 
contains the html that has already been produced, rather than go 
through the entore scribble mechanism to produce the html.

*

Now there appear to be a lot of functions available already to create 
html, documented in section 2 of 
https://plt.eecs.northwestern.edu/snapshots/current/pdf-doc/scribble-pp.pdf

Presumably I should write one of my own that reads the external file 
into a string and wraps it like these do.

but I can't figure out how to get scribble into a state where it 
I can embed calls to these functions into a scribble file.

Any ideas? or examples?  Or am I going about this all wrong?

*

I tried cutting and pasting an example on page 19 from section 1.5 
Using External Files, of that paper, because it inluded a file that 
contained explicit HTML, instead of funtions thaht generate html.  It 
did use  <at> -escapes withing the html to invoke scrible primitives, so it 
wasn't quite an HTML file:

main file, htest.scrbl:

#lang scribble/text
 <at> (require racket/list)
 <at> (define (itemize . items)
   (list
    "<ul>"
    (add-between
     (map (lambda (item)
             <at> list{<li> <at> |item|</li>})
          items)
     "\n")
    "</ul>"))
 <at> (define title "Todo")
 <at> (define summary
    <at> list{If that's not enough,
         I don't know what is.})
 <at> include["template.html"]

template.html:

<html>
<head><title> <at> |title|</title></head>
<body>
  <h1> <at> |title|</h1>
   <at> itemize[ <at> list{Hack some}
            <at> list{Sleep some}
            <at> list{Hack some
                 more}]
  <p><i> <at> |summary|</i></p>
</body>
</html>

when I did this I got error messages I could not understand:

hendrik <at> notlookedfor:~/write/tryscribble$ make test.html
scribble --html htest.scrbl
dynamic-require: name is not provided
  name: 'doc
  module: 
#<resolved-module-path:"/home/hendrik/write/tryscribble/htest.scrbl">
  context...:
   /usr/share/racket/pkgs/scribble-lib/scribble/run.rkt: [running body]
Makefile:4: recipe for target 'test.html' failed
make: *** [test.html] Error 1
hendrik <at> notlookedfor:~/write/tryscribble$ 

Of course, what I really want is to include an html file without 
interpreting the  <at>  signs, but I thought this might be a start.

-- hendrik

--

-- 
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+unsubscribe@...
For more options, visit https://groups.google.com/d/optout.


Gmane