Re: [racket-users] Displaying limited decimal places of a BigFloat?

2017-05-25 Thread Alasdair McAndrew
On Thursday, 25 May 2017 23:44:58 UTC+10, David K. Storrs wrote: > This isn't smooth, but it works: > > #lang at-exp racket > (first (regexp-match @pregexp{\d+\.\d{0,4}} "15.123456789")) > (first (regexp-match @pregexp{\d+\.\d{0,4}} "15.12")) > Thank you - that is certainly more complicated than

[racket-users] seeking advice on implementing a racket structure editor

2017-05-25 Thread andrew blinn
I'm looking to make a structure editor for racket code, with an eye to perhaps eventually integrating it into the DrRacket IDE. I haven't used Racket/Draw or Racket/GUI before and I'm currently evaluating their suitability for the task. In general, I'm eager for relatively simple Racket/GUI exa

Re: [racket-users] making a language that can return the body of a function

2017-05-25 Thread Matthias Felleisen
The client module can refer to all imported #% forms. If you don’t export it from the language module, it’s not there. [Well, mostly] Implicitly the client module already refers to #% forms already. > On May 25, 2017, at 7:09 PM, Vityou wrote: > > On Wednesday, May 24, 2017 at 2:05:23 PM U

Re: [racket-users] immutable hash table performance

2017-05-25 Thread 'John Clements' via Racket Users
> On May 25, 2017, at 3:49 PM, Matthew Flatt wrote: > > At Thu, 25 May 2017 18:28:16 -0400, "'John Clements' via Racket Users" wrote: >>> On May 25, 2017, at 3:27 PM, Jon Zeppieri wrote: >>> Immutable hash operations are logarithmic, not constant time. >> >> I believe our documentation says th

Re: [racket-users] making a language that can return the body of a function

2017-05-25 Thread Vityou
On Wednesday, May 24, 2017 at 2:05:23 PM UTC-6, Matthias Felleisen wrote: > Don’t eval. This is a bit crude but it now your lam-s keep track of your > environment, too. > > #lang racket ;; new-lang.rkt > > (provide > #%app > #%datum > #%top-interaction > (rename-out > (new-lambda lambda)

Re: [racket-users] immutable hash table performance

2017-05-25 Thread Matthew Flatt
At Thu, 25 May 2017 18:28:16 -0400, "'John Clements' via Racket Users" wrote: > > On May 25, 2017, at 3:27 PM, Jon Zeppieri wrote: > > Immutable hash operations are logarithmic, not constant time. > > I believe our documentation says they’re “effectively constant-time”. FWIW, there's a margin n

Re: [racket-users] immutable hash table performance

2017-05-25 Thread Robby Findler
Well, that's because the log of the largest possible hash table is like, what, less than 100? Robby On Thu, May 25, 2017 at 5:28 PM, 'John Clements' via Racket Users wrote: > >> On May 25, 2017, at 3:27 PM, Jon Zeppieri wrote: >> >> On Thu, May 25, 2017 at 6:16 PM, 'John Clements' via Racket U

Re: [racket-users] immutable hash table performance

2017-05-25 Thread 'John Clements' via Racket Users
> On May 25, 2017, at 3:27 PM, Jon Zeppieri wrote: > > On Thu, May 25, 2017 at 6:16 PM, 'John Clements' via Racket Users > wrote: >> Following up on a discussion I had with another teacher here, I decided to >> briefly investigate the running time of insertion and deletion on mutable vs >> im

Re: [racket-users] immutable hash table performance

2017-05-25 Thread Jon Zeppieri
On Thu, May 25, 2017 at 6:16 PM, 'John Clements' via Racket Users wrote: > Following up on a discussion I had with another teacher here, I decided to > briefly investigate the running time of insertion and deletion on mutable vs > immutable hash tables. I was a bit disappointed to find that it t

Re: [racket-users] immutable hash table performance

2017-05-25 Thread 'John Clements' via Racket Users
> On May 25, 2017, at 3:20 PM, Ben Greenman wrote: > > Is the y-axis on the first plot labeled correctly? It's reporting fractions > of a millisecond, but the text talks about 7 vs. 40 seconds. Yes, I believe that’s correct: the 7 seconds is for constructing the table of 10 million elements,

Re: [racket-users] immutable hash table performance

2017-05-25 Thread Ben Greenman
Is the y-axis on the first plot labeled correctly? It's reporting fractions of a millisecond, but the text talks about 7 vs. 40 seconds. Also the timings links aren't working for me: https://www.brinckerhoff.org/img/hash-table-timings.rkt https://www.brinckerhoff.org/img/hash-table-lookup-timings.

[racket-users] immutable hash table performance

2017-05-25 Thread 'John Clements' via Racket Users
Following up on a discussion I had with another teacher here, I decided to briefly investigate the running time of insertion and deletion on mutable vs immutable hash tables. I was a bit disappointed to find that it turns out that insertion really doesn’t look very constant-time for insertion… o

Re: [racket-users] What can I do with thread descriptors?

2017-05-25 Thread Alexis King
> On May 25, 2017, at 1:16 PM, David Storrs wrote: > > 1) What can I do with a thread descriptor? The section on Threads in the reference[1] includes all sorts of functions that operate on thread descriptors, including but not limited to thread-suspend, thread-resume, kill-thread, break-thread,

[racket-users] What can I do with thread descriptors?

2017-05-25 Thread David Storrs
Two questions: 1) What can I do with a thread descriptor? 2) Is there a way to get the thread descriptor from inside the thread? There's no documentation that I can find on what a thread descriptor actually is or what can be done with it. It's an opaque structure...I guess I can use it for eq?

Re: [racket-users] using a created language in the repl

2017-05-25 Thread Dmitry Pavlov
Vityou, I will give you an example though I myself sometimes doubt that I did it in the right way. Anyway, here is what I did when I had exactly the same problem: - redefine and reexport #% top-interaction - provide #:language-info to the DrRacket's REPL (I am not sure if racket's REPL needs

Re: [racket-users] Displaying limited decimal places of a BigFloat?

2017-05-25 Thread David Storrs
This isn't smooth, but it works: #lang at-exp racket (first (regexp-match @pregexp{\d+\.\d{0,4}} "15.123456789")) (first (regexp-match @pregexp{\d+\.\d{0,4}} "15.12")) On Thu, May 25, 2017 at 7:59 AM, Alasdair McAndrew wrote: > In (standard) Racket, I can display a real number x to (say) 4 dec

[racket-users] Displaying limited decimal places of a BigFloat?

2017-05-25 Thread Alasdair McAndrew
In (standard) Racket, I can display a real number x to (say) 4 decimal places using something like (displayln (string->number (real->decimal-string x 4))) This is handy for printing out multiple versions of a list or vector of real numbers, and seeing how they change. I would like to do the sa