Re: [racket-users] continuing after a user break

2015-07-27 Thread Jay McCarthy
On Mon, Jul 27, 2015 at 4:48 PM, John Carmack  wrote:
> Any chance that could make it in as a DrRacket feature?  Seems likely to have 
> moderately broad utility.
>
> Out of curiosity, what programming environment do the core Racket devs use 
> when programming Racket?  I quite like DrRacket for my projects that are only 
> a few files, but it doesn't seem to be aimed at large scale work.
>

Many Racketeers use DrRacket for very big things, but I'd say that it
requires a few changes to the default configuration to work really
well. Such as turning on tabs and getting used to its keybindings and
the ability to open module paths directly. Similarly, getting used to
using the syntax arrows is really useful for big programs.

I am a black sheep, however, and am often chided by Matthias because I
use Emacs for everything. I use a very small piece of Greg
Hendershot's racket-mode, which is partly designed to be like a good
Lisp mode but for Racket and partly designed for porting over the
awesome features of DrRacket. I mostly use Emacs because of the
historical baggage of all my keybindings and environment and quickly
getting around my files.

Jay

> -Original Message-
> From: Matthew Flatt [mailto:mfl...@cs.utah.edu]
> Sent: Monday, July 27, 2015 2:43 PM
> To: John Carmack
> Cc: Racket Users
> Subject: Re: [racket-users] continuing after a user break
>
> At Mon, 27 Jul 2015 19:32:32 +, John Carmack wrote:
>> Is it possible to continue execution after a ^b user break in DrRacket
>> (not debugging)?  It would often be useful to be able to ^b, print
>> some global state, set some flags, and continue running.
>
> The `exn:break` exception record includes a `continuation` field. An 
> exception handler can apply that continuation to resume from the point of the 
> break.
>
> A significant limitation is that the handler has to be installed with 
> `call-with-continuation-handler` or `uncaught-exception-handler`. If any 
> `with-handlers` is in effect, it will catch any continuation and escape to 
> the `with-handlers` form, at which point the continuation in `exn:break` 
> cannot be applied (because it's an escape-only continuation).
>
> 
>
> #lang racket
>
> (let ([orig (uncaught-exception-handler)])
>   (uncaught-exception-handler
>(lambda (exn)
>  (if (exn:break? exn)
>  (begin
>(printf "continuing...\n")
>((exn:break-continuation exn)))
>  (orig exn)
>
> (let loop () (loop))
>
> --
> 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.



-- 
Jay McCarthy
http://jeapostrophe.github.io

   "Wherefore, be not weary in well-doing,
  for ye are laying the foundation of a great work.
And out of small things proceedeth that which is great."
  - D&C 64:33

-- 
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] continuing after a user break

2015-07-27 Thread John Carmack
Any chance that could make it in as a DrRacket feature?  Seems likely to have 
moderately broad utility.

Out of curiosity, what programming environment do the core Racket devs use when 
programming Racket?  I quite like DrRacket for my projects that are only a few 
files, but it doesn't seem to be aimed at large scale work.

-Original Message-
From: Matthew Flatt [mailto:mfl...@cs.utah.edu] 
Sent: Monday, July 27, 2015 2:43 PM
To: John Carmack
Cc: Racket Users
Subject: Re: [racket-users] continuing after a user break

At Mon, 27 Jul 2015 19:32:32 +, John Carmack wrote:
> Is it possible to continue execution after a ^b user break in DrRacket 
> (not debugging)?  It would often be useful to be able to ^b, print 
> some global state, set some flags, and continue running.

The `exn:break` exception record includes a `continuation` field. An exception 
handler can apply that continuation to resume from the point of the break.

A significant limitation is that the handler has to be installed with 
`call-with-continuation-handler` or `uncaught-exception-handler`. If any 
`with-handlers` is in effect, it will catch any continuation and escape to the 
`with-handlers` form, at which point the continuation in `exn:break` cannot be 
applied (because it's an escape-only continuation).



#lang racket

(let ([orig (uncaught-exception-handler)])
  (uncaught-exception-handler
   (lambda (exn)
 (if (exn:break? exn)
 (begin
   (printf "continuing...\n")
   ((exn:break-continuation exn)))
 (orig exn)
   
(let loop () (loop))

-- 
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] UDP bytes?

2015-07-27 Thread Слава ПолноеИмя
It is simply awesome! Thanks!


понедельник, 27 июля 2015 г., 22:54:22 UTC+3 пользователь Matthew Flatt написал:
> At Sun, 26 Jul 2015 22:42:48 -0700 (PDT), Слава ПолноеИмя wrote:
> > Sorry, list, for dumb unprofessional question, but I'm not even amateur 
> > programmer)
> > How can I convert string and floats to bytes, that can be passed to 
> > udp-send? 
> > Tried real->floating-point-bytes and string->bytes/utf-8 but it produces 
> > not 
> > compatible output. 
> 
> The `real->floating-point-bytes` bytes conversion gives you a machine
> representation of number. To convert bytes back to a number, you'd use
> `floating-point-bytes->real`.
> 
> Alternatively, you could use `number->string` to get a human-readable
> encoding of a number, and then using `string->bytes/utf-8` to encode
> the string into bytes. The reverse would be `bytes->string/utf-8` and
> then `string->number`.
> 
> 
> > Any best practices of forming udp datagrams in racket exists?
> 
> A more general strategy would be to use `write` to convert anything to
> bytes, then then use `read` to convert back from a byte string to the
> value. The `read` and `write` functions work on ports, and some ports
> can write to or read from a byte string. This approach works for
> numbers, strings, symbols, lists, and other things that can round-trip
> with `read` and `write`.
> 
> (define (value->bytes v)
>   (define o (open-output-bytes))
>   (write v o)
>   (get-output-bytes o))
> 
> (define (bytes->value bstr)
>   (define i (open-input-bytes bstr))
>   (read i))

-- 
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] UDP bytes?

2015-07-27 Thread Matthew Flatt
At Sun, 26 Jul 2015 22:42:48 -0700 (PDT), Слава ПолноеИмя wrote:
> Sorry, list, for dumb unprofessional question, but I'm not even amateur 
> programmer)
> How can I convert string and floats to bytes, that can be passed to udp-send? 
> Tried real->floating-point-bytes and string->bytes/utf-8 but it produces not 
> compatible output. 

The `real->floating-point-bytes` bytes conversion gives you a machine
representation of number. To convert bytes back to a number, you'd use
`floating-point-bytes->real`.

Alternatively, you could use `number->string` to get a human-readable
encoding of a number, and then using `string->bytes/utf-8` to encode
the string into bytes. The reverse would be `bytes->string/utf-8` and
then `string->number`.


> Any best practices of forming udp datagrams in racket exists?

A more general strategy would be to use `write` to convert anything to
bytes, then then use `read` to convert back from a byte string to the
value. The `read` and `write` functions work on ports, and some ports
can write to or read from a byte string. This approach works for
numbers, strings, symbols, lists, and other things that can round-trip
with `read` and `write`.

(define (value->bytes v)
  (define o (open-output-bytes))
  (write v o)
  (get-output-bytes o))

(define (bytes->value bstr)
  (define i (open-input-bytes bstr))
  (read i))

-- 
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] continuing after a user break

2015-07-27 Thread Matthew Flatt
At Mon, 27 Jul 2015 19:32:32 +, John Carmack wrote:
> Is it possible to continue execution after a ^b user break in DrRacket (not 
> debugging)?  It would often be useful to be able to ^b, print some global 
> state, set some flags, and continue running.

The `exn:break` exception record includes a `continuation` field. An
exception handler can apply that continuation to resume from the point
of the break.

A significant limitation is that the handler has to be installed with
`call-with-continuation-handler` or `uncaught-exception-handler`. If
any `with-handlers` is in effect, it will catch any continuation and
escape to the `with-handlers` form, at which point the continuation in
`exn:break` cannot be applied (because it's an escape-only
continuation).



#lang racket

(let ([orig (uncaught-exception-handler)])
  (uncaught-exception-handler
   (lambda (exn)
 (if (exn:break? exn)
 (begin
   (printf "continuing...\n")
   ((exn:break-continuation exn)))
 (orig exn)
   
(let loop () (loop))

-- 
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] continuing after a user break

2015-07-27 Thread John Carmack
Is it possible to continue execution after a ^b user break in DrRacket (not 
debugging)?  It would often be useful to be able to ^b, print some global 
state, set some flags, and continue running.

-- 
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] saving a BMP in racket

2015-07-27 Thread Matthew Flatt
I've updated `racket/draw` to restore support for writing BMP files.

At Sun, 26 Jul 2015 11:55:51 -0400, "'John Clements' via Racket Users" wrote:
> 
> > On Jul 23, 2015, at 2:47 AM, copycat  wrote:
> > 
> > Yes, i can and will try with the old imagemagick bindings.
> > 
> > On Thursday, July 23, 2015 at 6:28:00 AM UTC+8, johnbclements wrote:
> >>> On Jul 20, 2015, at 4:11 AM, copycat  wrote:
> >>> 
> >>> Hi, not sure if this is considered a bug?
> >>> 
> >>> (send model save-file "model1.bmp" 'bmp)
> >>> 
> >>> save-file in bitmap%: kind saving not yet implemented: 'bmp
> >>> 
> >>> I found this link, and it's been 2 years since. Is it an update that will 
> take a long time?
> >>> 
> >>> http://stackoverflow.com/questions/14987784/how-can-i-save-a-bmp-in-racket
> >> 
> >> My guess is that no one is currently working on this. I just took a quick 
> 1-minute look at the respective wikipedia pages for PNGs and BMPs, and it 
> appears that although in principle BMP can support things that PNG cannot 
> (e.g., arbitrary bit-depth color channels), a PNG is not likely to lose any 
> of 
> the information associated with a racket bitmap%, meaning that generating a 
> PNG and then converting it to a BMP using an external utility should produce 
> the same result as directly creating a BMP. Granted, it’s not as convenient.
> >> 
> >> Given this, would you consider this issue resolved if the word “yet” was 
> simply removed from the error message?
> 
> I’ve reworded this error message and pushed the change; I will cheerfully 
> revert it if anyone objects.
> 
> John
> 
> >> 
> >> Best,
> >> 
> >> John Clements
> >> 
> >> 
> >>> 
> >>> -- 
> >>> 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.

-- 
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] What limits would you put on racket?

2015-07-27 Thread Pierpaolo Bernardi
On Fri, Jul 24, 2015 at 4:31 PM, Hendrik Boom  wrote:

> You might be interested in the language Styx, the language that goes with
> the Inferno operating system.  I believe it uses reference counting up
> front, with full garbage collection as a backstop.

The language is called Limbo.  Styx is Inferno (and Plan 9) network protocol.

> Inferno can be run on the bare metal, but also as a user process on Linux
> (and some other OS's, I believe).

At least on Windows too.

Nowadays is completely dead, though.  And, IMHO the interesting ideas
in Plan 9/Inferno were NOT in the programming languages created for
them.

-- 
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] Re: Slack team for racket

2015-07-27 Thread mazert

Le 27/07/2015 04:13, Jason Yeo a écrit :

Hi Everyone!

For anyone out there who finds IRC too daunting and difficult to use, there's a 
slack team created just for racketlang at http://racket.slack.com. Get invites 
to the team at http://racket-slack.herokuapp.com.

Cheers,
Jason



Hello,

IRC and a Newsgroup/Mailing-list is largely enough. I think it is better 
to centralize a community around 1-2 services, otherwise you have to 
post your question on a lot of services to hope having an answer, or to 
discuss about a specific subject.


And honestly, if a developer finds that IRC is too complicated, he 
should do something else ;). But for people who already use slack.com 
why not !


--
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.