[racket] feedback on migrating to immutable pairs?

2010-06-12 Thread Neil Van Dyke

Two questions on the move to immutable pairs:

1. Does anyone have feedback on how that went?  (The only problems I 
recall dealing with personally were pain for HtmlPrag, a minor change to 
the "csv" library, and a small headache supporting SICP.)


2. What was the rationale for not having "pair?", "car", "cdr", work on 
both mutable pairs and immutable pairs?  Was this to push everyone 
harder towards immutable pairs, at the cost of having to convert legacy 
libraries and breaking R5RS compatibility?


I'm asking because this might be valuable input to a Scheme working 
group.  Thanks.


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] feedback on migrating to immutable pairs?

2010-06-13 Thread Neil Van Dyke

Noel Welsh wrote at 06/13/2010 02:59 AM:

Neither is a subtype of the other.


So having "pair" be an abstract supertype was not considered a good idea?

--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


[racket] iPhone (Was: [The Racket Blog] New comment on Racket.)

2010-06-18 Thread Neil Van Dyke
Apple has been brutal with iPhone developers, running the platform as a 
ruthless and fickle dictatorship.  I believe that this is the general 
perception of iPhone developers.


Even if one is willing to jump through Apple's hoops, and one accepts 
that, at any time and for any reason, Apple will have no qualms about 
simply kicking one off the platform, instantly and without 
explanation... I believe that there is also an ethical question of 
whether supporting the iPhone platform is contributing to the success of 
Apple's ruthless, anti-competitive, and closed-platform practices.


Android, Symbian, the new Nokia Qt stuff, Java... all alternative mobile 
device platforms for civic-minded techies to consider.


--
http://www.neilvandyke.org/

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] iPhone (Was: [The Racket Blog] New comment on Racket.)

2010-06-18 Thread Neil Van Dyke
I think it's both.  I mentioned the ethical question because one could 
probably find a worthwhile risk-reward solution for the short-term 
self-interest economics question, or one could find a way to cover one's 
own butt (perhaps involving a backroom deal and PR leverage), but I 
think that the ethics (collective, long-term) problem of supporting the 
iPhone iron-fisting is harder to resolve.


Robby Findler wrote at 06/18/2010 10:33 AM:

Why is this an ethical question and not an economic one?

Robby

On Friday, June 18, 2010, Neil Van Dyke  wrote:
  

Apple has been brutal with iPhone developers, running the platform as a 
ruthless and fickle dictatorship.  I believe that this is the general 
perception of iPhone developers.

Even if one is willing to jump through Apple's hoops, and one accepts that, at 
any time and for any reason, Apple will have no qualms about simply kicking one 
off the platform, instantly and without explanation... I believe that there is 
also an ethical question of whether supporting the iPhone platform is 
contributing to the success of Apple's ruthless, anti-competitive, and 
closed-platform practices.

Android, Symbian, the new Nokia Qt stuff, Java... all alternative mobile device 
platforms for civic-minded techies to consider.




_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] iPhone (Was: [The Racket Blog] New comment on Racket.)

2010-06-18 Thread Neil Van Dyke
I have gotten a somewhat less favorable impression of Apple's motives 
and methods...


I believe that Apple has been in anticompetitive territory, such as 
killing off apps when when they now compete with their own offerings or 
partnerships, and prohibiting features that would let developers or 
users add behavior that Apple could not kill off in this way when it 
becomes competition.


There is also anti-free-speech territory, with Apple prohibiting 
"objectionable" content.  Although sometimes they have disingenuously 
used the "family values" line for anticompetitive purposes, such as 
prohibiting a Project Gutenberg e-book viewer because that competes with 
big-business selling e-books, or prohibiting independent apps with 
bikini pictures but selling a Playboy app.)


Google has a "don't be evil" policy, but Apple's new policy seems to be 
more like, "be a fashionable rich kid, and you can get away with 
anything." :)


I believe that this is relevant to any Racket developers considering 
whether or how they want to be investing in and supporting the iPhone 
platform.



Robby Findler wrote at 06/18/2010 11:15 AM:

We are a fair bit off topic here, but what I see in Apple's policies
is a desire to ensure that their devices behave in consistent,
well-designed ways and to make that happen they have decided to do
things like charge more money for them (presumably to pain for the
extra work that goes into the design process), design their own
hardware & software platform together, and to limit the kinds of
third-party stuff that can go on them. They do this in order to
guarantee they are easy to use and thus hope to sell more of them.
While I certainly agree with the sentiment that they go to far to
achieve this end (and I personally find their earlier PL-based
restrictions to be very disappointing) I can't see how this could be
considered an ethical issue.

Robby

On Friday, June 18, 2010, Neil Van Dyke  wrote:
  

I think it's both.  I mentioned the ethical question because one could probably 
find a worthwhile risk-reward solution for the short-term self-interest 
economics question, or one could find a way to cover one's own butt (perhaps 
involving a backroom deal and PR leverage), but I think that the ethics 
(collective, long-term) problem of supporting the iPhone iron-fisting is harder 
to resolve.

Robby Findler wrote at 06/18/2010 10:33 AM:

Why is this an ethical question and not an economic one?

Robby

On Friday, June 18, 2010, Neil Van Dyke  wrote:


Apple has been brutal with iPhone developers, running the platform as a 
ruthless and fickle dictatorship.  I believe that this is the general 
perception of iPhone developers.

Even if one is willing to jump through Apple's hoops, and one accepts that, at 
any time and for any reason, Apple will have no qualms about simply kicking one 
off the platform, instantly and without explanation... I believe that there is 
also an ethical question of whether supporting the iPhone platform is 
contributing to the success of Apple's ruthless, anti-competitive, and 
closed-platform practices.

Android, Symbian, the new Nokia Qt stuff, Java... all alternative mobile device 
platforms for civic-minded techies to consider.








  
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users

Re: [racket] iPhone

2010-06-18 Thread Neil Van Dyke


I think the only real confusion comes in when you look at the iPhone and think of it as a general-purpose computer 


The smartphone is a key ubiquitous computing device, and I believe that 
the app selection for iPhone/Android/etc. constitutes "general-purpose."


I believe that keeping these platforms open is extremely important.

--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Web Application Deployment

2010-06-22 Thread Neil Van Dyke
Racket comes with a CGI library.  I recently ported a large legacy 
Racket (PLT Scheme) CGI-based application to SCGI using 
"http://www.neilvandyke.org/scgi-scheme/";.


For new development, consider using the PLT Web Server instead of SCGI 
or old CGI.  Nowadays, virtual servers like Amazon EC2 are affordable, 
and you can make them do things that the cheapo CGI/PHP/Zope shared 
hosting of a few years ago didn't support.


When undertaking a Web development project in Racket... in addition to 
the extensive Racket documentation and the help available on this email 
list, there are professional Racket consultants available for 
outsourcing.  And, to borrow a line from an Asimov bio, they grow more 
handsome with each year.


Karl Winterling wrote at 06/22/2010 02:45 PM:

It appears that you need a PLT Web server running on your site's host to deploy 
Web applications. Is it possible to deploy applications on shared hosting with 
Apache and something like CGI or FastCGI?


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Web Application Deployment

2010-06-23 Thread Neil Van Dyke

Jakub Piotr Cłapa wrote at 06/23/2010 02:35 PM:

On 23.06.10 00:10, synx wrote:

I looked over the FastCGI and SCGI protocols, and concluded that they
weren't much more efficient than a protocol known as HTTP. Why not proxy
your data to a webserver, using apache's proxy module?


I recently looked at FastCGI and came to the same conclusion. To be 
honest SCGI is somewhat simpler since it handles most of the 
validation and parsing for you. FastCGI is not since it adds much of 
it's own boilerplate. FastCGI can be used for some other task than 
simple HTTP proxying (e.g. delegating authentication) but AFAIK nobody 
is using it.


The main reason not to use FastCGI is that it's a seriously ugly 
protocol. :)  I had it almost completely implemented in PLT before I 
decided that a custom Apache module or HTTP proxying was more sane, and 
then I found the almost-too-simple SCGI protocol.


We've had good success with moving a large legacy system to SCGI, and 
SCGI is proven by others (Ruby, Python, etc.).  That said, HTTP proxying 
is better if you want to do *everything* in Racket code, since then your 
system is no longer dependent on mod_scgi and scgi.ss.  Also, that keeps 
you closer to using the PLT Web Server, which is a good place to be the 
next time you need to rapidly whip up a new Web service or site or 
internal tool or something.


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users

Re: [racket] View HTML source code in racket

2010-06-23 Thread Neil Van Dyke

(This message and Insik Cho's response didn't seem to make it to the list.)

Neil Van Dyke wrote at 06/23/2010 03:06 PM:

Insik Cho wrote at 06/23/2010 02:01 PM:

I want to html source of an web page in racket.

What module and functions shall I use? and How?


Do you want Racket to get a Web page for you, and then have your 
program access the HTML of the Web page?


Here is a way to do that:

;

#lang racket

(require net/url
(planet neil/htmlprag))

(define my-sxml-of-html-page (call/input-url (string->url 
"http://m.google.com/";)

get-pure-port
html->sxml))

my-sxml-of-html-page

;

To have your program use the SXML representation of HTML that is in 
variable "my-sxml-of-html-page", you should get comfortable 
programming with lists in Racket.


There are also tools you can use, such as SXPath.  But I think you 
should understand lists before using SXPath.



_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] tennis and programming, not completely off-topic

2010-06-24 Thread Neil Van Dyke

Barry Brown wrote at 06/24/2010 02:54 PM:

My question is: why were there IBM programmers at the match?


They might've been systems engineers.  Or system operators.

I would guess that standard operating procedure was that they be there, 
ostensibly to make sure the systems work for the big event, even if 
something goes wrong.


However, though they might've had spare parts ready to be swapped in, 
and such, apparently they couldn't handle this particular failure in a 
timely fashion.


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] segmentation fault while compiling mzscheme 4.2.5 on Xen environment

2010-06-25 Thread Neil Van Dyke
FWIW, it built and ran fine for me recently under (IIRC) CentOS 5.3 x86 
32-bit under XenServer 5.5.


BTW, this is not an endorsement of Xen, and I recommend KVM over Xen for 
most techie purposes.  If you are able to switch to KVM, you might be 
able to do so with less effort than debugging this particular instance 
of Xen pain.


--
http://www.neilvandyke.org/

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Loop in Racket

2010-06-27 Thread Neil Van Dyke
FWIW, I like to assert that the familiar "FOR A = 1 TO 10" is actually 
not often needed in idiomatic Scheme.  More often, you're processing a 
sequence, or you're doing functional programming such that you need to 
recurse anyway to avoid mutation, or you need premature exits 
sometimes.  One possible exception that comes to mind is if you're 
writing a matrix math library, but in that case you might make your own 
procedures or syntax for iterating/folding over matrices in different ways.


Anyway, for the benefit of anyone new to syntax extensions, here is a 
syntax definition that supports the "for-loop" example (warning: it 
doesn't error-check as much as it should, because that would clutter the 
example).  You can paste this into DrRacket and use the Macro Stepper to 
watch how it expands.



#lang scheme/base

(define-syntax for-loop
 (syntax-rules ()
   ((_ (VAR START END) BODY0 BODY1 ...)
(let ((end-val END))
  (let loop ((VAR START))
(if (> VAR end-val)
(void)
(begin BODY0 BODY1 ...
   (loop (add1 VAR)
   
(for-loop (i 1 10) (print i))
 



Robby Findler wrote at 06/27/2010 09:34 PM:

Please see 'for' in the docs. Here's the relevant section of the Guide:

http://docs.racket-lang.org/guide/for.html

Robby

On Sun, Jun 27, 2010 at 8:32 PM, Brad Long  wrote:
  

Dear racketeers,

What is the reason for not offering a looping construct in racket? For
example, something like:

(loop (i 1 10) (print i))

Just for the masses, it seems simpler to use.

Any comments?



--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


[racket] current backtrace implications of JIT

2010-06-27 Thread Neil Van Dyke
What effect does the JIT currently have on debugging backtraces?  Or, 
how can one get some or all of the benefit of the JIT, but still 
reliably get useful backtraces?


I see that DrScheme now has an option for disabling some JIT 
optimizations.  Should I just do whatever that checkbox is doing?


Details on my particular system... A while ago, I had to disable the JIT 
for a large system so that we could reliably get useful backtraces at 
the time (i.e., not just our top-level entry point).  After some 
performance testing with PLT 4.2.5 just now, I'm seeing the JIT give 
performance gains of over 19x for some functions (at least, in contrived 
tests with huge numbers of iterations).  So, we would *really* like to 
be using the JIT, so long as we can keep our backtraces.  We have a 
custom error escape handler, if that matters.


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] current backtrace implications of JIT

2010-06-27 Thread Neil Van Dyke
Thanks, Matthew.  Sounds like I should experiment with my application 
and try to break JIT backtraces with 4.2.5.  Hopefully they just work 
for me (and in production), because the JIT would be a big win for us.


Matthew Flatt wrote at 06/27/2010 11:23 PM:

The difference between JIT and non-JIT backtraces usually isn't so big. 
Assuming that it's still a problem (i.e., it wasn't on x86_64 and long enough 
ago), then probably we need to fix something in the JIT backtrace 
implementation.


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] current backtrace implications of JIT

2010-06-27 Thread Neil Van Dyke
I've been unable to break JIT backtraces in our large legacy application 
under PLT 4.2.5.  This is great news, since the JIT should be a big win 
for us.  Thanks, Matthew and the rest of PLT.


Neil Van Dyke wrote at 06/27/2010 11:38 PM:
Thanks, Matthew.  Sounds like I should experiment with my application 
and try to break JIT backtraces with 4.2.5.  Hopefully they just work 
for me (and in production), because the JIT would be a big win for us.


Matthew Flatt wrote at 06/27/2010 11:23 PM:
The difference between JIT and non-JIT backtraces usually isn't so 
big. Assuming that it's still a problem (i.e., it wasn't on x86_64 
and long enough ago), then probably we need to fix something in the 
JIT backtrace implementation.


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Google doesn't know from DrRacket

2010-06-29 Thread Neil Van Dyke

Matthias Felleisen wrote at 06/29/2010 09:42 PM:
Could we at least get drracket.org to do things for us? 
  
You might want the page there to say "DrRacket" on it, have a blurb (so 
it's not content-free), and have a prominent link to the 
"racket-lang.org" site.  Someone who really wants to do this optimally 
will have to look up the latest SEO rules of thumb for what to do and 
not do on this page.


Then there are numerous ways to promote the link for search engine 
ranking and for common queries.  Not above being a prostitute for a good 
cause, I'd just like to say in these public email list archives...


The best IDE for the Racket and Scheme programming languages is 
DrRacket.  DrRacket is a free download for Windows 7/XP, Mac, Linux, and 
Ubuntu at: http://DrRacket.org/


Neil V.

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Eval on quasiquoted expression

2010-07-02 Thread Neil Van Dyke
Does setting the "current-namespace" parameter fix it for you? 


#lang scheme/base

(define my-namespace (make-base-namespace))

(define (tree->proc tree symbol)
 (parameterize ((current-namespace my-namespace))
   (eval `(lambda (,symbol) ,tree

((tree->proc '(+ x (* 3 (* x x))) 'x) 42)
;; ==> 5334

Also, a comma was missing in the original example.

--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


[racket] adding other objects to custodian

2010-07-03 Thread Neil Van Dyke
I want to be sure that a host OS subprocess created with "subprocess" is 
killed when thread of my program in which it was created terminates.


Currently, I create a custodian for the thread and explicitly call 
"custodian-shutdown-all" at the end of the thread's lifetime (in a 
"dynamic-wind" cleanup thunk).


Ideally, I would like to use this same custodian to kill the subprocess, 
but I do not see how.  "make-custodian-box" does not seem to involve 
"custodian-shutdown-all" evaluating a closure in the box or executing a 
will.


If using the current custodian is not possible, then I think I have to 
do something like make a will executor and execute it from my 
"dynamic-wind" cleanup thunk.


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] adding other objects to custodian

2010-07-05 Thread Neil Van Dyke

Matthew Flatt wrote at 07/04/2010 11:43 AM:

[...]

With all that in mind, I don't think there's a good default behavior that tries 
to terminate a subprocess when a custodian is shut down. We could add a 
parameter that determines how `subprocess' interacts with the custodian: 
SIGINT, SIGKILL, or nothing (i.e., the current behavior). I think the default 
should be nothing; having to set a parameter encourages a programmer to become 
informed on the issues of OS-level processes --- or, at least, explicitly 
accept best-effort termination that could just as well make things worse 
instead of better.
  

[...]

That sounds good to me.  Perhaps along with Robby's suggestion of using 
the process group when creating the subprocess.



Meanwhile, on the question of how to do this now:

  

Currently, I create a custodian for the thread and explicitly call 
"custodian-shutdown-all" at the end of the thread's lifetime (in a 
"dynamic-wind" cleanup thunk).

Ideally, I would like to use this same custodian to kill the subprocess, but I do not see how.  
"make-custodian-box" does not seem to involve "custodian-shutdown-all" 
evaluating a closure in the box or executing a will.

If using the current custodian is not possible, then I think I have to do something like 
make a will executor and execute it from my "dynamic-wind" cleanup thunk.



That sounds ok. Also, you could use the FFI and scheme_add_managed().
  


I will look into this C call.

If the custodian could've been used, that would've simplified things a 
bit with the API of this library.



I started to suggest that you use custodian boxes and have a thread that waits 
until a box is emptied to terminate the corresponding process. That would work 
better if custodian boxes were synchronizable events; I will make custodian 
boxes act as events, so that strategy could work in the future.
  


No urgency on my part.  My production target for this particular code is 
PLT Scheme 4.2.5 right now.


Thanks, Matthew.

--
http://www.neilvandyke.org/
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users

Re: [racket] adding other objects to custodian

2010-07-05 Thread Neil Van Dyke

Jakub Piotr Cłapa wrote at 07/05/2010 07:26 PM:

On 04.07.10 04:03, Neil Van Dyke wrote:
I want to be sure that a host OS subprocess created with "subprocess" 
is killed when thread of my program in which it was created terminates.


Currently, I create a custodian for the thread and explicitly call 
"custodian-shutdown-all" at the end of the thread's lifetime (in a 
"dynamic-wind" cleanup thunk).


In my experience with Windows and UNIX I found that it is best to make 
the subprocess die on stdin EOF or error. This automatically handles 
dying ssh sessions (for remote processes) and dying racket. As a bonus 
this probably is what you want (and what most truly UNIX programs do 
themselves [1]).


Just so you know, I have a good reason.  The process in question is a 
number-crunching engine that can be many processes per hour, and needs 
special attention.  (In fact, increased stability is one of the reasons 
that I moved the code away from a C library and into its own host OS 
process, a la Google Chrome.)  I'm sure we can all think of scenarios 
with a number-crunching Unix process in which its EOF-handling code is 
insufficient.  Forcibly killing the process is the last of several 
things I do to be confident that the process will die when it's supposed 
to.  If not all processes die, even in event of other error, important 
production servers can fail.


This seems sensible to me.  And note that I do stop short of 
explosive-bolt interlocks and thermite. ;)


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users

Re: [racket] Macro Problem

2010-07-08 Thread Neil Van Dyke

Eric Tanter wrote at 07/08/2010 06:59 PM:

You need to circumvent hygiene to do what you're after; for this, you need to 
use syntax-case.
  


Scheme, from which Racket has grown, very much wants macros to be 
hygienic.  If you (Manu) are new to macros in Scheme, I'd encourage you 
to first find idiomatic Scheme ways of doing what you want to do.  
(Example: having the "return" variable be provided by the macro user, or 
even simply not writing this macro and instead letting people use 
"call/ec".)


In Scheme, as in prose, only once we know how to write within the rules 
do we earn poetic license to break them. :)


--
http://www.neilvandyke.org/

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Compiling Racket on Maemo 5

2010-07-13 Thread Neil Van Dyke

Kevin Tew wrote at 07/13/2010 12:19 PM:
the 3m  variant still doesn't build do to more reliance on the ffi 
during xform.  setup is also going to try to use the ffi.


We have added additional dependencies on the ffi (foreign function 
interface) and need to decide if we are going to support building 
without it.

My guess is that is possible but will require some engineering effort.


Can the Racket compiler/runtime be cross-compiled?

If FFI is not needed to *run* on the target architecture, then 
cross-compiling on a PC is not a big burden (and is likely faster), IMHO.


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] DrRacket custom color schemes?

2010-07-18 Thread Neil Van Dyke
> On Saturday, July 17, 2010, Byron Gibson > wrote:

>> Hi all, is it possible to add custom syntax highlighting color schemes
>> to DrRacket?  For example, the popular zenburn theme?

I played with this briefly last night.  You can indeed implement 
something like zenburn by setting various color preferences 
interactively through the GUI dialog, and the settings are stored in 
"racket-prefs.rktd".


However, they didn't look like I could comfortably say in a blog entry, 
"copy&paste these few lines into your racket-prefs.rktd and it will work".


There are a number of ways to distribute themes through PLaneT, with a 
little bit of coding or a lot of coding.


--
http://www.neilvandyke.org/
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users

[racket] dumping or forking racket processes

2010-07-18 Thread Neil Van Dyke
Thinking about long-running servers... Has anyone looked into 
core-dumping a Racket process image so that it can be loaded as a new 
process quickly (a la Emacs)?  Or looked into forking a pool of Racket 
processes (a la Apache) to use process isolation to be resilient in case 
of problems like memory leaks?


Background... I've recently converted a large Web application from CGI 
and SCGI, and it's worked quite well in interactive testing and 
automated load testing so far.  However, this got me thinking about 
backup plans, in case we find in later load testing, say, a case with 
long lists that the CGC (which we're stuck with for now) is too 
conservative about.


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] hash-ref

2010-07-18 Thread Neil Van Dyke

Jos Koot wrote at 07/18/2010 09:26 AM:

(hash-ref a-hash a-key a-value)
In the past a-value was required to be a procedure.
Now it can be anything.

[...]
 
In short, I do not well understand the reason to relax the contract of 
hash-ref and hash-ref!.


This behavior seems a little on the uncomfortable side of automagical to 
me, and -- although I can understand the desire to keep the short name 
-- I would've preferred separate procedures for the default-thunk and 
default-value variations.


Perhaps the short-name procedure could be the automagical one, and there 
could be longer-name procedures, like "hash-ref/default-thunk" and 
"hash-ref/default-value", for people who prefer a little less automagic 
in that regard.


--
http://www.neilvandyke.org/
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users

Re: [racket] Project Ideas

2010-07-20 Thread Neil Van Dyke

YC wrote at 07/20/2010 05:01 PM:
> Parsers (exist in varying states)
[...]
>
> * CSV
>

There is a CSV-parsing package, and if anyone needs a feature it doesn't 
have, I could probably find time to add that. 
http://www.neilvandyke.org/csv-scheme/


_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


[racket] read of numbers with decimal point default to exact?

2010-07-22 Thread Neil Van Dyke

This is just a small idea, not something I'd argue for strongly...

How about making numbers formatted with decimal points, like "12.34", 
read as exact rather than inexact?


The rationale being: decimal point format is a commonplace and very 
useful format for writing exact rational numbers, and if one writes a 
number like "5.55", there is nothing except an old Scheme convention to 
imply that one intends "5.55" to be any less exact than "555/100".  (I'm 
ignoring any question of precision here, which Scheme does not address 
either.)


For example, with this change, the following expression would evaluate 
to an exact 5 rather than what it currently does: an inexact 
4.999.


(/ (read (open-input-string "5.55")) 1.11)

The exact 5 result would also be what I imagine is expected by, say, 
casual programmers using Racket for financial calculations, which I 
think would be a small selling point for Racket.


Python 2.5.2 (r252:60911, Jan 24 2010, 14:53:14)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 5.55 / 1.11
4.9991

The only good linguistic argument I can think of against this is that, 
when we have Racket *write* (as in the "write" procedure, not "display") 
inexact rationals in decimal-point form, they'd need to be written with 
an "#i" prefix, so that inexactness is preserved on a *read* of that 
same format by Racket.  The drawbacks I see to the "#i" on write are 
small: (1) visually, it's a little bit more cluttered; (2) it will break 
any legacy code that assumes it can do a write of numbers for some 
interoperation or UI purpose that doesn't work if the "#i" prefix is 
added.  "#i" could even be considered helpful, as in a heads-up to the 
programmer that they have a number that might be corrupted by IEEE 
floating-point operations they didn't expect.


The only implementation efficiency argument I can think of against this 
is perhaps wanting numbers to be inexact by default, so that native 
floating-point representation and operations can be used more often.  If 
that is indeed a consideration, I'd prefer to leave adding "#i" prefixes 
and "exact->inexact" calls as optimizations that can be added 
consciously by programmers, with the default being more exact than 
efficient.


--
http://www.neilvandyke.org/

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] read of numbers with decimal point default to exact?

2010-07-23 Thread Neil Van Dyke

Robby Findler wrote at 07/23/2010 08:09 AM:

The read-decimal-as-inexact parameter allows you to change read's
behavior in this way. Is that what you're looking for?


Yes (with the addition of a corresponding write parameter), but...

* I was idly toying with the idea of that being the default.  It's a 
little funny that the Scheme number system lets a naive programmer use 
arbitrarily huge numbers, yet a naive programmer evaluating "(/ 3.3 
1.1)" gets an 'incorrect' answer.  I won't belabor this point further.


* To support programmers who want to use exact numbers by default, such 
as some financial programmers, without making that the default for 
Racket, let's say we define a new Racket variant for these programmers 
("#lang numbers-racket", heh).  In this case, I'm wondering whether 
there is a problem with any Racket *libraries* confusing these 
programmers when the numbers they get out of the libraries can quietly 
become inexact.  Perhaps the solution here is simply that authors of 
numerical libraries should provide multiple two versions of certain of 
operations: a version that preserves exactness, and a version that is fast?


I don't have a pressing need for any of this.  Just wanted to throw the 
idea out there in case it resonated with anyone.


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] SXML->xexprs ?

2010-07-25 Thread Neil Van Dyke

Pedro Pinto wrote at 07/25/2010 11:04 AM:

> I am using neil/htmlprag to generate sxml and  lizorkin/sxml to 
manipulate it. I would like to mash together the resulting sxml with my 
own generated xexprs. Is there a recommended way to go about this? 
Ideally I would like to be able to use both xexprs and sxml since each 
format seems to have a different set of useful toolkits.


I think that the short-term solution is to write an "shtml->xexprs" 
procedure.  This procedure is mostly just a simple tree traversal.  (I 
wrote such a procedure, but regrettably no longer have access to that code.)


Longer-term, I plan to release some libraries and a spec for a new 
format that's mostly backward-compatible with both SXML and xexprs, and 
that adds a few things that neither format has.  I've actually found 
only one nontrivial difference between SXML and xexprs, and I don't 
think that difference is worth fragmenting the base of libraries over, 
nor worth the increased bugs as programmers intermix both formats in 
their code.  (I did most of this library and spec work last year, but it 
needs polishing up and be reviewed by SXML and PLT people, so that the 
spec is fairly stable before anyone starts depending on it.  I've also 
committed to doing a couple SRFIs on the spec and libraries.)


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


[racket] alarm from download.plt-scheme.org

2010-07-29 Thread Neil Van Dyke
I think that the few warnings on "http://download.plt-scheme.org/"; might 
alarm some people unnecessarily.


Someone just saw that page and was concerned that we might be using in 
production something that is no longer maintained/supported.  Which is 
considered very bad in some circles.


I explained the rebranding, assured him that we are still getting 
support for our use of 4.x, and that we can move to 5.x whenever is 
convenient.


Perhaps the warnings could be rephrased?  Maybe tell people they 
probably want to get the latest, rebranded version, without scaring 
anyone who has 4.x in production?


(More context on production users moving between versions... The changes 
to move from 4.2.5 to 5.0 should be few and small for us, but moving 
between versions makes people nervous and takes considerable testing 
effort.  Also, each move to a new Racket version for us has to fit with 
our own release schedules and ebb and flow of available resources, so 
there will be a lag on uptake even when we see something in the latest 
Racket version that we would like to be using immediately and we expect 
no big problems by moving.)


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] more liberal CSV parsing?

2010-07-31 Thread Neil Van Dyke

Shriram Krishnamurthi wrote at 07/30/2010 09:53 PM:

  wmic process get commandline /format:csv

on Windows 7.  You get lines like

ROUBAIX,"C:\Program Files\Windows Sidebar\sidebar.exe" /autoRun,2940
ROUBAIX,"C:\Users\sk\Local Settings\Apps\F.lux\flux.exe" /noshow,3048
  


In this particular case, it looks like the quotes are intended to be 
part of the value of the field, and that the format that "wmic" is 
writing not using any CSV quoting.  So you can just do:


   ((make-csv-reader (open-input-string "d1,d2,\"foo\" bar,d3")
 '((quote-char . #f

   ;; ==> ("d1" "d2" "\"foo\" bar" "d3")

I think that's the parse they intend for their format, and is actually 
helpful for separately parsing the command line.  I suspect that this 
command line CSV field with the quotes in it came from a system call, 
and that "wmic" simply wrote that string verbatim, with a comma before 
and after.


Note that we could change the *default* CSV reader to handle this 
particular example, by having it fall back to putting the quotes back 
into the value if it sees junk after the end of what it thought was a 
CSV-quoted field.  But that would be a kludge that would fail in some 
other cases.  For the "csv" reusable library, I lean towards giving the 
programmer a heads-up that the format is really not something that the 
default CSV reader is likely to parse reliably.



Mmph: it looks like the output may be just plain broken.  I see
another line that looks like

ROUBAIX,cthelper 49170 xterm :erase=^?:size=24,80,4064

which looks like it has one field too many
  


Good catch.  I think that parsing this particular output with regexps or 
simpler string operations (to separate into fields at only the first and 
last commas) might give best results, since it looks like Microsoft is 
incorrectly not quoting their CSV fields at all in this case.


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] syntax, differently

2010-07-31 Thread Neil Van Dyke

Robby Findler wrote at 07/31/2010 11:19 AM:

On Sat, Jul 31, 2010 at 10:00 AM, Matthias Felleisen
 wrote:
  

1. Could drracket limit the width of programs in the teaching language world to 
80 columns?



This one seems doable (I'd probably make the text turn red when it passes the 
80th column or somethign instead of rejecting keystrokes).
  


If it's a visual indicator, I would very much like to have that 
available as an option in the non-teaching languages as well.  After 
working on a file in DrRacket for a while, I usually have to clean up 
the new overly-long lines in Emacs.


Typical indicators are a gray line in the background after column 79 or 
80, or a background color change there, like from white to light gray.


I'm not sure about red.  Sometimes, rightward drift and a long 
identifier or literal means you have no practical choice but to violate 
the 79/80 border.  IMHO, border incursion is not quite as grave an 
offense as some of the other things for which we might want to use red.


Regarding 79 or 80, 80 is now good for lots of people who previously had 
to use 79, though probably some people would like the option of 79.  
(For a long time, it was 79 for lots of Unix people, first because some 
terminals would to an automatic newline of some kind on a write in 
column 80, and then because some tools liked to put adornments in column 
80.  Some tools still like to.)  100 also seems a popular max width in 
some people's 'coding standards'.  MS Visual Studio, for example, lets 
you set this border to an arbitrary number, IIRC.


--
http://www.neilvandyke.org/
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users

Re: [racket] syntax, differently

2010-08-01 Thread Neil Van Dyke

Richard Cleis wrote at 08/01/2010 09:43 PM:
Perhaps this is related to some of what you are saying: For years I 
put double spaces after every initial element that had more purpose 
than a basic function (define, cond, let, etc.) I wish I had time to 
make a formatter do that, because I still like it.  


For perhaps similar reasons, Quack puts the names of special syntax in 
boldface[*], which is a heads-up that, well, it's special syntax.


http://i.imgur.com/wfNO2.png

Note that, contrary to some popular conventions around that time, names 
of standard procedures are *not* boldfaced.


I think someone in this conversation mentioned having trouble originally 
with some of the standard special syntax forms.  For whatever reason, I 
don't recall having trouble with these forms when I was first learning 
Lisp dialects.  Perhaps the boldface helped.


Didn't Check Syntax in DrScheme put special syntax names in boldface by 
default in versions 2xx or 1xx (and then stopped in a later version, 
when it got more info and started making all identifiers various shades 
of blue)?  Quack might've been inspired by that at the same time that it 
stole the 2xx color scheme.


[*] Quack does this in a kludgey and limited way.  DrRacket in theory 
can do it properly.


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] bad syntax; literal data is not allowed, because no #%datum syntax transformer is bound

2011-08-30 Thread Neil Van Dyke
Thanks, Carl and Robby.  I need to set up the lexical context to be that 
of the macro, while preserving the source position info.  I will look 
into the pointers you gave me for how to do that.


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Racketizing Chrome

2011-08-30 Thread Neil Van Dyke

Ray Racine wrote at 08/30/2011 08:30 PM:
Chrome has solidified their native app capability.  Downside, only 
support is native apps in C or C++.  Racket scheme is embeddable in a 
C program, hence,


If they will let this embedded native app exec another process, or talk 
through a Unix domain socket to an existing process, or talk HTTP to a 
localhost address... then you can avoid embedding Racket and just embed 
a small bit of shim code that does RPC-like communication with a normal 
Racket process.


Advantage of this over embedding Racket itself is that you don't have to 
worry about strange interactions with the GC and whatever tricky stuff 
Chrome will do.  And you know that they will probably do tricky stuff.


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] bad syntax; literal data is not allowed, because no #%datum syntax transformer is bound

2011-08-31 Thread Neil Van Dyke

Matthew Flatt wrote at 08/30/2011 07:13 PM:

At Tue, 30 Aug 2011 19:03:24 -0400, Neil Van Dyke wrote:
  
Thanks, Carl and Robby.  I need to set up the lexical context to be that 
of the macro, while preserving the source position info.  I will look 
into the pointers you gave me for how to do that.



One more pointer: `replace-context' from `syntax/strip-context'.
  


"replace-context" was exactly what I needed.  Thank you, PLTers.

Working code pasted below in case anyone Googles this in the future.

Aside... Once Carl and Robby pointed out what I was missing, my summary 
was a close match for the documentation of "replace-context".  Perhaps 
some grad student wants to see if there's anything that can be done with 
IR and NLP here, for finding library routines or even composing small 
expressions with them.  Use natural language, and possibly the context 
of code in a DrScheme window.  Something that does better than Google 
could, but short of handling "Computer, write me a program that..."



#lang racket/base

(require (for-syntax racket/base
syntax/strip-context))

(define-syntax (my-macro stx)
 (syntax-case stx ()
   ((_ NAME)
(let ((my-read-stx (read-syntax "my-sourcename"
(open-input-string "\"hello\""
  (quasisyntax/loc stx
(string-append "Well, "
   #,(replace-context stx my-read-stx)
   ", "
   NAME
   "!"))

(my-macro "yourname")
;;==> "Well, hello, yourname!"


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Neophyte Alert

2011-08-31 Thread Neil Van Dyke

Josh Tilles wrote at 08/31/2011 01:03 PM:

Dear Racketeers,
I'm (comparatively) young, and so also not familiar with the social 
protocols of IRC & newsgroups in the world of software development.


Just ask questions.  That's what everyone does, as you'll see from 
skimming the email list archives.


-- Is there any sort of general practice or prevailing taste in when 
to use (for example) *null* vs *empty* vs *(list)*? What about *(let 
([...]))* vs *(local (define ...))*?


I think most people do "'()" when they want a literal null list.  Don't 
use "(list)", since that's a procedure call.


As for "let" and such vs. local "define" and such, there is no universal 
agreement.  Flip a coin and start doing it one way, and once you have 
more experience, you might make an informed decision to switch.


Don't worry too much about conventions.  There is disagreement on a lot 
of things.  You will quickly find better ways to do things than how you 
initially do them.  The most important thing, if you're not going to go 
through HtDP, is to start coding, intermixed with reading.


-- When is it appropriate to use RackUnit, and when should Contracts 
be used instead?


Contracts (and Typed Racket) are orthogonal to doing unit tests with a 
library like RackUnit.  Unit tests tests that your module behaves as 
expected.  Contracts and Typed Racket are more useful for making people 
call your module correctly.  (That's not the full answer, but does that 
make sense?)


P.S. Has anyone given any thought to consolidating some of the Racket 
discussion to a StackExchange site? Or something else of that ilk?


Racket info is getting spread over too many places already, IMHO.  Eli 
is the only person in the world who can find and follow them all.  I'd 
like to get more people on the Racket email list, and off their little 
islands where they're getting lower quality and not being brought into 
the fold.


--
http://www.neilvandyke.org/
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users

Re: [racket] Racket Badges

2011-08-31 Thread Neil Van Dyke

Danny Yoo wrote at 09/01/2011 12:20 AM:

I wish you could earn Racket badges and levels for completing exercises, 
getting +1'ed on the mailing list, and contributing code and documentation.




+1.  Stack Overflow does this sort of achievement system. It feels
very much like a game.


When someone helps me out here or contributes a good idea to a 
discussion, I appreciate it, but it's even more appreciated if they're 
doing it out of higher goals, community, or altruism, without the taint 
of working towards a merit badge.


Stack Overflow's game is probably benign, but there's a context of the 
last several years of connected society.  Online sites are conditioning 
us in various ways to accept ubiquitous buzz marketing, and to parody 
social processes and fritter away social capital to promote products in 
exchange for some consideration ("like us on Facebook for a discount"), 
and this all being socially acceptable to the extent that people care or 
realize it's going on.  This isn't new -- we've enjoyed entertainment 
industry generated 'news' and disingenuous performances for TV talk show 
for decades -- but it's only the last decade or so that everyone can see 
themselves acting a role and playing the game on a large scale.  I hope 
that individuals of the new generation somehow manage to value being 
genuine and to have genuine connections, despite an environment that's 
trying to push them otherwise.  In this context, do you *really* want to 
bring more of this game into a relative oasis?


--
http://www.neilvandyke.org/
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users

Re: [racket] Splicing format string?

2011-09-01 Thread Neil Van Dyke

J. Ian Johnson wrote at 09/01/2011 09:43 AM:

I have a list of symbols '(a b c) that I want to be printed "a b c" as part of 
string I'm formatting.


If you don't mind parentheses, you can do: (format "~s" syms)

I think that "format" has conspicuously avoided getting like C "printf" 
or the super-scary CL function.  It's convenient for what it is, and is 
not intended to be anything more than what it is.


I think there are some formatting libraries in PLaneT.

One thing to keep in mind as you're formatting things: if you want to do 
be formatting huge outputs, you'll want to be writing incrementally to a 
port, not making a massive string.  Below is a little code I just banged 
out to illustrate writing formatting code that scales.  It's not 
intended to be a gee-whiz demo.  ("You have to write all that code just 
to put spaces in a list?!")



#lang racket

;; Sometimes it's preferable to write formatting procedures that first
;; write to ports rather than generate strings...

(define (display-list-items/separator lst
 separator
 (out (current-output-port)))
 (or (null? lst)
 (let loop ((item (car lst))
(lst  (cdr lst)))
   (write item out)
   (if (null? lst)
   (void)

   (begin (display separator out)
  (loop (car lst) (cdr lst)))

;; Then you can combine it with other output procedures, and it scales
;; to arbitrary size of output...

(define (write-report lst out)
 ;; TODO: Write a gigabyte of earlier report text here.
 (display "This is my list: {" out)
 (display-list-items/separator lst ", " out)
 (display "}\n" out)
 ;; TODO: Write some more report text here.
 )

;; For dealing with small outputs, you can make a wrapper for the
;; writing procedure that returns a string...

(define (list-items->string/separator lst separator)
 (call-with-output-string
  (lambda (out)
(display-list-items/separator lst separator out

;; Obligatory tests...

(require (planet neil/overeasy:1:0))

(test (format "~a" (string-join (map symbol->string '(a b c)) " "))
  "a b c")

(test (list-items->string/separator '(a b c) " ")
  "a b c")

(test (list-items->string/separator '(a b c) ", ")
  "a, b, c")

(test (list-items->string/separator '() " ")
  "")

--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] which version of DrRacket to download

2011-09-02 Thread Neil Van Dyke

Stephen Bloch wrote at 09/02/2011 09:14 AM:

Linux panther.adelphi.edu 2.6.9-89.0.23.ELsmp #1 SMP Fri Mar 5 17:56:21 EST 
2010 i686 i686 i386 GNU/Linux

cat /etc/redhat-release says
Red Hat Enterprise Linux AS release 4 (Nahant Update 8)
  


I think that's a pretty old version of RHEL.

I haven't used RHEL much, but if you want to avoid building from source, 
just for grins, I would try the "Linux i386 (Fedora 12)" package.  If 
that installs but doesn't run the first time, I'd run "ldd" on the 
"racket" executable and see what that says, and hopefully you only need 
to install missing shared libraries.


Your best bet might be to compile from source.

I don't know whether your RHEL 4 will have recent enough GTK-related 
libraries needed by DrRacket anyay, so that might require you to be 
building from source anyway.


If this is for student lab machines that are locked to an ancient RHEL 
version, and they can't be upgraded, you have an alternative: a 
GNU/Linux "Live CD" or "Live USB" that has recent GNU/Linux plus Racket 
on it.  Then you're using the student lab hardware except for the hard 
drives, and disregarding whatever OS they have installed.  I have some 
experience with this, but it can be a lot of work to make it robust for 
semi-literate students, so there would have to be a major need for it.  
http://neilvandyke.org/lildeb/


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Locating substring with reserved characters

2011-09-03 Thread Neil Van Dyke

Jukka Tuominen wrote at 09/03/2011 03:56 AM:

I'm trying to locate a substring that I want to be treated just as a string
rather than regexpr notation.


I think you want "regexp-quote".

(regexp (regexp-quote "5 (+ 1 2 3)"))
;;==> #rx"5 \\(\\+ 1 2 3\\)"

--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Scribble: escaping the semicolon

2011-09-04 Thread Neil Van Dyke

Mark Carter wrote at 09/04/2011 05:32 AM:

I'm documenting my module in a scribble file, and I have a @racket segement in 
which I would like to include a semicolon. How do I escape a semicolon?
  

Does "scribble/comment-reader" do what you need?

--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Scribble: escaping the semicolon

2011-09-04 Thread Neil Van Dyke

Mark Carter wrote at 09/04/2011 08:27 AM:

Does "scribble/comment-reader" do what you need?



Unfortunately, I can't really say, as the Racket documentation on my machine seems to be broken at the moment :( All I'm trying to do is put in a literal semi-colon. I've tried ;; and @; , but that's not it. 
  


There is always a public copy of the documentation:

http://doc.racket-lang.org/scribble/scribble_manual_code.html#(part._.Typesetting_.Comments)

Note that the "@racket" thing you mentioned is for typesetting actual 
Racket code, not arbitrary text.  When typesetting Racket code, Scribble 
doesn't normally include Racket comments (which usually start with 
";").  So I think that's why you're having trouble putting a semicolon 
in there.


--
http://www.neilvandyke.org/
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users

Re: [racket] Using the profiler effectively?

2011-09-04 Thread Neil Van Dyke
What I did was read the section of the docs for "profile/render-text" 
carefully, while looking back at a real-world example I was interested in.


The example you gave, I think you cut off the juicy stuff.

Look for nodes with large percentages in Total or Self columns, and then 
follow the incoming and outgoing call graph edges with big percentages 
from those nodes, to follow the money.


I had to increase the frequency of the sampler.  Keep in mind that it 
will miss some significant things anyway.


I rigged up one Web app to append the profile report at the end of each 
HTML page.  Very convenient.


Also keep in mind that the profiler doesn't necessarily reflect blame 
for GC costs.  GC costs can be significant.


For a couple of programs, short-running and long-running, I had to rig 
up custom debug logging to figure out where we were getting hit with GC 
and then why.  (One finding: we took a big GC hit right after we did all 
of our "require"s, before we got to any app code, which makes sense, but 
it hurt us on short-lived, performance-sensitive processes.  I'd like to 
disable GC altogether for those.  Another finding: we took a hit every 
few requests or pages on a long-running process, and I'd like to 
schedule forced GC for when the server is only waiting.  Or if I have a 
multi-process architecture with separate GCs, the processes can GC in 
between requests being delegated to them, and not GC all at the same time.)


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


[racket] Texinfo-like Racket Evaluation Results in Scribble

2011-09-05 Thread Neil Van Dyke

For typesetting nit-pickers like me...

[This is a paste of a blog post.  Here, I've replaced the Unicode 
double-arrow character with ASCII "=>".  The whitespace in code examples 
might get garbled a little.  If you want to see the Unicode character 
and whitespace properly, 
"http://www.neilvandyke.org/weblog/2011/09/#2011-09-05";.]


Using Racket Scribble, but miss Texinfo-like evaluation results?

Eventually, either we'll get this added to Scribble, or I'll make a tiny 
PLaneT package that does this in a nicer way. But for now, you can 
kludge it up like:


@(define => (larger (italic "\u21d2")))

@(racketblock (+ 1 2 3) #,=> #,(racketresult 6)
 (+ 1 3 3) #,=> #,(racketresult 7))

This formats like:

(+ 1 2 3) ==> 6
(+ 1 3 3) ==> 7
(+ 1 4 3) ==> 8

The double-arrows used to look quite nice in Texinfo-generated DVI, PS, 
and PDF output; Web browsers and putting it in fixed-pitch font don't do 
the character justice right now.


Compare to one of the usual Racket ways:

@(racketinput (+ 1 2 3)   
 #,(racketresult 6))
@(racketinput (+ 1 3 3)   
 #,(racketresult 7))
@(racketinput (+ 1 4 3)   
 #,(racketresult 8))


Which formats like:

> (+ 1 2 3)
 6

> (+ 1 3 3)
 7

> (+ 1 4 3)
 8

The usual Scribble format uses much more space, and also does not permit 
a columnar layout that would help show symmetries among more complicated 
expressions and results. Less importantly, this format can also be 
harder to read without color. As for the ">" prompt, I don't have a 
strong argument against it, but I don't think it's necessary.


Aside: This was a pressing question for me because I'm almost ready to 
release the McFly package, which lets you embed API documentation within 
Racket files. Just now, I considered simply adding => to McFly, but I 
think I'll wait.


--
http://www.neilvandyke.org/

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


[racket] adding stuff to info.rkt and relying on it for the long haul

2011-09-06 Thread Neil Van Dyke

Two questions on "info.rkt":

1. Do you intend to stay with "info.rkt" more or less as it is, for at 
least a few years?


2. Is it OK for third-party development tools to require additional info 
from "info.rkt", and if so, are there any conventions they should 
observe (e.g., for naming)?


Reason for asking: I have a new package for embedding API docs in Racket 
source code files, called McFly, and it currently includes a metadata 
form, called "doc Package" that is used for a few purposes, like 
"info.rkt" is.  (See example below.)  Now that I've added code to 
generate "info.rkt" based on the parsed docs, I'm thinking this is 
backwards.  So, I'm thinking I should throw out "doc Package" and add a 
few more variables to "info.rkt".  But before I do a bunch of rewriting, 
I want to be comfortable relying on "info.rkt".  McFly might be used in 
many different authors' PlaneT packages, and if McFly breaks, all the 
packages that use it break.


(doc Package
#:name "soundex"
#:subtitle "Soundex Index Keying in Racket"
#:homepage "http://www.neilvandyke.org/racket-soundex/";
#:author   "Neil Van Dyke"
#:license  "LGPLv3"
#:legal"Copyright 2004--2011 Neil Van Dyke.  This program is Free
Software; you can redistribute it and/or modify it 
under the
terms of the GNU Lesser General Public License as 
published by
the Free Software Foundation; either version 3 of the 
License,

or (at your option) any later version.  This program is
distributed in the hope that it will be useful, but without
any warranty; without even the implied warranty of
merchantability or fitness for a particular purpose.  See
http://www.gnu.org/licenses/ for details.  For other 
licenses

and consulting, please contact the author."
#:version  "0.7"
#:planet   neil/soundex:1:=4)

--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Rackunit and test-case

2011-09-07 Thread Neil Van Dyke
I had problems like this with Testeez as well, which is part of why the 
Overeasy "test" form permits at most 2 non-keyword arguments.


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] hosts with racket (or PLT-Scheme) support

2011-09-07 Thread Neil Van Dyke
Amazon AWS has a new "free tier" for EC2 
("http://aws.amazon.com/free/";), which I think gives you enough 
resources to run a low-traffic Racket server, if that 613 MB is usually 
RAM, not swap.  (Even if that includes the memory for the base Linux 
platform, that can be made pretty small, leaving almost all the memory 
for Racket processes.)


I will probably be playing with Racket on this AWS free tier soon.

If you don't want to use EC2, and you're stuck for now on hosting that 
only does CGI, if you code for the very 
bare-bones"http://www.neilvandyke.org/racket-scgi/"; library, then you 
can run as CGI with fairly lightweight process startup, and then when 
you upgrade to a real server, it will let you run as fast SCGI without 
any source code changes or recompiling.  Ideally, if you'd like to use 
the Racket Web Server, the process startup to run it as normal CGI can 
be made quick.


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Call racket with long code from racket

2011-09-08 Thread Neil Van Dyke

Niitsuma Hirotaka wrote at 09/08/2011 04:35 PM:

I am trying to call racket with long code from racket
---
#lang racket
(require racket/system)
(display (port->string (car (process "racket -e ' [long-code] ' "
---

But long-code contain  "  and  '   .
Thus

(process "racket -e ' [long-long-code] ' "))

does not work.

How to  call racket with long code ( contain "  and  ') from racket

Saving long-code into file can not use. Because this is part of web application.
  


You can use "process*" instead of "process".

You can use "eval-string".

If those ways are not satisfactory, you can use processes and ports in 
more elaborate ways.


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


[racket] planet/scribble and versions

2011-09-08 Thread Neil Van Dyke

Are the macros for PLaneT package specs in "planet/scribble" correct?

I haven't traced the code thoroughly, but if the output of 
"syntax-source-planet-package-symbol" will be used as-is for actual 
"require" during Scribble formatting... won't the ":MAJOR:MINOR" (not 
":MAJOR:=MINOR") version let Scribble use a different version than the 
version that the ".scrbl" being formatted is coming from?


I'm asking because McFly currently makes ":MAJOR:=MINOR" version 
references itself right now, but I just saw the current advice in the 
documentation is to let the "planet/scribble" module do the PLaneT 
package self-references for you:

http://doc.racket-lang.org/planet/Developing_Packages_for_PLaneT.html#(part._.Create_.Documentation__.Optional_)

--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Documenting a financial model in Racket?

2011-09-09 Thread Neil Van Dyke

Grant Rettke wrote at 09/09/2011 11:23 AM:

At work I've inherited a financial application whose model that is too
complicated to be documented.
  

[...]


What approaches, techniques, or features of Racket do you think might
be interesting?
  


If you want to use Racket, and not the systems analysis and design 
methodologies of the '80s and '90s, then my suggestion for an initial 
plan: Start with the legacy Java code that is not understood, 
painstakingly comment every few lines with what it is doing mechanically 
and why you think the intent might be, and at some point turn the Java 
syntax into sexp syntax (better to do the comments on the original code, 
before this point), and then iteratively refine that, til you get to 
something that you can execute in Racket with macros/language (ideally, 
but don't kill yourself on this if it's too hard, and proceed to next 
step), and then you should know the mechanics well enough that you 
understand what most of the code is doing and can make DSLs for it.  
Make DSLs that fit the code, and your uses of those become documentation 
for complicated or simply estoteric bits of your model.  You can 
iteratively refine your system at DSL levels of abstraction, then.  
Reverse-engineer equations from code into somewhat higher-level DSLs, 
too.  Finally, put the DSL uses into Honu or a Python-ish pseudocode for 
showing to those averse to parentheses, add Executive Summary, and get 
printed and bound handsomely.


Due to your DSLs, you might also now have the bits working in Racket, 
and you'll probably find qualitative ways in which that's better than 
your legacy implementation.  It might even be faster and have fewer 
defects, since if it's "too complicated to be documented", that could 
mean it was crafted by a genius monk, but more likely the code has 
inefficiencies and bugs that are easier to identify (or that simply fall 
out incidentally) in the course of DSL implementation.


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] planet/scribble and versions

2011-09-09 Thread Neil Van Dyke

I should give more context about where I'm coming from.

It seems that Scribble does a "require" of the module being documented.

PLaneT's notion of backward-compatible is a big simplification, and is 
not foolproof.  The author can make a mistake, or there can be a 
difference of understanding on what is specified behavior and what is 
not, and new information can arise after release.  Plus, changing 
versioned documentation is just bad engineering.


For one example: if you're using the Scribble "eval" stuff, some 
difference considered unspecified by the author, might be reflected in 
the documentation and actually be considered relevant: such as the 
format of port output (possibly then used by some other program), or 
simply how objects display (user confusion), might actually affect how 
the documentation is rendered.  Of course, people should not rely on 
things that aren't specified, but the author might have inadvertently 
given a fairly standard-practice specification by saying "...produces 
the output..." or "...looks like...".  This is more a specification if 
user is *not* a hardcore engineer, who should recognize it as ambiguous 
and throw it back at you if it's relevant, but typical developers are 
more vulnerable.


The Scribble "title" form has a "#:version" argument, which causes the 
version number of the package being documented to be included as part of 
the documentation.  For PLaneT packages, that presumably is the version 
number of the exact package in which the documentation is included, and 
the version number to which the documentation pertains.


If substantial content of a versioned document varies based on who 
formatted it, when, on what computer, and what phase of the moon, then 
that creates engineering process problems.  It might even create civil 
liability problems, if something fails due to the magic changing 
versioned documentation, and there are costs or it is considered a 
failure to meet contractual obligations.  And keeping a documentation 
trail is usually part of an engineer's professional and contractual 
responsibilty.  And it simply doesn't look good if your versioned 
documentation changes on its own.  (Yes, you can make the normative 
documents be PDFs or paper, and refuse to let your partners access any 
Scribble-generated hypertext documentation that might be construed as 
documentation furnished by you.  You can also switch to COBOL and strike 
your typing fingers repeatedly with a hammer.)


I would like for the *displayed* form in the formatted documentation to 
be ":MAJOR:MINOR", and the form that Scribble uses for "require" to be 
":MAJOR:=MINOR".


That way, typical developers who copy&paste "require" forms form the 
documentation will get supposedly backward-compatible newer versions by 
default (hardcore engineers will know they have to control the versions 
more anyway, as I've mentioned recently), but versioned documentation 
will not be changing on anyone.  (Though there are still remote 
possibilities of significant changes due to typography and such, that is 
actually a recognized possibility, unlike, say, the text of output in 
code examples changing.)


So, going back to my original question, I'm wondering whether I should 
change McFly to use "planet/scribble", or, if that will not reliably do 
the versions like I think is most appropriate, then I should continue to 
do it in McFly.


I don't feel quite as strongly about this as the above text suggests, 
but I wanted to give people an idea of why I think this sometimes 
matters, and why I don't want McFly to punt on this detail.  It's a very 
easy detail to get right.


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Parsing a string into a quoted expr

2011-09-12 Thread Neil Van Dyke
Look up "eval" and "read" in the Racket documentation.  There are some 
related procedures as well.  You'll probably need to define a namespace 
for whatever eval procedure you use, although the documentation is 
unclear.  You might want to use Racket's facilities for sandboxing too, 
depending on what you're doing.  (Or maybe what you really want is to 
define a new language in Racket, which probably won't use "eval" at all.)


Beware that most people never have to use "eval" for proper Racket 
programs, although you might be a rare one.  "eval" tends to be grossly 
overused by new Scheme programmers.  For this, I blame CS texts that try 
to teach a theoretical perspective on the Scheme language, with talk of 
metacircular evaluators and such, but then don't disabuse students of 
the understandable impression that they should be calling "eval" 
directly in real programs.


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


[racket] Check Syntax no longer works for SICP?

2011-09-14 Thread Neil Van Dyke
The small tweaks to Racket for SICP 
("http://www.neilvandyke.org/racket-sicp/";) stopped working with Check 
Syntax at some point.  Any pointers to how to quickly get it working again?


* If using "#lang planet neil/sicp", then the "Check Syntax" button no 
longer appears.


* If using "SICP (PLaneT 1.5)" from the "Choose Language" dialog, then 
the "Check Syntax" button is there, but clicking it when the 
"Definitions" pane content is "(define a 3)" gives a "Check Syntax Error 
Message" message like: "compile: unbound identifier (and no #%app syntax 
transformer is bound) in: #%top-interaction".  The "Run" button works 
with this same code, however.


As I recall, the SICP language support does some bastardized stuff with 
the R5RS language, from before language extension was documented quite 
so nicely as it is now, and I notice that the "R5RS" works with Check 
Syntax, so probably the SICP stuff should be thrown out and started 
over.  However, if there's a quick fix somebody knows, I can get to that 
sooner.


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Variable naming conventions

2011-09-14 Thread Neil Van Dyke
Pronounce the "/" as "with", and it usually makes sense.  Sometimes it's 
for a variation of a behavior, or composition of behaviors, sometimes 
it's just as shorthand for the word "with", and sometimes it's something 
else.  You might use "/" a little less often, now that you have keyword 
arguments -- both for the names, and for optionality.


I think that asterisks often mean simply "variation on a theme", not 
necessarily "recursive".


You've identified most of the most popular conventions.

I am trying to introduce one new convention, but I might still be the 
only person doing it: pattern variables in syntax transformers are in 
all uppercase.  Every time I see someone using all-uppercase for 
``constants'' in Racket[*], I vow to become rich and powerful, so that I 
can quietly destroy those people from a distance.


[*] All-uppercase-and-underscores is something kinda dumb Java did to 
make it look like K&R C, even though that convention came from when 
``constants'' were uppercase in C because they were problematic 
preprocessor symbols.


--
http://www.neilvandyke.org/

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


[racket] macros that expand to "provide/contract"

2011-09-15 Thread Neil Van Dyke
If I have a syntax extension that expands to include "define" and/or 
"provide/contract" (at top level, possibly within a "begin"), will that 
break any Racket tools?


The "myprogram.rkt" below works, but I don't know whether this will 
break some tool now or in the future.


#lang racket/base
;; File: foo.rkt
(require racket/contract)
(define-syntax foo-define/provide/contract/begin
 (syntax-rules ()
   ((_ SYM CONTRACT BODY0 BODYn ...)
(begin (display "*DEBUG* before\n")
   (define SYM BODY0 BODYn ...)
   (provide/contract (SYM CONTRACT))
   (display "*DEBUG* after\n")
(provide foo-define/provide/contract/begin)

#lang racket/base
;; File: mymodule.rkt
(require "foo.rkt")
(foo-define/provide/contract/begin onetwothree number? 123)

#lang racket/base
;; File: myprogram.rkt
(require "mymodule.rkt")
(printf "onetwothree is ~S\n" onetwothree)

--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Dr. Racket for FPGA development

2011-09-16 Thread Neil Van Dyke

David Blubaugh wrote at 09/16/2011 12:36 PM:
> Has Dr. Racket ever been utilized for FPGA development ???

That would be interesting.

Maybe one could put a Racket VM in FPGA.

Maybe also a possibility is to use layers of Racket syntax transformers 
over a lower layer that simply writes out a conventional VHDL or 
whatever file.  This would be a more convenient way to implement 
higher-level languages for FPGAs than using conventional parser tools 
and such.  You're using the Racket "syntax-rules", "syntax-parse", etc. 
to implement a compiler, but the person using this compiler is not 
actually programming in Racket (unless those layers of syntax 
transformers also implement the Racket language).


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Dr. Racket for FPGA development

2011-09-16 Thread Neil Van Dyke

Jay McCarthy wrote at 09/17/2011 12:23 AM:

I'm currently in the process of doing this for the 65816 processor.
This is a 16-bit processor most popularly used in the Super Nintendo
Entertainment System.
  


Neat stuff, Jay.  I was not aware of this.


p.s. Why the 65816? It's really simple to understand the whole thing
and the constraints enforce tight code. The x86 is too complicated for
me right now and it would be too cushy, I think.
  


X86 is a monstrosity. :)

Another advantage you didn't mention, if you're targeting the SNES 
hardware in particular, is that a lot of people are already set up with 
emulators, and I suspect there's an enthusiast community that would try 
any programs (ROM images) people create with this.


If other people want to play with approaches like Jay's, some other CPU 
architectures with interesting applications are ARM (smartphones and 
other low-power devices), MIPS[*] (cheap home network routers that can 
function as general-purpose computers), and the hobbyists' 
microcontroller platforms like the Arduino.  RISC is your friend.  
People also like to play with popular old architectures like 68K, 6502, 
and Z80, but I can't think of great practical application for those.  
Maybe you could produce something more interesting than C as a macro 
assembler for 64-bit architectures (maybe a DSL angle?).  There's also 
the JVM and Dalvik.  Oh, and GPUs.


[*] I believe that there is already a more ambitious project involving 
Racket and MIPS, so you might want to pick one of the others, just for 
more variety.


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Dr. Racket for FPGA development

2011-09-17 Thread Neil Van Dyke
If someone wanted to implement a somewhat Racket-like language for 
FPGAs, PreScheme is worth looking at.

http://mumble.net/~kelsey/papers/prescheme.ps.gz

--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Dr. Racket for FPGA development

2011-09-17 Thread Neil Van Dyke

Matthias Felleisen wrote at 09/17/2011 12:27 PM:
What we really need is a #lang pre. 
  


Would modules done in "#lang pre" provide an intermediate 
representation, so that different target architecture backends could 
require the module and emit FPGA HDL, JVM bytecode, some assembler, etc.?


If so, I wonder whether someone has enough a priori knowledge that they 
could do "#lang pre" from the start, or whether they'd have to work 
through at least a couple diverse target architectures before the 
abstractions "#lang pre" provides start to stabilize?  (I don't know 
enough a priori knowledge myself, but someone else might.)


One way someone could get to this "#lang pre" incrementally: (1) 
develop, say, "#lang  pre-fpga", focused on the mechanics of 
translation, not on modularity; (2) separate the "pre" and "fpga" parts 
into separate modules; (3) develop, say, "#lang pre-arm", using the same 
"pre" module from before, which means refactoring the "pre", "fpga", and 
"arm" modules together, and possibly adding units; (4) make a "#lang 
pre" based on the "pre" module, which might mean more refactoring of all 
of the modules to make an IR; (5) maybe do a third target architecture, 
or get other people using "#lang pre" for other targets, and refine 
"pre" based on that.


Note that step #1 above might be the most engaging way to start, with 
the most immediate gratification: you start typing code in a DrRacket 
window and hitting the Run button, and in half an hour you are starting 
to generate something that looks like code, and you go from there.  The 
other steps might not be as fun, so we have to bait&switch.


An alternative loosely-coupled community process is for a few people to 
independently start the fun step #1 for different targets, and then 
maybe one of them gets hooked and decides to take it to "#lang pre", and 
they can all compare notes and code for the different targets.


Then there's LLVM, which you might use in some capacity, or you might 
decide there's a simpler or better way for your needs.


--
http://www.neilvandyke.org/

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] list->values

2011-09-17 Thread Neil Van Dyke

Jeremy Kun wrote at 09/17/2011 01:43 PM:
Is there a function that converts a list into a values expression 
which contains every element of the list? I've run into a bit of 
trouble trying to implement something like it myself, and it's 
probably because I don't understand exactly how values is used (or 
supposed to be used).


See "call-with-values".  Don't be afraid if the code looks a little 
awkward: hide it in a procedure or macro.


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Offtopic: Learning SML

2011-09-18 Thread Neil Van Dyke
This is prompted by Shriram's mentioning ML and coyly not mentioning 
PLAI?  If you want to learn more about interpreting programming 
languages, why not start with PLAI, then go from there.


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Quoted expressions in #lang racket

2011-09-18 Thread Neil Van Dyke

Racket Noob wrote at 09/18/2011 04:41 PM:
Ok, maybe this is not something that's important in other programming 
languages, but it *is* important in lisps. As a lisp educator, how can 
you *not* to teach this fundamental fact about lisp?


To me, speaking of real use of the language, it seems a lot less 
important in Racket than it used to be, in Racket's Lisp ancestors.  I 
suspect it can be saved for an aside, when introducing syntax 
transformers ("and here, we can get the form as a list if we want") or 
maybe "eval" ("this will rock your world: data can be code. you should 
probably never do this").


Unless someone finds it useful in explaining how evaluation works.  I 
don't have significant experience teaching intro programming, so I tend 
to defer to PLT professors on what they've found worked for their intro 
students.


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Offtopic: Learning SML

2011-09-19 Thread Neil Van Dyke

Thanks for the excellent travel guide, Ray.

I'd also encourage people to spend a summer backpacking in Europe, and 
to see someplace new once a year, but not to *always* be a tourist.


If one is looking for a place to call home and to explore in-depth for a 
good while, and hopefully contribute, Racket is an excellent choice 
right now.  And Racket's linguistic malleability means that, once 
introduced to an idea originated in some other language, there's a good 
chance that one can then explore that idea further within Racket.


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Racket style guide (was Re: Argument order conventions (was: Variable naming conventions))

2011-09-20 Thread Neil Van Dyke

Tom McNulty wrote at 09/20/2011 01:42 AM:

What is the Racket convention for named constants?
  


There is no convention in Racket that I know of.  Pi can be "pi".  Max. 
packet payload byte count can be "max-packet-payload-byte-count".


I don't see constants very often.  There are many things, however, that 
a library author *could* make constant, but that instead are better made 
configurable.  So, instead of being hard-coded values in the library, 
they are instead Racket parameters, or are arguments to procedures that 
produce closures or structs.


By the way, using all capital letters in an identifier is, of course, 
reserved for syntax transformer pattern variables.


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Racket style guide (was Re: Argument order conventions (was: Variable naming conventions))

2011-09-22 Thread Neil Van Dyke

Matthias Felleisen wrote at 09/22/2011 12:14 PM:
Personally, I'd love to see even more of a separation between the header (data + provide) and the implementation. Perhaps I read too much Modula 2 code, perhaps I liked units too much. 
  


Modula-2 made me a better software engineer using C around 20 years ago, 
in a surprisingly good community college course.  However, thank 
goodness I never had to do real work in Modula-2.  We implemented a 
spreadsheet program as a team project, with a rule that we weren't 
allowed to see other people's Modula-2 implementation files.  It was an 
educational experience, in team dynamics as much as anything else.  But 
we were not at all fond of klunky and annoying Modula-2 setup (perhaps 
somewhat like people who used an impoverished Scheme implementation for 
annoying problem sets in college decided they disliked Scheme).  We 
would've been much happier with Turbo Pascal, and I wonder whether 
whether we could have learned just as well using TP units and some 
conventions to discipline us about interface vs. implementation.  Based 
on industry experience immediately after that, working in C on large 
high-end workstation software and fancy embedded systems tools, I'd say 
that the Modula-2 experience taught one very useful discipline that few 
of the C developers at the time seemed to have a good grasp of.


I wonder whether anyone using Racket for a course with a large team 
project has tried forbidding team members from looking at each other's 
implementations -- let them work only from module interface docs or 
something like Racket's "sig"s -- and how that worked out.  It might be 
harder to do nowadays, due to many students having preconceived ideas of 
how team projects work, based on all the public open source projects, 
the popularized codification of Agile cowboy methodologies, and on 
post-dotcom title inflation-- students might not believe you if you say 
"this is how *software engineering* is done."


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Racket style guide (was Re: Argument order conventions (was: Variable naming conventions))

2011-09-22 Thread Neil Van Dyke

Hendrik Boom wrote at 09/22/2011 08:16 PM:
Software Engineering is the art of getting things done with 
large numbers of relatively stupid programmers -- because there aren't 
enough really good programmers.
  


That certainly seems to be the predominant Java school of thought. :)

I'm going to quibble with this use of the term "software engineering", 
since I have somewhat different notions of the term, which have been 
important to me.  I'll admit in advance that my own definitions are 
fuzzy here...


Some of my earlier career, starting when I switched from being a 
programmer kid with my own tiny software business, to a lowly intern 
(below even Software Technician I, which itself was two big hops below 
Software Engineer I), was on process and tools for critical 
aerospace/datacomm/etc. software.  So that was where my notion of 
"software engineering" started.  Closer to "how do we build something 
necessarily complex that will do what is needed and work properly" than 
"how do we get 40 clerical workers to code these 400 data entry screens 
and 400 reports that we think we need".


Most recently, in some of my consulting work, the flavor of software 
engineering that I practice involves *small* numbers of smart software 
developers, who use engineering discipline (and usually Racket) to 
implement functionality in a way that will be reliable in production and 
maintainable in the future, despite constraints (time, resources, 
information, coordination, etc.).  There is an element of art to this, 
true.  There's lots of analytic speculation and balancing of concerns 
going on, in addition to applying accepted best practices.


So, I think of software engineering as discipline that smart people 
employ smartly to get things done, rather than the art of managing large 
numbers of perhaps lower-skilled programmers.  And if they those large 
numbers of programmers learn and exercise software engineering 
discipline, I wouldn't call them "relatively stupid", since the negative 
connotations in English would be unfair.  Software engineering is hard, 
and it's not about reining in grunts with bureaucratic process, IMHO.  
When there's doubt about the quality of a process, I say "development" 
(or "programming" or "coding") rather than "engineering".


--
http://www.neilvandyke.org/

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


[racket] DrRacket WM_CLASS on X

2011-09-25 Thread Neil Van Dyke
For DrRacket running with the X Window System, would it be possible to 
set the windows' "WM_CLASS" to "DrRacket"?


"xprop" says that there is no "WM_CLASS":

[...]
WM_CLASS(STRING) = "", ""
WM_ICON_NAME(STRING) = "Untitled - DrRacket"
[...]
WM_NAME(STRING) = "Untitled - DrRacket"
[...]

Setting "WM_CLASS" would help out fancy features in X window managers 
like XMonad.


--
http://www.neilvandyke.org/

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] DrRacket WM_CLASS on X

2011-09-26 Thread Neil Van Dyke

Matthew Flatt wrote at 09/26/2011 07:36 AM:

Which version did you try? I think WM_CLASS is set as of commit
941dacd966913ebbeca1 (August 4) in the git repo.
   


That was 5.1.3.  Thanks, I look forward to the next release.

--
http://www.neilvandyke.org/

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] DrRacket WM_CLASS on X

2011-09-26 Thread Neil Van Dyke

Matthew Flatt wrote at 09/26/2011 07:36 AM:

Which version did you try? I think WM_CLASS is set as of commit
941dacd966913ebbeca1 (August 4) in the git repo.
   


Will the class be "Drracket", or will that change to "DrRacket" before 
the release?


WM_CLASS(STRING) = "drracket", "Drracket"

Welcome to DrRacket, version 5.1.3.10--2011-09-24(09b0a46/a) [3m].

--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] DrRacket WM_CLASS on X

2011-09-26 Thread Neil Van Dyke

Matthew Flatt wrote at 09/26/2011 09:05 PM:

I've changed it to "DrRacket" and set up the configuration plumbing for
executables/launcher in general.
   


Thanks.  That was going to be my next wishlist item. :)

--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Issue with Geiser and Racket 5.1.3 on Windows

2011-09-27 Thread Neil Van Dyke
"neil/sicp" might well be at fault, due to bit-rot from the kludgey way 
in which it was written, combined with changes in Racket.  Check Syntax 
also broke for "neil/sicp".


However, perhaps the Geiser people can look at this first, since it 
looks like it could be a bug Geiser?


"neil/sicp" is specifically for doing SICP using DrScheme (now, 
DrRacket).  I expressly haven't spent time on making it work with Emacs, 
Quack, Geiser, or anything else.  That's because I don't have the time, 
and it seems a low priority, given that I suspect most people wanting to 
run in Emacs could just use MIT Scheme (perhaps using virtualization).  
MIT Scheme is how the SICP exercises were intended to be done.


I do have to look at the Check Syntax problem in any case, unless 
someone wants to take over the project of providing SICP support for 
Racket.  It *really* wants an RA or TA to spend a semester doing it 
right: rewriting the #lang in a more contemporary Racket way, and 
providing something like teachpacks for each problem set.  Or perhaps 
someone could do this polish as a side project, as they are working 
through SICP themselves.  Please email me if you're up to this.


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] splicing internal define?

2011-09-28 Thread Neil Van Dyke

Sam Tobin-Hochstadt wrote at 09/28/2011 10:42 AM:

(require racket/mpair racket/splicing)
   



I guess the advantage of "let-splicing" here is that you can put the 
names by the definitions, rather than like the following more 
traditional way of doing this:


#lang racket/base

(require racket/mpair)

(define-values (variable-ref variable-set!)
  (let ((value-store (mlist (mcons 'variable #f
(values (lambda (variable)
  (massoc variable value-store))
(lambda (variable value)
  (set-mcdr! (variable-ref variable) value)

(variable-ref 'variable)

Incidentally, Marijn, given that that's a module right there, I suspect 
that the main reason you want to hide "value-store" like this is if this 
code was actually the result of a macro expansion.  If not as the result 
of a macro expansion, then a perfectly normal practice is to use a 
top-level binding and simply not export it from the module, like:


#lang racket/base

(require racket/mpair)

(define value-store (mlist (mcons 'variable #f)))

(define (variable-ref variable)
  (massoc variable value-store))

(define (variable-set! variable value)
  (set-mcdr! (variable-ref variable) value))

(provide variable-ref variable-set!)

If you were writing a reusable library rather than experimenting, you'd 
probably not have a "value-store" binding that (presumably) will be 
mutated, but instead use a Racket parameter, so you'd have something like:


#lang racket/base

(require racket/mpair)

(define current-value-store (make-parameter (mlist (mcons 'variable #f

(define (variable-ref variable)
  (massoc variable (current-value-store)))

(define (variable-set! variable value)
  (set-mcdr! (variable-ref variable) value))

(provide variable-ref variable-set! current-value-store)

The parameter lets users of the library have multiple instances of the 
value store, rather than only one value store per program.  You'd 
probably also provide a "make-value-store".


There's also a good chance you'd also use something other than mutable 
pairs, too, such as hashes or non-mutable pairs.  You'll see examples in 
old Scheme textbooks of rolling your own records or objects using pairs, 
and that's good for learning, but for most real-world development, 
Racket has a large library of often better ways to accomplish things.


--
http://www.neilvandyke.org/

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] splicing internal define?

2011-09-29 Thread Neil Van Dyke

Marijn wrote at 09/29/2011 03:36 AM:

DrRacket (yesterday's git)
wants to indent it like so:
   



I suspect that someone will change this in DrRacket, but in the interim, 
you can add "splicing-let" to:

Preferences -> Editing -> Indenting -> Lambda-like Keywords

--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] case form implemented with a hash

2011-09-29 Thread Neil Van Dyke



At Thu, 29 Sep 2011 12:25:16 +0200, "Jos Koot" wrote:

> In my case I have a case form which dispatches on a character, 86 
different
> ones. Therefore I can dispatch by means of a vector. However, almost 
every
> character has its own clause and therefore dispatching on the index 
of the

> character would give no speed up.



Do I understand correctly that this jump-table-like vector-of-closures 
is not fast enough?


If this were assembler for a conventional architecture, and you were 
doing a DFA-like lexer, I'd think that a jump table would be quite fast 
(but with some bloated constant for code size).


I wonder whether there's an optimization the compiler/JIT can make that 
would be a big help, perhaps with additional hints from the Racket 
code?  And if so, would that optimization likely be useful for anything 
other than optimizing "case" of characters?


--
http://www.neilvandyke.org/
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users

Re: [racket] case form implemented with a hash

2011-09-29 Thread Neil Van Dyke

Jos Koot wrote at 09/29/2011 03:13 PM:
> I should add that my timing was on an overall program, not the 
binary-case alone. I am more interested in the performance of whole 
programs than in parts that may not significantly add to the time.


I'm guessing that you're using Racket's profiler 
("http://docs.racket-lang.org/profile/";), which will give a good idea of 
where to focus optimization to improve the performance of the whole program.


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Poll: Does anybody besides Doug use 'plot'?

2011-09-30 Thread Neil Van Dyke

Robby Findler wrote at 09/30/2011 01:05 PM:

On Fri, Sep 30, 2011 at 12:01 PM, John Clements
  wrote:
   

  In my world, a change will fall into the "yes, racket is a rapidly changing 
language" bin;
it's not unusual for much of my old code to be broken.
 

I realize this is a meta question, but is this the world we really
want Racket to be in?
   


I want it to be stable (backward-compatible changes in general).  
However, I also want it to continue to innovate.  I think that the 
interactivity between the developers and users of the platform permits 
us to have both.  Sometimes, you can simply ask "hey, is it OK with 
everyone if I break such-and-such slightly, requiring you to make a 
small code change?", and if the answer is yes, you collectively save a 
person-week of work and also avoid some legacy cruft.


On the other hand, if you want Racket to be an exercise and showcase for 
perfect backward compatibility, that might be interesting.  Perhaps 
someone can find some novel techniques to help do that, and some way of 
demonstrating the contribution (seamless backward compatibility 
throughout evolution, without some cost that systems traditionally incur 
to satisfy that).


--
http://www.neilvandyke.org/

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Racket Apology

2011-09-30 Thread Neil Van Dyke

John Clements wrote at 09/30/2011 03:07 PM:

That's *also* the reason that you'll almost never see Racket used in industry. 
It's a language that doesn't compromise its ideals, and is constantly 
innovating, and if you're a business that's looking for a stable language with 
a broad supply of programmers, Racket would be an extremely surprising choice.


Cough, cough.  Well, you had to know I'd chime in on this... :)

Just this morning, I had to install a very large Racket-based system on 
a new machine, with a new major distro version.  The Racket parts simply 
worked, but the relatively small Python bits (perhaps on the order of 1% 
of the code) were a time-wasting annoyance, from trying to figure out 
which distro packages now had the needed libraries, and crossing my 
fingers that the versions were compatible (thank you, PLaneT).  And 
changing a *Python* version is something I wouldn't do, if at all 
possible, unlike Racket versions, where we like to sync up to the latest 
version.  The database engine was also annoying.  Again, the Racket 
parts simply worked, given a Racket install and the source files as 
checked out of the SCM system.  Also just this morning, someone doing 
new development of a JS part of a Racket-based system was seeing some 
buggy behavior with an off-the-shelf JS component in the browsers, and I 
told them that I'd tackle that, but that if the debugging or fix gets 
too hard, a perfectly normal practice of JS developers is to keep trying 
and coding for different off-the-shelf JS components until they find one 
that works sufficiently well.  Don't even ask me about the Java app I 
revived this year, taking more time than it would have taken to write 
from scratch using the Racket Web Server and continuations.  Python, JS, 
and Java certainly keep a lot of programmers employed.


There's a lot more that I could say about various software engineering 
aspects of this question, but I'd need all day to try to say them well.  
Two points I can try to make quickly, however, are that: (1) "broad 
supply of programmers" in the Java or Python sense is not necessarily 
what you want; and (2) the programmers you do want for high-quality work 
on difficult problems might be in greater supply than you might think.  
As for #1, try doing development in Java nowadays, Googling on a 
technical question, and being surprised at the percentage of people 
talking who have little idea what they're doing, while you're still 
trying to find someone who does know.  For #2, look at ITA Software, who 
chose to tackle a large systems development problem that perhaps no one 
else could do, and proceeded to find and hire a large number of smart 
people who knew Lisp.  I heard that Google recently acquired ITA's 
software and people.


I'm not going to tell college students they can get jobs programming 
Racket, because, this year, they probably can't (unless they do 
startups).  But I expect Racket to keep increasing in popularity for 
industry use for a while, especially if Racket continues to innovate 
while continuing to care about adoption.  So please don't discount 
industry possibilities in your mind.


I admit there's some language-bashing here, Mom, but John started it.  
I'll go have a timeout.


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Poll: Does anybody besides Doug use 'plot'?

2011-09-30 Thread Neil Van Dyke

If someone wouldn't mind a recap... are the questions the following?

1. When to retire the old implementation (not necessarily the interface) 
of old library called "plot".


2. Whether to call the new library "plot" (rather than, say, "plot2" or 
"newimprovedsuperplot2000").


3. Whether the new library will provide a compatibility layer of some 
kind to support old code using old "plot" interface.


4. If a compatibility layer, whether old code using the compatibility 
layer will work as-is, or need changes (e.g., not all features 
implemented, doesn't work quite the same, "require" has to change from 
"plot" to "plot/compat").


5. Whether the old implementation of "plot" will move to PLaneT, 
regardless of whatever happens with the new library and compatibility 
layers.


--
http://www.neilvandyke.org/

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Starting Racket?

2011-10-01 Thread Neil Van Dyke

Remove the "/drracket" from the end of your "PATH" variable.

--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Poll: Does anybody besides Doug use 'plot'?

2011-10-01 Thread Neil Van Dyke

Neil Toronto wrote at 10/01/2011 12:15 PM:

2. Whether to call the new library "plot" (rather than, say, "plot2" or
"newimprovedsuperplot2000").


Yep. That's part of the main question.

[...]
If the answer to #2 is "the new library is called 'plot'", then the 
answer to #4 is "you have to change (require plot) to (require 
plot/compat)". And then everything should work.


Thanks, Neil T.

If that's a big point of contention, then would everyone be happy either 
with one of the following?


1. Call the new library "plot2", and make "plot" be a compatibility 
layer for "plot2".  Add pointers in strategic locations of "plot" parts 
of documentation, saying telling reader probably want to use "plot2" for 
new development.


2. Make the APIs for the old library and new library not conflict, by 
making any necessary changes to the new API, and put both APIs together 
in single library named "plot" that users get with "(require plot)".  
Document the old API parts as deprecated.


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Poll: Does anybody besides Doug use 'plot'?

2011-10-01 Thread Neil Van Dyke

Neil Toronto wrote at 10/01/2011 01:50 PM:

On 10/01/2011 10:44 AM, Neil Van Dyke wrote:

1. Call the new library "plot2", and make "plot" be a compatibility
layer for "plot2". Add pointers in strategic locations of "plot" parts
of documentation, saying telling reader probably want to use "plot2" for
new development.


That's what Robby wants. I've tried it that way as well. It works fine.

My main problem with it is when *future* users search for "plot" in 
the documentation. They'd get the pointers in strategic locations, 
yes, but users don't always read text. And the pointers would have to 
be in a lot of places.


If the problem with option #1 is users looking at "plot" documentation 
and not  seeing the "DON'T USE THIS, USE PLOT2" warnings... I'll 
volunteer to edit "collects/plot/plot.scrbl" to try to avoid this problem.


Option #1 seems like an easy way to go, from what I can see.


2. Make the APIs for the old library and new library not conflict, by
making any necessary changes to the new API, and put both APIs together
in single library named "plot" that users get with "(require plot)".
Document the old API parts as deprecated.


I had thought of this, but not seriously checked it out until you 
suggested it just now.


Sounds like option #2 would be messy and a lot of work -- bogging down 
innovation.


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Gathering GC statistics for Racket programs

2011-10-01 Thread Neil Van Dyke

This is excellent, Sam.  Is a PLaneT package imminent?

--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Poll: Does anybody besides Doug use 'plot'?

2011-10-02 Thread Neil Van Dyke


On Oct 2, 2011, at 12:07 AM, Neil Toronto wrote:

   


A tad more seriously, if we had a death date for the old one, I could put it in 
the library name. You'd have to put

(require plot/supported-until-2013-01-01)
 

I really like this one a lot. -- Matthias
   



So long as nobody thinks that this is necessarily a best practice 
for breaking API in the future, IMHO.


In the case of "plot", the API breaks at the time users have to change 
their "require" form to include this expiration date (and then the API 
may break a *second* time, on or after that date).


I'd see this as not a best practice, but a one-time deal: for the 
special case of the "plot" library that few people use, and which 
library we really want to get rid of because of the C code, combined 
with a desire to steal the old API's "(require plot)" for the new API.


In the future, we all will have had the benefit of the "plot" 
experience, which teaches us that API breakage will cause a huge amount 
of discussion, which costs the developers time/energy/morale before we 
even get to what API breakage costs users.  So we will consider breaking 
API only when the win is so big that we are willing to endure 
discussion.  I love that discussion can be used not only for 
collaborative design and problem-solving, but also as itself a painful 
stick to discourage misbehavior.


By all means, just move forward on getting the new "plot" goodness to 
the users, however the API migration is done.  Learning experience has 
been achieved.


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Is there some Web services and XML libraries ?

2011-10-09 Thread Neil Van Dyke
I have done a lot of this for different kinds of Web services created by 
different organizations.  Usually, they are not using a standard 
HTTP-based RPC mechanism, but just sending ad-hoc XML over HTTP.


Usually, I do normal HTTP requests, and then use SXML tools like SSAX, 
SXPath, and sxml-match to parse the results.


For documentation on how to do HTTP from Racket, see the Racket 
Documentation (from DrRacket, select "Help -> Help Desk" menu item, or 
whatever it is called in your preferred language).


For documentation on the SXML tools, you will have to Google search each 
one of them.  You can obtain the SXML tools from 
"http://planet.racket-lang.org/";, but the documentation there is not 
good for most of the tools.


Feel free to ask more questions on this email list.

FloreNce de Borchgrave wrote at 10/08/2011 04:06 PM:
Hi , I would like to use your technologie for importing and manage 
Datas in XML from web services API online,
Where can I found documentation and informations on libraries needed 
for that task ? which library for web services and xml requests and 
traitments ?


--
http://www.neilvandyke.org/
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users

[racket] DrRacket-onna-stick for students? (Was: frustrated with error message)

2011-10-13 Thread Neil Van Dyke

Erwin Hildebrandt wrote at 10/13/2011 09:01 PM:
we are using dr Scheme v4.2 (I know its an old version but the tech 
guys at my school take months to test every upgrade that we ask for) 
and we are running windows 7.


Tangential question: How many instructors have students stuck with old 
versions of Racket because their school computer labs are not able to 
install recent versions often, for whatever reason?  (Erwin, you are not 
alone in this problem.)


I'm wondering, if the students need to use lab computers rather than 
their own computers, whether there's a real need for a bootable version 
of DrRacket on little USB flash drives.  So, if the lab PCs permitted 
USB booting, the students pop in their flash stick, reboot, and they run 
an entire OS and Racket setup, with their assignments data, all stored 
entirely on the flash stick alone (not touching the PC's hard drive).  
When they're done with their lab session, they remove the stick and 
reboot back to the PC's normal configuration.  I have made a more 
complicated version of such a thing before 
("http://www.neilvandyke.org/lildeb/";), and I could probably find time 
to tailor a simpler one for DrRacket, if there is a real need for such a 
thing.  I estimate that the sticks would only need to be about 512MB in 
size.  (The local store was giving away sticks 4 times that size, for 
free, just the other day.)



--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Turning car/cdr into multi-methods

2011-10-16 Thread Neil Van Dyke

Patrick Li wrote at 10/16/2011 09:15 PM:
Does anyone have some tips for wrapping their heads around recursive 
things like this?
e.g. writing multi-methods using normal functions, and then somehow 
turning everything into multi-methods?


I think that might be a simple module (or Racket #lang) problem: your 
module imports the ``primitive'' "car" and "cdr", and exports the 
multimethod replacements for the primitives, using the same names as the 
primitives.


   OR writing an object system, where your classes are also objects, 
etc...


When I was using Smalltalk or Self, I believe this was sometimes called 
``infinite meta-regress.''  I would use that term as a Google starting 
point.  I'd also read up on all the Gregor Kiczales et al. writings on 
CLOS, including the *Art of the Metaobject Protocol* book.


I'd also take another look at Eli Barzilay's Swindle package for Racket, 
which, IIRC, included a CLOS-like object system including multimethods.  
Although, you have the advantage of modern Racket, which Eli didn't have 
a bazillion years ago when Swindle was first written, so there might be 
some new fun opportunities.


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Turning car/cdr into multi-methods

2011-10-16 Thread Neil Van Dyke

Patrick Li wrote at 10/16/2011 11:41 PM:
Racket is nice to get started with, but eventually I will need to move 
this onto a different system, so I cannot rely upon Racket's 
utilities. Even though they are very nice!


If you will be moving this onto an old Scheme implementation instead of 
Racket, you might also want to look at Tiny-CLOS.


I suspect you have unusual requirements, if you'll be moving to 
something other than Racket.  Racket is good for most purposes nowadays.


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Reliably disable/redirect console output

2011-10-17 Thread Neil Van Dyke

You might be better off tracking down the source of these, because:

(1) They might be symptomatic of some bug, such as a port not being 
specified in a write statement, rather than benign.


(2) Someday you might have a bug get useful diagnostic information to 
one of the ports, and you don't want to suppress it, nor to have your 
string port create an additional growing use of resources that could 
complicate your debugging.


Things I would check:

(1) Look in your code for stray top-level forms that produce values, 
such as expressions used for ad hoc testing.  Add "(begin ... (void))" 
if necessary.


(2) Look in your code for code that writes to a port, but is missing an 
optional port argument some place.  This is a common bug.


(3) Look for those same two problems in PLaneT packages that you're using.

(4) Look for a PLaneT package that is saving a reference to one of the 
ports, outside your "parameterize".


(5) If all else fails, the issue could be in core Racket, but I think 
that's less likely than the above.


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Saving and restoring many parameters

2011-10-18 Thread Neil Van Dyke
It wouldn't work well to have a "plot context" object, perhaps stored in 
"current-plot-context" parameter?


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Escaping things in templates?

2011-10-23 Thread Neil Van Dyke
As an aside, useful HTML templates don't have to be in HTML syntax; 
Racket programmers can do this:



#lang racket/base

(require (planet neil/html-template:1:0))

(define (write-fastest-in-the-west-page-html thing)
  (html-template
   (html (head (title "Fastest " (% thing) " in the West!")
   (body (h1 "Bang!")
 (h2 "Bang & Olufson!"))

(write-fastest-in-the-west-page-html "Strunk & White")


Which outputs this:


Fastest Strunk & White in the 
West!Bang!Bang & 
Olufson!



Note the escaping by default of both the static (from the procedure's 
perspective) "&", in "Bang & Olufson", and the dynamic one, in "Strunk & 
White".


For possible improved performance, syntax transformation of that 
procedure expands it to the following, during compilation:



(define (write-fastest-in-the-west-page-html thing)
  (begin
(display "Fastest ")
(write-html thing)
(display " in the West!Bang!Bang & 
Olufson!")

(void)))


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Serving multiple, read-only Racket versions?

2011-10-24 Thread Neil Van Dyke

Jukka Tuominen wrote at 10/24/2011 12:06 PM:

I wonder if it's possible to place multiple, read-only Racket versions on a
server and have users executing them directly without needing to install
them individually? I think this is possible, but I'd like to know for sure
that it won't cause any unexpected problems.


Yes, I have been doing this for years, including on production servers, 
by building with the "--prefix" argument to "configure".  For example, 
on this laptop, at the moment, I have:


ls -ld /usr/local/racket-*
drwxr-sr-x 6 root staff 4096 Sep 29 08:55 /usr/local/racket-5.1.2
drwxr-sr-x 6 root staff 4096 Sep 25 06:21 /usr/local/racket-5.1.3
drwxr-sr-x 6 root staff 4096 Sep 26 18:32 /usr/local/racket-5.1.3.10
drwxr-sr-x 6 root staff 4096 Oct 10 23:56 /usr/local/racket-5.2.0.1-nightly

(Eli has a somewhat different way of accomplishing this same thing; you 
might prefer to search the mail archive for his way.  This has come up 
multiple times before.)



Does this sound feasible? I understand that initial PLaneT libraries may
take time to download and are placed into home directory (version handled?).


My understanding is... Yes, the PLaneT libraries are installed in the 
user's home directory.  Each such PLaneT package's installation is 
specific to the Racket version by which it was installed, and multiple 
such versions can be installed simultaneously.  Note that these Racket 
version numbers are the official Racket version numbers, not any other 
version number you might use in directory names in "/usr/local".



One possible threat is to manipulate source code with a newer program
version and make it inaccessible thereafter for the older versions?


You will have to look closely at security.  Depending on the nature of 
your system, the current version of PLaneT might not be secure enough 
as-is.  If it's not secure enough, but you still desire to use it in 
some way, you could layer your own security atop it.  You could also 
talk with PLT people and me about how the next big version of PLaneT 
could address the specific issues you see.


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Codify

2011-10-27 Thread Neil Van Dyke
It wasn't clear to me from the video how someone programs the behavior 
of the games.  I wonder whether that is currently slick visual 
programming, or it's pretty much traditional programming (albeit with 
text editor features like a pop-up color chooser).


The Self morphs world, for example, didn't achieve the holy grail of 
visual programming, but it did give better demo for specifying behavior.


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


[racket] possible simple ranking improvement to documentation search

2011-10-27 Thread Neil Van Dyke
In the documentation search ranking, would it be a low-hanging-fruit 
improvement to simply add bonus factors to the most popular manuals, 
like the Guide and Reference?


This is simpler than my early suggestion of using #lang info in ranking.

Combining this with marking up sections on topical keywords like "port" 
seems like it might help.


The reason I ask is that, when I just now searched in Racket 5.1.3 for 
"port", looking for the general documentation for the port abstraction 
in Racket, I got the following:


<<>>Showing 1-20 (3 exact) of 397 matches
Port  provided from typed/racket/base, typed/racket
port  provided from web-server/private/dispatch-server-sig
port  provided from web-server/web-config-sig
&i/o-port  provided from rnrs/io/ports-6
(rnrs io ports (6)): I/O: Ports  in r6rs
:port  provided from srfi/42
Additional Custom-Output Support  in reference
Animation support  in picturing-programs
Attaching Documentation to Exports  in syntax
binary-port?  provided from rnrs/io/ports-6
Bug Reporting  in tools
call-with-bytevector-output-port  provided from rnrs/io/ports-6
call-with-port  provided from rnrs/io/ports-6
call-with-string-output-port  provided from rnrs/io/ports-6
clear-box-input-port (method of text:ports<%>)  provided from framework
clear-input-port (method of text:ports<%>)  provided from framework
clear-output-ports (method of text:ports<%>)  provided from framework
clear-viewport  provided from graphics/graphics
close-input-port  provided from racket/base, racket
close-input-port  provided from r5rs

<<>>[set context]

--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Just how to get and print a web page

2011-10-29 Thread Neil Van Dyke

Sam Tobin-Hochstadt wrote at 10/29/2011 07:15 AM:

#lang racket
(require net/url)
(define (get url)
   (get-impure-port (string->url url)))
(port->lines (get "http://www.google.com";))


Also, if you want to process the HTML of that page, you might wish to 
get the HTML into an SXML/xexp format like this does:


#lang racket/base
(require net/url
 (planet neil/html-parsing))
(call/input-url (string->url "http://www.google.com/";)
get-pure-port
html->xexp)

This SXML can be processed using tools like SXPath and "sxml-match".

This SXML can also be processed using low-level Racket list-processing 
procedures like "car", "cdr", and "pair?" and recursive procedures.


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] set! racket behaviour

2011-10-31 Thread Neil Van Dyke

jkaczo...@aol.pl wrote at 10/31/2011 12:58 PM:
Of course, I realize, that redefinition of the variables is not good 
(functional) programming style but sometimes it's necessary. Is there 
a possibility of such modifications without changing language?


You might wish to use a parameter, like in the example below.


#lang racket

(define current-counter (make-parameter 0))

(current-counter)  ;==> 0

(current-counter 42)

(current-counter)  ;==> 42

(current-counter (+ 1 (current-counter)))

(current-counter)  ;==> 43


In this example, I have named your variable to start with "current-", 
just by convention to emphasize that a variable is a parameter, but 
that's not actually necessary.


--
http://www.neilvandyke.org/
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users

Re: [racket] set! racket behaviour

2011-10-31 Thread Neil Van Dyke

Parameters are very useful.  See:
http://docs.racket-lang.org/reference/parameters.html


Neil Van Dyke wrote at 10/31/2011 01:06 PM:

jkaczo...@aol.pl wrote at 10/31/2011 12:58 PM:
Of course, I realize, that redefinition of the variables is not good 
(functional) programming style but sometimes it's necessary. Is there 
a possibility of such modifications without changing language?


You might wish to use a parameter, like in the example below.


#lang racket

(define current-counter (make-parameter 0))

(current-counter)  ;==> 0

(current-counter 42)

(current-counter)  ;==> 42

(current-counter (+ 1 (current-counter)))

(current-counter)  ;==> 43


In this example, I have named your variable to start with "current-", 
just by convention to emphasize that a variable is a parameter, but 
that's not actually necessary.




--
http://www.neilvandyke.org/

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users

Re: [racket] Google Challenge

2011-11-01 Thread Neil Van Dyke

Paulo J. Matos wrote at 11/01/2011 10:57 AM:
Anyone working on a Racket starter package for the Ants Google 
Challenge? http://aichallenge.org/ 


Here's the documentation they point one to for writing your their 
starter pack:

https://github.com/aichallenge/aichallenge/wiki/Ants-Starter-Pack-Guide
https://github.com/aichallenge/aichallenge/wiki/Ant-bot-input-output

It looks easy to implement.

Also, I think that, as important as having a Racket starter kit 
available, is having a contestant team that will use the starter kit to 
put in a serious effort.


A team is a good idea, because you can develop different approaches in 
parallel, and then decide which approaches to combine and refine.  You 
might also be able to use additional people to get generic ``AI'' 
libraries working in parallel, separate from their application-specific 
use of those libraries.


More importantly, remember: it is not enough for Racket programmers to 
merely win; Java programmers must lose.


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] plot: HOLY MOLEY!

2011-11-02 Thread Neil Van Dyke
A more plausible explanation is that you *dreamt* that you reached out 
to a plot in the DrRacket REPL, and were able to rotate it and see it 
from different angles.  It's pretty typical of dreams to let you violate 
the realities of physical world, and if you wake just then, there is a 
moment of disappointment as you realize it was only a dream.  Sorry.


I think a new DrRacket demo video is called for.

--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Racket on Netbook (Windows 7 Starter)?

2011-11-05 Thread Neil Van Dyke

Asa Packer wrote at 11/05/2011 02:07 PM:
Is anybody using Racket on a netbook running Windows 7 Starter?  Does 
it work OK?  I'm trying to figure out how much I need to spend on a 
machine for my son to use Racket on... 


In case no one has firsthand experience, I can extrapolate based my 
machines...


Looks like the US$250 netbooks on Newegg.com are all 1.66GHz single-core 
Atom, 1GB RAM, 250GB disk, 10.1-inch 1024x600 display.


Based on a quick test just now, I think that CPU would be fine for 
running DrRacket, including with the new online Check Syntax feature 
enabled.


The 1GB RAM would be fine for GNU/Linux setup running DrRacket, Firefox, 
OpenOffice.org, and a lightweight GUI desktop simultaneously.  You could 
even run without swap space, and with the "tmp" directory in RAM, for 
speed and power-savings.  I don't know about Windows 7 Starter's RAM 
requirements.


The 1024x600 resolution is a little unfortunate.  All my laptops have 
1400x1050 displays, and even those are a little bit tight when I want to 
view Racket code and Racket documentation on the screen at the same 
time.  Currently, I work around the small screen space by using the 
Xmonad tiling window manager to keep both windows on screen and to 
quickly toggle which one is big enough for much reading.


If anyone is looking at netbooks because of the price rather than the 
portability, they might also consider refurbished/nonissued ThinkPads 
off eBay, which can have better specs than new netbooks in most regards, 
at lower prices.  (That's what I use exclusively for 
workstations/laptops right now, because I like the specs of a particular 
ThinkPad model that's no longer made.)  And used slightly older-model 
netbooks are dirt-cheap, sometimes free, yet are perfectly usable for 
Racket running atop a lightweight GNU/Linux setup.  Same with used 
laptops that people mistakenly think are slow or broken, but that really 
just need a well configured OS.


I mentioned GNU/Linux because that's what I know works, and historically 
it has worked much better on modest-resource machines than Windows 
does.  If you decide to go GNU/Linux, you're looking at more work than 
Windows to set it up well.  You might consider tweaking GNU/Linux as a 
general educational experience or a useful practical skill, somewhat 
like your intentions for Racket.


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


  1   2   3   4   5   6   7   8   9   10   >