Tony Garnock-Jones | 20 Dec 20:05 2014

SIgnal-catching in Racket

Hi all,

If I wanted to catch a Unix signal (say, SIGUSR1) within my Racket
program, how should I go about it?

My current best guess is:
 - load a C extension, which
 - creates a semaphore and
 - hooks the signal with a handler (MZ_SIGSET looks relevant), which
 - posts to the semaphore when the signal arrives.

However this seems like a recipe for problems. Is it even permitted to
post to a semaphore from a signal handler? Will the runtime be upset
about unscheduled intrusions into its demesne? Is it possible for a C
extension to allocate a global value like a semaphore and make it
available to Racket code?

Is there a better way?

 - Perhaps a self-pipe would be better than a semaphore?
 - A thread from 2006 [1] points at scheme_signal_received() but
   I don't understand why creating an event type is the right thing
   to do.



  Racket Users list:
(Continue reading)

Johan Jeuring | 18 Dec 08:53 2014


      Trends in Functional Programming in Education (TFPIE 2015)
                          Call for papers

The 4th International Workshop on Trends in Functional Programming in Education,
TFPIE 2015, will be held on June 2, 2015 in Sophia-Antipolis in France. It is
co-located with the Symposium on Trends in Functional Programming (TFP 2015)
which takes place from June 3 - 5.

*** Goal ***

The goal of TFPIE is to gather researchers, teachers and professionals that use,
or are interested in the use of, functional programming in education. TFPIE aims
to be a venue where novel ideas, classroom-tested ideas and work-in-progress on
the use of functional programming in education are discussed. The one-day
workshop will foster a spirit of open discussion by having a review process for
publication after the workshop. The program chair of TFPIE 2015 will screen
submissions to ensure that all presentations are within scope and are of
interest to participants. Potential presenters are invited to submit an extended
abstract (4-6 pages) or a draft paper (up to 16 pages) in EPTCS style. The
authors of accepted presentations will have their preprints and their slides
made available on the workshop's website/wiki. Visitors to the TFPIE 2015
website/wiki will be able to add comments. This includes presenters who may
respond to comments and questions as well as provide pointers to improvements
and follow-up work. After the workshop, presenters will be invited to submit (a
revised version of) their article for review. The PC will select the best
articles for publication in the journal Electronic Proceedings in Theoretical
Computer Science (EPTCS). Articles rejected for presentation and extended
abstracts will not be formally reviewed by the PC. TFPIE workshops have
previously been held in St Andrews, Scotland (2012), Provo Utah, USA (2013), and
(Continue reading)

Robby Findler | 20 Dec 16:15 2014

DrRacket UI Translation Help Requested

Hi All: DrRacket has a number of translations of it's GUI that are in
varying states of decay (German and French are both actively
maintained but . If you would like to help maintain one of them, that
help would be most welcome! Please hop on over to the
translators@... mailing list, where I'll post some
instructions on getting started shortly.

  Racket Users list:

WarGrey | 20 Dec 05:23 2014

Is typed racket ready for web application?

Hello, ignoring the state of not supporting unit in typed racket. If I will (require/typed) all I need, are
there any problems to develop a real world (personal but modern) web system with stateless servlets in
typed racket? 
  Racket Users list:

Peter Achten | 19 Dec 17:49 2014

[TFP 2015] 1st call for papers

                         C A L L   F O R   P A P E R S

                         ======== TFP 2015 ===========

               16th Symposium on Trends in Functional Programming
                                June 3-5, 2015
                        Inria Sophia Antipolis, France

The symposium on Trends in Functional Programming (TFP) is an
international forum for researchers with interests in all aspects of
functional programming, taking a broad view of current and future
trends in the area. It aspires to be a lively environment for
presenting the latest research results, and other contributions (see
below). Authors of draft papers will be invited to submit revised
papers based on the feedback receive at the symposium.  A
post-symposium refereeing process will then select a subset of these
articles for formal publication.

The selected revised papers are expected to be published as a Springer
Lecture Notes in Computer Science (LNCS) volume.

TFP 2015 will be the main event of a pair of functional programming
events. TFP 2015 will be accompanied by the International Workshop on
Trends in Functional Programming in Education (TFPIE), which will take
place on June 2nd.

The TFP symposium is the heir of the successful series of Scottish
(Continue reading)

George Neuner | 19 Dec 03:03 2014

lists and pg-arrays

Hi all,

Using 6.0.1.   I just painfully discovered that

    (pg-array-≥list (list->pg-array (list)))
    => ERROR
    pg-array-≥list: expected argument of type <pg-array of dimension 1>; 
given: (pg-array 0 '() '() '#())

The documentation for  list->pg-array  states that it produces an array 
of dimension 1.  However, if you pass an empty list, you get back an 
array of dimension zero which you then can't transform back to a list [ 
except by going straight to the internal vector ].

My question is, "shouldn't these conversions be symmetric?"   I 
understand  an array with no elements is meaningless as an array, but 
Postgresql (ab)uses arrays as substitutes for lists and sets, so an 
empty array does have meaning.

Just a thought.


  Racket Users list:

Matthew Butterick | 18 Dec 20:02 2014

how to write a contract for indeterminate number of return values

"If (values range-expr ...) is used as the last sub-form of ->, the function must produce a result for each
contract, and each value must match its respective contract." [1]

I understand what this means if you have a fixed number of return values. But how do you write an output
contract for an indeterminate number of return values? 

Similar to how (listof type?) contract doesn't care how long the list is, I'm trying to write a contract that
means "however many values come back, they all need to be integers".

  Racket Users list:

Jens Axel Søgaard | 18 Dec 16:31 2014

New grammar for highlighting Racket code on GitHub

Hi All,

Github has until recently used a lexer for Racket from Pygments to
recognize and color tokens
for programs written in Racket. Unfortunately they have stopped using
Pygments and now
use TextMate grammars. TextMate is an editor that is famous for its
support for a plethora
of programming languages. To support many languages TextMate (read
Allan Odgaard)
created a file format to describe language grammars. Being a success
in TextMate, the
editors SublimeText[123] has chosen to support the same grammars. Github's
SublimeText copy (the editor Atom) also supports these grammars. Since the two
favorite editors in the Racket community are DrRacket and Emacs, the
Racket grammar
needed an upgrade. I have thus attempted to improve the grammar, see link below.
Before making a pull request to Github, I like to run the new
highlighter by you in order
to fix any oversights first.

Since the TextMate grammars are based on regular expressions (mostly being
applied to one line at a time), there are some restrictions on the
kind of constructs that can
be recognized. For example, nested multiline comments are at best
tricky (I am tempted to
say impossible) to lex parse properly. For the same reason s-expressions
comments (prefixed with #;) are handled by just coloring the #;.

Here is an example of the current colorer:
(Continue reading)

Snyder Pearson | 18 Dec 09:20 2014

Memory buildup (leak?) when using `copy-port` with SSL connections.

I build this simple TLS upgrading proxy[2], which sits in front of a TLS service and just accepts connections using any SSL/TLS version that Racket supports and forwards the data to the service using the default TLS version (why would I need this is a long story :)).

When stress testing this using boom [1], I see significant memory buildup.  This memory is not released when the test finishes.  It only gets reclaimed when I kill the proxy process.  So I suspect there is some kind of memory leak going on here.

In principle, the only values constructed on each iteration of the loop are the SSL connection ports, which I'm closing when |pipe| exits.

Am I using copy-port wrong, or maybe it is itself leaking memory?

This is using Racket v6.1.1 on Ubuntu 14.10.


[2] Source:

#lang racket

(require openssl)

(define DEBUG #f)

(define (pipe in out)
  (thread (λ ()
             (if DEBUG
               (copy-port in (current-output-port) out)
               (copy-port in out))
             (close-output-port out)
             (close-input-port in))))

(define accept (if DEBUG ssl-accept/enable-break ssl-accept))
(define connect (if DEBUG ssl-connect/enable-break ssl-connect))

(define listener (ssl-listen 62445))
(ssl-load-private-key! listener "pk.pem")
(ssl-load-certificate-chain! listener "cert.pem")

(let loop ()
  (let-values (((from-src to-src) (accept listener)))
      (λ ()
         (let-values (((from-dest to-dest)
                            (connect "localhost" 62444 'tls)))
           (pipe from-src to-dest)
           (pipe from-dest to-src)))))
  Racket Users list:
Michael Sperber | 18 Dec 09:19 2014

BOB conference on Jan 23 in Berlin: Early-bird registration ends Friday, Dec 19!


			       BOB 2015

	     "What happens if we simply use what's best?"
			   January 23.2015


BOB is the conference for developers, architects and decision-makers
to explore technologies beyond the mainstream in software development,
and to find the best tools available to software developers today.
Our goal is for all participants of BOB to return home with new
insights that enable them to improve their own software development

The program features 14 talks and 8 tutorials on current topics:

The subject range of talks includes functional programming,
microservices, package management, and data management.

The tutorials feature introductions to Erlang, Haskell, Swift, and
ClojureScript, and their applications.

Anil Madhavapeddy will hold the keynote talk - about unikernels and
functional programming.

Registration is open online:

NOTE: The early-bird rates expire on Dec. 19, 2014!

BOB cooperates with the :clojured conference on the following day.
There is a registration discount available for participants of both events.

  Racket Users list:

Neil Van Dyke | 18 Dec 04:27 2014

comments on format for api documentation embedded in modules

Anyone have comments on how they'd like to embed API documentation 
within Racket module source code?

I've done in two ways so far, and am about to write a new tool for this, 
so I have a chance to rethink it.  The earlier two ways;

* The first way I did it, for generic Scheme, was in Funcelit 
("functionally-illiterate programming"), which let me embed fragments of 
Texinfo documentation throughout the code by prefixing each line with 
";;;".  Along with a few other conveniences.  The main drawback was that 
you couldn't encode type information, and also I wanted to be able to 
use all the Scribble goodness (e.g., BNF).

* The second way I did it, for McFly in Racket, was to have a dummy 
syntax form (named `doc`) that could be put most anywhere at toplevel, 
and into which you could embed Scribble code.  Along with a few other 
conveniences (like a special form for package history, and inferring 
procedure signatures in some cases).  The main drawbacks were that 
Scribble documentation was a little harder to read and write than 
Texinfo documentation, and that the eye couldn't tell documentation and 
code apart well enough (I never got around to adding syntax coloring for 
this to Emacs like I did for Funcelit). (Incidentally, I ended up not 
using the signature inference in practice, since I almost always ended 
up writing in `racket/base` and without contracts.)

For the new tool, I'm leaning strongly towards the documentation format 
being exactly like in McFly, but I'm open to comments.

Neil V.

  Racket Users list: