Re: [racket-users] garbage collection

2020-10-25 Thread Daniel Prager
> is it possible to run modern Lisp-y languages without a garbage collector? Is it even smart to try? This seems to cover it ... https://stackoverflow.com/questions/16240183/not-using-garbage-collector-in-scheme-lisp-implementation Dan -- You received this message because you are subscribed

[racket-users] TCR (test && commit || revert) in DrRacket?

2020-05-14 Thread Daniel Prager
Has anyone figured out how to do TCR (test && commit || revert) in Racket? Here's Kent Beck demoing TCR in VSCode, using Python: www.youtube.com/watch?v=Aof0F9DvTFg=PLlmVY7qtgT_nhLyIbeAaUlFOWbWT5y53t=1 His set-up is described in Video 0 (#2 in the playlist). Dan -- You received this message

Re: [racket-users] HTDP2e Exercise 309

2020-03-05 Thread Daniel Prager
Hint: (define (words-on-line llos) (match llos ['() empty] [(list a b ...) )) 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] Day 7 Advent of Code - continuations?

2019-12-06 Thread Daniel Prager
Does anyone have a continuation-based solution to AoC day 7? https://adventofcode.com/2019/day/7 I don't normally use continuations, and I solved today's puzzles without them, but part 2 looks to me like it might have yielded ;-) a more elegant solution. Dan -- You received this message

Re: [racket-users] DrRacket 7.5 colors a bit dark and low contrast on Mac

2019-12-06 Thread Daniel Prager
t. >> >> Robby >> >> On Fri, Dec 6, 2019 at 1:29 PM Sorawee Porncharoenwase < >> sorawee.pw...@gmail.com> wrote: >> >>> Confirm that I have this problem as well, even when I reset all >>> preference files. >>> >>> On Fri, D

Re: [racket-users] DrRacket 7.5 colors a bit dark and low contrast on Mac

2019-12-06 Thread Daniel Prager
Hi Robby > What happens if you open the preferences dialog and turn white-on-Black on and back off again? No change. I still have 7.2 on my system, which works fine. Here's what it looks like in black-on-white for reference. [image: image.png] > >> -- You received this message because you

Re: [racket-users] Limiting consecutive identical elements with match

2019-12-05 Thread Daniel Prager
While playing around with this I came across an error message in match that could perhaps stand some improvement ... > (define (super-cool?/flawed ds) (match ds [(list _ ... a a ... _) #t] [_ #f])) a59: unbound identifier; also, no #%top syntax transformer is bound in: a59 Dan

Re: [racket-users] Simple macro issues

2019-09-09 Thread Daniel Prager
Hi Simon I only use macros sparingly, and sympathise with your struggles to develop macro-fu. Some simple macros can be written quite simply using define-syntax-rule/s and aren't that much more complex than writing functions. To milk a bit more from this example, here's a similarly themed

Re: [racket-users] Simple macro issues

2019-09-09 Thread Daniel Prager
Hi Simon I think you'll find that the if statement is misguided, since it treats numbers as decimal rather than hex valued. Happily, this simplifies the solution. #lang racket (define-syntax-rule (hex h ...) (bytes (string->number (~a (quote h)) 16) ...)) (hex a b c 1 2 3 41 42 43) ;

[racket-users] Would it help to call racket2 something else?

2019-08-28 Thread Daniel Prager
Changing the canonical syntax seems like a bigger jump than from PLT Scheme to Racket. Perhaps a name change would help. I looked up English language anagrams of racket and found two: retack and tacker. *retack** [Nautical] To tack or alter course by sailing into the wind for a second or

Re: [racket-users] [standard-fish] A geometric design

2019-08-25 Thread Daniel Prager
Wow! Loved the background video you linked to explaining the roots in Islamic art and design: https://www.youtube.com/watch?v=pg1NpMmPv48 So different to the patchwork inspired approach that I've taken to tessellation. Brilliant stuff. Dan -- You received this message because you are

Re: [racket-users] [standard-fish] Reverse engineered quilt design

2019-08-01 Thread Daniel Prager
Hi Stephen On Thu, Aug 1, 2019 at 8:31 PM Stephen De Gabrielle wrote: > How your use of racket has evolved over the past 5 years > * how you handled the changes to racket in that time > * what was good (and bad) about using Racket > > in general what has changed since that presentation? > Not

Re: [racket-users] [standard-fish] Reverse engineered quilt design

2019-08-01 Thread Daniel Prager
On Thu, Aug 1, 2019 at 9:53 PM John Clements wrote: > That’s a really nice example of the uses of abstraction in non-programming > domains. Thanks! > Thanks, John! I think there's real potential for a *#lang quilt *as a(nother) creative way to teach aspects of programming while exploring a

Re: [racket-users] [standard-fish] Reverse engineered quilt design

2019-08-01 Thread Daniel Prager
Hi Stephen What specifically would you like to hear more about? Cheers Dan On Thu., 1 Aug. 2019, 00:39 Stephen De Gabrielle, wrote: > Hi Daniel > > On Wed, 31 Jul 2019 at 14:16, Daniel Prager > wrote: > >> On Wed, Jul 31, 2019 at 6:28 PM Stephen De Gabrielle < &g

Re: [racket-users] [standard-fish] Reverse engineered quilt design

2019-07-31 Thread Daniel Prager
On Wed, Jul 31, 2019 at 6:28 PM Stephen De Gabrielle < spdegabrie...@gmail.com> wrote: > Wow. > Thanks Stephen, and good on you for this fun competition! It's been almost 5 years since RacketCon 2014, where I talked about youpatch.com, still up and running, BTW.

[racket-users] [standard-fish] Reverse engineered quilt design

2019-07-30 Thread Daniel Prager
Here's a photo of the original quilt from Red Pepper Quilts (not my work): More images, including details, here: http://bastings54.rssing.com/browser.php?indx=6115008=60 And here's my reverse-engineered Racket version: [image: super-duper-HST-and-QST-quilt.png] Top-level code, below. #lang

Re: [racket-users] The case, and a proposal, for elegant syntax in #lang racket2

2019-07-17 Thread Daniel Prager
I'm confused on one point. Why would a new canonical notation be preferable to, say, also fully supporting an alternative general notation (like Shriram's p4p, or a derivative thereof) or even multiple notations in addition to retaining good old s-expressions? The idea would be that you could

Re: [racket-users] Thinking in scheme / racket

2019-07-09 Thread Daniel Prager
Hi Bob My pleasure. (in-value ...) is a very neat facility that I suspect could do with a couple of examples in the Racket Guide and Reference to highlight its utility and application. Dan -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To

Re: [racket-users] Thinking in scheme / racket

2019-07-09 Thread Daniel Prager
Hi Bob Here's how I'd write your function using for*/sum: (define (count-primes-in-seq/2 f bound) (for*/sum ([n (in-range bound)] [k (in-value (f n))] #:when (and (positive? k) (prime? k))) 1)) Performance is similar to your original. Dan -- You received this

Re: [racket-users] [PSA] Upcoming projects

2019-06-28 Thread Daniel Prager
Hi Eric On Fri., 28 Jun. 2019, 16:15 Eric Griffis, wrote: On Thu, Jun 27, 2019 at 9:12 PM Daniel Prager wrote: [snip] > Quick question: Why Algebraic Racket? If I understand the question, you're asking what makes Algebraic Racket "algebraic?" It started as an attempt

Re: [racket-users] [PSA] Upcoming projects

2019-06-27 Thread Daniel Prager
Hi Eric They all sound great. I'm particularly interested in the first two, and was very impressed by the Diagram project gallery , and it would be great to see in Racket. Quick question: Why *Algebraic* Racket? Dan --

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

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)

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

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

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

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

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*

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

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

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

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

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

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

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

Re: [racket-users] Intro and projects inquiry

2017-10-11 Thread Daniel Prager
Great topic! Providing examples and tutorials around data analysis and visualisation in Racket (and filling gaps and simplifying) gets my vote. Another area that might be interesting is generating data-driven web-sites: e.g. presenting questionnaires and quizzes. I recently did a bit of

Re: [racket-users] Re: Efficient & "nice" communication mechanism between Racket and other languages

2017-09-08 Thread Daniel Prager
For youpatch.com my colleague and I used a "quasi-microservices architecture" to get my Racket, his Python, and our JavaScript to work together, using JSON and HTTP. Starting out with a JSON and HTTP would give you a baseline, and then swapping in other formats and transport mechanisms could

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

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-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-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
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
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
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
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
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-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] 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-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-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] 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] RacketCon Code of Conduct

2017-06-17 Thread Daniel Prager
+1 for a code of conduct from me. Although I can only rarely attend RacketCon (coming from Australia) codes of conduct seem to have had a net positive effect at local conferences: enhancing inclusivity and tone. Perhaps one day such codes can be optimized away, but in the present day requiring

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

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

2017-06-16 Thread Daniel Prager
The classic making change problem cropped up in discussion on the Racket reddit with solutions proffered in Haskell and Clojure. See: https://www.reddit.com/r/Racket/comments/6gumem/what_is_a_string_p/dixlvpr/ I was able to contribute a Lazy Racket translation: #lang lazy (define zeros (cons 0

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

2017-05-07 Thread Daniel Prager
On Mon, May 8, 2017 at 3:05 AM, Matthias Felleisen wrote: > > Measure with outer contract and remove the inner define/tight. If you > wrote this algorithm with a loop in Eiffel, instead of a tail-recursive > function, you wouldn’t check the invariant for every loop

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

2017-05-07 Thread Daniel Prager
Thanks Georges, Matthias, and Philip for the further pointers: Helped by your comments I inferred that I could construct a legitimate unsupplied-arg case using case-lambda. I think that this is the kind of illustration would be helpful in the docs: #lang racket (module server racket

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

2017-05-07 Thread Daniel Prager
that Racket obliges you to supply a default when declaring an optional argument, in what sort of situations does the unsupplied case arise? Dan On Sun, May 7, 2017 at 10:36 PM, Dupéron Georges < jahvascriptman...@gmail.com> wrote: > Le dimanche 7 mai 2017 07:27:08 UTC+2, Daniel Prage

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

2017-05-06 Thread Daniel Prager
Putting this new set-up through its paces I think I've found a few issues: *1. Default argument goes missing from post-condition, leading to an unexpected error ...* (define/contract (greater-than-square? x [y 0]) (->i ([x real?]) ([y real?]) [result boolean?] #:post (x y

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

2017-05-06 Thread Daniel Prager
Le samedi 6 mai 2017 23:38:29 UTC+2, Daniel Prager a écrit : > > Although I understand why my macro does this > > > > unsafe-factorial: contract violation > > ... > > blaming: (function fn/impl) > > ... > > at: unsaved-editor:13.15 > > > &g

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

2017-05-06 Thread Daniel Prager
(not not/c negative?)) to remove the inconsistency, but it does seem to point to another leak. Dan On Sun, May 7, 2017 at 12:25 AM, Matthias Felleisen <matth...@ccs.neu.edu> wrote: > > On May 5, 2017, at 11:30 PM, Daniel Prager <daniel.a.pra...@gmail.com> > wrote: > > Thank-y

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

2017-05-05 Thread Daniel Prager
Thank-you Matthias That's neat! And yes, I can write a basic macro. By introducing #:freevar I was able to improve the blame situation, but the abstraction is a bit leaky ... (define-syntax-rule (define/tight (fn args ...) ctc body ...) (begin

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

2017-05-05 Thread Daniel Prager
Hi Matthias Thanks for the pointer to Robby's 2014 keynote. Here's the link for those interested — it's really good: https://www.youtube.com/watch?v=gXTbMPVFP1M * * * In regard to Racket's use of boundaries, am I right in thinking that it's difficult to pull the boundaries in really *tight*?

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

2017-05-03 Thread Daniel Prager
Using Ben's left-pad example as a model I get the following re-write of the real-sqrt contract (([x real?]) #:pre/name (x) "non-negative argument expected" (>= x 0) . ->i . [result (x) real?] #:post/name (x result) "the sqrt of zero is zero" (implies (= x 0) (= result

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

2017-05-03 Thread Daniel Prager
On Thu, May 4, 2017 at 12:42 PM, Matthias Felleisen <matth...@ccs.neu.edu> wrote: > > On May 3, 2017, at 10:01 PM, Daniel Prager <daniel.a.pra...@gmail.com> > wrote: > > Do you bet on the Formula I driver whose team includes the most safety > features? ;-) > >

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] 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-02 Thread Daniel Prager
wrote: > > On May 2, 2017, at 4:33 PM, Daniel Prager <daniel.a.pra...@gmail.com> > wrote: > > (define/pre-post (real-sqrt x) > #:pre ([(real? x) "real argument expected"] > [(>= x 0) "non-negative argument expected"]) > > #:im

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

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

2017-05-02 Thread Daniel Prager
My concept of how (simple) contracts should work was influenced by the Bertrand Meyer / Eiffel approach and spent many years of rolling my own contracts in lesser languages to mimic this. The main things I found pragmatically useful were: 1. Being able to specify pre-conditions and

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

2017-05-02 Thread Daniel Prager
Hi Ju Interesting results. Did you run the Contract Profiler tool? [ http://docs.racket-lang.org/contract-profile/] I think it's fairly well understood that the contract-induced performance costs across the typed / untyped boundary can be severe. BTW: At the back of my mind is the thought that

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

2017-04-29 Thread Daniel Prager
On Sat, Apr 29, 2017 at 11:44 PM, Robby Findler <ro...@eecs.northwestern.edu > wrote: > On Sat, Apr 29, 2017 at 3:18 AM, Daniel Prager > <daniel.a.pra...@gmail.com> wrote: > > On Sat, Apr 29, 2017 at 6:04 PM, Philip McGrath < > phi...@philipmcgrath.com> > &

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

  1   2   >