[racket-users] Re: Best to ask here or on Stackoverflow from a language promotion perspective?

2015-12-09 Thread Alex Harsanyi
On Thursday, December 10, 2015 at 2:33:32 AM UTC+8, Matthew Butterick wrote: > Here's one good way to promote the language: > > 1) Make something impressive with Racket. Not the original poster, but does this count? https://github.com/alex-hhh/ActivityLog2 it is a fitness tracker for cycli

[racket-users] Re: Best to ask here or on Stackoverflow from a language promotion perspective?

2015-12-09 Thread Alex Harsanyi
On Thursday, December 10, 2015 at 9:01:24 AM UTC+8, Emmanuel Oga wrote: > On Wednesday, December 9, 2015 at 3:32:24 PM UTC-8, Alex Harsanyi wrote: > > On Thursday, December 10, 2015 at 2:33:32 AM UTC+8, Matthew Butterick wrote: > > > > > Here's one good way to promote

Re: [racket-users] Re: Racket 6.4 very slow

2016-03-02 Thread Alex Harsanyi
I have the same problem with Racket 6.4 64Bit Windows (running on Windows 7): > (time (total 10)) cpu time: 85520 real time: 88070 gc time: 204 BTW, my "Choose Language" dialog box (Ctrl+L) has the following selected: * Debugging * Populate "compiled directories" * Preserve sta

Re: [racket-users] Racket 6.4 very slow

2016-03-02 Thread Alex Harsanyi
ebug" disabled, "Preserve stack trace" enabled -> 4.5 seconds * "Debug" and "Preserve stack trace" disabled -> 3.6 seconds. > > > On Mar 2, 2016, at 8:21 PM, Alex Harsanyi wrote: > > > > I have the same problem with Racket 6.4 64Bit Wind

Re: [racket-users] Re: Racket in command line, puts out wrong number

2017-11-09 Thread Alex Harsanyi
Hi Karim, You forgot to add the racket users list to your message, so your reply is sent to the mailing list. I fixed that. On Fri, Nov 10, 2017 at 12:17 AM, Karim Djemai wrote: > Hey Alex, > thank you for your quick response! > Is there any way for me to get the eulers number, starting with 27.

Re: [racket-users] Re: New wiki page ‘friends of Racket’

2017-11-13 Thread Alex Harsanyi
On Mon, Nov 13, 2017 at 5:26 PM, 'Paulo Matos' via Racket Users wrote: > > > On 30/10/17 00:18, Alex Harsanyi wrote: >> >> You could add ActivityLog2 (https://github.com/alex-hhh/ActivityLog2) to >> that list (Disclaimer: I am the author). >> >>

[racket-users] confused about raco check-requires error

2017-11-20 Thread Alex Harsanyi
I'm trying to use the "raco check-requires" command to determine which requires I should remove from my source files, and the command fails when I include one of my files (the application compiles and runs fine). I managed to reproduce the case as follows: ;; Save this in "file1.rkt" #l

[racket-users] Re: structs vs classes

2017-12-06 Thread Alex Harsanyi
In my code, I started experimenting with using immutable structs and "updating" them using 'struct-copy'. I had to write my own "update" functions, but I was surprised at how elegant the resulting code was. I believe (although I did not check) that the guard function is invoked every time a

[racket-users] Re: stumped

2017-12-13 Thread Alex Harsanyi
I built a similar control, although it does not represent directory paths, just labels which are stacked vertically. I ended up defining a structure to hold the text and width + height of each label and keep these structures in a list. In my case, all labels have the same size so converting a mo

[racket-users] Re: 2htdp/universe: behavior of dual shift keys

2017-12-17 Thread Alex Harsanyi
I tested this on a Windows platform and have the same result. It seems there is a problem in Racket with handling the right shift key: pressing down the right shift key results in "keydown" being invoked with a "rshift" argument, but releasing the right shift key results in "keyup" being called

[racket-users] Adding interactive overlays to racket plots

2018-01-29 Thread Alex Harsanyi
The racket plot package produces interactive snip% objects which allow zooming of the plot area. While this is a cool and sometimes useful feature, the functionality is hard coded in the plot-snip% class inside the package. I would like to extend the package to allow the user to customize the i

Re: [racket-users] Adding interactive overlays to racket plots

2018-02-02 Thread Alex Harsanyi
Hi Matthias, I updated the plot package to cover all the cases I had in mind for plot overlays and also updated my application to make use of these features, just to make sure that they are adequate. The pull request is here: https://github.com/racket/plot/pull/32, it would be good if I could

[racket-users] Re: Adding interactive overlays to racket plots

2018-02-09 Thread Alex Harsanyi
On Saturday, February 10, 2018 at 10:00:29 AM UTC+8, Evan Whitmer wrote: > > Do you anticipate this playing well with charts that have multiple Y > values for a given X value. For example, candlestick plotting >

[racket-users] How to check if a symbol is defined before calling it?

2018-02-17 Thread Alex Harsanyi
The recent plot library introduces a new function, `point-pict` which is not yet available as part of a Racket distribution, and the plot package has to be installed separately from GitHub for this function. In my code I would like to be able to check if this function is available before calli

Re: [racket-users] How to check if a symbol is defined before calling it?

2018-02-17 Thread Alex Harsanyi
27;point-pict (λ () #f))]) > (when point-pict > (point-pict ...))) > > -Philip > > On Sat, Feb 17, 2018 at 7:57 PM, Alex Harsanyi > wrote: > >> >> The recent plot library introduces a new function, `point-pict` which is >> not yet available as part of a R

Re: [racket-users] How to check if a symbol is defined before calling it?

2018-02-18 Thread Alex Harsanyi
Hi Robby, On Sunday, February 18, 2018 at 10:33:09 AM UTC+8, Robby Findler wrote: > > FWIW, the approach that is less friendly to your clients but perhaps > easier for you (and maybe good enough for them) is to declare a > dependency on a specific version in the info.rkt file of your pkg. The

[racket-users] Re: Is it possible to get the size of a panel%

2018-02-21 Thread Alex Harsanyi
Get-size should work, can you provide a example that illustrates the problem? The only tricky bit is that the actual size of a widget is only computed after it is shown. Here is an example: #lang racket (require racket/gui) (define toplevel (new frame% [label "hello"] [widt

[racket-users] Are canvases stackable?

2018-02-23 Thread Alex Harsanyi
You want to use a pasteboard% for the chess table and snip% objects for the pieces. You can draw the board as the pasteboard background in the on-draw method. You will have to implement snip management in the pasteboard though because by default snips can just be dragged around and placed any

Re: [racket-users] Are canvases stackable?

2018-02-28 Thread Alex Harsanyi
6:12 AM David Alkire > wrote: > >> That's interesting. Thanks, I'll give it a try. >> >> On Fri, Feb 23, 2018, 11:24 PM Alex Harsanyi > > wrote: >> >>> You want to use a pasteboard% for the chess table and snip% objects for >>> the pie

[racket-users] Re: Sorting a list-box%

2018-03-05 Thread Alex Harsanyi
You can get the number of rows by calling `get-number` which is an inherited method from list-control<%>. However, you probably want to keep the data separate from the list box and sort that: the list box always contains strings, but your data type might be a number and you want to sort it as

Re: [racket-users] Adding interactive overlays to racket plots

2018-03-20 Thread Alex Harsanyi
-overlays-with-the-racket-plot-package-update.html Best Regards, Alex. On Saturday, February 3, 2018 at 3:08:50 PM UTC+8, Alex Harsanyi wrote: > > > Hi Matthias, > > I updated the plot package to cover all the cases I had in mind for plot > overlays and also updated my applicat

[racket-users] Unexpected error when building standalone Racket executable

2018-03-22 Thread Alex Harsanyi
I started getting some unexpected and unexplained errors from Racket when trying to build a stand alone executable. The versions is: Racket 6.12 64bit on Windows 10. If I try to run my application from Racket, it runs with no problems. If I build an executable and try to run it, I get the follo

Re: [racket-users] Unexpected error when building standalone Racket executable

2018-03-24 Thread Alex Harsanyi
tthew > > At Thu, 22 Mar 2018 22:31:11 -0700 (PDT), Alex Harsanyi wrote: > > I started getting some unexpected and unexplained errors from Racket > when > > trying to build a stand alone executable. The versions is: Racket 6.12 > > 64bit > > on Windows 10. &

[racket-users] Re: Splitting up a GUI source file?

2018-03-24 Thread Alex Harsanyi
The "traditional" way of doing this in other languages and GUI toolkits is to have a separate class for each of your panes (Books, Users and Rentals). The constructor would receive the parent widget and other initialization parameters (e.g. a database connection). Something like this: ;; bo

[racket-users] Re: truly stand-alone Windows ".exe"s

2018-03-27 Thread Alex Harsanyi
I have version 6.90.0.23 installed from a few days ago, which appears to be the latest version available at http://pre.racket-lang.org/, and "raco exe" does not accept the '--embed-dlls' option. Have these changes not been released in a snapshot yet? Best Regards, Alex. On Monday, March 26,

Re: [racket-users] Re: truly stand-alone Windows ".exe"s

2018-03-28 Thread Alex Harsanyi
On Tuesday, March 27, 2018 at 9:17:49 PM UTC+8, Matthew Flatt wrote: > > I should have bumped the version number when adding `--embed-dlls`, but > I didn't. So, even though it's still version 6.90.0.23, `--embed-dlls` > is in snapshots starting with the ones built on March 26. > I tried the n

Re: [racket-users] Re: truly stand-alone Windows ".exe"s

2018-03-28 Thread Alex Harsanyi
Yes, this seems to be a Windows Explorer problem, if I move the executable to a different place, the icon changes. It is the first time I see this behaviour... Sorry for the false alarm :-) Alex. -- You received this message because you are subscribed to the Google Groups "Racket Users" gro

[racket-users] Re: Experience with REST APIs in Racket

2018-04-11 Thread Alex Harsanyi
I used the built-in url package (http://docs.racket-lang.org/net/url.html) from Racket to fetch data from Wunderground weather API and it was simple enough that I did not feel the need for a separate REST library. I just used `format` to construct the URL, `get-pure-port` to fetch the data and

[racket-users] Re: game help

2018-05-03 Thread Alex Harsanyi
I wonder if *just solved your homework...* (define (same-value? vec) (define test-val (vector-ref vec 0)) (if (zero? test-val) #f (let ((same? (for/and ((v (in-vector vec))) (eqv? test-val v (and same? test-val (define (winner-by-row row-num)

[racket-users] GUI problem -- main window loosing focus when two dialog boxes are opened

2018-05-07 Thread Alex Harsanyi
I have a problem with the Racket GUI where the main application window looses focus if two dialog boxes are opened than closed. The problem occurs when the main window opens the first dialog box and the first dialog box opens the second one on top of it. Once both dialog boxes are closed, the m

Re: [racket-users] GUI problem -- main window loosing focus when two dialog boxes are opened

2018-05-08 Thread Alex Harsanyi
On Tuesday, May 8, 2018 at 2:08:02 PM UTC+8, gneuner2 wrote: > > Hi Alex, > > > So I guess the 1st question to answer is: does the GDI object have the > correct parent HWND? [The Racket dialog% object has a parent, but does > the underlying display object?] If it does, there's something wei

Re: [racket-users] GUI problem -- main window loosing focus when two dialog boxes are opened

2018-05-08 Thread Alex Harsanyi
On Wednesday, May 9, 2018 at 7:25:34 AM UTC+8, gneuner2 wrote: > > > Ignoring Racket's extraneous added panels, a better organization would be: > > Window 00010010 "" #32769 (Desktop) > : > Window 0017076E "Hello World" PLTFrame > Window 000F03D2 "Dialog 1" #32770 (Dialog) >

[racket-users] How to build unix paths on windows with build-path/convention-type

2018-05-22 Thread Alex Harsanyi
I am trying to create a path named "/foo/bar" in Racket on a windows machine. build-path produces "/foo\\bar" and build-path/convention-type does not seem to work: > (path->string (build-path "/" "foo" "bar")) "/foo\\bar" ; I am running on a Windows machine, so this is expected >

Re: [racket-users] How to build unix paths on windows with build-path/convention-type

2018-05-22 Thread Alex Harsanyi
quot;foo") (bs->p > #"bar")) > > Roughly, strings don't work, because they have to be converted to bytes > using the locale's default encoding. Although strings are allowed for > the current platform's convention on the assumption that the current > l

[racket-users] Re: A (long) question regarding parameters and scope

2018-08-01 Thread Alex Harsanyi
Parameters don't keep their values across threads, and since the plot library needs to re-draw the plot when it is rotated or zoomed, it saves parameters for later use in a different thread, where the drawing actually happpens. There is an explicit list of parameters that are saved and restore

[racket-users] Re: A (long) question regarding parameters and scope

2018-08-02 Thread Alex Harsanyi
On Thursday, August 2, 2018 at 11:19:58 PM UTC+8, Carlos Lopez wrote: > > Thanks Alex! > > Right, so make-bm is being called from another thread and so the > parameters are different there. > The parameters should not be different. The objective of the save/restore parameters is to make sure

[racket-users] Re: A (long) question regarding parameters and scope

2018-08-02 Thread Alex Harsanyi
On Friday, August 3, 2018 at 6:22:10 AM UTC+8, Alex Harsanyi wrote: > > > > On Thursday, August 2, 2018 at 11:19:58 PM UTC+8, Carlos Lopez wrote: >> >> Thanks Alex! >> >> Right, so make-bm is being called from another thread and so the >> parameters

Re: Parameters considered often harmful (was: Re: [racket-users] Re: A (long) question regarding parameters and scope)

2018-08-02 Thread Alex Harsanyi
On Friday, August 3, 2018 at 1:24:08 AM UTC+8, johnbclements wrote: > > I hate to turn a little question into a big one, but… are parameters the > right choice, here? It seems to me that optional parameters would be more > suitable. > Most (but not all) parameters act as default values for re

Re: [racket-users] Testing & global variables

2018-08-07 Thread Alex Harsanyi
If this is a problem only in your test code, you could write a function to reset/re-initialize the global state, and call that function at the beginning of each test. If you want to have a "global state" for each of the file that requires your module, global variables might not be the right app

[racket-users] Re: gui change-children portability and nuances

2018-08-07 Thread Alex Harsanyi
Hi Neil, I have used `change-children` on a Win32 GUI and the widgets that are switched in and out keep all their state, including the scroll position, unless, of course, if you change this state from the program.This means, for example, that if you have a list-box% and you remove it from a

[racket-users] using `define-runtime-path` inside macros

2018-08-31 Thread Alex Harsanyi
I have defined a macro to help with using SQL queries from external files: it uses `define-runtime-path` to store the path to the file and defines a function that reads the data when called the first time and constructs a `virtual-statement`: #lang racket (require racket/runtime-path db

Re: [racket-users] using `define-runtime-path` inside macros

2018-08-31 Thread Alex Harsanyi
On Friday, August 31, 2018 at 11:11:29 PM UTC+8, Matthew Butterick wrote: > > > On Aug 31, 2018, at 3:25 AM, Alex Harsanyi > wrote: > > Is there a way to write this macro such that the runtime path is defined > relative to the location of the file that uses `define-sql-

[racket-users] Re: Using ctags and vim with Racket

2018-09-13 Thread Alex Harsanyi
On Thursday, September 13, 2018 at 10:19:37 PM UTC+8, Marc Kaufmann wrote: > > Hi all, > > for the first time I wanted to use ctags today, which generates a bunch of > tags so that one can jump to and from function definitions and the like in > vim. However, the program generates no tags whatso

[racket-users] Re: How can I make GUI elements abut?

2018-09-19 Thread Alex Harsanyi
Hi David, I am running your example code on a Windows machine with Racket 7.0, and the buttons do stretch vertically and horizontally when I resize the window. There is a small gap between the buttons, but I think this is how the native buttons are drawn. Is the problem that there is this ga

Re: [racket-users] GUI in Racket

2018-10-11 Thread Alex Harsanyi
Hi Jeyron, here is a simple example which shows how the callback for the menu might open a new window (a dialog in this case). #lang racket/gui (define main-window (new frame% [label "Example"] [width 100] [height 100])) (define menu-bar (new menu-bar% [parent main-window])) ;; Callback for t

[racket-users] Re: Looking for suggestions: GUI failure

2018-10-14 Thread Alex Harsanyi
I get the same error too if I run your attached program and just click on the "All" and "None" buttons a few times. The problem seems to be with doing GUI container operations that take a long time (adding the message% objects) inside an event callback. To work around this, you can use queue-

[racket-users] Re: Looking for suggestions: GUI failure

2018-10-14 Thread Alex Harsanyi
On Monday, October 15, 2018 at 8:36:49 AM UTC+8, Dan Muller wrote: > > Thanks for taking the time to reproduce it, Alex. I assume you saw nothing > wrong with the overall approach I took for the table, outside of your > suggestion to use queue-callback. > I see nothing wrong with your example,

[racket-users] reporting contract violations in executable programs

2018-10-31 Thread Alex Harsanyi
In the Racket version 7.0 on Windows, a contract violation error in an executable program will trigger a very confusing error message. I think this is best illustrated by an example. Consider the file: #lang racket (require racket/contract) (define/contract (foo n) (-> intege

[racket-users] Re: reporting contract violations in executable programs

2018-11-01 Thread Alex Harsanyi
On Thursday, November 1, 2018 at 7:38:29 PM UTC+8, Alexander McLin wrote: > > I’m a little confused here, to me it looks like the second contract > violation is completely different from the first one. > My program is only seven lines of code and does not call `build-path`. Also, if I fix th

[racket-users] Re: plot library: legend outside plot?

2018-11-09 Thread Alex Harsanyi
It is not currently possible to draw the legend outside the plot area. The code that draws the legend is at the link below, however, this code assumes that the position will be inside the plot area and will not reserve extra space outside this area: https://github.com/racket/plot/blob/8dcfd77

[racket-users] Re: plot library: legend outside plot?

2018-11-10 Thread Alex Harsanyi
to generate both legend entries and plot renderers. The big advantage is that you can style the legend however you want. Best Regards, Alex. On Friday, November 9, 2018 at 9:16:48 PM UTC+8, Alex Harsanyi wrote: > > > It is not currently possible to draw the legend outside the plot are

[racket-users] Re: Posting Events To Window Asynchronously From Different Thread?

2018-11-19 Thread Alex Harsanyi
I think `queue-callback` is the closest "general" equivalent: it allows invoking methods on GUI objects from outside the event handler thread. It can also be used to schedule some work to be done outside a GUI widget's callback invocation. If you actually want to post specific messages to a

Re: [racket-users] Re: Posting Events To Window Asynchronously From Different Thread?

2018-11-19 Thread Alex Harsanyi
d-message-to-window%29%29), > > though I've never used it, and it sounds like it is different from what you > describe. > > -Philip > > > On Mon, Nov 19, 2018 at 5:22 PM Alex Harsanyi > wrote: > >> >> >> I think `queue-callback` is the closest

[racket-users] Re: Orchestrate SQL migrations with Racket

2018-11-21 Thread Alex Harsanyi
I implemented my own migration code for my Racket application and I am personally happy with it. It can only upgrade (from old to new) and not downgrade a database, however it supports showing a GUI progress dialog for the migration process (one step for each SQL statement applied). Not sure how

Re: [racket-users] using `define-runtime-path` inside macros

2018-11-21 Thread Alex Harsanyi
On Friday, August 31, 2018 at 11:11:29 PM UTC+8, Matthew Butterick wrote: > > > On Aug 31, 2018, at 3:25 AM, Alex Harsanyi > wrote: > > Is there a way to write this macro such that the runtime path is defined > relative to the location of the file that uses `define-sql-

[racket-users] Re: Thanks to Alex

2018-11-28 Thread Alex Harsanyi
On Wednesday, November 28, 2018 at 8:38:04 PM UTC+8, Jason Stewart wrote: > > My first Racket program: > > https://github.com/BourgeoisBear/stdinoscope > > This looks cool. Is this program intended for displaying real time data from some signal acquisition system? I'm also working on an applic

[racket-users] Re: What is the best way to daemonize a Racket program on linux?

2018-11-28 Thread Alex Harsanyi
If your Linux installation has systemd, you can create a service file for your application -- this way, systemd will manage the application as a server or daemon. Systemd will even redirect stderr messages to the system log. Alex. On Thursday, November 29, 2018 at 10:56:25 AM UTC+8, Brian Ad

[racket-users] Re: What is the best way to daemonize a Racket program on linux?

2018-11-29 Thread Alex Harsanyi
atically? > Yes. > I was planning on using monit to monitor/restart/etc. a set of Racket > processes, but maybe systemd will do everything I need such as restarting > one if it crashes. > > On Wednesday, November 28, 2018 at 10:45:59 PM UTC-5, Alex Harsanyi wrote: >> >

[racket-users] Re: embedded api docs and the `doc` submodule

2018-11-30 Thread Alex Harsanyi
On Wednesday, November 28, 2018 at 12:10:18 AM UTC+8, Neil Van Dyke wrote: > > What do people think about the following way of providing Scribble API > documentation from a module? > > Scribble can already be used to document Racket packages and the `scrdoc` modules can be used by people who wi

[racket-users] Re: plot legends

2018-12-01 Thread Alex Harsanyi
There was a similar question asked on this group a while ago. tThe plot library does not support legends outside the plot area, but you can use the pict package to construct your own legend and place it anywhere. This requires some coding, but provides more flexibility (for example, you can

Re: [racket-users] Re: plot legends

2018-12-01 Thread Alex Harsanyi
On Sunday, December 2, 2018 at 7:10:36 AM UTC+8, Matt Jadud wrote: > > Thanks for the pointer; I should have searched the group history before > asking. And, perhaps, the ticket queue. > > For what I'm exploring right now, that would be just fine, and makes > perfect sense, and will let me proc

[racket-users] Re: Questions about plot

2018-12-05 Thread Alex Harsanyi
The plot library creates plots by assembling elements (such as axes and renderers) together. For example, the plot library does no have a scatter plot type, instead points can be rendered on a plot, but lines could also be rendered on the same plot. You can also control many other things, such as

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

2018-12-06 Thread Alex Harsanyi
I have updated the Travis build file for my application to use Racket-on-Chez as one of the build configurations and, while the code builds and automated tests pass, the performance is very poor. I know that measuring times of Travis builds is not exactly scientific, however, I have run these bui

[racket-users] Re: Using Racket behind proxy

2018-12-10 Thread Alex Harsanyi
I cannot help you directly, but I just wanted to say that at my workplace, we are also behind a proxy, and I did not have to reconfigure Racket in any way. I also have to put in the "insteadOf" rule for git clones, as only HTTPS traffic is allowed, but I believe the Racket package manager just

Re: [racket-users] hackernews

2018-12-16 Thread Alex Harsanyi
On Sunday, December 16, 2018 at 12:48:09 AM UTC+8, Peter Schmiedeskamp wrote: > > I’m probably guilty of already being part of this task-force. To add, I > wonder if there’d be value in some longer, blog-form replies to interesting > HackerNews queries. > > For example, someone was extolling

[racket-users] Re: Racket good for GUI apps! :)

2018-12-30 Thread Alex Harsanyi
You cannot do that: The control already uses text% snips internally for each item, but it redefines their `on-default-char` method to discard all keyboard input, which means they are not editable in-line. If you want to have a look, the implementation for the hierarchical-list%, is in your Racke

[racket-users] Re: Dumb question about Windows paths

2019-01-08 Thread Alex Harsanyi
I asked a similar question a while ago, and I received a good explanation of why this is the case (you have to work with bytes instead of strings). However, the error messages reported by the path functions are indeed confusing and could be improved: https://groups.google.com/forum/#!searchin

[racket-users] Re: updated Racket-on-Chez status

2019-01-29 Thread Alex Harsanyi
I know the report explains the various cases where Racket CS is slower than Racket 7.1, but I would like to mention that these cases are very significant, at least in my case -- I mention this because the report recommends making Racket CS the default, which I am very concerned about: > To maximi

Re: [racket-users] Re: updated Racket-on-Chez status

2019-01-30 Thread Alex Harsanyi
On Wednesday, January 30, 2019 at 10:53:21 PM UTC+8, Matthew Flatt wrote: > > At Tue, 29 Jan 2019 17:32:42 -0800 (PST), Alex Harsanyi wrote: > > I mention this because the report recommends making > > Racket CS the default, which I am very concerned about: > >

Re: [racket-users] Re: updated Racket-on-Chez status

2019-01-31 Thread Alex Harsanyi
On Thursday, January 31, 2019 at 9:23:39 AM UTC+8, Matthew Flatt wrote: > > > I would be happy to help you identify where the performance degradation > > between Racket 7.1 and CS is when running these tests. > > Small examples that illustrate slowness in a specific subsystem are > always helpf

[racket-users] Python's append vs Racket's append and helping novices understand the implications

2019-02-01 Thread Alex Harsanyi
Someone asked recently for help on Reddit[1] with a Racket performance issue. The problem was they they were constructing a large list by appending many short lists repeatedly; their code was calling `(set! result (append result shortList))` in a loop and this was slow (unsurprisingly.) While tr

Re: [racket-users] Python's append vs Racket's append and helping novices understand the implications

2019-02-02 Thread Alex Harsanyi
I put together some notes about available data structures in Racket, with some performance considerations. It needs more work, but perhaps it can be used as a starting point and it can be added to the Racket wiki, if/when others consider it adequate: https://gist.github.com/alex-hhh/3cc5690a7

[racket-users] Re: Some concern about ChezScheme...

2019-02-05 Thread Alex Harsanyi
I guess I also have some concerns about the move to Chez, and largely for the same reasons: * the Chez community is very small, at least when looking at the chez-scheme Google Group and Github activity. I am glad that I'm not the only one who noticed that. * the "maintainability" angle is qu

Re: [racket-users] Re: updated Racket-on-Chez status

2019-02-05 Thread Alex Harsanyi
tter than the version with > for and in-list, but I recommend to keep the legible version. > > > *** I tried replacing the initial value of min-x and friends with +inf.0, > and removing the if in the updates. I'm convinced this is a good idea, but > the change in speed is

[racket-users] Re: Pitfall for contracts with serializable structs

2019-02-05 Thread Alex Harsanyi
On Wednesday, February 6, 2019 at 12:35:11 PM UTC+8, Philip McGrath wrote: > > > Why is this significant in practice? Realistically, I don't expect > programmers would write functions like `corrupt-serialized` in an attempt > to deliberately exploit some library's invariant, and the chance of s

[racket-users] Re: read-from-string(-all)

2019-02-06 Thread Alex Harsanyi
(read-from-string "123") is equivalent to `(call-with-input-string "123" read)` while read-from-string-all can be replaced by: (define (read-all in) (let loop ([result '()]) (let ((v (read in))) (if (eof-object? v) (reverse result) (loop (co

Re: [racket-users] Re: read-from-string(-all)

2019-02-06 Thread Alex Harsanyi
On Wednesday, February 6, 2019 at 7:36:40 PM UTC+8, Laurent Orseau wrote: > > On Wed, Feb 6, 2019 at 11:25 AM Alex Harsanyi > wrote: > > although I am not sure it is a good idea to call read on strings received >> from the user... >> > > They're not eval&

Re: [racket-users] Re: read-from-string(-all)

2019-02-06 Thread Alex Harsanyi
On Wednesday, February 6, 2019 at 7:58:47 PM UTC+8, Laurent Orseau wrote: > > Oh nice, I didn't know we could do that one! > Point taken :) > > I suppose (hope?) you can still use sandboxing with memory limits for this? > You could make your own read table which disables all special treatment o

[racket-users] Re: raco distribute creating too many subdirectories

2019-02-08 Thread Alex Harsanyi
It looks like the source tree has copies of itself inside it. This part of the path is repeating: /racket/pipo/app/lib/plt/tlf/exts/ert/r0/ I use raco distribute regularly on Windows, and while the path tree it creates is longer than I would like, it is nowhere near as deep, here is mine fro

Re: [racket-users] Guide and reference

2019-02-08 Thread Alex Harsanyi
ne who has worked on the documentation. >> > > Very well put. > > Besides the reference and the guide it would be wonderful to see a series > of tutorials. > We have some (on pict and the web-server), but more is better. > > Given the recent discussion on the strength

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

2019-02-10 Thread Alex Harsanyi
This line looks suspicious: (define results (make-vector years (make-vector (vector-length fecundity) 0))) The "(make-vector (vector-length fecundity) 0)" expression will create a single vector, than it creates the outer vector will all elements pointing to it. It is not a matrix, but a

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

2019-02-10 Thread Alex Harsanyi
ion" is needed at the end. If all is needed at the end is the "current" generation, it might be more efficient to just use two vectors, the current and next one and swap them each iteration. But before we get into improving the code, let's get it working first :-) Alex.

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

2019-02-10 Thread Alex Harsanyi
On Monday, February 11, 2019 at 8:01:47 AM UTC+8, travis.h...@gmail.com wrote: > > Thanks, Daniel, this is helpful. I think that I understand your code, but > it is a still a foreign way of thinking for me. Of course, that is a big > part of why I'm learning Racket, i.e., to make programming wit

[racket-users] Re: Loading foreign libraries on Windows

2019-02-11 Thread Alex Harsanyi
Do you have x64 Racket installed? This is an error that usually comes up when a 32 bit application tries to load a 64 bit DLL. Alex. On Tuesday, February 12, 2019 at 2:18:55 PM UTC+8, Philip McGrath wrote: > > I'm encountering an issue using `ffi-lib` to load a DLL on Windows. The > problem app

Re: [racket-users] Re: Loading foreign libraries on Windows

2019-02-12 Thread Alex Harsanyi
McGrath wrote: > > As far as I can tell, yes. I've confirmed that the install script is > getting Racket from > https://mirror.racket-lang.org/installers/7.2/racket-7.2-x86_64-win32.exe > > -Philip > > > On Tue, Feb 12, 2019 at 2:01 AM Alex Harsanyi > wrote: > >

[racket-users] Re: Autocomplete from a list

2019-02-14 Thread Alex Harsanyi
There are two solutions I can think of: (1) derive combo-field% and override the on-popup method to construct the choice menu dynamically based on what is selected in the combo box field. This has a few disadvantages, namely (a) you have to produce the menu immediately, so if you have to query

Re: [racket-users] "table" data structure in Racket

2019-02-21 Thread Alex Harsanyi
On Thursday, February 21, 2019 at 7:19:39 AM UTC+8, travis.h...@gmail.com wrote: > > Hi All, > > I'm resurrecting this thread to ask if anyone in the Racket community has > Apache Arrow on their radar. It seems like Apache Arrow might be gaining > steam. > > Apache Arrow is a cross-language d

[racket-users] Re: What is the best way to "raco make" all *.rkt files in a directory tree?

2019-03-11 Thread Alex Harsanyi
To add one more answer to this thread :-) In addition to compiling files specified on the command line, `raco make` will recursively compile all files referenced via `require`. This means that if you have a top level file for your application, you can tell `raco make` to compile that file, and

[racket-users] Re: Pretty display of tabular data?

2019-03-13 Thread Alex Harsanyi
You can use the table pict constructor to construct tables, https://docs.racket-lang.org/pict/Pict_Combiners.html?q=table#%28def._%28%28lib._pict%2Fmain..rkt%29._table%29%29 Here is an example: #lang racket (require racket/draw pict) (define (make-pretty-table items) (define c

Re: [racket-users] Re: Pretty display of tabular data?

2019-03-13 Thread Alex Harsanyi
On Thursday, March 14, 2019 at 9:06:12 AM UTC+8, Matt Jadud wrote: > > First, thank you for all the great pointers in this thread. It is clear > that different renderings will be useful in different contexts, and there's > good libraries to leverage in the community. That's what I was hoping. >

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

2019-03-19 Thread Alex Harsanyi
The Python matplotlib package supports the concept of a colormap for selecting colors for each data set that is displayed -- the user uses an index, like color 0, 1, 2, etc and this is mapped to a RGB value in the color map. The visual aspect of a plot can be changed just by switching the color

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

2019-03-19 Thread Alex Harsanyi
On Tuesday, March 19, 2019 at 9:53:23 PM UTC+8, Jens Axel Søgaard wrote: > > This is a great idea. > > It would be really nice to be able to use the colors also from non-plot > programs. > Could you (or Ben or Matt) elaborate on how do you see this work for non plot programs? For plots, the

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

2019-03-19 Thread Alex Harsanyi
On Wednesday, March 20, 2019 at 10:35:51 AM UTC+8, Ben Greenman wrote: > > > Could you (or Ben or Matt) elaborate on how do you see this work for non > > plot programs? > > I'm thinking a color-map% object would define a possibly-infinite > sequence of colors that look nice in some way. The co

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

2019-03-21 Thread Alex Harsanyi
I created a pull request for items (1) and (2), illustrating the changes that I propose, you can find it here: https://github.com/racket/plot/pull/52 Alex. On Wednesday, March 20, 2019 at 12:17:47 PM UTC+8, Alex Harsanyi wrote: > > > > On Wednesday, March 20, 2019 at 10:35:51 A

Re: [racket-users] Error handling for the GUI

2019-03-22 Thread Alex Harsanyi
On Saturday, March 23, 2019 at 5:17:22 AM UTC+8, James Platt wrote: > > Well, I might make some kind of compromise. What I don't want to allow is > the possibility of the user experience being "I click on the button and > nothing happens." You can wrap each button callback with a `with-hand

[racket-users] Re: SQL DB tooling

2019-03-23 Thread Alex Harsanyi
The package is called "north" and you can find it here: https://pkgs.racket-lang.org/package/north There is also the announcement on Reddit: https://www.reddit.com/r/Racket/comments/akob56/ann_north_database_migrations/ Alex. On Saturday, March 23, 2019 at 12:40:48 PM UTC+8, Aidan Gauland wr

[racket-users] Re: Intriguing performance difference between Windows and Linux on `(factorial 100000)`

2019-03-24 Thread Alex Harsanyi
You can check if the big number multiplication is the problem, by using a factorial version which does not need so many big number multiplications: #lang racket/base (require racket/math) (define (fact n) (if (zero? n) 1 (* n (fact (- n 1) (define (fact-1 n) (define nslots (exact-truncat

[racket-users] Emacs scribble-mode

2019-03-31 Thread Alex Harsanyi
I started writing Scribble documentation more often lately and Emacs has no good support for editing such documents. For me the main feature that I would like is indentation, like it is done in other programming modes. I found a `racket-mode` on GitHub, but it only supports some basic syntax

Re: [racket-users] Generate really large random numbers in Racket

2019-04-01 Thread Alex Harsanyi
You can use `crypto-random-bytes` to generate large random numbers, however, that function returns a string of bytes, which you have to combine into an integer: (define (random-bignum bits)

[racket-users] Re: How to install local dir package replacing pre-installed one

2019-04-05 Thread Alex Harsanyi
Here are some notes that I wrote to deal with this situation, except they use the plot package: https://alex-hhh.github.io/2018/01/changing-built-in-racket-packages.html You will also find some more information about this topic if you search this group, but most of what is explained in tho

  1   2   3   >