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

[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,

[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

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

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

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

[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] 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
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-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-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

[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] 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

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

[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] 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] 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] 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"

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

[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

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"

[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] 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] 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

[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

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

Re: [racket-users] Client side web applications in Racket

2017-01-22 Thread Daniel Prager
On the client-side framework front, I found some of the lightweight, post React / post Angular frameworks were easy enough to get going with Urlang, hence definitely worth a look for RacketScript. I played mainly with Ractive; vue.js is similar. There are others. The main seeking point for me was

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] 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] 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] Using the graph library

2016-10-29 Thread Daniel Prager
Starting at the very beginning, you could pick up some material on graph theory, and work through it, while making use of the graph library. E.g. Here's an introduction to the absolute basics of Graph Theory: https://www.youtube.com/watch?v=HmQR8Xy9DeM And here I've followed along in Racket,

Re: [racket-users] Funtional programming and the maximum of something

2016-10-22 Thread Daniel Prager
> circle of recursion I reckon "helix of recursion" would be a more helpful image. 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

Re: [racket-users] Re: Advent of Code 2016

2016-12-15 Thread Daniel Prager
/ This year I’m solving every problem as a DSL. Like cookies for Santa, I will leave at least one for Benjamin Greenman. https://github.com/mbutterick/aoc-racket/tree/2016/2016 On Monday, December 12, 2016 at 8:39:48 PM UTC-8, Daniel Prager wrote: > Is anyone else Racketin

Re: [racket-users] Re: Racket graphics?

2017-01-14 Thread Daniel Prager
Lawrence writes > Could it do diagrams as well as TikZ ... For making-TIkz like diagrams check out Jens Axel Søgaard's MetaPict library. It has as an explicit goal "to narrow the gap between Scribble and LaTeX + MetaPost/Tikz". https://soegaard.github.io/docs/metapict/metapict.html

Re: [racket-users] Re: Racket graphics?

2017-01-14 Thread Daniel Prager
> Also, are these links listed in your responses done in Scribble? Yes: it's standard for Racket documentation. What would be the novel aspect(s) of your GIS app? Dan -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this

Re: [racket-users] Animation-problem

2016-12-04 Thread Daniel Prager
Hi Janiho This should help get you get going ... The function big-bang takes minimally: * an initial "state of the world", * a function that that takes the current world state and evolves it with every tick of a notional clock, and * a function that takes the state of the world and draws it.

Re: [racket-users] Animation-problem

2016-12-05 Thread Daniel Prager
My pleasure. Good on you for doing the exercise. Here's a slightly modified version that: - removes the use of set!: it's cleaner "functional" style to avoid mutation where possible - illustrates the use of match-define to unpack world - other small tweaks and tricks Dan #lang

Re: [racket-users] Cleanest way to locate contiguous sequences? (as part of reuniting segments of a file)

2016-12-02 Thread Daniel Prager
Perhaps this is a more elegant approach to the tactical problem: simultaneously iterating over displaced versions of the original list. E.g. _x '(1 1 2 3 5 7 200 201 202) ; shifted right x '(1 2 3 5 7 200 201 202 203) ; original list x_ '(2 3 5 7 200 201 202 203 203) ; shifted left When

Re: [racket-users] How to write string-match?

2016-12-20 Thread Daniel Prager
Thanks Alexis! That's such an elegant solution. I'm a little in awe of all the pieces that you pulled together to make it work. Fantastic! In terms of surface syntax, I think that your straight extension to match is preferable to what I asked for, allowing this sort of thing (match s

[racket-users] How to write string-match?

2016-12-20 Thread Daniel Prager
While working through many of the puzzles in this year's adventofcode.com I tend to parse the input with a sequence of string-splits. This isn't too bad, but What I'd *really* like is a "string-match" form to more elegantly process structured data, via a few strings based on a simple (and greedy)

Re: [racket-users] How to apply side effects to all elements in a list

2017-03-22 Thread Daniel Prager
Hi Angus Usually it helps to start by getting something simple to work and then little-by-little adding more. E.g. Here's a working example with squares instead of bears, and limited to just varying rotation ... #lang racket (require 2htdp/image) (define blue-square (square 25 'solid 'blue))

Re: [racket-users] Beautiful Racket v1.0

2017-03-15 Thread Daniel Prager
Bravo Matthew! Great stuff. I look forward to buying it and using the payment to help motivate me to work through *all* the goodness. Cheers 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] change 'random' contract to allow zero in first position?

2017-03-03 Thread Daniel Prager
On Sat, Mar 4, 2017 at 6:21 AM, John Clements <cleme...@brinckerhoff.org> wrote: > > > On Mar 2, 2017, at 3:00 PM, Daniel Prager <daniel.a.pra...@gmail.com> > wrote: > > > > While we're at it, please allow negative arguments too, to allow for > cases suc

Re: [racket-users] change 'random' contract to allow zero in first position?

2017-03-02 Thread Daniel Prager
While we're at it, please allow negative arguments too, to allow for cases such as (random -100 100) 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

Re: [racket-users] Struggling with writing array generator function

2017-07-13 Thread Daniel Prager
, 2017 at 6:07 AM, Vasily Rybakov <madbada...@gmail.com> wrote: > On Thursday, July 13, 2017 at 9:30:44 PM UTC+2, Daniel Prager wrote: > > It's straightforward to design a recursive macro with similar intent, > but different surface syntax: > > > > (generate-array (i)

Re: [racket-users] Struggling with writing array generator function

2017-07-13 Thread Daniel Prager
t;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* Agile/Lean Coaching, Innovation

Re: [racket-users] Re: Decision Tree in Racket - Performance

2017-07-24 Thread Daniel Prager
Jon wrote: > Aside: if I read Daniel's solution correct, he avoids the first issue by assuming that it's a binary classification task (that is, that there are only two classes). Yep: I'm assuming binary classification. David wrote: > Out of curiosity, how much of that 0.5 seconds is overhead?

Re: [racket-users] Re: Decision Tree in Racket - Performance

2017-07-24 Thread Daniel Prager
nk. Might try that > soon.) > > I added your code as a new file and added a comment at the top of the file: > > #| > Attribution: > > This implementation of decision trees in Racket was written by Daniel > Prager and > was originally shared at: > > https://g

Re: [racket-users] Re: Decision Tree in Racket - Performance

2017-07-27 Thread Daniel Prager
t; -Philip > > On Wed, Jul 26, 2017 at 3:00 AM, Daniel Prager <daniel.a.pra...@gmail.com> > wrote: > >> Actually, I only use multiple values because that's what for/fold returns. >> >> Is there a way to convert from values to a list without going through >>

Re: [racket-users] Re: Decision Tree in Racket - Performance

2017-07-27 Thread Daniel Prager
rewritten. My recommendation for > fast code is to try to avoid allocations when possible. > > Gustavo > -- *Daniel Prager* Agile/Lean Coaching, Innovation, and Leadership Profile: skillfire.co/dan Startups: youpatch.com <http://www.youpatch.com>, skillfire.co Twitter: @agilej

Re: [racket-users] Re: Decision Tree in Racket - Performance

2017-07-27 Thread Daniel Prager
Revised to collect garbage before each timing shows the recursive function isn't too bad (but not great): cpu time: 405 real time: 404 gc time: 0 2452578471 cpu time: 368 real time: 368 gc time: 0 2452578471 cpu time: 50 real time: 50 gc time: 0 2452578471 cpu time: 194 real time: 195 gc time:

Re: [racket-users] Re: Decision Tree in Racket - Performance

2017-07-27 Thread Daniel Prager
The performance hit of first / rest vs car / cdr is a little disquieting from a readability POV. Very informative discussion, though! 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

Re: [racket-users] Re: Decision Tree in Racket - Performance

2017-07-27 Thread Daniel Prager
PM UTC+2, gustavo wrote: > > I read the solution of Daniel Prager and I have a few minor changes. > > > > * First I added a test that repeats `build-tree` 20 times, so the run > > time is approximately 1-2 seconds. This is not necessary, but times > > smaller than 1 second

Re: [racket-users] Re: Decision Tree in Racket - Performance

2017-07-27 Thread Daniel Prager
Zelphir: > I don't really understand the (in-list ...) thing. This seems to be internal magic to me. Maybe it informs about the type of what is iterated over and that makes it faster? Pretty much. Here's a program that constructs a lot of random numbers and adding them up in a few different ways.

Re: [racket-users] Re: Decision Tree in Racket - Performance

2017-07-27 Thread Daniel Prager
> >>> On Jul 27, 2017, at 9:18 PM, Matthew Flatt <mfl...@cs.utah.edu> wrote: > >>> > >>> I don't think optional arguments are all that slow. > >>> > >>> > >>> > >>> This isn’t just Matthew’s opinion.

Re: [racket-users] Re: Decision Tree in Racket - Performance

2017-07-28 Thread Daniel Prager
Interesting stuff, but if I may probe a little deeper into scheme history, why couldn't first have simply been defined as a synonym for car (i.e. first item in a pair) and rest a synonym for cdr? Dan On Fri, Jul 28, 2017 at 6:09 PM, Neil Van Dyke <n...@neilvandyke.org> wrote: > Dani

Re: [racket-users] Re: Decision Tree in Racket - Performance

2017-07-26 Thread Daniel Prager
Actually, I only use multiple values because that's what for/fold returns. Is there a way to convert from values to a list without going through define-values or similar? Dan On 26 Jul. 2017 09:40, "Zelphir Kaltstahl" wrote: I've come to the conclusion, that not

Re: [racket-users] Re: Decision Tree in Racket - Performance

2017-07-26 Thread Daniel Prager
guess the next step is for summertime to port this code to Typed Racket and see how that performs. Dan On 26 Jul. 2017 23:17, "Gustavo Massaccesi" <gust...@oma.org.ar> wrote: I read the solution of Daniel Prager and I have a few minor changes. * First I added a test that repeats

Re: [racket-users] Speeding up graphics / moving away from 2htdp/image

2017-04-26 Thread Daniel Prager
am `freeze` from 2htdp/image may help if you haven't tried already. For example this[1] program renders faster with freeze both in RacketScript and 2htdp/image. [1] http://rapture.twistedplane.com:8080/#example/default --Vishesh On Tue, Apr 25, 2017 at 9:09 PM, Daniel Prager <daniel.a.pra.

[racket-users] Speeding up graphics / moving away from 2htdp/image

2017-04-25 Thread Daniel Prager
Much as I enjoy making images using 2htdp/image it does get a tad slow as complexity increases. I currently have a program in which I generate images in 2htdp/image and translate them into bitmap%s per racket/gui and render on canvas%'s via a dc. Speed has become sluggish and I'm going to need

Re: [racket-users] Speeding up graphics / moving away from 2htdp/image

2017-04-26 Thread Daniel Prager
On Thu, Apr 27, 2017 at 12:34 PM, Vishesh Yadav wrote: > >> BTW: I'm interested in porting to RacketScript. How does the performance >> of the image library equivalent compare with regular Racket? >> >> > It is slower than regular Racket. I did not spend much time comparing

Re: [racket-users] Speeding up graphics / moving away from 2htdp/image

2017-04-28 Thread Daniel Prager
On Sat, Apr 29, 2017 at 2:10 AM, WarGrey Gyoudmon Ju wrote: > Hello, I think the main reason that pict is faster than 2htdp/image is, > the pict is implemented with struct while the 2htdp/image is implemented > with class, the speed of rendering is just as fast/slow as

Re: [racket-users] Speeding up graphics / moving away from 2htdp/image

2017-04-29 Thread Daniel Prager
On Sat, Apr 29, 2017 at 6:04 PM, Philip McGrath wrote: > I think that would be because "the *draw* is called during the dynamic > extent of the call to dc >

Re: [racket-users] Speeding up graphics / moving away from 2htdp/image

2017-04-29 Thread Daniel Prager
Thanks for all the suggestions. I was able to get pict down to "direct to dc"-like performance by making a custom pict that calls my direct-to-dc code ... (define (pict:render block) (pict:dc (λ (dc dx dy) (define old-brush (send dc get-brush)) (define old-pen (send dc

Re: [racket-users] Speeding up graphics / moving away from 2htdp/image

2017-04-28 Thread Daniel Prager
> On Friday, April 28, 2017 at 6:40:06 PM UTC+8, Daniel Prager wrote: > > > The reason is that what I really want to do is more complex layouts, for > which 2htdp/image or pict combiners make life a lot easier. > > The code to convert to bitmap allocates the bitmap and d

Re: [racket-users] Seeking a graphviz like, diagramming language for Racket

2017-08-19 Thread Daniel Prager
Hi Andrew I did commercial work on mind-map like tools in the 2000's, and have a soft spot for graph and tree visualisation. Example: https://www.researchgate.net/figure/221249211_fig1_Fig-1- Example-hi-tree-laid-out-in-the-standard-layout-style-It-shows-the-logical I didn't work on the deep

[racket-users] Re: Apropos contracts: simple predicates and switching on and off

2017-05-02 Thread Daniel Prager
Thinking more about the functional context, a macro — say (define/pre-post ...) that cleanly defined the following functions would be pretty sweet (continuing with the real-sqrt example): - real-sqrt-unsafe - real-sqrt-with-pre-conditions - real-sqrt-with-pre-and-post-conditions -

Re: [racket-users] Apropos contracts: simple predicates and switching on and off

2017-05-03 Thread Daniel Prager
Hi Philip Thank-you for sharing your version: each example and variation is helping me understand the machinery better. I agree that clarity in error reporting is also vital, and it's been made clear to me that it is feasible to hook into the contract system and take advantage of its facilities,

Re: [racket-users] Apropos contracts: simple predicates and switching on and off

2017-05-03 Thread Daniel Prager
u.edu> wrote: > > You have gotten plenty of good answers so let me focus on some of the > high-level points and some details that people didn’t respond to: > > > > On May 2, 2017, at 6:01 PM, Daniel Prager <daniel.a.pra...@gmail.com> > wrote: > >

Re: [racket-users] Apropos contracts: simple predicates and switching on and off

2017-05-03 Thread Daniel Prager
gt; > On Tue, May 2, 2017 at 11:43 PM, Daniel Prager <daniel.a.pra...@gmail.com> > wrote: > >> I kind of expected that it would be possible to do what I wanted with >> "indy" contracts, but struggled with the heavy use of combinators in the >> e

Re: [racket-users] Making change in Racket / lazy language question

2017-06-16 Thread Daniel Prager
Indeed it does. Thanks! On Sat, Jun 17, 2017 at 7:53 AM, Jon Zeppieri <zeppi...@gmail.com> wrote: > On Fri, Jun 16, 2017 at 5:41 PM, Daniel Prager > <daniel.a.pra...@gmail.com> wrote: > > > > But I get a perplexing error if I try to use foldl for added ele

  1   2   >