Re: [racket-users] for loop: any way to access the whole list?

2019-06-15 Thread Sanjeev Sharma
thanks, 

the whole idea is to localize the identifiers to the for (preferred) or the 
let*. 

Reaching back to get the whole list when the for has bound the same 
identifier is probably asking a bit much.

Within the given strictures I probably need to bind the list in the let* 
and use a different identifier in the for().


On Friday, June 14, 2019 at 12:46:54 PM UTC-4, David Storrs wrote:
>
>
>
> On Fri, Jun 14, 2019 at 10:45 AM Sanjeev Sharma  > wrote:
>
>> within this for loop is there any way to access different pieces of the 
>> description and amt?  car-ing and cdr-ing for example?
>>
>
> I'm not entirely clear on what you're looking for, but maybe this helps?
>
> (define lst '(a b c))
> (for ([(val idx) (in-indexed lst)]) 
>   (displayln (cons  val idx)) 
>   (when (< idx (sub1 (length lst))) 
> (displayln (format "\tnext val: ~a" (list-ref lst (add1 idx)) 
>
> Output:
> (a . 0)
> next val: b
> (b . 1)
> next val: c
> (c . 2)
>
>
>> Or move the identifier definitions into the let*, and pass those to for 
>> in some way?
>>
>> (let*((ratio 9/12))
>>   (for((description(list "this" "that"))
>>(amt(list 4467.61 2428.37)))
>> (printf"~a ~a: changed values\n"
>>description
>>(cat(* amt ratio) -2.
>>
>> -- 
>> 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...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/racket-users/07ad5ce3-0ba8-48a5-a356-5cb1545de4cd%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/racket-users/07ad5ce3-0ba8-48a5-a356-5cb1545de4cd%40googlegroups.com?utm_medium=email_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/cd979a18-c099-42b3-99f9-48ce099da19d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: for loop: any way to access the whole list?

2019-06-14 Thread Sanjeev Sharma
cat is from srfi/54

On Friday, June 14, 2019 at 10:45:10 AM UTC-4, Sanjeev Sharma wrote:
>
> within this for loop is there any way to access different pieces of the 
> description and amt?  car-ing and cdr-ing for example?
>
> Or move the identifier definitions into the let*, and pass those to for in 
> some way?
>
> (let*((ratio 9/12))
>   (for((description(list "this" "that"))
>(amt(list 4467.61 2428.37)))
> (printf"~a ~a: changed values\n"
>description
>(cat(* amt ratio) -2.
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/c169fcde-ba78-4ba6-8756-cb399089c560%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] for loop: any way to access the whole list?

2019-06-14 Thread Sanjeev Sharma
within this for loop is there any way to access different pieces of the 
description and amt?  car-ing and cdr-ing for example?

Or move the identifier definitions into the let*, and pass those to for in 
some way?

(let*((ratio 9/12))
  (for((description(list "this" "that"))
   (amt(list 4467.61 2428.37)))
(printf"~a ~a: changed values\n"
   description
   (cat(* amt ratio) -2.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/07ad5ce3-0ba8-48a5-a356-5cb1545de4cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: RacketCon: These 8 INSANE talks about Racket will change your life! I can't believe #7! --- (ninth RacketCon) on July 13th, 2019 --- Speakers Announced!

2019-04-29 Thread Sanjeev Sharma
I believe "you won't believe ..." tests out better (higher click through)  
in scientific advertising circles than "I can't believe ..." .  


On Thursday, April 25, 2019 at 4:06:41 PM UTC-4, Jay McCarthy wrote:
>
> (ninth RacketCon) on July 13th, 2019 
>
> Speakers Announced! 
>
> https://con.racket-lang.org/ 
>
> Sign up for RacketCon! 
>
> See you in Salt Lake City! 
>
> -- 
> Jay McCarthy 
> Associate Professor @ CS @ UMass Lowell 
> http://jeapostrophe.github.io 
> Vincit qui se vincit. 
>

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


[racket-users] Re: printing decimals

2019-03-19 Thread Sanjeev Sharma
WHOPS ... SRFI/54 

On Friday, March 15, 2019 at 1:57:03 PM UTC-4, sdgu...@gmail.com wrote:
>
> Hi all,
>
> I've been looking through the docs for a way to print decimals to a 
> defined precision.
>
> I can get close to what I want using something like ~a and giving it a set 
> width without having to build a function to do so. I mean I can build a 
> function to do as its just a bit of string manip but it feels really odd 
> that there doesn't seem to be a built in way to do so even though we try to 
> keep all the decimals in fractional notation to maintain precision as long 
> as possible in racket.
>
> any ideas anyone or am I just being blind and its right there in the docs 
> somewhere?
>
> thanks,
> Scott
>

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


[racket-users] Re: printing decimals

2019-03-19 Thread Sanjeev Sharma
SRFI 57, the function cat

differs from ~r in several areas,  but looks like a decent alternative 

On Friday, March 15, 2019 at 1:57:03 PM UTC-4, sdgu...@gmail.com wrote:
>
> Hi all,
>
> I've been looking through the docs for a way to print decimals to a 
> defined precision.
>
> I can get close to what I want using something like ~a and giving it a set 
> width without having to build a function to do so. I mean I can build a 
> function to do as its just a bit of string manip but it feels really odd 
> that there doesn't seem to be a built in way to do so even though we try to 
> keep all the decimals in fractional notation to maintain precision as long 
> as possible in racket.
>
> any ideas anyone or am I just being blind and its right there in the docs 
> somewhere?
>
> thanks,
> Scott
>

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


Re: [racket-users] Racket-on-Chez snapshot builds

2018-11-20 Thread Sanjeev Sharma
I'm getting much faster startup times.  

And the initial freeze when loading a file after initial startup - is that 
actually faster or has it been amortized using lazy techniques? 

On Monday, November 19, 2018 at 6:35:43 PM UTC-5, Matthew Butterick wrote:
>
>
> > On Nov 19, 2018, at 2:06 PM, Matthew Flatt  > wrote: 
> > 
> > Although Racket-on-Chez is not yet ready to replace the existing 
> > implementation of Racket for most purposes, it should generally work 
> > now --- and it might even be useful for some purposes. Many, many 
> > details have to be right for Racket-on-Chez to assemble itself into a 
> > snapshot distribution, so this is a significant milestone. 
>
> Thank you for the all your effort & hard work to get Racket-on-Chez this 
> far. 
>
> This week, I've gone over to using the Racket-on-Chez snapshots 
> exclusively. They are stable & fast enough for everything I do with Racket. 
> There are bugs, of course, though so far all small. And Matthew has been 
> fixing them as fast as I can file them. 
>
> For that matter, if you've ever wondered "what can I do to improve 
> Racket-on-Chez, without being a 1337 h4x0r?" I suggest that you also use 
> the snapshots and file bugs. Because that will make Racket-on-Chez better, 
> sooner, for everyone. 
>
> One tip, if you haven't used the snapshots before (I hadn't): I've 
> switched to installing my own packages in "--scope user" rather than 
> "--scope installation". This keeps the packages out of the snapshot folder, 
> so the snapshot can be easily replaced without disturbing the rest. 
>
> To infinity and beyond.

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


[racket-users] Re: 2018 SIGPLAN Software Award

2018-09-28 Thread Sanjeev Sharma
Hope you get many more accolades.  

Your work keeps me curious & engaged intellectually long after I left 
programming partly due to lack of curiosity among my colleagues and my own 
lack of curiosity with the methods available to me. 

On Wednesday, September 26, 2018 at 6:53:34 PM UTC-4, Matthew Flatt wrote:
>
> Dear Racketeers, 
>
> Racket has just received the 
>
>2018 ACM SIGPLAN Software Systems Award 
>
>

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


Re: [racket-users] Thank you Racket!

2018-08-24 Thread Sanjeev Sharma
I didn't realize (though I should have) that the comment could be taken 
that way. 

I realize you were not writing anything about the Turing language, but the 
title of the essay triggered some memories for me of what my classmates and 
later my professional colleagues used to talk about.  And for some reason 
this time the title made me laugh (I've read it before and did not have 
that reaction). 

I've been using Racket for all my hobbyist programming for a while so 
there's no possibility that it could not be taught on its own merits 
instead of through influence. 

On Friday, August 24, 2018 at 11:00:30 AM UTC-4, Matthias Felleisen wrote:
>
>
> For everyone else, the essay is NOT about Turing/the language or 
> Turing/the man but Turing, the concept. 
>
> And because it is true that we have monopoly power over students here, not 
> a single required course forces students to use Racket. In our freshman 
> course we use the teaching languages, e
>

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


Re: [racket-users] Thank you Racket!

2018-08-24 Thread Sanjeev Sharma
"Turing is useless" ... 

While I worked as a programmer I used to complain quite bitterly about 
university comp sci departments that had NIH (not invented here) syndrome 
and  a captive audience. 

I learned Turing as my 2nd programming language.  I'm sure the only reason 
it could have been taught is the profs & grad students that "invented" 
(added a few trivial things to Pascal) Turing had great political pull at 
University of Toronto in that decade. 

On Friday, August 24, 2018 at 9:02:47 AM UTC-4, Matthias Felleisen wrote:
>
>
> > On Aug 24, 2018, at 5:50 AM, Jérôme Martin  > wrote: 
> > 
> > I just read the article by Matt that was posted on Hacker News (
> http://felleisen.org/matthias/OnHtDP/index.html) and I wanted to take the 
> time to thank you all in the PLT/Racket team. 
> > 
> > Thank you for trying (and achieving!) to bring a new approach to 
> teaching computer science. Improving teaching methods is a hard process and 
> you have the courage and will to fight for it, against all odds. 
> > I'm glad some people are here to train students into a broader approach 
> to program design and eventually become way better programmers than we are. 
> > 
> > I discovered Racket one year ago and had the feeling I finally found the 
> language, and most importantly the community, that brings me hope and make 
> me feel like computer science is more than just about computers. 
> > You are making a language that feels like writing code is actually a 
> form of art sometimes, and it makes me see my profession with a new eye. 
> > 
> > (define congrats (map thank plt-team)) 
> > 
> > I wish all of you a great time teaching with Racket. 
> > 
> > I'll be sticking around improving some libs (especially web-server). 
> > 
> > See you around folks :) 
>
>
> I am glad you found us. Spread the word and stay around — Matthias 
>
>

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


Re: [racket-users] parameterize and keyword - doable?

2018-08-04 Thread Sanjeev Sharma
the specific case I had in mind was near this

(let ([unless? odd?]) 
  (for/sum ([x '(1 2 3 4 5)] 
#:unless (uless? x)) 
x)) ;6 

but as long as one is defaulting #:unless 
PLUS #unless is common to all the for's across some arbitrary scope, 
ideally one could elide it from each of the for's within that scope. 

your current-unless looks a good candidate for another place. 



On Saturday, August 4, 2018 at 3:47:42 PM UTC-4, Greg Hendershott wrote:
>
> Do you mean that in something like this: 
>
> (for/sum ([x '(1 2 3 4 5)] 
>   #:unless (odd? x)) 
>   x) ;6 
>
> You have many occurrences of the `(odd? x)` and you'd like to define 
> that in one place that you can vary? 
>
> If so: 
>
> First, if they're in the same local scope, you could use `let`: 
>
> (let ([unless? odd?]) 
>   (for/sum ([x '(1 2 3 4 5)] 
> #:unless (uless? x)) 
> x)) ;6 
>
> Or (same difference) if they're in the same function definition, you 
> could use a function parameter: 
>
> (define (f unless?) 
>   (for/sum ([x '(1 2 3 4 5)] 
> #:unless (unless? x)) 
> x)) 
> (f odd?) ;6 
>
> Or -- and maybe this is what you're asking? -- you could define a 
> Racket parameter: 
>
> (define current-unless? (make-parameter (const #f))) 
>
> (define (f) 
>   (for/sum ([x '(1 2 3 4 5)] 
> #:unless ((current-unless?) x)) 
> x)) 
>
> (parameterize ([current-unless? odd?]) 
>   (f)) ;6 
>
> I think this is the best you can do; the `for` macros don't provide a 
> parameter to inject an #:unless clause. 
>

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


[racket-users] current build instructions for racketcs?

2018-08-04 Thread Sanjeev Sharma
I haven't done this in a while & the config / build from 

src/cs/c/

using racket 7 source with built packages  failed this morning. 

Are the READMEs still up to date? 

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


Re: [racket-users] parameterize and keyword - doable?

2018-08-03 Thread Sanjeev Sharma
make a keyword useable as the parameter-expr in a parameterize expression. 

for example, If I need a similar #:unless cause for  a bunch of for 
expressions 

It's not a current issue, but would be good  to have in the toolbox for 
next time. 


On Thursday, August 2, 2018 at 8:25:31 PM UTC-4, gneuner2 wrote:
>
>
> On 8/2/2018 7:45 PM, Sanjeev Sharma wrote: 
> > can racket's  #: keywords be finagled / coerced into a parameterizable 
> > form? 
>
> ??? 
>
> Certainly you can pass a parameter to a keyword argument, and/or make a 
> parameter the default value of a keyword argument.  And you can use an 
> argument to parameterize code lower down in the call stack.  If you mean 
> something else, could you perhaps explain it better? 
>
> George 
>
>

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


[racket-users] parameterize and keyword - doable?

2018-08-02 Thread Sanjeev Sharma
can racket's  #: keywords be finagled / coerced into a parameterizable 
form? 

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


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

2018-05-08 Thread Sanjeev Sharma
SRFI 54 - ever need a 4-character "thousands" separator? Bharat has units 
called lakhs & crores, instead of thousands 

I think there was a numberphile episode on it.  French, Dutch, Babylonian, 
Indian ... 

Just one of the things I needed recently; I've used a bunch of SRFI 54 
features over the last little while.   ~r didn't do it for me. 

'(#\, 2))  is the separator spec.

(cat 13412312.345612456 '(#\, 2)) ;"13,41,23,12.34,56,12,45,5"
(cat 13412312.345612456 '(#\, 3)2.); "13,412,312.35"

On Monday, May 7, 2018 at 7:46:30 PM UTC-4, johnbclements wrote:
>
> Okay, how many times have I written the function that accepts 1.237472387 
> and returns “1.24” ? What do you folks use? I see that SRFI 54 covers this 
> use case, and a lot of others besides. Is this the most commonly used 
> package for formatting numbers? 
>
> John 
>
>
>
>

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


Re: [racket-users] sharing an awesome plot - warms the cockles of my heart

2018-03-29 Thread Sanjeev Sharma
Thanks so much Mr. Williams.

I posted that last item then disappeared - I had one of my CPA exams (I
failed, but i always think that after an exam) & just had to force myself
not to check my email for a couple of days.

I hope it didn't take you too long.

Unless, like me, you program like some people play video games.  If so, I
hope it kept you up all night ; )


On Tue, Mar 27, 2018 at 11:23 AM, Doug Williams <
m.douglas.willi...@gmail.com> wrote:

> Sanjeev and I took this discussion offline to iterate over some details.
> But, I thought I would post some final thoughts on this. First, I want to
> thank Sanjeev for his original post. Without it, I wouldn't have dived into
> some of these details - particularly creating the animated gif.
>
> One issue that came up was that the default line-samples parameter value
> of 500 doesn't work well for larger plots - those with 'longer' lines. So,
> you may need to up this value - we used 5000 for the following example by
> using (parameterize ((line-samples 5000)) ...) around the appropriate code.
> Other than that, this seems to work fine.
>
> I am attaching the code to animate another of Sanjeev's examples - both
> without and with the code to create an animated gif. I am also appending
> the resulting gif. This was a lot of fun.
>
> Doug
>
> On Mon, Mar 26, 2018 at 8:49 AM, Doug Williams <
> m.douglas.willi...@gmail.com> wrote:
>
>> And, I made a gif of the animated 3D plot.
>>
>> On Mon, Mar 26, 2018 at 8:42 AM, Doug Williams <
>> m.douglas.willi...@gmail.com> wrote:
>>
>>> I hit send a bit too fast. Here is the code (from the animate-canvas
>>> package on PLaneT) for the 3D animation.
>>>
>>> On Mon, Mar 26, 2018 at 8:39 AM, Doug Williams <
>>> m.douglas.willi...@gmail.com> wrote:
>>>
>>>> Another thing I like to do is to animate such plots. The plot package
>>>> is (generally) fast enough to do this. This code uses my animated-canvas%
>>>> package, which is still on planet. I've also attached a gif of it. [I had
>>>> never used the animated gif routines in Racket before, but they were pretty
>>>> easy to use.] I've also attached an an animation of one of the 3D plots
>>>> from the plot manual.
>>>>
>>>> animation.rkt - Sanjeev's plot animated
>>>> animation.gif - the animated gif (so you don't actually have to run the
>>>> code to see the results)
>>>>
>>>>
>>>> On Fri, Mar 23, 2018 at 3:17 PM, Sanjeev Sharma <throw...@gmail.com>
>>>> wrote:
>>>>
>>>>> I've done no math in 20 years - used to do tons (with the not so great
>>>>> graphics of the time) saw this intriguing plot & banged my head against a
>>>>> wall for a couple of hours.
>>>>>
>>>>> Then I just settled down & read the manual systematically, pretending
>>>>> it may have some info,  followed the examples and voila
>>>>>
>>>>> (require plot)(plot-new-window? #t)
>>>>> (define(xu u)(*(sin(* 33 u))(cos(* 9 u
>>>>> (define(yu u)(*(sin(* 49 u))(sin(* 7 u
>>>>> (plot(parametric(λ(t)(vector(xu t)(yu t)))0 1));
>>>>>
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Racket Users" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to racket-users+unsubscr...@googlegroups.com.
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>>
>>>
>>
>

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


Re: [racket-users] sharing an awesome plot - warms the cockles of my heart

2018-03-26 Thread Sanjeev Sharma
what.  the.  heck. 
is going on here? 


On Monday, March 26, 2018 at 10:49:45 AM UTC-4, m.douglas.williams wrote:
>
> And, I made a gif of the animated 3D plot.
>
>

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


an_plot_001.rkt
Description: Binary data


[racket-users] Re: sharing an awesome plot - warms the cockles of my heart

2018-03-25 Thread Sanjeev Sharma
http://pasterack.org/pastes/84326

(again - for your desktop)

(require plot)(plot-new-window? #t)

(plot(polar(λ(θ)
   (*(+(*(cos(* 8 θ)).9)1)
 (+(*(cos(* 24 θ)).1)1)
 (+(*(cos(* 200 θ)).05).9)
 (+(sin θ)1)))
 (* pi -1) pi #:samples 9)#:width 3870 #:height 2170)


On Friday, March 23, 2018 at 5:17:03 PM UTC-4, Sanjeev Sharma wrote:
>
> I've done no math in 20 years - used to do tons (with the not so great 
> graphics of the time) saw this intriguing plot & banged my head against a 
> wall for a couple of hours.
>
> Then I just settled down & read the manual systematically, pretending it 
> may have some info,  followed the examples and voila
>
> (require plot)(plot-new-window? #t)
> (define(xu u)(*(sin(* 33 u))(cos(* 9 u
> (define(yu u)(*(sin(* 49 u))(sin(* 7 u
> (plot(parametric(λ(t)(vector(xu t)(yu t)))0 1));
>
>
>

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


[racket-users] Re: sharing an awesome plot - warms the cockles of my heart

2018-03-25 Thread Sanjeev Sharma
http://pasterack.org/pastes/59894

for your  desktop (4k monitor) :

(require plot)(plot-new-window? #t)

(plot(polar
  (λ(θ)(+(exp(sin θ))(*(cos(* 4 θ))-2)(expt(sin(/(-(* 2 θ)pi)24))5)))
  -99 99 #:samples 9)#:width 3870 #:height 2170)


On Friday, March 23, 2018 at 5:17:03 PM UTC-4, Sanjeev Sharma wrote:
>
> I've done no math in 20 years - used to do tons (with the not so great 
> graphics of the time) saw this intriguing plot & banged my head against a 
> wall for a couple of hours.
>
> Then I just settled down & read the manual systematically, pretending it 
> may have some info,  followed the examples and voila
>
> (require plot)(plot-new-window? #t)
> (define(xu u)(*(sin(* 33 u))(cos(* 9 u
> (define(yu u)(*(sin(* 49 u))(sin(* 7 u
> (plot(parametric(λ(t)(vector(xu t)(yu t)))0 1));
>
>
>

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


[racket-users] sharing an awesome plot - warms the cockles of my heart

2018-03-23 Thread Sanjeev Sharma
I've done no math in 20 years - used to do tons (with the not so great 
graphics of the time) saw this intriguing plot & banged my head against a 
wall for a couple of hours.

Then I just settled down & read the manual systematically, pretending it 
may have some info,  followed the examples and voila

(require plot)(plot-new-window? #t)
(define(xu u)(*(sin(* 33 u))(cos(* 9 u
(define(yu u)(*(sin(* 49 u))(sin(* 7 u
(plot(parametric(λ(t)(vector(xu t)(yu t)))0 1));


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


[racket-users] windows nightly builds -run beside the stable version?

2018-03-07 Thread Sanjeev Sharma
Is there a self-contained nightly build without the installer which sets 
defaults and icons and shortcuts? 

I'd like to test out the nightly builds but they occasionally step over the 
stable version. 

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


Re: [racket-users] Olin Shivers's loop is supposed to be around somewhere

2017-07-25 Thread Sanjeev Sharma
sigh ... meant to get this part into the reply (from the same paper) 

The original version of the loop macro consists of 1840 lines of
code, not counting comments and empty lines. The implementation
of the loop keyword macros takes 387 lines; the rest includes the
implementation of its various intermediate languages and scope
inference for loop-bound variables. The syntax-parse version is
1887 lines, an increase of forty-seven lines. The increase is due to
the new version of define-simple-syntax. 

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


[racket-users] Re: Olin Shivers's loop is supposed to be around somewhere

2017-07-25 Thread Sanjeev Sharma
Thanks for the reply

I read that thing about the error handling on a forum but found it later in 
another location

http://www.ccs.neu.edu/racket/pubs/icfp10-cf.pdf


>  
> 
> In other words, adding error-checking
> to the loop macro is expected to double the size of the
> code. Using syntax-parse we can do better.  The original
> loop macro performs little error checking; in thirtytwo
> exported macros there are only three syntax validation
> checks plus a handful of internal sanity checks. The
> exported macros consist of the loop macro itself plus
> thirty-one CPS macros [Hilsdale and Friedman 2000] for loop
> clauses such as for and do.
> 
> CPS macros pose challenges for generating good erro


So it looks like Ryan Culpepper has a racket version?  I didn't see anything 
obvious on his github account. 


On Friday, July 21, 2017 at 6:32:43 AM UTC-4, Sanjeev Sharma wrote:
> anyone have a working implemntation?
> 
> Just a little while ago I read something to the effect that Shivers thought 
> error handling would be a huge mess but there's a Racket implementation that 
> does a lot of error handling cheaply.

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


[racket-users] Olin Shivers's loop is supposed to be around somewhere

2017-07-21 Thread Sanjeev Sharma
anyone have a working implemntation?

Just a little while ago I read something to the effect that Shivers thought 
error handling would be a huge mess but there's a Racket implementation that 
does a lot of error handling cheaply.  

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


[racket-users] Re: emacs keybinding behaviour - is this as designed?

2017-06-26 Thread Sanjeev Sharma
addenda are becoming a habit with me ... a vague memory stirs.

Was there an article discouraging the use of these bindings and giving good 
reasons for doing so a long time ago? 

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


[racket-users] emacs keybinding behaviour - is this as designed?

2017-06-26 Thread Sanjeev Sharma
The issue is with marking a region at s-expr boundary (start or end)

I start the marking (C-space) and move forward (C-f or right arrow) and the 
region is marked as I expect, whether I cross an s-expr boundary or not.

and some results I didn't expect

I start the marking (C-space) and move forward (M-C-f) or back (M-C-b) and the 
region marking gets disabled. 

I start the marking (C-space) and move forward (C-f or right arrow) then back 
to the start of the s-expr (C-a) and the region marking gets disabled. If I 
don't use C-a here, just going back and forth with the caret motion commands


Is this behaviour is as intended? 

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


Re: [racket-users] threading macros

2017-06-26 Thread Sanjeev Sharma
yeah, trying to apply the idea unreasonably beyond its intent.

Thanks for the replies folks.
 
On Sunday, June 25, 2017 at 2:52:00 PM UTC-4, Alexis King wrote:
> As written, the simple answer to your question is to use begin0 or
> begin, depending on if you are using ~> or ~>>.
> 
> > (~> 3 (begin0 (displayln "hi!")) (* 2))
> hi!
> 6
> 
> But as Greg mentions, this is not very useful, and it probably isn’t
> what you want, since the evaluated expression can only be evaluated for
> side-effects, which is rather against the spirit of threading macros
> altogether.
> 
> It is a little difficult for me to imagine what a hypothetical syntax
> for your use-case would look like without turning ~> into a much more
> complicated binding form. As it is, the threading macros are all quite
> simple, and they are simple shorthands for syntactic nesting. It would
> be possible to generalize them quite a bit, but I am fond of their
> simplicity, and I think Greg’s suggestion to just use let* is a good
> one. I’m not sure there is a good way to synthesize the brevity and
> simplicity of threading with a more powerful binding form, though if you
> can come up with a syntax that accomplishes what you’re getting at, I’d
> certainly at least be interested by it.
> 
> > On Jun 25, 2017, at 09:44, Sanjeev Sharma  wrote:
> > 
> > is there a way to do a calculation in the middle of the chain that
> > takes no arguments?  In other words, exempt some operations in the
> > chain from taking any arguments.
> > 
> > Suppose one's doing a calculation of interest earned on an investment
> > and one is threading a running balance through the chain, but at
> > places one needs a calculation for purchases and/or dispositions to
> > the investment.

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


Re: [racket-users] Re: lambda and the equivalent define / "defun"

2016-09-07 Thread Sanjeev Sharma
Just illustrates the changing structure (increased nesting depth) on each 
recursive call

The initial call to t2 changes the structure of the  argument/parameter - 
it puts in a list where there was no list.

Each recursive call from inside t2 again changes the structure, adding an 
enclosing '() for the  parameter

For the usual (no ) function call It's not an issue for the standard 
car/cdr idiom of walking down recursive structures. 

On Wednesday, September 7, 2016 at 9:28:23 AM UTC-4, Jon Zeppieri wrote:

> On Wed, Sep 7, 2016 at 8:33 AM, Sanjeev Sharma <thro...@gmail.com> wrote:
> Thanks for joining in.
> 
> 
> 
> The amended question had nothing to do with the earlier example
> 
> 
> 
> Okay.
>  
> 
> 
> I'm  wondering if there's a quick, standard (and easily understood) idiom 
> (without an internal helper function) to recur on the variable argument list y
> 
> 
> 
> I'm still not sure what you mean, and I don't understand what your `t2` 
> example is supposed to do.
> 
> 
> 
> -Jon

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


Re: [racket-users] Re: lambda and the equivalent define / "defun"

2016-09-07 Thread Sanjeev Sharma
Thanks for joining in.

The amended question had nothing to do with the earlier example

I'm  wondering if there's a quick, standard (and easily understood) idiom 
(without an internal helper function) to recur on the variable argument list y

The flatten's not ideal - I may want to retain some sub-list structure 

(define x 4)
(define t2
  (lambda y
(let ((z (car y)))
  (display y)(newline)
  (display (flatten y))(newline)
  (display z)(newline)
  (if (> x 0)
  (begin
(set! x (- x 1))
;(t2 (cdr y)))
(t2 y))
  (void)
(t2 1 2 3 4 5 6)



RETURNS
(1 2 3 4 5 6)
(1 2 3 4 5 6)
1
((1 2 3 4 5 6))
(1 2 3 4 5 6)
(1 2 3 4 5 6)
(((1 2 3 4 5 6)))
(1 2 3 4 5 6)
((1 2 3 4 5 6))
1 2 3 4 5 6
(1 2 3 4 5 6)
(((1 2 3 4 5 6)))
(1 2 3 4 5 6)
(1 2 3 4 5 6)
1 2 3 4 5 6


On Tuesday, September 6, 2016 at 9:04:07 PM UTC-4, Jon Zeppieri wrote:
> On Tue, Sep 6, 2016 at 8:50 PM, Jon Zeppieri  wrote:
>  
> The `(lambda s ...)` is variable-arity, but when you call `ss` internally 
> [...]
> 
> 
> Sorry, I realized after that your `ss` function essentially *is* a wrapper 
> around your `subsets` function -- which is exactly what I was suggesting. 
> However, there's no reason for it to duplicate so much of the work of 
> `subsets`. Since `subsets` works on any list, your definition of `ss` can 
> simply be:
> 
> 
> (define (ss . xs) (subsets xs))
> 
> 
> The only purpose of `ss` is to package up its arguments as a list and pass 
> that list to `subsets`.
> 
> 
> - Jon

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


[racket-users] Re: lambda and the equivalent define / "defun"

2016-09-06 Thread Sanjeev Sharma
Thanks, that's helpful

I am having trouble coming up with a quick and easy shorthand to recur on the 
rest parameter - is there a standard way to cdr down this list without an 
intermediary helper function that takes out the raise-nesting-depth effect? 

Recursion on the base define (the one with the rest parameter) always adds 
another layer of nesting for the rest parameter - the first time recurring one 
must cdr, all the other times one must fiddle with car & cdr and what I'm doing 
has been prone working for the first few iterations but eventually 
arity-mismatches.


On Tuesday, September 6, 2016 at 7:39:59 AM UTC-4, gneuner2 wrote:
> On Sun, 4 Sep 2016 10:36:21 -0700 (PDT), Sanjeev Sharma wrote: 
> 
> >two "x" 's also work
> >
> >(define list (lambda x x))
> 
> (lambda x x x) works because the evaluation of the middle x is a side
> effect which is ignored.  It still will work if you change it to,
> e.g., (lambda x 'q x)  or (lambda x 42 x) ... changing the middle x to
> anything that is not a variable.
> 
> 
> Extra information:   [ignore if you know this already]
> 
> (lambda x x) is the right way to define list ... but it works sort of
> incidentally because Scheme permits "rest" parameters which gather
> multiple arguments into a list.   
> 
> (define (list . x) x) also is equivalent and the syntax makes clear
> that x is intended to be a rest parameter.
> 
> 
> (lambda v v) is different from (lambda (v) v).  The unadorned v in the
> 1st indicates that v is a single rest parameter which will gather all
> the arguments into a list.  The parentheses in the 2nd indicate that v
> is a normal parameter which will take on a single value [which may be
> a deliberately passed list].
> 
> -> ((lambda v v) 1 2 3) 
> => '(1 2 3)
> 
> -> ((lambda (v) v) 1 2 3) 
> => #: arity mismatch
> 
> 
> Rest parameters may be combined with required parameters as in 
> (lambda (x . v) ... )  which is different from (lambda (x v) ... ).
> The dot in the parameter 1st indicates that v is a rest parameter.  In
> the 2nd, both x and v are normal parameters.
> 
> -> ((lambda (x . v) v) 1 2 3) 
> => '(2 3)
> 
> -> ((lambda (x . v) x) 1 2 3) 
> => 1
> 
> -> ((lambda (x v) v) 1 2 3) 
> => #: arity mismatch
> 
> -> ((lambda (x v) v) 1 2) 
> => 2
> 
> 
> A function can have only a single rest parameter [or none]. 
> 
> 
> Hope this helps,
> George

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


Re: [racket-users] Re: lambda and the equivalent define / "defun"

2016-09-04 Thread Sanjeev Sharma
if anyone stumbles on this later this is also discussed in Kent Dybvig's TSPL4

http://www.scheme.com/tspl4/start.html#./start:h6

from section 2.6:

For example, the definitions of cadr and list might be written as follows.

(define (cadr x)
  (car (cdr x))) 

(define (list . x) x)

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


Re: [racket-users] Re: lambda and the equivalent define / "defun"

2016-09-04 Thread Sanjeev Sharma
merci & danker - 

I had just done same-parity exercise using this but did not see the equivalence

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


[racket-users] Re: lambda and the equivalent define / "defun"

2016-09-04 Thread Sanjeev Sharma
two "x" 's also work

(define list (lambda x x))

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


[racket-users] lambda and the equivalent define / "defun"

2016-09-04 Thread Sanjeev Sharma
is there a define syntax equivalent to this lambda

(define list (lambda x x x))
(list 1 2 3 4 5 "a")
;returns 
;'(1 2 3 4 5 "a")


I wanted to write subsets from SICP without 
passing the parameter as a list, and a simiar
version of average 


(define nil '())

(define (subsets s)
  (if (null? s)
  (list nil)
  (let ((rest (subsets (cdr s
(append
 rest
 (map
  (lambda (x)
(append (list (car s))
x))
  rest)

(subsets (list 1 2 3))  

; complete using the format of the simplified list lambda
(define ss
  (lambda s
(if (null? s)
  (list nil)
  (let ((rest (subsets (cdr s
(append
 rest
 (map
  (lambda (x)
(append (list (car s))
x))
  rest))

(ss 1 2 3)

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


Re: [racket-users] values - should this work?

2016-08-18 Thread Sanjeev Sharma
very cool

let-values is does what I need


On Thursday, August 18, 2016 at 1:50:18 PM UTC-4, Jens Axel Søgaard wrote:
> No, (list (values 1 2 3)) is not supposed to work.
> Multiple values can be cumbersome to work with.
> In this case you want:
> 
> 
>     (call-with-values (λ () (values 1 2 3)) list)
> 
> 
> Yeah - not pretty.
> 
> 
> Other constructs to learn about:
> 
> 
>    define-values
>    match-values
> 
> 
> /Jens Axel
>

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


[racket-users] values - should this work?

2016-08-18 Thread Sanjeev Sharma
(list(values 1 2 3))
result arity mismatch;
 expected number of values not received
  expected: 1
  received: 3
  values...:


I've been under the impression this should be identical to
(list 1 2 3)

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


Re: [racket-users] colorizing code in html - scribble or the GUI?

2016-03-19 Thread Sanjeev Sharma
thanks folks - marked completed but please share more if there are more 

I was going to use hilite.me but I prefer having something resembling the 
racket documents

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


[racket-users] colorizing code in html - scribble or the GUI?

2016-03-15 Thread Sanjeev Sharma
is there a quick & dirty way to use scribble or the drracket GUI to generate 
html for random code snippets?

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


[racket-users] listing the identifiers from "all-defined-out" and "all-from-out"

2015-12-18 Thread Sanjeev Sharma
how can I get lists of identifiers im/exported when one uses

all-defined-out 
all-from-out

I can't yet make sense of regprov.rkt 

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


Re: [racket-users] keep everything in each in-place install

2015-08-02 Thread Sanjeev Sharma
thanks

same versions - I was trying to see the effects of different gcc optimization 
flags, especially with Pict3D  some math.

 

On Saturday, August 1, 2015 at 10:35:55 PM UTC-4, Matthew Flatt wrote:
 Are you seeing conflicts with different installations that have the
 same version number? Or different snapshot installations?
 

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


[racket-users] keep everything in each in-place install

2015-08-01 Thread Sanjeev Sharma
I am getting conflicts between the global install and in-place installs, 
especially in document searches not working.


I'm guessing the issue is with user preferences. 

Is there a way to do the in-place install such that everything gets put in the 
in-place install's tree?

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


[racket-users] overlapping fields in windows, DrRacket user interface (preferences, choose language)

2015-06-29 Thread Sanjeev Sharma
windows 7;  it's most obvious in 
preferences - warnings

also choose language - details 


I can ivoke and reverse it from this screen:
 
Control Panel\Appearance and Personalization\Display
 - make text and other items larger or smaller
   - medium

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