[racket-users] Positioning GUI controls in contact with one another

2016-09-05 Thread David Storrs
How do I find the actual minimum size of a GUI control (e.g. a button) without the space around it? I'm on OSX 10.11. I'm working on a spreadsheet application, and my current plan is to have each cell be represented as a separate text control.[1] I need to have these controls be in contact

Re: [racket-users] DrRacket says #%module-begin not a module

2016-09-03 Thread David Storrs
On Sat, Sep 3, 2016 at 6:03 PM, John Clements <cleme...@brinckerhoff.org> wrote: > > > On Sep 3, 2016, at 5:54 PM, David Storrs <david.sto...@gmail.com> wrote: > > > > The best would probably be if DrRacket's out-of-the-box language setting > was somet

[racket-users] DrRacket says #%module-begin not a module

2016-09-03 Thread David Storrs
I typically use Emacs, but I thought I would experiment with DrRacket a bit. I'm on OSX 10.11 using DrRacket v6.6, freshly installed an hour ago. I started it up, File>New, typed this: #lang racket (displayln "hello world") and hit the Run button at top right. I get the following message at

Re: [racket-users] Spreadsheet widget?

2016-09-03 Thread David Storrs
Spiffy, thanks. Also, what license is your spreadsheet under? I'm building a for-commerce app and I don't want to step on your toes if you'd rather it not be used that way. Dave On Sat, Sep 3, 2016 at 10:03 AM, Dmitry Pavlov wrote: > David, > >invalid symbol:

[racket-users] Spreadsheet widget?

2016-08-29 Thread David Storrs
Is there a spreadsheet in Racket? I dug through the list and found a mailing list thread from 2008 but nothing since then. I also checked the Widget Gallery and didn't see

Re: [racket-users] Iterating through a list more than one at a time

2016-08-10 Thread David Storrs
On Wed, Aug 10, 2016 at 5:50 AM, Greg Hendershott wrote: > > I feel like there should be a simpler way to do this, but I haven't found > > one despite much Googling and reading of docs about "for" and its > siblings. > > Can someone point me the right way? > > > > I'd

Re: [racket-users] How to dynamically generate top-level procedures?

2016-08-10 Thread David Storrs
Yes. Yes, that exactly solves my problem. *sheepish look* Thanks. On Tue, Aug 9, 2016 at 8:47 PM, Matthew Butterick <m...@mbtype.com> wrote: > > On Aug 9, 2016, at 7:52 PM, David Storrs <david.sto...@gmail.com> wrote: > > > This solves the problem of creating top

Re: [racket-users] How to dynamically generate top-level procedures?

2016-08-09 Thread David Storrs
On Tue, Aug 9, 2016 at 2:20 PM, John Clements wrote: > > Racket is essentially a lexically scoped language. That is: it should be > possible to look at a piece of code and figure out where the binding for a > given variable is. It does have a dynamic binding mechanism,

Re: [racket-users] How to dynamically generate top-level procedures?

2016-08-09 Thread David Storrs
l binding' the right term here?) > On Tue, Aug 9, 2016 at 5:20 PM, 'John Clements' via Racket Users < > racket-users@googlegroups.com> wrote: > >> >> > On Aug 9, 2016, at 4:46 PM, David Storrs <david.sto...@gmail.com> >> wrote: >> > >> >

[racket-users] How to dynamically generate top-level procedures?

2016-08-09 Thread David Storrs
In Perl it's possible to generate main-namespace functions like so: perl -E 'my $z = 1; for (qw/foo bar baz/) {my $x = $_; *$_ = sub{ say "$x: ", $z++ }}; foo(); bar(); baz();' This outputs: foo: 1 bar: 2 baz: 3 Note that it is generating top-level subroutines that can be called from

Re: [racket-users] Iterating through a list more than one at a time

2016-08-04 Thread David Storrs
m> wrote: > > On Aug 4, 2016, at 3:10 PM, David Storrs <david.sto...@gmail.com> wrote: > > I'd like to be able to iterate over a list N elements at a time -- e.g., > grab elements 1 and 2, do something with them, grab 3 and 4, etc. > > Your technique seems fine. Yo

[racket-users] Iterating through a list more than one at a time

2016-08-04 Thread David Storrs
I feel like there should be a simpler way to do this, but I haven't found one despite much Googling and reading of docs about "for" and its siblings. Can someone point me the right way? I'd like to be able to iterate over a list N elements at a time -- e.g., grab elements 1 and 2, do something

Re: [racket-users] Is my model of (values) accurate?

2016-07-22 Thread David Storrs
*sigh* Just when I was feeling clever, I discover I missed the obvious. ;> Thanks, everyone. On Fri, Jul 22, 2016 at 8:05 PM, Ryan Culpepper <ry...@ccs.neu.edu> wrote: > On 07/22/2016 07:58 PM, David Storrs wrote: > >> Thanks Jon, I appreciate the clear explanation.

Re: [racket-users] Is my model of (values) accurate?

2016-07-22 Thread David Storrs
eri <zeppi...@gmail.com> wrote: > > > On Fri, Jul 22, 2016 at 6:30 PM, David Storrs <david.sto...@gmail.com> > wrote: > >> >> The best mental model I've been able to come up with is that (values) >> returns its results vertically but most functions

[racket-users] Is my model of (values) accurate?

2016-07-22 Thread David Storrs
I think I don't understand (values) very well. I expected the following to return '(1 2 3): -> (list (apply values '(1 2 3))) (list (apply values '(1 2 3))) ; result arity mismatch; ; expected number of values not received ; expected: 1 ; received: 3 ; [,bt for context] This, on the other

Re: [racket-users] Re: How to differentiate between files and directories?

2016-07-22 Thread David Storrs
e-", no > duplicates in the entire application. > > On Fri, Jul 22, 2016 at 3:59 AM, David Storrs <david.sto...@gmail.com> > wrote: >> >> So there's no way to query the interface of a struct? >> >> >> On Thursday, July 21, 2016, Jon Zeppieri <zeppi...@gma

[racket-users] Re: How to differentiate between files and directories?

2016-07-21 Thread David Storrs
Okay. Thanks for the help, all. On Thursday, July 21, 2016, Jon Zeppieri <zeppi...@gmail.com> wrote: > > > On Thu, Jul 21, 2016 at 3:59 PM, David Storrs <david.sto...@gmail.com > <javascript:_e(%7B%7D,'cvml','david.sto...@gmail.com');>> wrote: > >> S

[racket-users] Re: How to differentiate between files and directories?

2016-07-21 Thread David Storrs
So there's no way to query the interface of a struct? On Thursday, July 21, 2016, Jon Zeppieri <zeppi...@gmail.com> wrote: > > > On Thu, Jul 21, 2016 at 2:44 PM, David Storrs <david.sto...@gmail.com > <javascript:_e(%7B%7D,'cvml','david.sto...@gmail.com');>> w

[racket-users] Re: How to differentiate between files and directories?

2016-07-21 Thread David Storrs
docs.racket-lang.org/reference/booleans.html#%28def._%28%28quote._~23~25kernel%29._boolean~3f%29%29> > > path : path-string? > <http://docs.racket-lang.org/reference/Manipulating_Paths.html#%28def._%28%28lib._racket%2Fprivate%2Fmisc..rkt%29._path-string~3f%29%29> > > Returns

[racket-users] How to differentiate between files and directories?

2016-07-21 Thread David Storrs
Silly question: given a <#path>, how do I tell if it's to a file, directory, link, etc? I'd like to know this in general, although the proximate issue is that I would like to use (in-directory) to process all the files in a directory, but I need a way to ignore everything that isn't a file. I

Re: [racket-users] Macros that use with-handlers

2016-07-16 Thread David Storrs
I see. Okay, thanks for clarifying. On Sat, Jul 16, 2016 at 8:05 PM, Alex Knauth <alexan...@knauth.org> wrote: > >> On Jul 16, 2016, at 7:18 PM, David Storrs <david.sto...@gmail.com> wrote: >> >> Wow, that is a lot of problems. Thanks for taking the time to &

Re: [racket-users] Macros that use with-handlers

2016-07-16 Thread David Storrs
Wow, that is a lot of problems. Thanks for taking the time to comment; this was in large part an effort to learn macros, so it's helpful to get this kind of feedback. On Sat, Jul 16, 2016 at 2:48 PM, Alex Knauth <alexan...@knauth.org> wrote: > >> On Jul 16, 2016, at 2:16 P

Re: [racket-users] Macros that use with-handlers

2016-07-16 Thread David Storrs
On Sat, Jul 16, 2016 at 2:48 PM, William J. Bowman wrote: > To address the immediate problem, this `procedure?` test will always return > `#f`, since `#'pred` is a > syntax object and not a procedure. You need to do `(procedure? (syntax->datum > #'pred))`. Similarly >

Re: [racket-users] Macros that use with-handlers

2016-07-16 Thread David Storrs
On Sat, Jul 16, 2016 at 2:48 PM, Alexis King wrote: > Of course, this makes sense, given that macros operate entirely at > compile-time. What you really want here is a function, not a macro. You > can write a simple function that will accept a procedure or a string and >

[racket-users] Macros that use with-handlers

2016-07-16 Thread David Storrs
I'm trying to write a macro to test expected exceptions. I'd like it to have the following forms: (throws exception-generator-function proc msg) (throws exception-generator-function string msg) Where 'proc' would be something like exn:fail? and 'string' would be matched against the message

Re: [racket-users] Question on contracts -- check equal length of args

2016-07-15 Thread David Storrs
Thanks Jens! On Fri, Jul 15, 2016 at 1:00 PM, Jens Axel Søgaard <jensa...@soegaard.net> wrote: > 2016-07-15 18:22 GMT+02:00 David Storrs <david.sto...@gmail.com>: > >> >> On a separate question: How do I contribute to the docs? The >> contract docs are

Re: [racket-users] Question on contracts -- check equal length of args

2016-07-15 Thread David Storrs
t; to use is `exact-integer?`. The `integer?` predicate accepts both exact and > inexact integers which can be a little strange at first. > > Dan > > > > On Fri, Jul 15, 2016 at 11:22 AM, David Storrs <david.sto...@gmail.com> > wrote: >> >> Hi folks, >>

[racket-users] Question on contracts -- check equal length of args

2016-07-15 Thread David Storrs
Hi folks, I'm writing a stats library (I'm sure there is already one out there; this is a learning exercise), and I'm currently implementing Kendall's Tau-a. I've got my head wrapped part of the way around contracts, but not all the way. I'd like to be able to express the following: (tau l m)

[racket-users] Writing Racket for iOS / Android

2016-07-10 Thread David Storrs
I need to build an app for iPhone and (later) Android, and I'd prefer to be able to write it in Racket but still get native interfaces. I searched through the list archives and found this thread https://lists.racket-lang.org/users/archive/2015-February/065929.html ("[racket] compiling Racket to

Re: [racket-users] What do you use macros for?

2016-04-07 Thread David Storrs
That's very cool, Dan. Thanks for the example. (Although, shouldn't -4^2 + 4^2 = 32, not 31?) If/when you do the 'further challenges' section, could you post the result here? It looks like it would be useful. Dave On Thu, Apr 7, 2016 at 1:53 PM, Daniel Prager

Re: [racket-users] What do you use macros for?

2016-04-07 Thread David Storrs
at documentation facilities, like > Scribble, as well as good macro constructs that will help you guide your > user through proper usage. > > On Wed, Apr 06, 2016 at 05:19:05PM -0700, David Storrs wrote: > > Hi folks, > > > > Macros are one of the biggest features that

Re: [racket-users] What do you use macros for?

2016-04-06 Thread David Storrs
Nice. Thank you, Asumu. That helps. On Wed, Apr 6, 2016 at 5:39 PM, Asumu Takikawa <as...@ccs.neu.edu> wrote: > Hi David, > > On 2016-04-06 17:19:05 -0700, David Storrs wrote: > >Macros are one of the biggest features that people list as the > advantages > &

[racket-users] What do you use macros for?

2016-04-06 Thread David Storrs
Hi folks, Macros are one of the biggest features that people list as the advantages of LISP / Scheme, and I don't really understand them. I get the basics -- they can create new code structures -- but not the implications What have you used them for, and what do they do that a function

Re: [racket-users] Using Racket server in production?

2016-01-24 Thread David Storrs
memory use and properly evict unneeded continuations. Keeping state on the > client works brilliantly. > > Using the Racket webserver has always been a breeze for me. It's easy to > do stuff that requires mucking with HTTP and it's easy to build complete, > reliable apps. This kind of fle

[racket-users] Using Racket server in production?

2016-01-23 Thread David Storrs
Is anyone here using the Racket web server in production? If so, what's your experience with it? Specifically: Have you had any difficulty integrating it with outside systems? (e.g. Varnish, Redis, load balancer ooling, etc) Most of this I wouldn't expect to be an issue, but I figured I'd ask

[racket-users] Code critique request: data/fetch, proc for walking hashes/lists

2016-01-10 Thread David Storrs
I feel like I'm starting to be somewhat functional with Racket, but I'd like to get more idiomatic. I'd appreciate it if people would critique the following code: (define (data/fetch s key-list) (if (or (empty? s) (nor (list? s) (hash? s))) s (let* ([key

[racket-users] Simple regex question. How to match this: "[X] foo"

2016-01-08 Thread David Storrs
I'm having some trouble with the syntax for regexen, and the docs are a bit opaque on this point. Given this: (regex-match* #px"\[[xX\d]\]" "[1] foo \n [2] bar \n [x] baz \n [X] baz \n"") I'm expecting it to return: ( "[1]" "[2]" "[x]" "[X]") Instead it complains about undefined

Re: [racket-users] Simple regex question. How to match this: "[X] foo"

2016-01-08 Thread David Storrs
On Fri, Jan 8, 2016 at 10:56 PM, Neil Van Dyke <n...@neilvandyke.org> wrote: > David Storrs wrote on 01/09/2016 01:38 AM: > >> >> (regex-match* >> #px"\[[xX\d]\]" >> "[1] foo \n [2] bar \n [x] baz \n [X] baz \n"") >> &g

Re: [racket-users] html parsing library does not handle 'article' tags -- any solutions?

2016-01-07 Thread David Storrs
So, I'm now doing this: (require (planet neil/html-parsing:3:0) (planet neil/xexp:2:0)) Those loaded just fine right off, although I needed to figure out raco pkg install sxml was necessary, but I got that. During the install, I got the following:

Re: [racket-users] html parsing library does not handle 'article' tags -- any solutions?

2016-01-07 Thread David Storrs
On Thu, Jan 7, 2016 at 3:25 PM, John Clements <cleme...@brinckerhoff.org> wrote: > > > On Jan 7, 2016, at 2:57 PM, David Storrs <david.sto...@gmail.com> wrote: > > > > So, I'm now doing this: > > > > (require (planet neil/html-parsing:3:0) (planet n

Re: [racket-users] html parsing library does not handle 'article' tags -- any solutions?

2016-01-07 Thread David Storrs
parsing" racket crashed. Text dump attached for reference. Dave > Jay > > On Thu, Jan 7, 2016 at 6:41 PM, David Storrs <david.sto...@gmail.com> > wrote: > > > > > > On Thu, Jan 7, 2016 at 3:25 PM, John Clements <cleme...@brinckerhoff.org >

Re: [racket-users] html parsing library does not handle 'article' tags -- any solutions?

2016-01-07 Thread David Storrs
On Thu, Jan 7, 2016 at 12:28 PM, Neil Van Dyke wrote: > I just checked that there wasn't a new bug in my old `html-parsing` > package, in case that's which package you meant. > Sorry, I should have been clearer. I'm talking about these: (require html xml), not yours.

[racket-users] html parsing library does not handle 'article' tags -- any solutions?

2016-01-07 Thread David Storrs
Hi folks, I'm using the html and xml libraries to parse a page that includes the following HTML: Message text here When I parse this, the 'article' tag simply isn't parsed -- it lists the contents of the messageContent div as just a series of PCDATA statements containing "\n" Is there

Re: [racket-users] HTTPS problem with net/url

2016-01-06 Thread David Storrs
eb2/racket-x86_64-macosx-2.zip > > and copy the two ".dylib" files from the "racket" folder into > > /Applications/Racket_v6.3/lib/ > > Thanks for delaying this question until the first day that I know the > answer! > > At Wed, 6 Jan 2016 13:50:51 -08

[racket-users] HTTPS problem with net/url

2016-01-06 Thread David Storrs
Hi folks, tl;dr: How do I make HTTPS calls from within Racket? Background: I co-write a play-by-post RPG ( https://forums.sufficientvelocity.com/threads/marked-for-death-a-rational-naruto-quest.24481/ -- stop by if you're curious; the barrier to entry is low). The players all vote to control

[racket-users] Problems with 'provide'

2015-12-23 Thread David Storrs
Hi folks, I have a file, "util.rkt", the complete text of which is: == QUOTE #lang racket (require racket/pretty) (define (print-prettier s) (parameterize ([pretty-print-columns 1]) (pretty-print s))) (define (hash-key-is? h k v) (and (hash-has-key? h k) (equal?

[racket-users] Re: Problems with 'provide'

2015-12-23 Thread David Storrs
Nope, only one. And I checked to make sure I was in the right directory. On Wednesday, December 23, 2015, Robby Findler <ro...@eecs.northwestern.edu> wrote: > Is it possible you have two util.rkt files and you are in the wrong > directory? > > Robby > > On Wednesday,

Re: [racket-users] Is there a way to return no value?

2015-12-11 Thread David Storrs
On Fri, Dec 11, 2015 at 2:32 PM, Jon Zeppieri <zeppi...@gmail.com> wrote: > On Fri, Dec 11, 2015 at 5:27 PM, David Storrs <david.sto...@gmail.com> > wrote: > > > > > > On Fri, Dec 11, 2015 at 1:53 PM, Matthew Butterick <chronf...@gmail.com> > > wro

Re: [racket-users] Is there a way to return no value?

2015-12-11 Thread David Storrs
On Fri, Dec 11, 2015 at 1:53 PM, Matthew Butterick wrote: > PS. I'm assuming that you're using `eq?` here in deliberate preference to > `equal?`. Because `eq?` is not reliable for string comparisons. > Ah. No, I did not realize that. I thought that Racket worked on a

<    3   4   5   6   7   8