Re: [racket-users] fluent: unix style pipes and lambda shorthand to make your code more readable

2021-03-09 Thread Daniel Prager
Impressive! How does fluent manage this infixing from a (require ...) rather than a #lang? I've been using the Clojure-like threading package for a while now and this has some nice advantages that are mentioned in the docs, like blending the first arg > and last arg >> variants easily in a sequen

Re: [racket-users] Is there a good Racket DSL alternative to Image Magick?

2021-05-11 Thread Daniel Prager
Hi Robert > Even better if I could point the function at a directory, it finds all of the images in it, and creates the data structure for me. Any ideas? You can get the files in a directory using *directory-list *and filter for the image files using a regex. (for ([f (directory-list "/some/path

Re: [racket-users] How to learn the *core* of Racket?

2021-11-12 Thread Daniel Prager
An alternative answer to the implied question: "How do I learn the core of the language-oriented features of Racket?" Check out Beautiful Racket: https://beautifulracket.com - Dan On Fri, Nov 12, 2021 at 2:03 PM Philip McGrath wrote: > On Thu, Nov 11, 2021 at 9:20 PM Yushuo Xiao wrote: > >

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 f

[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 (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 th

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

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

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

2015-05-21 Thread Daniel Prager
ld be >> pretty straightforward I expect (it creates a brush% object). 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 >> collec

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

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] 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 https://groups.google.com/d/

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

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

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

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

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 being

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 r

[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). Wh

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" gr

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 g

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

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 5 > yrs before dev

Re: [racket-users] minor proposed update to docs typography

2017-11-20 Thread Daniel Prager
Hi Matthew It looks very nice, but as a side effect slightly exacerbates a long-standing ergonomic issue with cross-links in the side-notes: docs.racket-lang.org: revision: In almost every case the user will want to click on the unbolded specific link *(Pattern Matching*), but the bolding entic

[racket-users] Mozart's Musical dice with rsound

2018-03-29 Thread Daniel Prager
For fun, I've written a program to synthesise random compositions based on Mozart's musical dice procedure, with results played courtesy of rsound. [Program appended.] See this Daily Programmer challenge for background: https://www.reddit.com/r/dailyprogrammer/comments/7i1ib1/20171206_challenge_3

Re: [racket-users] Mozart's Musical dice with rsound

2018-03-29 Thread Daniel Prager
Thanks John I've made updates (below) based on your suggestions, and the overall effect is pleasing. 1. The use of asdr fixed the choppiness, although I don't really understand what I'm doing. [I understand that asdr stands for Attack-Decay-Sustain-Release

Re: [racket-users] Mozart's Musical dice with rsound

2018-03-30 Thread Daniel Prager
On Fri, Mar 30, 2018 at 7:18 PM, Thomas F. Burdick wrote: > > > If you want to better understand why you need an envelope, it's a pretty > fun part of synthesis. By clipping the sound, you square off your waveform. > Square waves are made up of a lot of high-frequency components. To convince > yo

Re: [racket-users] what do people use for number formatting?

2018-05-07 Thread Daniel Prager
~r works nicely: > (~r 1.237472387 #:precision 2) "1.24" -- 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 opt

Re: [racket-users] Edmond's Blossom Algorithm

2018-05-15 Thread Daniel Prager
A more low-tech approach ... #lang racket (require threading) (define students '(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z)) (define indexes (for/hash ([s students] [i (in-naturals)]) (values s i))) ; A -> 0, B -> 1, ... (define (index student) (hash-ref indexes s

Re: [racket-users] Searching for packages

2018-08-14 Thread Daniel Prager
The "threading" package is an example of something I'd like to see promoted to the main Racket distribution. Reason: it adds clarity for an attractive style, and makes it available out-of-the-box*, on a par with e.g. Clojure, F#, and Elm. Just my opinion. But it does raise a question for the co

Re: [racket-users] Converting bulleted list to s-expression?

2018-08-20 Thread Daniel Prager
On Sun, Aug 19, 2018 at 11:03 AM, Andrew J wrote: > Very nice. The Racket special sauce is the (match*...). I need to get my > head around what's going on there. > > If you already understand match, perhaps this will help: > (match (list 5 6) [(list a b) (+ a b)]) 11 More concise, match* e

Re: [racket-users] From Clojure to Racket

2018-09-01 Thread Daniel Prager
Not quite string interpolation, but Racket also has (~a ...) with variable number of arguments, which I find convenient: E.g. (define x 5) (define y 6) (~a "x is " x " and y is " y " and x + y = " (+ x y)) ; "x is 5 and y is 6 and x + y = 11" Dan -- You received this message because

Re: [racket-users] 2018 SIGPLAN Software Award

2018-09-27 Thread Daniel Prager
Congratulations! And thank you ... 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 options, visit https

[racket-users] Should #; comments be colored as comments or code in Dr Racket?

2018-10-07 Thread Daniel Prager
I find the #; construct very convenient for commenting out sexps, but in Dr Racket the visual cue of switching to comment-color is missing. Example (in Racket 6.12): [image: Screen Shot 2018-10-07 at 10.19.09 pm.png] Expected: *#lang racket* (display #|Comment|# ; comment #;(

Re: [racket-users] Should #; comments be colored as comments or code in Dr Racket?

2018-10-07 Thread Daniel Prager
If only there was a way to have the best of both worlds. E.g. change the background color for #; to something reminiscent of the foreground color of regular comments: (display #|Comment|# ; comment #;(string-join "comm" "ent") "Hello world") Or perhaps something like t

[racket-users] IFL: #lang alda (music composition)

2018-10-18 Thread Daniel Prager
IFL = Request For #lang Here's a great talk from Dave Yarwood about his Clojure-based functional music composition language: Alda. https://www.youtube.com/watch?v=7nbBSwopG-E - Manifesto and introduction: https://blog.djy.io/alda-a-manifesto-and-gentle-introduction/ - Example programs

Re: [racket-users] Re: nested for loops and suggested alternatives

2019-02-10 Thread Daniel Prager
Hi Travis Would you mind sharing your results from R (and now Racket)? I'm having a play with the Racket code, and would like to check I'm not breaking anything as I refactor it. Dan -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscr

Re: [racket-users] Re: nested for loops and suggested alternatives

2019-02-10 Thread Daniel Prager
Thanks for the screenshot Travis. Just for fun, here's a version in Racket that eschews assignment, vectors and for loops, in favour of recursion and lists ... #lang racket (define years 30) (define prop-female 0.5) (define egg-surv 0.6) (define fecundity '(0 0 200 400 800)) (define survival '(

Re: [racket-users] Re: nested for loops and suggested alternatives

2019-02-11 Thread Daniel Prager
Hi Travis Glad you found it instructive. In mathematical terms these kinds of systems map from the current state at t=n to the next time-step at t=n+1. Given a transition function I tend to just use for/list (or for/vector) to build up a history. E.g. #lang racket (require math/matrix) (defi

Re: [racket-users] color-maps for the plot package

2019-03-20 Thread Daniel Prager
Side note: For people looking for aesthetically pleasing discrete color palettes, check out the top two tools on this page: http://www.play-crafts.com/blog/tools/ 1. *Palette builder *helps you select a few colors from a pleasing image 2. *Color play* randomly creates palettes (the source a

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 receiving

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 togethe

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 database connections and > to embed free form SQL i

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 byte-string

[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 Object-las

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

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

2016-05-16 Thread Daniel Prager
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 > wrote: > > Displaying bitmaps in DrRacket using 2htdp/image is near instantaneous > when > > (display)-ed, but takes quite a while

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" wrote: > Sorry it is taking me s

[racket-users] Questions about quad

2016-05-18 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? @(requ

[racket-users] Re: Questions about quad

2016-05-19 Thread Daniel Prager
ppily work more 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 wrote: > Hi Matthew > > I'm having a play with your quad type-setting library, which looks very > promising as a way

[racket-users] Re: Questions about quad

2016-05-19 Thread Daniel Prager
ul. I'll have a tinker and see what I can find: it's great stuff. Dan On Thu, May 19, 2016 at 11:44 PM, Matthew Butterick wrote: > On Thu, May 19, 2016 at 4:48 PM, Daniel Prager > wrote: > >> I'm having a play with your quad type-setting library, which looks ver

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

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

2016-05-25 Thread Daniel Prager
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 Prager &

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 separate arguments to map on

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 wrote: > You can write `(NonemptyListof a)` as > > (define-type (NonemptyListof a) (Cons a (Listof a))) > > Sam > Nice: Cons -> Pairof, though. Dan > > > > On Wed, May 25, 2016 at 5:08 PM, Dani

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

2016-05-30 Thread Daniel Prager
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 > > > > > > On Tue, May 17, 2016

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

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

2016-06-10 Thread Daniel Prager
d Racket doesn't know > that. > > Sam > > On Fri, Jun 10, 2016 at 5:39 PM Daniel Prager > wrote: > >> 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

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 type-checker (Robby's point). >

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

2016-06-10 Thread Daniel Prager
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 > wrote: > >> I'm working my way through the 99 Lisp Probl

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

2016-06-11 Thread Daniel Prager
ing clear of macros avoids an additional layer of sophistication. Dan On Sat, Jun 11, 2016 at 5:13 PM, Ben Greenman wrote: > > On Sat, Jun 11, 2016 at 12:46 AM, Daniel Prager > wrote: > >> Do you have an alternative recommendation in mind? > > > I guess you already sol

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-12 Thread Daniel Prager
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 message sugges

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

2016-06-12 Thread Daniel Prager
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 > wrote: > >> Cc:ing the list ... >> >> On Sun, Jun 12, 2016 at 4:56 PM, Ben Greenman < >>

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 tests vs whatever?

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 racket-users+unsubscr...@googlegroups.

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 > about stuff _other than

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

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+unsubscr...@googlegrou

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

2016-09-17 Thread Daniel Prager
oups > "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, Inn

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 racket-users+unsubscr...

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

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

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 rac

[racket-users] Advent of Code 2016

2016-12-12 Thread Daniel Prager
Is anyone else Racketing their way through www.adventofcode.com this year? It's worth checking out. We could even do a "private" leaderboard for Racketeers. Last year's problems (2015) are still available, and the awesome Matthew Butterick wrote up his Racket solutions: https://docs.racket-lang.

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

2016-12-15 Thread Daniel Prager
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 Racketing their way through www.adventof

[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 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 [(st

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

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 gr

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

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 wrote: > > > On Mar 2, 2017, at 3:00 PM, Daniel Prager > wrote: > > > > While we're at it, please allow negative arguments too, to allow for > cases such as > > > > (random -100 100) > > We

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 receivi

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

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

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

2017-04-26 Thread Daniel Prager
dp/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 wrote: > Much as I enjoy making

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 it > with Racket, and

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

2017-04-28 Thread Daniel Prager
"exploring" part. A "next level" improvement might be something similar to the "virtual dom" pioneered (or at least popularised) by the react-js folk, to simplify and reduce the cost of re-rendering. Dan On Fri, Apr 28, 2017 at 11:05 PM, Alex Harsanyi wrote: >

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 each other, but > manipulat

  1   2   3   >