[racket-users] pict/code with other languages

2015-03-26 Thread Jack Firth
I'd like to typeset some Javascript code in a way similar to what pict/code 
allows, but the naive approach of (code someFunc(someArg, someOtherArg)) 
doesn't quite work because of the reader adding whitespace in various places. 
pict/code seems to be purely oriented towards working with racket code, how can 
I get similar functionality for languages with C-style syntax?

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: pict/code with other languages

2015-03-26 Thread Jack Firth
Fantastic, thank you. Sidenote - I had to (require java-lexer) instead of 
(require java/code) like the readme says.

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Syntax parameters and renaming

2015-05-05 Thread Jack Firth
I find that 99% of the time when I'm using syntax parameters, I'm just using 
them with make-rename-transformer to implement macro-dependent keyword-like 
things, such as `aif` and `it`. So I made a small helper macro 
syntax-parameterize-rename:

(syntax-parameterize-rename ([param #'foo]) ...)

expands to

(syntax-parameterize ([param (make-rename-transformer #'foo)]) ...)

It seems weird to put it in a package when it's so heavily tied to the core 
syntax-parameterize form. I've added it to my fork of the Racket repo. Would 
anyone else find this useful enough to warrant a pull request? The code is at 
https://github.com/jackfirth/racket/tree/stx-param-rename

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] scribble namespace landgrab embedded package documentation

2015-05-08 Thread Jack Firth
Additionally if it were it's own lang extension, the tool using this 
information wouldn't need to do the parsing. The reader could extract all the 
;;; definitions into a submodule that the tool requires.

On Thursday, May 7, 2015 at 11:44:59 AM UTC-7, Matthew Flatt wrote:
 I have no problem with these names --- the `scribble` exports are
 unlikely to ever collide, since we rarely resort to capital letters ---
 but I can't help thinking that the language of the metadata should
 specified explicitly.
 
 Concretely, instead of
 
  #lang racket/base
 
 maybe the file should start
 
  #lang mcfly racket/base
 
 ... or some suitable word if `mcfly` isn't it ... to indicate that
 ;;; is being treated in a particular way. The `mcfly` name both
 specifies the special parsing of comments and the initial/default
 language of those comments, so that either of those are free to evolve
 in the future through a different name.
 
 At Mon, 04 May 2015 19:39:19 -0400, Neil Van Dyke wrote:
  For purposes of embedding docs for a package in its Racket source 
  file(s), anyone care whether I landgrab some names in the Scribble 
  namespace (for package metadata)?
  
  I'm thinking the names will generally one-word generic terms, but with 
  capitalization.
  
  Example package source file with said metadata:
  
   BEGIN 
  
  #lang racket/base
  ;;; @Package{duckling}
  ;;; @Version{0.1}
  ;;; @Subtitle{Small-Footprint Web Server in Racket}
  ;;; @Author{Neil Van Dyke}
  ;;; @Author{Alyssa P. Hacker}
  ;;; @License{LGPLv3}
  ;;; @Legal{Copyright 2015 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.}
  
  (require (for-syntax racket/base))
  
  ;;; @section{Introduction}
  
  [CODE INTERSPERSED WITH THREE-SEMICOLON SCRIBBLE GOES HERE]
  
  ;;; @History{
  ;;;
  ;;;   @Release[0.1 2014-12-31]{
  ;;; Initial release.}
  ;;; }
  
   END 
  
  Rationale:
  
  * I'm thinking of using the Racket reader for metadata, instead of some 
  special-cased text kludge for the metadata, for simplicity/elegance of 
  implementation.
  
  * I'm using three-semicolon comments instead of McFly's `doc` forms, to 
  simplify evaluation, and to make visually distinguishing between doc and 
  code easier without special editor support.
  
  * I've moved the metadata from `info.rkt` back into source file, to make 
  only one file you have to edit per package (the redundant bits of 
  `info.rkt`, like package name and description, can be updated 
  automatically using http://www.neilvandyke.org/racket-progedit/;). 
  Also, when packages were forked under McFly, the legal notice in 
  `mcfly-legal` variable in `info.rkt` tended to get lost, and lawyers 
  like you to put the notice on the actual file anyway (rather than my old 
  ;; See file info.rkt for legal info. kludge comment at the tops of key 
  files).
  
  Incidentally, if you paste that example code into Emacs with Quack, you 
  should see remnants of 13-year-old support for my earlier embedded 
  Texinfo format: http://postimg.org/image/wuwy376od/
  (Though I preferred the look of comments when they were light blue, like 
  in DrScheme v103, instead of the modern yellow-snow. :)
  
  Neil V.
  
  -- 
  You received this message because you are subscribed to the Google Groups 
  Racket Users group.
  To unsubscribe from this group and stop receiving emails from it, send an 
  email 
  to racket-users+unsubscr...@googlegroups.com.
  For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: pkg-build report for the v6.2 release candidate

2015-05-15 Thread Jack Firth
On Thursday, May 14, 2015 at 5:36:23 PM UTC-7, Matthew Flatt wrote:
 Here are the results of a package build using the v6.2 release
 candidate:
 
  http://release-pkg-build.racket-lang.org.s3-website-us-west-2.amazonaws.com/
 
 Compare to v6.1.1:
 
  http://pkg-build.racket-lang.org/
 
 
 For the v6.2 candidate, there are lots of dependency failures related
 to documentation, and the problem is usually a missing dependency on
 racket-doc. The new failures are a result improvements to the
 documentation dependency checker, not changes in the dependencies. (In
 other words, a dependency declaration was missing before, but it wasn't
 reported.) The 49 newly identified packages with dependency problems
 are listed below.
 
 
 Otherwise, two packages newly fail to install:
 
  bloggy --- an expected failure due to clean-up of an undocumented
 module
 
  munger --- looks like a bug in the release candidate, and we're
 investigating
 
 
 One package appears to have a new test failure:
 
  doc-coverage --- just needs test adjustments?
 
 
 
 Packages that have new dependency failures, almost always for
 racket-doc:
 
  avl
  binary-class
  binary-class-mp3
  check-sexp-equal
  describe
  dm
  dropbox
  ebml
  fast-convert
  finalizer
  fme
  gir
  grip
  heresy
  hyphenate
  icfp-2014-contracts-talk
  identikon
  levenshtein
  libscrypt
  libtoxcore-racket
  libuuid
  marketplace
  mboxrd-read
  midi-readwrite
  minikanren
  misc1
  mischief-dev
  multipath-daemon
  nlopt
  osc
  pollen
  racket-eventfd
  racket-lang-org
  racquel
  rsvg
  rtmidi
  set
  sfont
  squicky
  sugar
  systemd
  tandem
  tasks
  txexpr
  typed-big-bang
  unicode-properties
  xexpr-path
  yotsubAPI
  zmq

doc-coverage is most likely failing because either 1) a new undocumented export 
was added to racket/base, racket/list, racket/match, or racket/syntax (I forget 
the exact ones it tests) or 2) an old undocumented export was removed from one 
of those collections. Testing doc-coverage by relying on the exports of racket 
collections instead of a specific testing module was probably a bad idea.

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Constant syntax coloring?

2015-04-09 Thread Jack Firth
The DrRacket Check Syntax button colors syntax in a helpful way, particularly 
the distinction it makes between required/language bindings and bindings 
defined in the module. However, as soon as I type anything the coloring 
disappears. This wouldn't be so bad if it reappeared the next time background 
expansion / syntax checking succeeded, but it doesn't - I have to use the tool 
again to get the coloring. I'd even be fine with some way to just run the tool 
automatically whenever I save the module file. Is there some way I can achieve 
this?

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: how to add file types to `raco test`?

2015-07-06 Thread Jack Firth
On Sunday, July 5, 2015 at 4:51:22 PM UTC-7, Matthew Butterick wrote:
 `raco test` will automatically test every .rkt and .scrbl file in a 
 directory. Suppose I make `#lang foo` and thus many of my test files end with 
 .foo. I would want all .foo files to be automatically tested as well. Is 
 there a way to use info.rkt to tell `raco test` to add file types? (Should 
 there be?) 
 
 
 Of course the workaround is just to make a .rkt file that runs the files, but 
 it seems like info.rkt is the better place (inasmuch as this op is the 
 inverse of `test-omit-paths`)

I've recently run into the inverse, where I'd like to tell raco test to exclude 
all files of a particular extension. test-omit-paths lets me exclude 
directories and individual files, but not extensions. Perhaps something like 
glob-patterns in .gitignore files would be useful?

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Capability security in Racket?

2015-08-19 Thread Jack Firth
This idea in general is very cool, so do let us (or at least me) know when 
you've got a prototype working. I'm quite curious to see the inner workings.

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Some testing libraries

2015-08-20 Thread Jack Firth
I've made some libraries to assist testing. One is for integration testing and 
also making REST request simpler in general, and the other is for making mocks 
of procedures and checking they're called with certain arguments. The packages 
are named request (http://pkg-build.racket-lang.org/doc/request/index.html) 
and jack-mock (http://pkg-build.racket-lang.org/doc/mock/index.html) 
respectively. Let me know what you all think!

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Garbage Collection of Places

2015-08-17 Thread Jack Firth
On Monday, August 17, 2015 at 9:07:15 AM UTC-7, Matthew Flatt wrote:
 That's an especially basic mistake, and it slipped by because low-level
 locks are rarely allocated in the run-time system. Place channels are
 probably the simplest way to trigger new locks, but the test that
 checks for leaks with place channels uses the GC's count.

Would it be worthwhile to hook up a tool like Valgrind for catching these sorts 
of VM memory bugs to the Travis CI builds and tests of Racket? (Or is there 
already some such process in the builds, in which case why didn't it catch 
this?) From my limited experience with C, I've learned it's pretty much 
impossible to expect any sane human to keep track of memory perfectly.

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: Slack team for racket

2015-07-31 Thread Jack Firth
On Monday, July 27, 2015 at 1:15:31 AM UTC-7, mazert wrote:
 Le 27/07/2015 04:13, Jason Yeo a écrit :
  Hi Everyone!
 
  For anyone out there who finds IRC too daunting and difficult to use, 
  there's a slack team created just for racketlang at 
  http://racket.slack.com. Get invites to the team at 
  http://racket-slack.herokuapp.com.
 
  Cheers,
  Jason
 
 
 Hello,
 
 IRC and a Newsgroup/Mailing-list is largely enough. I think it is better 
 to centralize a community around 1-2 services, otherwise you have to 
 post your question on a lot of services to hope having an answer, or to 
 discuss about a specific subject.
 
 And honestly, if a developer finds that IRC is too complicated, he 
 should do something else ;). But for people who already use slack.com 
 why not !

Note that the Slack channel is integrated with the IRC chat room so anything in 
IRC is visible in Slack

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Export indentation preferences in a package's info.rkt?

2015-08-09 Thread Jack Firth
I find it irritating when I have to repeatedly add various macros exported by 
libraries to their proper group in the Indenting section of DrRacket's settings 
so that they're properly formatted. Is there a way for a package's info.rkt to 
specify default indentation preferences for it's macros for DrRacket to make 
sense of? If not, would that be something easy enough to do and useful enough 
to be worth doing?

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Pict circle radius

2015-07-25 Thread Jack Firth
So the documentation says that (circle 100) produces a circle with radius 100. 
However, (pict-width (circle 100)) produces 100 instead of 200, so apparently 
it's a circle with diameter 100 and radius 50? Is this a misdocumented 
function, or am I missing something embarrassingly obvious?

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: Macro to extract select subexpressions into other locations

2015-07-25 Thread Jack Firth
On Monday, July 20, 2015 at 5:03:55 PM UTC-7, Jack Firth wrote:
 I'm trying to create a way to automatically turn test cases into examples. 
 I'd like a macro that turns this:
 
 (extract-expressions
  (module+ test
(check-equal? (extract-expression (square 5)) 25)
(check-equal? (extract-expression (square -5)) 25))
  (module+ doc
@defproc[(square [x real?]) real?]{
  Returns the square of @racket[x], the result of
  multiplying @racket[x] by itself.
  @examples[#:eval evaluator (include-extracted-expressions)]}))
 
 into this:
 
 (begin
   (module+ test
 (check-equal? (square 5) 25))
   (module+ doc
 @defproc[(square [x real?]) real?]{
   Returns the square of @racket[x], the result of
   multiplying @racket[x] by itself.
   @examples[#:eval evaluator (square 5) (square -5)]}))
 
 That's the general idea anyway. I want to be able to gather arbitrary 
 expressions inside a region and copy them into some other marked place 
 inside the expressions. How exactly do I go about doing this, and how should 
 I do it properly?

Re Alex: I ended up with some functions that just walk the syntax tree and 
strip them out, seemed rather gross but it was all I could think of

Re Matthias: That definitely sounds better, at this stage I'm just fooling 
around with all the possible approaches I can think of to get a better feel for 
how the different forms behave.

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Pict circle radius

2015-07-25 Thread Jack Firth
Indeed it turns out I was missing something embarrassingly obvious. I was 
looking at the docs for the 2htdp/image functions, but using the pict functions.

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: How to draw a 3D ball?

2015-07-19 Thread Jack Firth
On Saturday, July 18, 2015 at 7:30:42 PM UTC-7, Mianlai Zhou wrote:
 Hi all,
 
 
 I am wondering how to change the following code of a 2D circle into a 3D ball:
 
 
 (require slideshow)
 (colorize (filled-ellipse (* size 15) (* size 15)) red)
 
 
 
 My intention is to make the picture look like a real ball in 3-dimension. Is 
 there such 
 a function existing already in Racket?
 
 
 Thank you in advance.

By 3D ball do you want a 2D pict of a ball with some shading to make it look 
3D, or a 3D model of a ball? If it's the latter you can use the pict3d package 
(raco pkg install pict3d):


(require pict3d)
(sphere origin 1)

If you do this in DrRacket, the repl will show a window with a 3D ball model in 
it. You can click it and use the arrow keys to change the angle and position 
you view the ball from.

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Macro to extract select subexpressions into other locations

2015-07-20 Thread Jack Firth
I'm trying to create a way to automatically turn test cases into examples. I'd 
like a macro that turns this:

(extract-expressions
 (module+ test
   (check-equal? (extract-expression (square 5)) 25)
   (check-equal? (extract-expression (square -5)) 25))
 (module+ doc
   @defproc[(square [x real?]) real?]{
 Returns the square of @racket[x], the result of
 multiplying @racket[x] by itself.
 @examples[#:eval evaluator (include-extracted-expressions)]}))

into this:

(begin
  (module+ test
(check-equal? (square 5) 25))
  (module+ doc
@defproc[(square [x real?]) real?]{
  Returns the square of @racket[x], the result of
  multiplying @racket[x] by itself.
  @examples[#:eval evaluator (square 5) (square -5)]}))

That's the general idea anyway. I want to be able to gather arbitrary 
expressions inside a region and copy them into some other marked place inside 
the expressions. How exactly do I go about doing this, and how should I do it 
properly?

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: racket users fight for their right to colon keywords

2015-10-22 Thread Jack Firth
Perhaps it would have been better phrased as "Which do you prefer, #:keyword or 
:keyword?" with options like "strongly prefer x", "prefer x", "indifferent", 
"prefer y", "strongly prefer y", rather than two different 1-10 scales.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Testing environment variable changes

2015-10-21 Thread Jack Firth
On Tuesday, October 20, 2015 at 11:56:33 AM UTC-7, Tim Brown wrote:
> I'm not sure if I'd want to be able to arbitrarily change 
> current-proxy-servers on the fly (something that has proven difficult, 
> highlighted by the hoops I have to jump through in the tests). On the other 
> hand it's probably not necessary, since proxy servers are a fixed feature of 
> the network configuration. Mostly.
> 
> On 20 October 2015 18:46:05 BST, Jay McCarthy  wrote:
> I'd want Matthew and Sam's input on this, but I personally don't see
> anything wrong with have to parameterize with a promise:
> 
> (parameterize ([c-p-s (delay '())]) )
> 
> It seems a lot cleaner than having the effectful behavior and using
> the parameter like a global variable (which I like to pretend they
> aren't.)
> 

You could provide a `(call-with-proxy-servers proxy-servers thunk)` procedure 
to hide the detail that it's a parameter, and then a `(with-proxy-servers 
proxy-servers body ...)` syntax rule to make it cleaner to use.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: Reliable equality testing of procedures

2015-11-04 Thread Jack Firth
On Wednesday, November 4, 2015 at 8:14:42 AM UTC-8, erich wrote:
> Hi,
> 
> I have a number of functions for computing raw distance measures and
> functions to compute their maxima for a given number of items, so to
> normalize them to [0,1] I provide this:
> 
> (define (normalize/distance measure maximum)
>   (lambda (p q)
> (/ (measure p q) (maximum (full-domain-size p q)
> 
> However, the maximum procedure seems unnecessary, because every measure
> has its own maximum. So I was wondering whether I could leave it out
> and instead use something like this:
> 
> (define (get-maximum measure)
>   (cond
> ((eq? measure footrule) footrule-maximum)
> ((eq? measure bogart) bogart-maximum)
> .
> .
> .
> (else (error 'get-maximum "unknown measure ~s" measure
> 
> both internally and for export. But if I also export it, because
> sometimes people might want to use the respective procedure directly,
> is this really safe? Will this always work, or can this somehow
> interfere with macros, modules, etc.? 
> 
> Best,
> 
> Erich

Alternatively, you can represent measures with structs containing a function 
instead of just functions, and then attach the maximizer function to each 
measure. If you want them to still use the function application syntax, you can 
implement prop:procedure in the measure struct so they're still usable as 
functions.

(struct measure (measuring-proc maximum-proc)
  #:prop prop:procedure (struct-field-index measuring-proc))

(define footrule (measure footrule-proc footrule-maximum))

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: Standardizing the threading macro and organizing packages

2015-10-07 Thread Jack Firth
I definitely like standard packages, but how will we avoid the problem of this 
becoming just another threading macro package instead of an actual standard? I 
also feel like something similar would be useful for anonymous functions, what 
with curly-fn, rackjure, fancy-app, the cut and cute macros from srfi 26, etc. 
etc.

If this isn't going to be added to the core (and I don't think it should), then 
there would need to be some work done on exposure and making sure everyone who 
wants this functionality knows "look here first and only roll your own if this 
isn't specific enough". Maybe a Wiki page acting like a swiss army knife of 
useful single purpose packages that the community has standardized? Also things 
like Greg Hendershott's threading macro blog post would need to be updated to 
point to the standardized version, along with other places "non standardized" 
versions of the functionality have been documented.

As for the actual package, I'm a strong proponent of a non-macro version that's 
just the reverse of compose, mostly because it plays very nicely with anonymous 
macro functions like fancy-app. I'm a bit biased as that's the one I made in my 
point-free package however. Macro versions are nice too, but I prefer the 
flexibility of an actual function for most purposes.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] racket users fight for their right to colon keywords

2015-10-14 Thread Jack Firth
On Wednesday, October 14, 2015 at 3:45:46 PM UTC-7, Neil Van Dyke wrote:
> Alex Knauth wrote on 10/14/2015 05:57 PM:
> 
> >
> > It's not worth changing the default for all of racket just to avoid 
> > putting #lang colon-kw racket at the top of a program.
> >
> 
> I currently have the opposite opinion on that point.
> 
> Partly because, before I would use `#lang colon-kw racket/base` at the 
> top of each of my modules, I would use `#lang paddle/base`. Then the 
> effective forking of the language is perhaps more apparent, even though 
> the actual texts below the respective differing `#lang` lines would be 
> identical in both cases.  Because I really-really don't want to 
> effectively fork the Racket dialect in which people write snippets on 
> email lists and such, that's why I'm investing in the energy-intensive 
> town hall dialogue that's usually involved in making any programming 
> language change when it's not simply done by fiat and announced as a 
> done deal. :)
> 
> Neil V.

It's not "forking the language", it's turning into an opt-in library. The huge 
difference between the colon-kw language mixin and that paddle/base language is 
that the form isn't a language. It can be provided to any language. If your 
paddle/base language didn't provide colon keywords, you could just as easily 
get them with #lang colon-kw paddle/base. You're not forking anything, you're 
simply using a library.

I find the idea of breaking existing code for such a simple stylistic matter 
that you can fix with nine extra characters at the top of your file somewhat 
absurd. This isn't fixing some troublesome misfeature, or adding an important 
new base language feature, or correcting buggy behavior, it's tweaking a 
completely superficial minor behavior for aesthetic benefit that's quite 
opinion-driven and not at all a benefit for even a majority of Racket 
programmers. That's the kind of thing that belongs precisely in an opt-in 
library, not in a breaking change of the core language.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Standardizing the threading macro and organizing packages

2015-10-08 Thread Jack Firth
I agree about using the function form for flexibility. (Alliteration!) The
macro form should be optimized for simple cases, because macros by nature
are less flexible. If you have a complex case, write actual functions.
You'll spend less time wrangling the syntax system that way.

On Thu, Oct 8, 2015 at 1:16 PM, Alexis King  wrote:

> > My macro and Jack Firth's function both allow that.
>
>
> Sounds like the solution is to go with a function instead of a macro then.
> If you want that flexibility, I don’t think there’s any reason to stick
> with a macro, anyway. The point-free package is very nice.
>
> Alexis

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Standardizing the threading macro and organizing packages

2015-10-08 Thread Jack Firth
The more I think about it, the more I realize I really dislike specifying
the position of arguments in these anonymous function syntaxes. For
instance I would prefer this:

(λ (x y) (/ y x))

To this:

λ.(/ $.1 $.0)

In the common case, you won't need to flip any argument orders around. In
that case the numbering is just noise that gets tuned down relative to the
expression structure. In the uncommon case, because of the common case I
might not notice it when reading the code and could critically misread the
order of an anonymous function's arguments. In addition, when shuffling the
positions around I find it much easier to think in terms of actual
bindings, as with the first example, than in terms of positions, as in the
second example. What if I need to change argument order or insert an
argument? Now I have to tweak the numbers used in the *structure* of the
function, rather than just messing with the declaration of bindings for the
function.

This is why I like fancy-app. Once you throw out specifying positions, you
don't need that syntactic overhead in the common cases. You're left with
just structure:

(define halve (/ _ 2))

Ideally fancy app would do keyword arguments and rest arguments, perhaps
rest arguments as (+ . _). I think it handles keyword args (never tried)
but I don't know if it does rest args.

On Thu, Oct 8, 2015 at 3:48 PM, Jay McCarthy  wrote:

> On Thu, Oct 8, 2015 at 6:23 PM, Alexis King  wrote:
> >> On Oct 8, 2015, at 1:34 PM, Jay McCarthy 
> wrote:
> >>
> >> FWIW, I find my threading macro to be very powerful, pretty clear when
> >> used complicatingly, and at about power-level 9,000:
> >>
> >> https://github.com/jeapostrophe/exp/blob/master/threading-arrow.rkt
> >
> > I have to agree with Jack and Alex here: I find that a little
> terrifying, and I would not want to need to understand any code that used
> it.
>
> I'm inspired by your terror.
>
> >> My opinion is to include something like this in remix along with some
> >> nice syntax for cut (what ignorant people call "function literals".)
> >
> > I admit I can’t really disagree with this point. I’m mostly just
> interested in what syntax you have in mind.
>
> The idea would be to make it like super cut, but with . to give it
> that delicious C-like crunchy topping
>
> https://github.com/jeapostrophe/exp/blob/master/scut.ss
>
> So,
>
> λ.(+ $ 1) => (λ (x) (+ x 1)
> λ.(+ $.0 $.1) => (λ (x y) (+ x y))
> λ.(+ $.x 1) => (λ (#:x x) (+ x 1)
> λ.(+ $.x $8) => (λ (#:x x a0 a1 a2 a3 a4 a5 a6 a7 a8) (+ x a8)
> λ.(apply + $.0 $.…) => (λ (x . args) (apply + x args))
>
> --
> Jay McCarthy
> http://jeapostrophe.github.io
>
>"Wherefore, be not weary in well-doing,
>   for ye are laying the foundation of a great work.
> And out of small things proceedeth that which is great."
>   - D 64:33
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] package-build status for upcoming release

2015-10-07 Thread Jack Firth
command-line-ext is indeed failing because of mischief, and I removed that 
dependency the other day. jack-mock is failing due to attempting to require 
`unstable/sequence`, I don't remember offhand which package that's in now.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: Official Docker images for Racket

2015-09-04 Thread Jack Firth
On Friday, September 4, 2015 at 4:51:43 AM UTC-7, Juan Francisco Cantero 
Hurtado wrote:
> On 09/03/2015 08:07 AM, Jack Firth wrote:
> > I've attempted to compile from source in an alpine image, but with no 
> > success. There's a bit too much arcane magic there for me to figure out how 
> > to do that.
> >
> 
> Can you show the errors on Alpine? Are you using Alpine in a container 
> or in a virtual/real machine?.
> 
> Alpine is interesting because they use grsecurity and musl.

I've got my attempt in the repo now under the 6.2-min folder. Furthest I've 
gotten - install dev tools including C compiler, download source, run 
./configure && make && make install, and watch errors show up.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: Official Docker images for Racket

2015-09-04 Thread Jack Firth
On Friday, September 4, 2015 at 8:23:14 AM UTC-7, Juan Francisco Cantero 
Hurtado wrote:
> On 09/04/2015 04:59 PM, Jack Firth wrote:
> > On Friday, September 4, 2015 at 4:51:43 AM UTC-7, Juan Francisco Cantero 
> > Hurtado wrote:
> >> On 09/03/2015 08:07 AM, Jack Firth wrote:
> >>> I've attempted to compile from source in an alpine image, but with no 
> >>> success. There's a bit too much arcane magic there for me to figure out 
> >>> how to do that.
> >>>
> >>
> >> Can you show the errors on Alpine? Are you using Alpine in a container
> >> or in a virtual/real machine?.
> >>
> >> Alpine is interesting because they use grsecurity and musl.
> >
> > I've got my attempt in the repo now under the 6.2-min folder. Furthest I've 
> > gotten - install dev tools including C compiler, download source, run 
> > ./configure && make && make install, and watch errors show up.
> 
> Which OS is running the host?

OS X Yosemite 10.10.5.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: Official Docker images for Racket

2015-09-06 Thread Jack Firth
On Sunday, September 6, 2015 at 10:56:16 AM UTC-7, Juan Francisco Cantero 
Hurtado wrote:
> On 09/06/2015 01:05 PM, Jack Firth wrote:
> > Alpine provides a glibc package, could I just swap out for that instead?
> 
> No, they don't provide glibc: 
> https://pkgs.alpinelinux.org/packages?name=glibc=all=all
> 
> Probably you're thinking in the "glib" package which is not a libc :)

This thread https://github.com/gliderlabs/docker-alpine/issues/11 mentions an 
available glibc implementation for the image, but it's not part of the official 
package repository. Will experiment with this and see if it works.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Re: Official Docker images for Racket

2015-09-07 Thread Jack Firth
On Monday, September 7, 2015 at 12:49:11 AM UTC-7, daniel wrote:
> Yes, thanks for providing the images. I tested a bit and it worked very
> well. I like the idea of the "ONBUILD" images.
> 
> Daniel.

Those are experimental at the moment, I may change the interface they use 
sometime in the near future.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: Official Docker images for Racket

2015-09-03 Thread Jack Firth
I've attempted to compile from source in an alpine image, but with no success. 
There's a bit too much arcane magic there for me to figure out how to do that.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Official Docker images for Racket

2015-09-02 Thread Jack Firth
I do a lot of Racket development in Docker, and it's a pretty big pain. There's 
a handful of images on Docker Hub but they're pretty unmaintained, usually lag 
behind a version or two, tend to be built off an unnecessarily large base image 
like ubuntu, don't offer a snapshot build, and don't offer "minimal Racket" 
versions. I'd like to work on this and add some Racket images to the Official 
images like other languages have. Has anyone else worked on this?

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: Official Docker images for Racket

2015-09-06 Thread Jack Firth
On Saturday, September 5, 2015 at 2:54:42 PM UTC-7, Juan Francisco Cantero 
Hurtado wrote:
> On 09/04/2015 10:32 PM, Jack Firth wrote:
> >>
> >> Virtualbox -> Linux -> Docker -> Alpine
> >> ^
> >>
> >> Which Linux distro?
> >>
> >> I'm asking because the usual Racket errors in distros with grsecurity
> >> are pretty easy to workaround. These errors affect to every JIT, not
> >> only to Racket.
> >>
> >> If you're running a non-grsecurity kernel in the host OS, then the
> >> problems are probably related to musl. It would require to patch the
> >> Racket interpreter.
> >
> >  From what I can gather, it's using a modified TinyCore linux through the 
> > boot2docker driver 
> > https://github.com/boot2docker/boot2docker/blob/master/doc/FAQ.md#what-is-the-boot2docker-distribution-based-on
> 
> I've created a patch to workaround the errors related to musl. It 
> doesn't fix every bug, only enough to finish the build. Racket still 
> fails in some tests.
> 
> Git HEAD:
> http://juanfra.info/bl/15/racket-head-alpine-vanilla-musl.patch
> 
> Racket 6.2.1 Minimal:
> http://juanfra.info/bl/15/racket-621min-alpine-vanilla-musl.patch
> 
> I've not sent a pull request because musl doesn't use a C define which 
> permits to recognize the library, so the detection of the library would 
> be a mess. My recommendation is to use a different Linux distro with 
> glibc, i.e. forget Alpine.

Alpine provides a glibc package, could I just swap out for that instead?

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Re: Official Docker images for Racket

2015-09-03 Thread Jack Firth
> Perhaps you could provide your Dockerfile etc. on Github so others could
> look into it and maybe give some hints.

I've got them up at https://github.com/jackfirth/racket-docker, and they're on 
Docker Hub as https://hub.docker.com/r/jackfirth/racket/. Currently the images 
are built off Debian and support all racket versions back to 5.3 (except 5.9x 
variants because I couldn't find debian installers for them). So now you should 
be able to do this:

$ docker run -it jackfirth/racket
Welcome to Racket v6.2.1.
> 

And this:

$ docker run -it jackfirth/racket:5.3
Welcome to Racket v5.3.
> 

Next steps are minimal racket images built on something like Alpine Linux. I'll 
throw up my experiments on there, but I haven't gotten anything working yet.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] RabbitMQ

2015-09-10 Thread Jack Firth
Has anyone implemented a RabbitMQ client in racket? Is anyone working on it and 
partway there? I'm trying to set up a distributed task system like Celery in 
Python which needs the workers to be in Racket.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: reducing pauses with incremental GC

2015-12-02 Thread Jack Firth
Absolutely fantastic! I wonder how often language designers implement features 
useful to game developers because of their children.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: about rackjure

2015-12-12 Thread Jack Firth
There's also the fancy-app, curly-fn, and afl packages for different ways of 
writing anonymous functions (cut and cute from srfi/26 always seemed awkward to 
me).

cut:
(cut map sqr <>)

fancy-app:
(map sqr _)

curly-fn
 #{map sqr %}

afl:
#λ(map sqr %)

point-free doesn't give you special syntax for writing functions, ~> is just a 
regular procedure. So it works with all of them. (Disclaimer: I wrote the 
point-free package)

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] about rackjure

2015-12-12 Thread Jack Firth
> This is an area in which there are probably too many options, but opinions 
> are strong, and we have not standardized (yet). Feedback is welcome!

Speaking of which, there's also the `threading` package, which I really should 
add the point-free version of ~> to.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: auto-defining variables mentioned in a program

2016-06-02 Thread Jack Firth
On Thursday, June 2, 2016 at 10:06:25 AM UTC-7, Matthew Butterick wrote:
> I have a solution to this problem — is it legit, or is there some slick 
> Rackety technique I'm missing?
> 
> I'm making a toy #lang interpreter for Basic, which allows variables to be 
> created with an assignment statement (like Python). The wrinkle in Basic is 
> that the execution order of the lines isn't known till runtime, so there's no 
> way to identify the "first" use of a variable and change it from a `set!` to 
> a `define` (e.g., by testing `identifier-binding`)
> 
> To fix this, I gather a list of variable identifiers from the parsed AST, 
> insert the `define`s at the top of the `#%module-begin`, and then the rest of 
> the AST, and the expander proceeds. That works.
> 
> But it seems like the gathering of variables should be able to happen as the 
> expander encounters them in the code (ie., do everything with one pass rather 
> than two). The problem is that by the time all the variables have been 
> discovered & gathered, the expansion is done, so AFAICT I can't go back and 
> `define` them retroactively.

I think you can do this by having your language provide it's own #%top syntax 
that defines what to do with unknown variables. 
http://docs.racket-lang.org/reference/__top.html?q=%24%25top#%28form._%28%28quote._~23~25kernel%29._~23~25top%29%29

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: auto-defining variables mentioned in a program

2016-06-02 Thread Jack Firth
#%top provides fallback behavior at compile time, but only in expression 
positions. I think what you want can be done by doing this:

- Under the hood, make variables immutable and have their values be boxes.
- Have (set! x:id expr) and (define x:id expr) both expand to (box-set! x 
expr). This is an expression rather than syntax, so x should expand to (#%top 
x) if x is unbound
- Have #%top somehow magically figure out if it should make a new box or reuse 
an existing one for the identifier it's given.

I'm guessing the syntax you're looking at allows something like this:

function foo(a, b):
  if a < b:
c = "blah!"
  c = "bloo!"

The outlined expansion strategy would likely produce this:

(define (foo a b)
  (when (< a b)
(box-set! (#%top c) "blah!"))
  (box-set! (#%top c) "bloo!"))

Then #%top somehow needs to figure out that the proper scope to put c in is the 
function scope of the foo function. Block scope doesn't make much sense here, 
as how else would you get assignment statements where the order isn't known 
until runtime? You could likely do something where `define` surrounds its body 
with some code that sets what the current scope is, maybe by creating a 
free-id-table. At that point however you're doing scope management work 
yourself, so I'm not sure this is a good approach.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: auto-defining variables mentioned in a program

2016-06-02 Thread Jack Firth
Erm, set-box! not box-set! My bad.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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

2016-01-11 Thread Jack Firth
I'd probably prefer using a fold over explicit recursion. This gets easier if 
you split your code into two steps - one that does just one level of lookup, 
and one that does nested lookups. Additionally, I'd prefer list indexes rather 
than pair lookup functions:

(define (data/ref s key)
  (cond
[(hash? s) (hash-ref s key)]
[(list? s) (list-ref s key)]
[else fail-somehow ...]))

(define (data/fetch s keys)
  (define (fetch-once key s)
(data/ref s key))
  (foldl fetch-once s keys))


> (data/ref (hash 'a 1 'b 2) 'a)
1
> (data/ref '(a b c) 2)
'c
> (data/fetch (hash 'a '(foo bar baz) 'b 0) '(a 2))
'baz

By splitting the recursion (define (data/ref s key)
  (cond
[(hash? s) (hash-ref s key)]
[(list? s) (list-ref s key)]
[else fail-somehow ...]))

(define (data/fetch s keys)
  (define (fetch-once key s)
(data/ref s key))
  (foldl fetch-once s keys))


> (data/ref (hash 'a 1 'b 2) 'a)
1
> (data/ref '(a b c) 2)
'c
> (data/fetch (hash 'a '(foo bar baz) 'b 0) '(a 2))
'baz

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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

2016-01-11 Thread Jack Firth
I'd probably prefer using a fold over explicit recursion. This gets easier if 
you split your code into two steps - one that does just one level of lookup, 
and one that does nested lookups. Additionally, I'd prefer list indexes rather 
than pair lookup functions:

(define (data/ref s key)
  (cond
[(hash? s) (hash-ref s key)]
[(list? s) (list-ref s key)]
[else fail-somehow ...]))

(define (data/fetch s keys)
  (define (fetch-once key s)
(data/ref s key))
  (foldl fetch-once s keys))


> (data/ref (hash 'a 1 'b 2) 'a)
1
> (data/ref '(a b c) 2)
'c
> (data/fetch (hash 'a '(foo bar baz) 'b 0) '(a 2))
'baz

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] How do I use fetch-blueboxes-strs?

2016-01-14 Thread Jack Firth
fetch-blueboxes-strs claims in its documentation it can get the text of a 
Scribble bluebox, but I have no idea how to actually use it. Attempting to get 
the bluebox content of "list-ref", the following all either fail or return #f:

(fetch-blueboxes-strs 'list-ref)
(fetch-blueboxes-strs "list-ref")
(fetch-blueboxes-strs '(def list-ref))
(fetch-blueboxes-strs '(def "list-ref"))
(fetch-blueboxes-strs '(part list-ref))
(fetch-blueboxes-strs '(part "list-ref"))
(fetch-blueboxes-strs 'racket/list)
(fetch-blueboxes-strs "racket/list")
(fetch-blueboxes-strs '(def racket/list))
(fetch-blueboxes-strs '(def "racket/list"))
(fetch-blueboxes-strs '(part racket/list))
(fetch-blueboxes-strs '(part "racket/list"))

The documentation doesn't include any examples, and the documentation on tags 
is somewhat scattered and vague, so I'm shooting in the dark here.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] How do I use fetch-blueboxes-strs?

2016-01-14 Thread Jack Firth
Ah hah! Thanks for that link Robby. The appropriate definition tag for list-ref 
is '(def ('#%kernel list-ref)). Extracted this function for figuring out the 
definition tag of an identifier in an installed module:

(define (find-definition-tag identifier)
  (xref-binding->definition-tag
(load-collections-xref)
identifier
0))

Although now I'm hitting problems where fetch-blueboxes-strs works perfectly 
fine with anything in the main distribution, but fails on bindings from third 
party packages.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: How do I use fetch-blueboxes-strs?

2016-01-14 Thread Jack Firth
Samth's example doesn't work for me, even after raco setup -xl. I'm on version 
6.3

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Slack IRC bridge malfunctioning

2016-02-07 Thread Jack Firth
The Slack channel that mirrors the messages in the IRC hasn't seen any messages 
in the last few days. I checked the archives and there are a few messages in 
the Slack channel that didn't make it across the bridge into irc-land either. 
Would whoever set up the bridge between the two be willing to check it out?

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: anyone using MongoDB 2.x or 3.2 with Racket 6.x ?

2016-02-08 Thread Jack Firth
That library is the old Planet one, Racket has a new package management system 
and the mongodb package has been moved to it. Try running `raco pkg install 
mongodb` at a terminal (or installing through DrRacket's GUI) and then 
`(require mongodb)`. The package server (https://pkgs.racket-lang.org/) reports 
test failures for the mongodb package however, so something might actually be 
wrong with it.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: Slack IRC bridge malfunctioning

2016-02-08 Thread Jack Firth
Slack's business model would be negatively affected by user data mining. They 
operate on a "free for small hobbyist use, expensive for large corporate use". 
Corporations do not like when you mine their data and are generally able to do 
far more about it than average citizens. By default Slack's free plan doesn't 
even store more than the most recent ten thousand messages, so clearly they're 
not that interested in extracting targeted ad information from what free users 
have to say.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: Slack IRC bridge malfunctioning

2016-02-09 Thread Jack Firth
I'd like to note that the bridge has been restored, and the wormhole is 
functioning properly now.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: Implement Topological sorting in HtDP-y way?

2016-01-28 Thread Jack Firth
Out of idle curiosity: why `(define (topological-sort ...) (local ((define 
(topological-sort ... done)) (topological-sort ... '())` rather than using a 
local define and a different name like `topological-sort/accumulator`?

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Docker images updated

2016-02-24 Thread Jack Firth
Hey all, I've made some pretty significant changes to the racket Docker images:

1) 6.4 and 6.3 support (took long enough...)
2) Onbuild images for running and testing apps for every 6.x version, 
additionally the onbuild images were changed to run "racket main.rkt" as their 
command after doing a setup to create bytecode, rather than making an executable
3) Racket minimal used by default for all images
4) Fixed an issue where "raco setup" was never run as part of building the 
images, so installing a package would take forever (had to setup the package 
and everything else)
5) Significant image size improvements - previous images were about ~180MB 
compressed on DockerHub, now all images are under 40MB compressed (uncompressed 
their virtual size is about 80-100MB). They're still Debian Jesse operating 
systems.

I attempted to get Racket running on alpine linux, but hit significant 
difficulties (alpine uses musl rather than glibc). If anyone has experience 
with the Racket source, alpine linux, and/or musl and would like to take a 
crack at that, the repo is https://github.com/jackfirth/racket-docker and you 
can see my paltry attempts thus far in the 6.2-min folder.

The images are available as "jackfirth/racket:VERSION", e.g. 
jackfirth/racket:6.2 or jackfirth/racket:5.3.4. The onbuild images have an 
`-onbuild` suffix, and the onbuild test images (automatically raco tests your 
app) have an `-onbuild-test` suffix, e.g. racket:6.3-onbuild or 
racket:6.4-onbuild-test.

Enjoy!

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: `compile-omit-paths` seems to be ignored when creating a package.

2016-02-27 Thread Jack Firth
I think compile-omit-paths only works in an info file for a collection, not a 
package. So you'd have to put it in an info file in the samples/ directory and 
tell it to exclude everything in that collection.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Slack IRC bridge down again

2016-03-25 Thread Jack Firth
Slack room shows no new messages since Tuesday, yet IRC archives state the room 
is as active as ever. Messages from the slack side aren't crossing over to IRC 
either.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Typed Racket unsafe-provide with contract?

2016-04-22 Thread Jack Firth
I'm writing some Typed Racket code that works with syntax objects, which 
currently can't be converted to contracts since syntax chaperones aren't a 
thing. As a result, if I want untyped racket users to use my library, I have to 
`unsafe-provide` functions in my module.

However, all of my procedures are simple enough that if I wrapped them in 
contracts that checked the `syntax?` predicate they ought to work fine in most 
cases. This might not be sound from a TR perspective, but it's a huge step up 
from `unsafe-provide`. Is there a way I can somehow get something like this 
example to work?

#lang typed/racket

(require typed/racket/unsafe)
(unsafe-provide (contract-out [foo (-> string? string?)]))

(: foo (-> String String))
(define (foo s) s)

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: Order of argument conventions, or ... conventions of argument ordering

2016-04-22 Thread Jack Firth
On Friday, April 22, 2016 at 10:40:01 AM UTC-7, Ronie Uliana wrote:
> I like a lot this advice from Haskell:
> 
> "... in Haskell it is not possible to alter objects, but there are many 
> functions which return a somehow altered input object. This object should be 
> the last parameter because then you can compose a sequence of operations on 
> this object" (https://wiki.haskell.org/Parameter_order)
> 
> That makes threading macros (~>>) easier to apply, and also to remember the 
> argument order. :)

This advice applies mostly when you're using currying, because it makes 
function composition much easier. If you use a lambda shorthand form like those 
provided in the `afl`, `fancy-app`, and `curly-fn` packages, then the order of 
arguments has little effect on the ease of composition.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: scribble output redirection

2016-04-22 Thread Jack Firth
How are you running Scribble? The command line `scribble` program, DrRacket's 
scribble plugin, or through `raco setup`?

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Question about syntax properties and expansion

2016-04-21 Thread Jack Firth
The documentation for syntax properties states that if a macro sets a syntax 
property during expansion then instead of the expanded syntax having only the 
set value, it has a cons tree containing that value and any previous values set 
for that same property. As I understand it, this means it's impossible for 
macros to remove syntax property values during expansion. Why is that? I don't 
understand the purpose of it, and it makes working with custom syntax 
properties a bit unpleasant API-wise.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Question about syntax properties and expansion

2016-04-21 Thread Jack Firth
> In the same way that properties can now be attached as preserved or
> not, we could and an option for specifying whether properties are are
> propagated/merged or not. If it's useful, we could even allow a
> combining function to be associated with with either a property value
> or a property key --- although a general combining function wouldn't
> work with a preserved property. Any thoughts on those details?

I don't think I want a general combining function in the `syntax-property` 
procedure. Ideally syntax properties don't know anything about combining and 
some external macro expansion parameter defines a syntax properties that should 
be expanded in this special combining way. That way I don't have to think about 
it - configuring the behavior of how all macros treat a certain syntax property 
seems like spooky action at a distance to me. I haven't used them enough to 
know how well that interoperates with other macros though.

> (FWIW, as I look back at the documentation, I think it needs
> clarification on the point that only properties of the immediate syntax
> object for the input and output of a macro are merged. Properties are
> not merged on any syntax object within the immediate syntax object.)

I strongly agree with this. The `syntax-property` procedure documentation 
should mention it.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] How to write a #%module-begin that inspects a syntax property post expansion?

2016-05-08 Thread Jack Firth
I'm writing a series of macros that attach metadata using syntax properties 
during expansion, and I'm attempting to write a #lang whose module-begin form 
expands the module and then inspects the metadata attached. The problem I'm 
getting is that local-expand seems to not "expand enough" - it returns a 
partially expanded syntax object in which the macros that attach the metadata 
haven't run yet. I'm not sure how to fully expand the syntax object in the 
context of a module begin form. Do I need to do something with the stop-ids 
argument to local-expand to do this properly?

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: Running racket on a #lang-less module-less file?

2016-05-06 Thread Jack Firth
William's remark is spot on about my use-case. There exists a language that 
wasn't initially designed with racket in mind, but could easily be a racket 
#lang. To interop with code already written in this language, I wanted an easy 
way to run files that don't have the #lang line. If I were designing the 
language Racket-first, I wouldn't need this feature.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Running racket on a #lang-less module-less file?

2016-05-05 Thread Jack Firth
Suppose I have a file in some custom language, like #lang foo, but it omits the 
#lang foo line. Is there a way I can run the racket command line program in a 
way where it says "treat this file as if it starts with the line #lang foo"? 
I'm having trouble parsing the "Running Racket or Gracket" section of the docs 
to determine if this is possible.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Running racket on a #lang-less module-less file?

2016-05-05 Thread Jack Firth
On Thursday, May 5, 2016 at 5:39:44 PM UTC-7, Matthew Flatt wrote:
> At Thu, 5 May 2016 17:32:20 -0700 (PDT), Jack Firth wrote:
> > Does that evaluate the file as if it were entered in a REPL?
> 
> Yes.

What if I don't want REPL semantics, but I want behavior identical to if the 
file began with the appropriate #lang line? Is there some subtle reason that's 
not an option?

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Running racket on a #lang-less module-less file?

2016-05-05 Thread Jack Firth
On Thursday, May 5, 2016 at 5:28:06 PM UTC-7, Matthew Flatt wrote:
> At Thu, 5 May 2016 17:14:57 -0700 (PDT), Jack Firth wrote:
> > Suppose I have a file in some custom language, like #lang foo, but it omits 
> > the #lang foo line. Is there a way I can run the racket command line 
> > program 
> > in a way where it says "treat this file as if it starts with the line #lang 
> > foo"?
> 
> Not in general, but if a language supports the top level, then
> 
>  racket -I  -f 
> 
> might work.

Is that a lowercase L or an uppercase i? Both seem to work. Does that evaluate 
the file as if it were entered in a REPL?

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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

2016-07-17 Thread Jack Firth
On Saturday, July 16, 2016 at 7:06:10 PM UTC-4, David K. Storrs wrote:
> So, if one should prefer functions, what is a good place to use
> macros?  When people talk about why LISP/Scheme/Racket are the most
> powerful languages, they inevitably mention macros and continuations.
> What is a good use case for macros?

You generally want macros for things that can't be done with functions period, 
for instance a static type checker, pattern matching, a class system with 
static method resolution, making your own language, etc.

Your use case can benefit from macros by having a function that accepts a 
procedure to test and making a macro that constructs the function from a series 
of body expressions. Consider an example of a slightly modified version of your 
throws function:

(throws "Should throw when frobnicating non-widgets"
  exn:fail:contract?
  (lambda ()
(frobnicate (make-gizmo

Notice you have to wrap the "(frobnicate (make-gizmo))" expression in a thunk 
(a function that takes no arguments) so the throws function can control when 
the test expression is evaluated. If you didn't, throws would evaluate 
"(frobnicate (make-gizmo))" as its argument before doing anything and the 
exception would be thrown immediately. If you don't want to have to write the 
wrapper lambda all the time, you can make a macro version of throws that adds 
the lambda for you:

; define-simple-macro is basically define-syntax-rule but using syntax-parse
; instead of syntax-case
(define-simple-macro (throws-macro message:expr matcher:expr body:expr ...+)
  (throws message matcher (lambda () body ...)))

; expands to a call to the throws test function
(throws-macro "Should throw when frobnicating non-widgets"
  exn:fail:contract?
  (frobnicate (make-gizmo)))

The throws-macro *at compile time* transforms the body expression it's given 
into an expression with a wrapper lambda, but *at runtime* the throws function 
does all the actual testing and logic. It's common for macro-writers to keep as 
much logic as possible out of macros and in runtime functions, as that's what 
functions are best at.

One last note - this particular use case for macros can also be achieved with 
lazy evaluation, but macros and lazy evaluation in general have very different 
non-overlapping goals and it's best not to conflate them.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: Racket Docker images from Alpine

2016-07-13 Thread Jack Firth
On Tuesday, July 12, 2016 at 8:20:55 PM UTC-7, m4burns wrote:
> Hi all,
> 
> I remember this topic came up on the list a while back. I've made a 
> Docker image of the latest Racket from alpine 3.3 with just musl libc. I 
> had to monkey patch some Racket internals to get this working, so it 
> might be badly and subtly broken. Feedback is appreciated!
> 
> Dockerfile etc.: https://github.com/m4burns/racket-docker
> Docker repo: https://hub.docker.com/r/m4burns/racket/
> 
> The size is a little bit of an improvement over Jack Firth's images (35 
> vs 22 mb). I'm not sure it's worth the uncertainty of using musl instead 
> of glibc.
> 
> Enjoy!
> 
> Marc

This is fantastic! I'm glad somebody figured out how to do this. Those more 
familiar with Racket's internals can comment on what implications using musl 
has, but if you'd like to get more confidence in the installation's correctness 
I recommend installing and testing a majority of packages in the package 
catalog. I'd be glad to include this in my DockerHub image repo.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] TR could be even more spectacularly awesome:

2016-07-13 Thread Jack Firth
On Tuesday, July 12, 2016 at 2:36:24 PM UTC-7, Sam Tobin-Hochstadt wrote:
> Could this be an API like the one for tooltips? IOW, some sort of general 
> warning with a message and a syntax location?

I'd just like to interject quickly and say that's what I'm working on for 
RacketCon :)

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re-using an identifier as a submodule name?

2016-07-14 Thread Jack Firth
I've got a macro that extends function definition by letting the user rebind 
some identifiers with different values, which are then only available in a 
certain context. For the sake of simplicity suppose it looks like this:

(define/foo (func v ...)
  #:bind [helper1 expr]
  #:bind [helper2 other-expr]
  (helper1 v ...)
  (helper2 v ...))

I would like helper1 and helper2 to have their normal meaning unless I'm inside 
a special `with-foo` form like so:

(helper1 'a) ; normal behavior

(with-foo func
  ; in here, helper1 and helper2 are bound to expr and other-expr instead
  (helper1 'a))

I'd also like `with-foo` to be the only way to access the versions of helper1 
and helper2 that have this alternate behavior. I'm attempting to do this with 
some submodule hackery, essentially I'm expanding the above to this:

(define (func v ...)
  (helper1 v ...)
  (helper2 v ...))

(module foo racket/base
  (module+ func
(define helper1 expr)
(define helper2 other-expr)
(provide (all-defined-out

(begin
  (require (submod ".." foo func))
  (helper 1))

My reasoning is that by letting "func" double as a submodule identifier, I can 
easily bring all the specially-bound identifiers associated with func into 
scope, and by putting that submodule in a "foo" submodule I can hide the 
existence of the foo submodule so only `with-foo` knows how to require the 
correct "func" module. But I'm hitting scope issues - I'm not sure hot to make 
the redefinitions of func available in (body ...) in a (with-foo func body ...) 
use, naively adding the require imports fails to bring them into scope. Various 
combinations of using syntax/loc and datum->syntax on the require statement, 
the require submod path, and/or the body are all failing to do what I want.

How can I achieve this? Is there a better way to try and do this?

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: Re-using an identifier as a submodule name?

2016-07-14 Thread Jack Firth
On Thursday, July 14, 2016 at 10:28:07 PM UTC-7, mattap...@gmail.com wrote:
> On Friday, July 15, 2016 at 2:22:50 PM UTC+10, Jack Firth wrote:
> > I've got a macro that extends function definition by letting the user 
> > rebind some identifiers with different values, which are then only 
> > available in a certain context. For the sake of simplicity suppose it looks 
> > like this:
> > 
> > (define/foo (func v ...)
> >   #:bind [helper1 expr]
> >   #:bind [helper2 other-expr]
> >   (helper1 v ...)
> >   (helper2 v ...))
> > 
> > I would like helper1 and helper2 to have their normal meaning unless I'm 
> > inside a special `with-foo` form like so:
> > 
> > (helper1 'a) ; normal behavior
> > 
> > (with-foo func
> >   ; in here, helper1 and helper2 are bound to expr and other-expr instead
> >   (helper1 'a))
> > 
> > I'd also like `with-foo` to be the only way to access the versions of 
> > helper1 and helper2 that have this alternate behavior. I'm attempting to do 
> > this with some submodule hackery, essentially I'm expanding the above to 
> > this:
> > 
> > (define (func v ...)
> >   (helper1 v ...)
> >   (helper2 v ...))
> > 
> > (module foo racket/base
> >   (module+ func
> > (define helper1 expr)
> > (define helper2 other-expr)
> > (provide (all-defined-out
> > 
> > (begin
> >   (require (submod ".." foo func))
> >   (helper 1))
> > 
> > My reasoning is that by letting "func" double as a submodule identifier, I 
> > can easily bring all the specially-bound identifiers associated with func 
> > into scope, and by putting that submodule in a "foo" submodule I can hide 
> > the existence of the foo submodule so only `with-foo` knows how to require 
> > the correct "func" module. But I'm hitting scope issues - I'm not sure hot 
> > to make the redefinitions of func available in (body ...) in a (with-foo 
> > func body ...) use, naively adding the require imports fails to bring them 
> > into scope. Various combinations of using syntax/loc and datum->syntax on 
> > the require statement, the require submod path, and/or the body are all 
> > failing to do what I want.
> > 
> > How can I achieve this? Is there a better way to try and do this?
> 
> Although I'm not experienced enough to understand all that's going on in your 
> design, I wanted to remind you of (require (for-syntax )) since you're using 
> the required module in the macro?

The macros don't use the defined modules themselves, the runtime expressions 
wrapped by `with-foo` do. A runtime require is definitely what I'm looking for. 
I've made some progress where `with-foo` is implemented basically like this:

(define-syntax-parser with-foo
  [(_ foo-defined:id body ...)
   #`(let ()
   (local-require
#,(syntax-local-introduce
   #`(submod "." foo foo-defined)))
   body ...)])

But when I attempt to use it, e.g. (with-foo func (helper1 ...)), I get the 
error "helper1: identifier's binding is ambiguous in context" which I'm 
guessing is because syntax-local-introduce is doing quite what I want with 
scopes.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] [ANN] Mock, a test mocking library

2016-07-28 Thread Jack Firth
I've written a library for making test mocks, so that tests can verify they're 
correctly calling dependencies without really calling them (for example, to 
avoid IO in unit tests). It's available in the package catalog under the name 
"mock", and a separate package with RackUnit checks for mocks is available as 
"mock-rackunit".

Documentation: http://docs.racket-lang.org/mock@mock/index.html
Source repository: https://github.com/jackfirth/racket-mock

Issues, comments, bug reports, pull requests, and party favors are all more 
than welcome.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Re: Package layout in docs

2017-01-31 Thread Jack Firth
On Tuesday, January 31, 2017 at 11:25:31 AM UTC-8, Neil Van Dyke wrote:
> For the benefit of the tightwad people, packages could optionally 
> include metadata about any docs and tests that can be stripped -- 
> anything nonessential to "run-only" the package.  This metadata could be 
> used by either the installation tools or by a package file transformer 
> tool that people can run themselves.  (And, eventually, these tests and 
> documentation might normally be linguistic constructs anyway, embedded 
> within the code, not something in their own files that can be maintained 
> in a separate package from the implementation.)  The package catalog 
> still only lists the one canonical package, though.

This currently exists. All dependencies used in test and doc submodules and 
scribblings/ modules are build dependencies (defined in `build-deps` in 
info.rkt) and when installing a pre-built package, you can optionally omit 
build dependencies by installing the package with the `--binary` and 
`--binary-lib` flags. The package build server also creates a separate "built 
packages" catalog that hosts pre-built versions of packages. Unfortunately, 
pre-built packages are specific to a Racket version so this catalog is only 
usable if you're using the latest Racket version.

If the package build server and catalog hosted built packages for multiple 
Racket versions, I think we could go a long ways towards removing the need to 
split packages completely.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: Package layout in docs

2017-01-30 Thread Jack Firth
Rather than splitting "core packages" from "community packages", what if we 
used the package ring system? [1] We could establish a way for the Racket 
community to bless packages with "ring zero" status, then provide a --catalog 
argument to Scribble to lookup ring information in when deciding how to style 
package documentation. The docs would remain unified, we'd have a centralized 
place to curate packages, and there's no artificial barrier that prevents 
user-contributed packages from living alongside main-distribution packages.

[1] http://docs.racket-lang.org/pkg/Future_Plans.html?q=ring

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: Package Providing results from another package

2017-01-26 Thread Jack Firth
Usually when this situation arises, the collection is divided as you suggest 
into a `foo/base` module that has minimal dependencies and a small "kernel" 
API, while various `foo/X` modules provide things that either are logically not 
necessary in the base API or may trigger large dependencies. For users that 
don't really care about the dependencies and just want a convenient entrypoint, 
the `foo` collection (implemented by the `foo/main` module) re-provides 
everything from the various `foo/*` modules. However, other libraries like 
`bar` wouldn't be re-provided.

If you're writing a module like `foo/main` that just requires and provides 
other libraries, you can use the `reprovide` package to minimize how much work 
that takes. In your case, a `simple-polynomial/main.rkt` module would be:

#lang reprovide
"base.rkt"
"spline.rkt"

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: math/statistics running expected values

2017-01-27 Thread Jack Firth
I don't have enough stats experience to help with the details of your problem, 
but I'd like to suggest adding a separate package that extends math/statistics. 
You'll likely have an easier time developing and testing it, and you won't have 
to worry about adding extra dependencies to the built in math library.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: Programming paradigms supported by Racket (according to wikipedia)

2017-02-12 Thread Jack Firth
Somewhat reductionally, anyone can write a Racket library that implements a 
`#lang` with the semantics of any language on that list, so Racket therefore 
supports all paradigms. This doesn't really say anything useful.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Are types first class values in typed/racket

2017-02-15 Thread Jack Firth
That's not possible in Typed Racket, no. Type checking is after macro expansion 
so type information doesn't even exist when your macro would expand.

However, hope is not lost. There is a new approach to typechecking with macros 
outlined in the Types as Macros paper by Stephen Chang and Alex Knauth, and 
reified in the `turnstile` Racket package. This approach interleaves 
typechecking and macro expansion, making types essentially macros with extra 
compile time metadata that alter the flow of macro expansion. In this case, 
types are actual *things* that exist at macro expansion time, so you could make 
a macro that interacted with types and used type information to decide how to 
expand.

On Tuesday, February 14, 2017 at 5:32:30 AM UTC-8, Robert Kuzelj wrote:
> given a type definition in typed/racket like
> 
> (define-type BinaryTree (U Number (Pair BinaryTree BinaryTree)))
> 
> would it be possible to feed that type into a macro (aka not runtime) so that
> 
> (define-transformed-type MyBinaryTree BinaryTree)
> 
> and would that macro be able to access the constituent elements and their 
> types of given type?

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] How to adjust an expansion-time parameter in a dynamic-require?

2016-09-02 Thread Jack Firth
I have a module that during its expansion calls a function defined by a 
parameter.

I have a command line tool that would like to read a module path and 
dynamic-require it with that parameter changed to implement tool-specific 
behavior.

However, (parameterize ([param tool-func]) (dynamic-require mod-path)) doesn't 
seem to work because the parameter is being set for the runtime phase rather 
than the expansion time phase.

How can I dynamically require a module while changing a parameter it uses at 
expansion time?

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: DrRacket Debugger pause on error?

2016-10-04 Thread Jack Firth
I'm not sure about how to do this with the DrRacket debugger, but you can use 
`debug-repl`[1] from the `debug` package to basically set a breakpoint that 
opens a REPL you can use to inspect variables in. This works in both DrRacket 
and regular command line racket.

[1] 
http://docs.racket-lang.org/debug/index.html?q=debug#%28form._%28%28lib._debug%2Frepl..rkt%29._debug-repl%29%29

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Custom command completion?

2016-09-22 Thread Jack Firth
Right, but shell completion varies by shell implementaiton so I was hoping that 
raco
would have some built-in completion script that racket installs, and that 
script would
dispatch to some racket code that implements custom completion for a particular 
command
I'd like to stick something like this in an info.rkt file:

(define raco-commands
  '(("some-command" command-impl-mod "Some command" 20 #:complete-with 
(completion-impl-mod completion-procedure-binding

...and have `raco` setup a single completion script on installation that 
notices when you're
completing a command with custom completion and dispatches to it. That way I 
don't have
to figure out how to get raco pkg install to put shell scripts in the right 
places.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Custom command completion?

2016-09-22 Thread Jack Firth
If I have a `raco` command that I want to add command completion too, how can I 
do that?
Ideally I'm looking for some way to tell raco to dispatch to a particular 
function whenever
shell completion is requested for any uses of my raco command. If there is no 
way to do this
right now, what would I need to build for it?

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: moment->date or moment ... -> ... epoch-seconds

2016-09-22 Thread Jack Firth
On Thursday, September 22, 2016 at 10:55:11 AM UTC-7, Geoffrey Knauth wrote:
> I was using Racket's date. Then I found it was creating a local time when I 
> needed UTC. So I started using moments from (require gregor). Now I'm trying 
> to figure out how to get either a regular date from a moment, or better, how 
> I can get epoch seconds (from 1970-01-01T00:00:00Z) from a moment. I suppose 
> I could compute the since-epoch seconds difference myself, I just don't know 
> if it's in there already and I just missed it.
> 
> Geoff

I believe ->posix[1] is the function you're looking for

[1] 
https://docs.racket-lang.org/gregor/datetime-provider.html?q=gregor#%28def._%28%28lib._gregor%2Fmain..rkt%29._-~3eposix%29%29

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: Help with macros

2016-09-21 Thread Jack Firth
Your `syntax-rules` macro-defined macro uses the name "b", but that name is 
already bound by the `syntax-case` step of `define-primitive`. So your 
expansion looks like this:

(define-primitive (add a b c d) (print (+ a b c d)))

=>

(begin
  (define add-property-table (make-hash))
  (hash-set! add-property-table 'is-prime #t)
  (hash-set! add-property-table 'arg-count (length '(a b c d)))
  (hash-set! add-property-table 'emitter (lambda (a b c d) (print (+ a b c d)))
  (define-syntax add
(syntax-rules ()
  ((add a) (list 'add a))
  ((add a (print (+ a b c d))) (list 'add a (print (+ a b c d)))

Note that `add` macro you create uses `(print (+ a b c d))` instead of `b` in 
the second pattern. You can rectify this by using a different name.

However, here are a couple other notes to consider:

- `syntax-case` is considered somewhat obsolete in the Racket community, 
`syntax-parse` allows for better-specified patterns and error messages. Your 
example with syntax parse would look like (synatx-parse stx [(_ (primitive-name 
arg*:id ...) b:expr ...+) ]). This makes your macro throw a 
syntax error if anything used for `arg*` isn't an identifier, or if 
non-expression syntax (like a keyword) is used for `b`.
- Construction of the "-property-table" identifier can be done much more 
concisely with `format-id`, making your DS/SS/SD shorthands unnecessary
- Avoid mutable data structures unless you know you need mutation. Your 
`hash-set!` code can be easily expressed with a plain call to `hash`:

(define table-name
  (hash 'is-prime #t
'arg-count (length '(a b c d))
'emitter (lambda (a b c d) (print (+ a b c d)

- When a macro defines a macro, the elipses (...) refer to the outer macro 
template. This is why you couldn't use ... in the `syntax-rules` macro you 
attempted to create. You can get around this by using two ellipses grouped 
together, like this:

(define-syntax primitive-name
  (syntax-rules ()
((primitive-name a (... ...)) (list 'primitive-name a (... ...)

- It's considered good Racket style to use brackets for the clauses of 
`syntax-rules` / `syntax-case` / `syntax-parse`, like this:

(syntax-case stx ()
  [(pattern ...) body ...]
  [(pattern ...) body ...]))

- If you (require syntax/parse/define) you can use `define-simple-macro` (badly 
named, we know) in place of `define-syntax-rule`. They function similarly, but 
the former uses `syntax/parse` and thus lets you specify constraints like "this 
should be an identifier".
- The macro you create for each primitive is exactly the same. It may be 
simpler to factor that out into a separate macro:

(define-simple-macro (define-primitive-application-syntax (primitive-name:id 
arg:id ...))
  (define-simple-macro (primitive-name arg-expr:expr (... ...))
(list 'primitive-name arg-expr ...)))

(define-syntax (define-primitive stx)
  (syntax-parse stx ()
[(_ (primitive-name:id arg:id ...) body ...+)
 #:with table-name
(format-id #'primitive-name "~a-property-table" #'primitive-name)
 #'(begin
(define table-name )
(define-primitive-application-syntax (primitive-name arg ...))]))

Hope this helps!

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: Sending a file via HTML request.

2016-08-23 Thread Jack Firth
You could base64 encode the file bytes and stick that into a field in the JSON 
you send. Why not just send the file directly though? For instance, instead of 
sending this:

POST /somewhere
Content-Type: application/json
{
  filename: "foo"
  content: "Zm9vLGJhcixiYXoNCjEsMSwxDQoyLDIsMg0KMywzLDM="
}

Send this:

POST /somewhere
Content-Type: text/csv
foo,bar,baz
1,1,1
2,2,2
3,3,3

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] How to get non-prefab struct values from manually-expanded syntax?

2016-10-03 Thread Jack Firth
So I'm reading a file in as code and expanding it, then looking for values in a 
certain
syntax property that macros in the expanded code attach. This works fine for 
prefab
structs, but I can't seem to get it to work with transparent structs. The issue 
is that
the struct values can be extracted just fine, but they don't satisfy the struct 
predicate
because a different module instance is used to construct them during expansion 
from
the one I use to analyze the extracted values. I found 
`namespace-attach-module`,
but there's a phase-difference involved because I'm trying to get expansion-time
constructed structs and manipulate them at runtime. I could just leave the 
struct as
prefab, or define it in a cross-phase-persistent module, but then I don't get 
to do
things like implement the gen:custom-write interface. What can I do?

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: Convention for package build scripts (that don't really have to be part of the package)?

2016-10-29 Thread Jack Firth
I've thought about this as well, and I think a `-build` or a `-develop` package 
makes the most sense. As an aside, if you wanted to you could even add some 
Scribble docs to that package describing the implementation of your library and 
where important bits of it are. That kind of documentation is highly underrated 
in my view.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Re: cvs-reading ?

2016-10-29 Thread Jack Firth
I'm not quite sure, but one thing I see off that I forgot to mention in my
previous post is that I think the package you want is "csv-reading", not
"cvs-reading".

On Sat, Oct 29, 2016 at 10:31 PM, <meino.cra...@gmx.de> wrote:

>
> Hi Jack,
>
> thanks fpr your reply ! :)
>
> I tried that with this script (copied from the docs, "/bin/env racket
> replace by the actually path to racket):
>
> #!/usr/local/bin/racket; \
> #lang scripty  ; | script preamble
> #:dependencies '("cvs-reading"); /
> --
> #lang racket
>
> (require cvs-reading)
>
> and it failed with:
>
> default-load-handler: cannot open module file
> module path: #
> path: /home/mccramer/; \
> system error: No such file or directory; errno=2
> context...:
> standard-module-name-resolver
> [1]32658 exit 1 ./test.rkt
>
> What did I wrong here?
>
> Cheers
> Meino
>
> Jack Firth <jackhfi...@gmail.com> [16-10-30 06:08]:
> > I would recommend adding `info.rkt` files to your projects so that your
> projects are *themselves* packages. In these info files you can declare
> what packages you depend on, so rather than manually installing
> dependencies one at a time globally (and reinstalling when upgrading
> racket), you simply install your project as a package and `raco pkg` will
> fetch all the dependencies you listed.
> >
> > If you're writing things that tend to be one-off scripts rather than
> full-blown projects and the overhead of an `info.rkt` file irks you, have a
> look at Scripty[1]. This is a Racket package that lets you write scripts
> that declare what packages they depend on in the script itself -- when you
> run the script, it prompts you to install any declared packages that aren't
> present. It's especially useful for replacing random shell scripts with
> racket scripts without forcing your coworkers to confront the racket
> packaging system.
> >
> > [1] http://docs.racket-lang.org/scripty/index.html
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "Racket Users" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to racket-users+unsubscr...@googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: cvs-reading ?

2016-10-29 Thread Jack Firth
I would recommend adding `info.rkt` files to your projects so that your 
projects are *themselves* packages. In these info files you can declare what 
packages you depend on, so rather than manually installing dependencies one at 
a time globally (and reinstalling when upgrading racket), you simply install 
your project as a package and `raco pkg` will fetch all the dependencies you 
listed.

If you're writing things that tend to be one-off scripts rather than full-blown 
projects and the overhead of an `info.rkt` file irks you, have a look at 
Scripty[1]. This is a Racket package that lets you write scripts that declare 
what packages they depend on in the script itself -- when you run the script, 
it prompts you to install any declared packages that aren't present. It's 
especially useful for replacing random shell scripts with racket scripts 
without forcing your coworkers to confront the racket packaging system.

[1] http://docs.racket-lang.org/scripty/index.html

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Declaring structs as final?

2016-11-07 Thread Jack Firth
On Monday, November 7, 2016 at 11:19:22 AM UTC-8, David K. Storrs wrote:
> Out of curiosity, why do you want this?

Some context: https://github.com/jackfirth/lens/issues/290

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: Round-tripping binary data through the web server

2016-11-08 Thread Jack Firth
HTTP headers are ASCII characters only (more accurately, ISO-8859-1 - slight 
differences from ASCII). So your protobuf message stored in the header may get 
bytes above the 127-character range of ASCII mangled. There's a few other 
issues here:

1. You're including the protobuf serialization in a header. Don't do this. 
Headers are for metadata, not data. The protobuf *is* your data, send that as 
the body.
2. The response you're using is HTML describing which message you processed, 
which you could/should do with a Content-Type header instead.

My recommendation: use your own custom Content-Type subtype of octet-stream and 
use a parameter to state the name of the message type you decoded, like 
"application/vnd.some-fancy-name-specific-to-your-project+octet-stream; 
message-type=foo-message". Then send the serialized bytes as your response 
bytes, without any sort of wrapping in HTML at all.

Also, remember to include a Content-Length header!

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: find-seconds daylight saving

2016-11-10 Thread Jack Firth
This thread truly terrifies me when I think of any code I ever wrote that 
worked with dates and times.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: opinions on YAML as communication tool

2016-10-21 Thread Jack Firth
If you'd still like to use yaml, I would like to quietly point out that each of 
the following is a valid boolean value in yaml:

- true
- false
- yes
- no
- y
- n
- True
- False
- TRUE
- FALSE
- on
- off
- YES
- NO

... but it's not strictly case-insensitive, as yES is parsed as a string

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: date->seconds complaining about a supposedly non-existent date

2016-10-20 Thread Jack Firth
There's also the Gregor package 
(https://docs.racket-lang.org/gregor/index.html?q=gregor), which gives a much 
more comprehensive interface to dates and times. In particular, Gregor allows 
you to specify an "offset resolver" for these sorts of time-holes.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: If a thunk is a proc of zero arguments, what is a proc of one argument?

2016-11-13 Thread Jack Firth
I'm assuming you intend to *use* the argument, in which case this is a trickier 
macro to write than `thunk` because you have to make sure the macro respects 
scope properly. If you wanted a function that accepts one argument and ignores 
it, you can use `const`. Otherwise, you can implement a macro like this with a 
syntax parameter[1]:

(define-syntax-parameter the-arg #f)
(define-syntax-parser func
  [(func body:expr ...)
   #' (lambda (arg)
(syntax-parameterize ([the-arg (make-rename-transformer #'arg)])
  body ...))])

(define add1 (func (+ the-arg 1)))

Personally however, I recommend against such a macro. I find using syntax 
parameters for "keyword"-like (as in what other languages call keywords, not 
the Racket #:keyword syntax) behavior can be much harder to understand than 
simple explicit bindings. I'd only use macros like this when there are 
significant readability gains, or it's impossible to do something otherwise. A 
"break" keyword in looping macros is a good use case.

Instead, you may wish to look at existing packages that provide various 
shorthands for writing anonymous functions. The `afl`[2], `curly-fn`[3], and 
`fancy-app`[4] packages all provide various ways of writing anonymous 
functions. Here's various examples of what an anonymous version of `add1` would 
look like with these packages:

plain racket - (lambda (x) (+ x 1))
afl - #λ(+ % 1)
curly-fn - #{+ % 1}
fancy-app - (+ _ 1)

These packages do not all provide identical feature sets, some are more 
restricted than others. Fancy-app doesn't allow anonymous functions with nested 
expressions, and curly-fn automatically curries the resulting function. This is 
the kind of feature where everyone's got their own favorite syntax for it.

[1] - https://docs.racket-lang.org/reference/stxparam.html?q=syntax-parameter
[2] - http://docs.racket-lang.org/afl/index.html
[3] - http://docs.racket-lang.org/curly-fn/index.html
[4] - https://github.com/samth/fancy-app

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: Logging and stdout in web-server

2016-11-11 Thread Jack Firth
You may need to call `(flush-output)` after printing to ensure the buffer is 
flushed. The library racket/place/distributed provides some convenience 
wrappers like printf/f and displayln/f which print and immediately flush the 
output port.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: Contracts for functions that take only a rest arg

2016-11-01 Thread Jack Firth
As an aside, I've written (define (rest-> arg result) (->* () #:rest (listof 
arg) result)) enough times that it'd be nice if it was either in the 
racket/contract library or a sugar/contract lib on the package server.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] [ANN] New packages: compose-app and retry

2017-01-10 Thread Jack Firth
I've added two new packages to the package catalog. The first, `compose-app`, 
provides a
simple #%app macro for composing single-argument functions together:

> (require compose-app)
> (map (add1 .. string->number) (list "1" "2" "3"))
(list 2 3 4)

Optionally, you can use the package with `fancy-app` to get both composition 
syntax and underscores-as-lambdas syntax:

> (require compose-app/fancy-app)
> (map (/ _ 2 .. string->number) (list "10" "20" "30"))
(list 5 10 15)

The second package, `retry`, provides "retryers" for repeating operations in 
the event of failure. To use, first construct retryers for each action you wish 
to do (e.g. sleep X seconds, log a message, etc.), then combine the retryers 
together with `retryer-compose`, then use `call/retry` or `with-retry` to 
evaluate something until it succeeds.

For more information, see:

- The `compose-app` docs: http://docs.racket-lang.org/compose-app/index.html
- The `retry` docs, including The Retry Guide and The Retry Reference: 
http://docs.racket-lang.org/retry/index.html
- The `compose-app` Github repo: https://github.com/jackfirth/compose-app
- The `retry` Github repo: https://github.com/jackfirth/racket-retry
- The `fancy-app` Github repo: https://github.com/samth/fancy-app/tree/master

Patches, issues, comments, musings, and lollipops are all welcome. Special 
thanks to Sam for fancy-app!

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: minimal vs full racket performance issues

2017-03-16 Thread Jack Firth
On Thursday, March 16, 2017 at 3:25:34 PM UTC-7, Dan Liebgold wrote:
> Is there a way to do minimal installs of packages?  I imagine skipping any 
> gui elements would cut down the dependencies quite a bit.

You can install a package in binary form with `raco pkg install --binary foo`, 
which fetches pre-built bytecode and pre-rendered documentation from the 
package catalog build server. This requires you use the same Racket version the 
build server uses, which is usually the latest released version. This also 
completely skips installing dependencies only needed for build time (build-deps 
in a package's info.rkt). You can further omit installing pre-rendered 
documentation by using --binary-lib instead of --binary.

Side question for Racket package system folks: will the migration to Chez 
scheme affect binary installs of packages? I seem to recall discussion that 
bytecode might be going away as part of the Chez transition.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: low-friction app extensibility in racket

2017-07-06 Thread Jack Firth
On Thursday, July 6, 2017 at 2:53:43 AM UTC-7, Neil Van Dyke wrote:
> * Pretty similar alternative: user has a Racket file "my-foo", which is 
> the immediate program the user runs.  This file does a `(require foo)`, 
> as well as a `(start-foo #:pref1 x #:pref2 y ...)`.

You may be interested in a recent change to Greg Hendershott's Frog static site 
generator, which does basically this: 
https://github.com/greghendershott/frog/pull/194

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] [ANN] New package: disposable

2017-07-21 Thread Jack Firth
I recently published `disposable`, an experimental package for safely handling 
external resources.

Features:

- representation of a "disposable", a producer of values with external 
resources that must be disposed
- safe handling of disposables for multiple usage patterns, including:
  - for a series of expressions, `(with-disposable ([v disp]) body ...)`
  - for the lifetime of the program with the resource cleaned up on program 
exit, `(acquire-global disp)`
  - for the lifetime of the current thread, with a single resource reused 
automatically in the same thread, `(acquire-virtual disp)` (heavily inspired by 
virtual connections in the `db` library)
  - until an arbitrary event is ready for synchronization, `(acquire disp 
#:dispose-evt (alarm-evt 1000))`
- abstractions over disposables and combinators for extending disposables, 
including:
  - creating a pool of disposable values with reuse, `(disposable-pool disp)`
  - asynchronously deallocating disposables, `(disposable/async-dealloc disp)`
  - monadically composing disposables with concurrent allocation and 
deallocation, `(disposable-apply f disp ...)` and `(disposable-chain disp f)`
- temporary files and directories as disposables
- utilities for testing disposables, including observing when allocation and 
deallocation occur

If you're familiar with AutoClosable in Java or IDisposable in C#, think of 
disposables as thunks that produce AutoClosable or IDisposable values.

The API is still in the early stages, and there's a few concurrency bugs to 
work out but the features above should work as advertised. Feedback strongly 
welcomed.

Docs: http://docs.racket-lang.org/disposable/
Source code: https://github.com/jackfirth/racket-disposable

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] [ANN] MessagePack implementation for Racke

2017-07-24 Thread Jack Firth
> Just to make sure I understood correctly: ‘msgpack’ is the umbrella module 
> that users import, ‘msgpack/test/pack’ (and ‘unpack’) are the test modules 
> that will be run for testing only. How about the directory structure? I like 
> to keep all source files in a source directory (my original reason for doing 
> ‘multi), can I still do something like this?
> 
> |-README
> |-LICENSE
> |-info.rkt
> |-source
>   |-msgpack.rkt
>   |-pack.rkt
>   |-unpack.rkt
> |-test
>   |-pack.rkt
>   |-pack
> |- ...
>   |-unpack.rkt
>   |-unpack
> |- …
> 
> It doesn’t have to be exactly this structure, but the idea is that all 
> project-realted files are in the root, all the source files in the source 
> directory and all the test files in the test directory.

That you cannot do, and if you wish to do that keeping your code as one package 
might be a little unidiomatic. If you want to keep your test code completely 
separate from your implementation code, and you want both to be separate from 
the top level root of the project, you could have two separate packages each 
with a single collection like so:

|-README
|-LICENSE
|-msgpack-lib
  |-info.rkt ;; collection is "msgpack"
  |-main.rkt
  |-pack.rkt
  |-unpack.rkt
|-msgpack-test
  |-info.rkt ;; collection is "msgpack"
  |-pack-test.rkt
  |-unpack-test.rkt

Having said that, have you considered test submodules? They allow you to write 
your tests in the same file as the code they're testing, while keeping test 
dependencies separate from your library's normal runtime dependencies. With 
test submodules, your code would probably look like this:

(define (pack ...) ...)

(module+ test
  test pack ...)

(define (unpack ...) ...)

(module+ test
  test unpack ...)

And your directory structure would look like this:

|-README
|-LICENSE
|-info.rkt ;; collection is "msgpack"
|-main.rkt
|-pack.rkt ;; has test submodule
|-unpack.rkt ;; has test submodule

You could also put the code into a subdirectory package like above, if you 
really want to keep the project files and the source files separate.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: Best way to write run-once-and-cache functions?

2017-04-26 Thread Jack Firth
A `define/delay` macro for this might be a good addition to `racket/promise`:

(define-simple-macro (define/delay id:id expr:expr)
  (begin (define p (delay expr)) (define (id) (force p

(define/delay conf
  (with-input-from-file "db.conf" read-json))

(conf) ;; forces promise

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


  1   2   >