Re: [racket-users] Assigning a new value to a global variable in Rachet - how?

2016-09-17 Thread Daniel Prager
ubscribed 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. > -- *Daniel Prager*

Re: [racket-users] Controlling DPI when saving a png image

2016-09-14 Thread Daniel Prager
Thanks Robby Looks like post-processing with process* is the way to go. Dan -- 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] Controlling DPI when saving a png image

2016-09-14 Thread Daniel Prager
It looks like save-png in 2htdp/image defaults to 72 DPI. Is there any way to set the DPI when saving from Racket? Currently I post-process externally with ImageMagick. Dan -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from

Re: [racket-users] fivethirtyeight indexes reddit

2016-08-25 Thread Daniel Prager
On Fri, Aug 26, 2016 at 2:27 AM, Norman Gray wrote: > What this looks consistent with -- given that the vertical axis is a > fraction not absolute -- is that these terms have stayed roughly constant > in popularity, but the rest of Reddit has grown exponentially, talking

Re: [racket-users] Whalesong instead of Clojurescript

2016-08-25 Thread Daniel Prager
There's also the lighter-weight Urlang: https://github.com/soegaard/urlang -- 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

Re: [racket-users] Learning by doing Typed Racket

2016-06-12 Thread Daniel Prager
On Mon, Jun 13, 2016 at 10:59 AM, Matthew Butterick wrote: > Some people, when confronted with a problem, think "I know, I'll use Typed > Racket." Now they have (Pairof Problem Problem). > > Most droll ! Taken seriously, when is the right time for TR vs Contracts vs lots of

Re: [racket-users] Learning by doing Typed Racket

2016-06-12 Thread Daniel Prager
eone (Matthew B.?) suggested before, we could really use a > systematic way of documenting the type variables on each polymorphic > function. > > > On Sun, Jun 12, 2016 at 5:23 PM, Daniel Prager <daniel.a.pra...@gmail.com> > wrote: > >> Cc:ing the list ... >

Re: [racket-users] Learning by doing Typed Racket

2016-06-12 Thread Daniel Prager
ons Integer Integer) null (list 1 2 3 4)) - : (Listof Integer) '(4 3 2 1) In this case inst-ing cons is more concise than inst-ing foldl (in which the Nulls are placeholders since c & d are ignored), so preferable. * * * Also, perhaps discoverability would be improved if the error m

Re: [racket-users] Learning by doing Typed Racket

2016-06-11 Thread Daniel Prager
Next example. In Racket: > (sort '((a 45) (b 13) (c 12) (d 16) (e 9) (f 5)) < #:key second) '((f 5) (e 9) (c 12) (b 13) (d 16) (a 45)) In Typed Racket I couldn't get a version using #:key to type-check. Pulling second into a comparison function works: > (sort '((a 45) (b 13) (c 12) (d 16) (e

Re: [racket-users] Learning by doing Typed Racket

2016-06-11 Thread Daniel Prager
; program knows that this won't be a problem, because `boolean-tuple` always > produces a list of exactly the right length, but Typed Racket doesn't know > that. > > Sam > > On Fri, Jun 10, 2016 at 5:39 PM Daniel Prager <daniel.a.pra...@gmail.com> > wrote: > >> I'm wo

Re: [racket-users] Learning by doing Typed Racket

2016-06-10 Thread Daniel Prager
On Sat, Jun 11, 2016 at 8:17 AM, Sam Tobin-Hochstadt wrote: > The easiest way to avoid this is to program with the types, and the > type checker, in mind from the start. That's what I'm trying to do, hampered by my limited of understanding of the limits of the

Re: [racket-users] Learning by doing Typed Racket

2016-06-10 Thread Daniel Prager
th, but Typed Racket doesn't know > that. > > Sam > > On Fri, Jun 10, 2016 at 5:39 PM Daniel Prager <daniel.a.pra...@gmail.com> > wrote: > >> I'm working my way through the 99 Lisp Problems ( >> http://www.ic.unicamp.br/~meidanis/courses/mc336/2006s2/funciona

[racket-users] Learning by doing Typed Racket

2016-06-10 Thread Daniel Prager
I'm working my way through the 99 Lisp Problems ( http://www.ic.unicamp.br/~meidanis/courses/mc336/2006s2/funcional/L-99_Ninety-Nine_Lisp_Problems.html) to improve my proficiency with Typed Racket. While sometimes the discipline of the types helps me catch mistakes, quite often I find myself

Re: [racket-users] DrRacket: Laggy when rendering images as results vs display-ing

2016-05-30 Thread Daniel Prager
on. I don't see how I can reasonably > > support this for picts (because the `dc` procedure is used a lot), but > > maybe DrRacket can collude with the 2htdp/image library to get > > display's speed and print's safety. I'll think more about it. > > > > Robby > > &

Re: [racket-users] for/list vs map in Typed Racket

2016-05-26 Thread Daniel Prager
On Thu, May 26, 2016 at 7:13 AM, Sam Tobin-Hochstadt <sa...@cs.indiana.edu> wrote: > You can write `(NonemptyListof a)` as > > (define-type (NonemptyListof a) (Cons a (Listof a))) > > Sam > Nice: Cons -> Pairof, though. Dan > > > > On Wed,

Re: [racket-users] for/list vs map in Typed Racket

2016-05-25 Thread Daniel Prager
Thank-you Matthias On Wed, May 25, 2016 at 10:46 PM, Matthias Felleisen wrote: > > 1. You had a } mistake. > I see it now. By putting an extra ) at the end of the λ I committed an arity error. I could have seen this in DrRacket if I formatted as you did, with the

Re: [racket-users] for/list vs map in Typed Racket

2016-05-25 Thread Daniel Prager
idn't > provide an annotation. In the `for/list`, the call to `(pack xs)` is > right there, so inference works. > > To make the use of `map` work, you just annotate `ys`: (λ ([ys : > (Listof a)]) (list (length ys) (first ys))) > > Sam > > On Tue, May 24, 2016 at 5:50 PM, Daniel

[racket-users] for/list vs map in Typed Racket

2016-05-24 Thread Daniel Prager
The following program works in Typed Racket, but if you comment out the for/list in (encode ...) and uncomment the seemingly equivalent map it fails to type check. Why the discrepancy and how do the experienced Typed Racketeers diagnose and fix these sorts of issues? Thanks Dan P.S. These

[racket-users] Re: Questions about quad

2016-05-19 Thread Daniel Prager
ker and see what I can find: it's great stuff. Dan On Thu, May 19, 2016 at 11:44 PM, Matthew Butterick <m...@mbtype.com> wrote: > On Thu, May 19, 2016 at 4:48 PM, Daniel Prager <daniel.a.pra...@gmail.com> > wrote: > >> I'm having a play with your quad type-set

[racket-users] Re: Questions about quad

2016-05-19 Thread Daniel Prager
programmatically if that's what it takes. An illustrative example would be great! Thanks Dan On Thu, May 19, 2016 at 4:48 PM, Daniel Prager <daniel.a.pra...@gmail.com> wrote: > Hi Matthew > > I'm having a play with your quad type-setting library, which looks very > promising as

[racket-users] Questions about quad

2016-05-19 Thread Daniel Prager
Hi Matthew I'm having a play with your quad type-setting library, which looks very promising as a way to generate typeset pdfs from Racket without invoking LaTeX. It looks really promising. Quick questions (which may also prompt a light update to the docs): - How do I require modules?

Re: [racket-users] DrRacket: Laggy when rendering images as results vs display-ing

2016-05-17 Thread Daniel Prager
Hi Robby I only used the same bitmap for convenience of example. I have cases where every bitmap is different! I hope that the eventual outcome is fast *and* secure! At the moment my workaround is to (display ...). Dan On May 18, 2016 8:52 AM, "Robby Findler"

Re: [racket-users] DrRacket: Laggy when rendering images as results vs display-ing

2016-05-16 Thread Daniel Prager
two now. > I'm not completely confident in the change but let me know how it > works for you. > > Robby > > On Sat, May 14, 2016 at 4:41 PM, Daniel Prager > <daniel.a.pra...@gmail.com> wrote: > > Displaying bitmaps in DrRacket using 2htdp/image is near instantane

[racket-users] DrRacket: Laggy when rendering images as results vs display-ing

2016-05-14 Thread Daniel Prager
Displaying bitmaps in DrRacket using 2htdp/image is near instantaneous when (display)-ed, but takes quite a while when shown as a result. The effect gets very bad when lots of images are combined with (beside) and (above), while (display)-ing remains fast. Racket version is 6.5. Dan Sample

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

2016-04-21 Thread Daniel Prager
Great comments. Thank-you! I think that for the purposes of remembering "take and drop family functions are backwards / wrong" should suffice, or train myself to think "from list L take n elements", etc. Another point that occurred to me is that the common library naming convention of object-fn

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

2016-04-21 Thread Daniel Prager
Does anyone else struggle to remember the order of arguments for some of the common functions? There seem to be two extant conventions, roughly: 1. object-first: (function obj other) 2. object-last: (function other obj): e.g. Object-first: take, drop, list-ref, add-between, sort

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

2016-04-12 Thread Daniel Prager
Thanks George Of interest to me is that you eschew the use of syntax-parse / -case / -rules in favour of a straight syntax->datum -> straight racket -> datum->syntax solution. I suppose this approach trades away hygiene and error-checking for simplicity. Also, nice trick appropriating

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

2016-04-11 Thread Daniel Prager
On Apr 12, 2016 7:53 AM, "George Neuner" wrote: > > On Mon, 11 Apr 2016 10:25:46 -0400, Matthias Felleisen > wrote: > > >These days I define little macros inside of loops or methods all the time. > > Same here. My most common uses are to handle

Re: [racket-users] Messing with 2htdp/image & universe, got a weird problem

2016-04-10 Thread Daniel Prager
Hi Wesley Some tips: 1. Your use of random with two args is incorrect: create a (random-range a b) function to express your intent. 2. The slow-down is because you're using unlimited precision arithmetic. Try using 1.0 instead of 1 to get floating point. 3. Instrument your

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

2016-04-07 Thread Daniel Prager
On Thu, Apr 7, 2016 at 4:13 PM, Rickard Andersson < rickard.m.anders...@gmail.com> wrote: > > What have you used them for? > > https://github.com/GoNZooo/gonz/blob/master/gonz/define-test.rkt > > It's a macro that allows me to bundle expected inputs with expected > outputs for those inputs

Re: [racket-users] macros within expressions.

2016-04-06 Thread Daniel Prager
(map point-y points) gives the expected result without recourse to a macro. Or is y-coord intended as a simplified example of something else? Dan -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop

Re: [racket-users] Racket -> HTML+JavaScript using Urlang and Ractive

2016-03-23 Thread Daniel Prager
On Sun, Mar 20, 2016 at 9:44 AM, Matthew Butterick wrote: > When you put it that way, subjectively it still sounds good. I'd use it. > But objectively I can't foresee that it would be a wise investment of > anyone's Racket time. Let's face it: any web framework is lucky to live

[racket-users] Racket -> HTML+JavaScript using Urlang and Ractive

2016-03-19 Thread Daniel Prager
Awesomely, Jens has been working on Urlang: a Racket-ish syntax for JavaScript, using the nanopass compiler infrastructure: https://github.com/soegaard/urlang and more ambitiously, a Racket (subset) ->JavaScript compiler (rjs), taking a distinct approach from Whalesong. * * * Just using plain

Re: [racket-users] predicate as an atom within a regexp?

2016-03-18 Thread Daniel Prager
Hi Matthew Do you want the leftmost, longest substring matching the predicate? E.g. something like (substring/p string->number "foo-46.3bar12789") returns "-46.3"? Dan -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this

Re: [racket-users] Racket -> HTML+JavaScript using Urlang and Ractive

2016-03-18 Thread Daniel Prager
Matthew writes: > The idea of a subset of Racket that compiles to this kind of statistically probable subset of JS is very appealing. Agreed. The way Jens has split it up is that Urlang is a thin, cleaned-up Racket-ish syntax for ES5, with a bit of sugar and a macro capability. Then there's rjs,

Re: [racket-users] How to get a "green bar" (or similar) on passing tests?

2016-03-05 Thread Daniel Prager
Thank-you Stephen I had tried to get it to work at the level of test-cases (which I still can't grok), but not test-suites. Those examples would make worthy additions to the docs. Much obliged Dan -- You received this message because you are subscribed to the Google Groups "Racket Users"

[racket-users] How to get a "green bar" (or similar) on passing tests?

2016-03-05 Thread Daniel Prager
Is there a way to get a successful run of RackUnit tests to give a bit of encouragement? E.g. 12 out of 12 tests passed. The regular set-up seems to follow the "no news is good news" philosophy. Also, I couldn't figure out how to summon the rackunit/gui test runner (which may be what I want).

Re: [racket-users] recursive definition of a PROPOSITION

2016-02-18 Thread Daniel Prager
Hi Aysenur Here are some hints: - It's simpler to work with symbols than strings in this sort of problem. E.g. (define ops '(↔ → ∧ ⊕ ∨ ¬)) (define propositions '(P Q R X Y Z)) - It helps to start by solving a simpler problem. Can you write a function (random-simple-expression) to

Re: [racket-users] Call for Google Summer of Code Project Suggestions

2016-02-11 Thread Daniel Prager
Great list! Suggestion: * #lang web/racket: Compilation from a Racket subset to compact JS / webassembly (+ HTML & CSS) Concept: Develop / debug in Racket, deploy to the web. Problem: The current approach using Whalesong is heavy / slow-loading for practical use. [Please correct me if I'm

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

2016-01-09 Thread Daniel Prager
Matthew writes: > Repeated application of `string-split` is my secret weapon. (filter (curryr string-prefix? "[X]") (string-split str "\n")) To say nothing of string-prefix? (new in 6.3) and curryr - nice! Somewhat more explicit (and verbose) variations: (filter (λ (line) (string-prefix?

Re: [racket-users] Advent of Code solutions & explanations

2016-01-07 Thread Daniel Prager
Nice! Advent of code is a fun way to learn some new aspects of Racket by solving puzzles. Matthew: To further enhance the educational value of your write-up please consider providing an index of the Racket features you explicate in your solution discussions. This could be as simple as augmenting

Re: [racket-users] Racket in a web page (via Whalesong)

2016-01-02 Thread Daniel Prager
Greg Trzeciak wrote: > I am also writing this post to show there is an interest in Javascript Racket (and ClojureScript competitor). Just wondering: is Whalesong the only option for Racket targeting JS, or are there other options available or under development? Dan -- You received this

[racket-users] Racket documentation - emphasis in margin notes

2015-12-25 Thread Daniel Prager
I've noticed a usability issue with margin notes in the docs: the bolding is misleading. *Example*: [image: +]Regular Expressions in The Racket Guide introduces regular expressions. *Problem*: The eye

Re: [racket-users] Advent of Code

2015-12-19 Thread Daniel Prager
Thanks! I will study and return with questions. Dan -- 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

[racket-users] Advent of Code

2015-12-19 Thread Daniel Prager
I'm having a bit of fun working through the puzzles on adventofcode.com using Racket, and of course trying to use it to improve my Racket skills along the way. I've just solved Day 7 (adventofcode.com/day/7) for which the input "data" starts with: lf AND lq -> ls > iu RSHIFT 1 -> jn > bo OR bu

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

2015-10-14 Thread Daniel Prager
Something for consideration in Racket 2? I've gotten used #:keywords, but initially felt that they were inelegant. Dan -- 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

Re: [racket-users] Naming for generalization of find-min and find-max?

2015-10-12 Thread Daniel Prager
find-min and find-max are (already) good names in my opinion. They shorten both minimum / minimal (maximum / maximal), which works for both numbers (whence our intuition) and partial orders. How about find-min or find-max with an optional keyword argument #:order-by (defaulting to <)? I dislike

Re: [racket-users] above/beside

2015-10-11 Thread Daniel Prager
If memory serves, this is to cater for beginning students for whom passing a single image is more often than not an error. I (and no doubt others) have written functions above* and beside* to do "the right thing". Dan -- You received this message because you are subscribed to the Google Groups

Re: [racket-users] Somewhere to keep racket snippets

2015-09-09 Thread Daniel Prager
www.pasterack.org -- 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

Re: [racket-users] Whalesong-as-a-service

2015-09-09 Thread Daniel Prager
Cool! I was chuffed to see my 2048 implementation ported and included. It even loaded on my phone, but of course can't be played on touch devices without support for swipe events. That would be a nice enhancement! Dan -- You received this message because you are subscribed to the Google Groups

Re: [racket-users] Re: Converting a heterogenous list into a string

2015-06-22 Thread Daniel Prager
I reckon, rather than using match or first second (apply ~a (map (λ (x) (apply format [~a=~a] x)) paired-list)) is quite neat. BTW: In DrRacket you can get the λ by using Cmd+\ (on Mac, shortcut listed in the Insert file menu). Dan -- You received this message because you are

Re: [racket-users] Generic collections in Racket

2015-05-24 Thread Daniel Prager
Hi Alexis Nice! I've been playing with Clojure a bit recently and I 1. several aspects (like the generic operations, concise destructuring, etc.), 2. am frustrated with others (e.g. error messages and tooling), 3. are intrigued by some of the other design choices (e.g. pervasive use

Re: [racket-users] How to fill a shape with a texture using 2htdp/image or similar?

2015-05-21 Thread Daniel Prager
). And then there's the work of updating the documentation and adding new examples and test cases. The relevant files are mrlib/image-core and various files in the 2htdp collection. Patches welcome. :) Robby On Tue, May 19, 2015 at 6:36 PM, Daniel Prager daniel.a.pra...@gmail.com wrote: 2htdp/image

[racket-users] How to fill a shape with a texture using 2htdp/image or similar?

2015-05-20 Thread Daniel Prager
2htdp/image makes it easy to draw all sorts of solid shapes (triangles, squares, stars, etc.) and fill them with a solid color. But say I want to fill with a texture (say from a bitmap loaded from a file). I could brute-force it by creating a separate stencil image, converting both to pixels and

[racket-users] Use Parsack to parse a #language?

2015-05-12 Thread Daniel Prager
I've been having a great time playing with Stephen Chang's Parsack http://stchang.github.io/parsack/parsack.html (parsec-style parsing for Racket) and enjoying the straightforward learning curve and usability. Thanks Stephen! Has anyone used Parsack to do the parsing for a little language and

[racket-users] Re: Use Parsack to parse a #language?

2015-05-12 Thread Daniel Prager
Hi Stephen Thanks for the encouragement, and the tips: I was wondering especially about item 3. Once I get my head around what's needed to connect up a custom reader, I should be in a position to have a shot ... and ask further questions. Dan -- You received this message because you are

[racket-users] Debugging Clojure in Racket

2015-04-19 Thread Daniel Prager
This is a bit of an anecdote: I've started doing some Clojure and ClojureScript tutorials; the idea being to learn enough ClojureScript to use it with reactjs wrappers on the front-end. So far the experience has been quite pleasant, with my brain wrapping itself around a #lang racket cousin,

Re: [racket-users] Projects (was: the Racket manifesto)

2015-03-26 Thread Daniel Prager
One area where a notion of Project comes in handy is with cross-file refactoring. E.g. Right now I am in the midst of renaming a #:keyword and resorting to grep to find dependencies in other files. Is there a smarter existing way of doing this kind of thing in DrRacket? Or is this a use-case for

<    1   2