[racket-users] Re: Polished 3D package for some simulations
Have you tried out Pict3D [1]? There is also a library from Matthew Flatt that can create 3D Text / extruded pathes: [2] Personally I currently use opengl [3], these bindings support higher opengl versions than the [4] (which only support opengl 1.5 according to its documentation) I can't say exactly up to which opengl version [3] has working bindings, these bindings were automatically generated, but that stopped working at some point. (Apparantly the input that was used for the generation isn't provided for recent opengl versions anymore, so the generator has to be fixed or replaced to work with a different input/description) [1] https://docs.racket-lang.org/pict3d/index.html [2] https://docs.racket-lang.org/pict3d-die-cut/index.html [3] https://docs.racket-lang.org/opengl/index.html [4] https://docs.racket-lang.org/sgl/index.html?q=opengl#%28idx._%28gentag._0._%28lib._sgl%2Fscribblings%2Fsgl..scrbl%29%29%29 -- 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/67072c79-aac7-40a1-8774-2d684c7476d1n%40googlegroups.com.
Re: [racket-users] Typed Racket: type relations
(Not experienced with typed racket) How about something like this, is there something bad about this? (fxquotient (-> Fixnum Fixnum Fixnum)) (fixnum->byte (-> Fixnum Byte)) ;; possible runtime error (fixnum->byte (fxquotient rs n)) (I don't expect a type to always snap to the narrower one automatically... Or is that something typed racket actually tries to do [which would be cool], but this is something I am more likely to expect from a dependently typed language??) TL;DR does typed racket try to reason about math and or treat values as types? Sam Tobin-Hochstadt schrieb am Freitag, 16. April 2021 um 15:51:46 UTC+2: > To improve this, we'd have to extend the type of `fxquotient`, which > is reasonable, but I'm not sure what the addition would be. In > particular, your addition is not sound: > > (fxquotient 1024 2) produces 512 which is not a Byte. > > Sam > > On Thu, Apr 15, 2021 at 6:22 PM Dominik Pantůček > wrote: > > > > Hello Racketeers, > > > > working on gradually typing some of my modules I encountered an > > interesting problem: > > > > (define-type Color Fixnum) > > > > (: argb-average (-> Color * Color)) > > (define (argb-average . argbs) > > (let loop ((as : Fixnum 0) > > (rs : Fixnum 0) > > (gs : Fixnum 0) > > (bs : Fixnum 0) > > (n : Fixnum 0) > > (argbs : (Listof Color) argbs)) > > (if (null? argbs) > > (make-argb (fxquotient as n) > > (fxquotient rs n) > > (fxquotient gs n) > > (fxquotient bs n)) > > (let-values (((a r g b) (argb-split (car argbs > > (loop (fx+ as a) > > (fx+ rs r) > > (fx+ gs g) > > (fx+ bs b) > > (fx+ n 1) > > (cdr argbs)) > > > > Type Checker: type mismatch > > expected: Byte > > given: Fixnum > > in: (fxquotient bs n) > > > > The only way of fixing this issue was using unsafe-fxquotient which is > > unsafe-require/typed accordingly: > > > > (unsafe-require/typed > > racket/unsafe/ops > > (unsafe-fxquotient (-> Fixnum Fixnum Byte))) > > > > Is there a better way? > > > > The relation between Byte and (Nonnegative-)Fixnum is mathematically > > sound here, but making TR understand it is apparently pretty hard... > > > > > > Cheers, > > Dominik > > > > -- > > 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...@googlegroups.com. > > To view this discussion on the web visit > https://groups.google.com/d/msgid/racket-users/608fdb93-b2ce-37e0-750c-037b47fed102%40trustica.cz > . > -- 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/17e9a04a-1648-4c88-8e2e-70691ca0fd0dn%40googlegroups.com.
Re: [racket-users] Is there a good Racket DSL alternative to Image Magick?
Personally I use pict and racket/draw instead of htdp/image, because save-image is png only. Pict to transform or load the image, racket/draw's bitmap% to save and/or load the image (sidenote: in general I find pict more pleasant to work with, but that may be subjective): (require pict racket/draw) ;; this is a rough sketch of the image functions I use ;; make-object 2nd variant: https://docs.racket-lang.org/draw/bitmap_.html?q=bitmap%25#%28constructor._%28%28lib._racket%2Fdraw..rkt%29._bitmap~25%29%29 (define b (make-object bitmap% filename-or-port image-type-see-docs #f #t)) ;; background color #f, complain on failure #t (define p (bitmap b)) ;; use bitmap% as pict ;; use pict functions to transform pict (define p2 (scale-to-fit p ...)) ;; other pict transforms (define p3 (inset p2 30 0)) ;; saving the transformed file (send (pict->bitmap p3) save-file out 'png) ;; other file types possible roberthh...@gmail.com schrieb am Mittwoch, 12. Mai 2021 um 15:06:02 UTC+2: > Dan, that's awesome. Thank you. > > Martin, I would love some way to extract the image metadata from each of > the files outputted by Dan's function. All my function does is take the > current width and height and apply some math to return some new values, so > right now I'm just manually going into finder, looking at the images width > and height, and plugging those values into my function. > > On Tuesday, May 11, 2021 at 7:31:15 PM UTC-6 martin...@gmail.com wrote: > >> So to clarify, you want something like the following (pseudocode)? >> >> (define (process-image transform image-file-data) >>(let* ([path (get-full-path image-file-data)] >> [image (bitmap/file path)] >> [new-image (transform image)]) >> (save-image new-image path)) >> >> (define (process-file path) >> (let ([image-file-data (extract-image-metadata path)]) >> (process-image resize image-file-data))) >> >> (map process-file (find-all-images directory)) >> >> One question - where do the new width and height of each image come from, >> if you are reading the list of filenames from a directory? >> >> martin >> >> >> On Tue, May 11, 2021 at 3:42 PM Robert Haisfield >> wrote: >> >>> Okay, so I figured out how to do what I want on individual photos using >>> bitmap/file and 2htdp/image, but I'm trying to find a more programmatic way >>> to do it. Basically, I'd love to create a data structure that feeds into >>> the file path, width, and height into the image-resizer function. Even >>> better if I could point the function at a directory, it finds all of the >>> images in it, and creates the data structure for me. Any ideas? >>> >>> *No, I'm not trying to just resize photos (this would be much easier if >>> that's all I had to do), the thing I'm working with requires me to add >>> whitespace to the sides of the images to have them display properly.* >>> >>> [image: CleanShot 2021-05-11 at 16.31...@2x.png] >>> >>> On Tuesday, May 11, 2021 at 3:06:20 PM UTC-6 Jens Axel Søgaard wrote: >>> Hi Robert, There are some bindings for Magick in the example folder for the FFI library. https://github.com/racket/racket/tree/master/pkgs/racket-doc/ffi/examples The bindings are in magic.rkt and examples of use are in use-magick.rkt (see the bottom). /Jens Axel Den tir. 11. maj 2021 kl. 22.15 skrev 'John Clements' via Racket Users < racket...@googlegroups.com>: > Racket has the ability to read a variety of different image files. I > would go first to 2htdp/image’s “bitmap/file” to read images. > “save-image” > can write images (but only as png files). I believe there are also an > array > of lower-level image manipulation functions that are likely to have a > less > friendly interface :). > > Apologies in advance for any misleading information I might be > providing…. > > John > > > On May 11, 2021, at 1:09 PM, Robert Haisfield > wrote: > > > > Alternatively, does the normal images function for Racket work? When > I was looking through the documentation I saw a lot about creating shapes > but not about using image files. > > > > On Tuesday, May 11, 2021 at 2:03:33 PM UTC-6 Robert Haisfield wrote: > > Hmm does the video language work for image files? If so, then I > think it might work. > > > > On Tuesday, May 11, 2021 at 9:03:35 AM UTC-6 Sage Gerard wrote: > > I hope that has what Robert is looking for, but I don't recognize > that speech. In fact, I have a false memory, because I'm not finding the > speech I'm looking for on https://con.racket-lang.org/2018/#speakers > > > > On 5/11/21 10:19 AM, Bruce O'Neel wrote: > >> This might be it. > >> > >> (seventh RacketCon): Leif Andersen -- Movies as Programs: The Story > of a Racket - YouTube > >> > >> > >> > >
Re: [racket-users] Is there a good Racket DSL alternative to Image Magick?
p.s: scale-to-fit might be interesting for you and if you don't care about extra options (for background/alpha etc.) you can construct the pict with (bitmap path) directly instead of (bitmap (make-object bitmap% ...)) p.p.s: I think there was also a way to convert/use images within picts or the other way around but I currently can't find it... ...I did find it: pict/convert a little bit more example code options / some might be useful for you or other people (I partly write this as a note to myself) #lang racket (require (only-in 2htdp/image circle) (except-in pict circle) pict/convert) (module+ main (define c (circle 708 "solid" "blue")) (displayln "pict-convertible:") (pict-convertible? c) (define p (pict-convert c)) (define p2 (frame (scale-to-fit p 1440 (pict-height p) #:mode 'inset))) (send (pict->bitmap p2) save-file "example.png" 'png) (send (pict->bitmap p) save-file "test.png" 'png) (make-directory* "./resized") (define resize (resizer "." "./resized" 1440)) (resize 708 1100 "test.png")) (define ((resizer source target max-width) width height filename) (define p (bitmap (build-path source filename))) ;; (pict-width p) (pict-height p) would give the dimmensions of the incoming image ;; maybe that could be used instead of the hardcoded arguments, if that is possible for the usecase ;; this is a pict based variant with scaling (maybe you don't need scaling) ;; maybe you need something a little bit different ;; maybe scale-to-fit with certain parameters may be enough, or you can keep using your 2htdp/image ;; version and you could convert it to a pict with pict-convert if you want to use pict or bitmap% functionality (define p2 (cc-superimpose (filled-rectangle max-width height #:color "white" #:draw-border? #f) (scale-to-fit p (- max-width width) height #:mode 'inset))) (send (pict->bitmap p2) save-file (build-path target filename) 'png)) ;; - ;; everything below this is completely optional and I only do it because I wanted to try it ;; - ;; because this contract is defined on the module boundary it won't work within this module ;; [define/contract could be used to define it on the function boundary] ;; we could use a ->i contract to specify that width has to be <= max-width (require racket/contract) (define pathish/c (or/c path-string? path-for-some-system? 'up 'same)) (provide (contract-out [resizer (->i ([source pathish/c] [target pathish/c] [max-width exact-nonnegative-integer?]) [result (max-width) (->i ([width (and/c exact-nonnegative-integer? (<=/c max-width))] [height exact-nonnegative-integer?] [filename string?]) [result () boolean?])])])) (module* contract-test racket (require (submod "..")) ;; require enclosing module ;; testing the contract from a submodule similar to requiring from a different file (define resize (resizer "." "./resized" 1440)) (resize 708 1100 "test.png") ;; works (resize 1708 1100 "test.png")) ;; contract error ;; to execute contract-test submodule use this in drracket-repl: ;; (require (submod "." contract-test)) kamist...@gmail.com schrieb am Donnerstag, 13. Mai 2021 um 01:04:41 UTC+2: > Personally I use pict and racket/draw instead of htdp/image, because > save-image is png only. > Pict to transform or load the image, racket/draw's bitmap% to save and/or > load the image > (sidenote: in general I find pict more pleasant to work with, but that may > be subjective): > > (require pict > racket/draw) > > ;; this is a rough sketch of the image functions I use > > ;; make-object 2nd variant: > https://docs.racket-lang.org/draw/bitmap_.html?q=bitmap%25#%28constructor._%28%28lib._racket%2Fdraw..rkt%29._bitmap~25%29%29 > (define b (make-object bitmap% filename-or-port image-type-see-docs #f > #t)) ;; background color #f, complain on failure #t > (define p (bitmap b)) ;; use bitmap% as pict > ;; use pict functions to transform pict > (define p2 (scale-to-fit p ...)) > ;; other pict transforms > (define p3 (inset p2 30 0)) > ;; saving the transformed file > (send (pict->bitmap p3) save-file out 'png) ;; other file types possible > > roberthh...@gmail.com schrieb am Mittwoch, 12. Mai 2021 um 15:06:02 UTC+2: > >> Dan, that's awesome. Thank you. >> >> Martin, I would love some way to extrac
[racket-users] Re: preview of a cross-compilation tool
I ran raco-cross (installed on racket cs 8.0 [does this cause trouble for racket cs < 8.2 or is it fine because host and target are both bc?]) to run exe and dist: ;; install dependencies raco cross --workspace /tmp/todays-snapshot --target i386-win32 --vm bc pkg install ;; create exe raco cross --workspace /tmp/todays-snapshot --target i386-win32 --vm bc exe myapp.rkt ;; create dist raco cross --workspace /tmp/todays-snapshot --target i386-win32 --vm bc dist myapp-i386-win32-bc myapp.exe >> Cross configuration Target:i386-win32 Host: x86_64-linux Version: 8.0 VM:bc Workspace: /tmp/todays-snapshot On windows: 1. I had to add the lib subfolder in the dist to the path (else the exe would not find the dlls in there). 2. Copy the dlls from /tmp/todays-snapshot/i386-win32-bc/lib/ to the lib subfolder. [I also tried `raco exe --embed-dlls` but then the libs from 2. are missing from the executable, do I need to run future raco-cross at version cs 8.2 so that this part works, or could I use bc to make it work?] After that the program ran for a bit allowed me to select a directory and then crashed with an exception, probably this is a bug in my application that is windows specific. I need to check that. I also tried the utah snapshots but they don't have i386 builds and the windows7 vm is 32bit, I might also test with 64bit windows10 vm, I am currently downloading it. https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/ (in case other people need the link to the test vms, they are for ie testing but you can test other things with it) Anyways so far the experience has been quite good compared to my tries without raco-cross maybe a year ago. schle...@gmail.com schrieb am Samstag, 15. Mai 2021 um 01:44:11 UTC+2: > This is like being a child, waking up and realizing its christmas (and > easter at the same time), > thank you for working on this, I will test out this shiny new toy/gift > (meant in the best possible way). > > Because I am on linux, I will try to cross compile to windows (time to > dust off my windows vm for testing ;)) > > Matthew Flatt schrieb am Donnerstag, 13. Mai 2021 um 17:54:40 UTC+2: > >> While `raco exe` in v8.1 very nearly supports cross-builds of Racket >> executables[*], it's not easy to pass the right flags and set up the >> needed target-platform distributions. >> >> The `raco cross` command provided by the new "raco-cross" package wraps >> Racket tools to simplify all of that management. For example, >> >> raco cross --target x86_64-linux --vm bc exe example.rkt >> >> is like running >> >> raco exe example.rkt >> >> but it cross-builds for x86_64 Linux. That build process involves >> downloading a minimal racket tarball for the target platform, >> installing "compiler-lib" there, downloading a matching minimal build >> of Racket for the host platform, and then running the host Racket in >> cross-build mode with installed target distribution --- but, again, >> `raco cross` takes care of all that. >> >> Just like using `raco exe` on Linux, the generated executable won't >> actually work on other machines until you package it in a distribution >> using `raco dist`: >> >> raco cross --target x86_64-linux --vm bc dist example-dist example >> >> Naturally, this second invocation of `raco cross` for the same target >> uses the installations prepared by the first `raco cross`, so it's >> relatively fast. >> >> >> I expect that `raco cross` will become more useful after the v8.2 >> release, which will repair cross-compilation for CS executables and >> executables with native libraries (like GUI executables). Meanwhile, >> it's possible to use `raco cross` with snapshot builds, but you have to >> point it at a snapshot site; see the documentation for more >> information. >> >> >> Because juggling multiple installations and versions is a lot of the >> work for cross-compilation, `raco cross` can also be a way to get to a >> different version of Racket in minimal form. For example, >> >> raco cross --version 8.0 racket >> >> starts a Racket v8.0 prompt. (The `racket` command is treated specially >> by `raco cross`. All other commands are prefixed by `raco`.) >> >> >> For more information see >> >> https://docs.racket-lang.org/raco-cross/index.html >> >> >> [*] Running a cross-built CS executable fails at the very last step of >> startup, and that's due to an expander bug for handling top-level >> `begin` forms compiled in machine-independent form. We didn't >> detect this problem before, because it wasn't part of Bogdan's use >> case for cross builds, and because cross-compilation was painful >> enough that we didn't actually try other cases. >> > -- 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
Re: [racket-users] Re: preview of a cross-compilation tool
> > > On windows: > > 1. I had to add the lib subfolder in the dist to the path (else the exe > > would not find the dlls in there). > > The intent in a Windows distribution is that the executable and "lib" > folder stay together, as they are in the archive. Was the executable > not able to find the folder content when kept alongside in the same > directory? > Yes it didn't find the libiconv-2.dll in the distribution "lib" sub-folder, only after I added that to my path. Is there a specific function like `current-library-collection-paths` I should output from my executable, to get insight into what might be wrong? It seems as if "./lib" is meant to be a default search path, but isn't for some reason. > > 2. Copy the dlls from /tmp/todays-snapshot/i386-win32-bc/lib/ to the lib > > subfolder. > > Which libraries were needed? They should have been pulled along in the > distribution's "lib" folder automatically, assuming they're referenced > in a Racket module with `define-runtime-path` (which modules like > `racket/draw` and `racket/gui` do for their libraries). > I copied a few one by one, with the error message telling me which one it didn't have next, but eventually I got impatient and copied all that I had in that folder: libatk-1.0-0.dll libfribidi-0.dll libiconv-2.dll libpixman-1-0.dll libcairo-2.dll libgio-2.0-0.dll libintl-9.dll libpng16-16.dll libeay32.dll libglib-2.0-0.dll libjpeg-9.dll longdouble.dll libexpat-1.dll libgmodule-2.0-0.dll libpango-1.0-0.dll myssink.dll libffi-6.dll libgobject-2.0-0.dll libpangocairo-1.0-0.dll sqlite3.dll libfontconfig-1.dll libgthread-2.0-0.dll libpangoft2-1.0-0.dll ssleay32.dll libfreetype-6.dlllibharfbuzz-0.dll libpangowin32-1.0-0.dll zlib1.dll these were present before the copy: libiconv-2.dll libracket3m_d8ary8.dll longdouble.dll I am not too sure where to start debugging this, any tips about values to look at would be appreciated. -- 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/0fb20b6d-8c8c-4554-a687-9e71a07eda74n%40googlegroups.com.
Re: [racket-users] Re: preview of a cross-compilation tool
utah has 32-bit Windows snapshots now again. I did a cross build with: >> Cross configuration Target:i386-win32 Host: x86_64-linux Version: current VM:bc Workspace: /tmp/todays-snapshot with `pkg install` `exe ...` `dist ...` moved dist over to windows vm and it ran fine, until it hit a sqlite syntax that was too new for the version that is included in racket i386-win32 (it reported sql-lite version 3.22.0 from 2018-01-22). I then downloaded 3.35.5 (current release) for windows replaced the sqlite3.dll in /tmp/todays-snapshot/i386-win32-bc/lib/ with the newer one, repeated the exe and dist, after that the application worked without problems. (So I guess the only question that comes up is: is it possible to update the sqlite version?) [vaguely remember seeing a mailing list thread about this but, currently I only find other ones] The build was pretty easy and working great (I guess with the next release it becomes even simpler, not having to use snapshots, but that is just one more command line argument anyway), so thank you again, definitively makes distributing racket applications easier! Simon Matthew Flatt schrieb am Samstag, 15. Mai 2021 um 14:51:22 UTC+2: > At Sat, 15 May 2021 05:18:22 -0700 (PDT), "kamist...@gmail.com" wrote: > > Yes it didn't find the libiconv-2.dll in the distribution "lib" > sub-folder, > > only after I added that to my path. > > Oh, right... I had forgotten already that the current release does > *not* cross-build correctly, even for a BC build, when the target needs > native libraries. That problem should be fixed in snapshots. > > So, you were on the right track trying to use a snapshot, and it just > happens that neither site at the moment manages to cover the > combination of Linux and 32-bit Windows. We'll get the snapshot sites > in line soon, I hope. > > > Matthew > -- 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/50590986-3614-4d68-a96d-eb8047e2490en%40googlegroups.com.
Re: [racket-users] recent sqlite3 versions (was Re: preview of a cross-compilation tool)
> > > (So I guess the only question that comes up is: is it possible to update > > the sqlite version?) > > [vaguely remember seeing a mailing list thread about this but, currently > I > > only find other ones] > > My libsqlite3[1] package provides recent versions (currently 3.35.5) of > SQLite for Linux, macOS and Windows. If you add it to your app's > `deps`, everything should just work. > > [1]: https://pkgd.racket-lang.org/pkgn/package/libsqlite3 > This package works great! Now I could run my app without copying files. Some caveats though (am I doing something wrong here?): because db-lib already has an old version of the sqlite library `raco pkg install` complains that there is a conflict if I depend on db-lib and libsqlite3 I used `raco pkg install --force` to make it ignore the conflict I wonder whether racket has a way to tell db-lib to not include its version of sqlite. (would this require to split db-lib into smaller packages so that you can depend on hypothetical: db-interface-lib and not on db-sqlite-lib?) If the conflict is present tools like `raco setup --check-pkg-deps --unused-pkg-deps ...` don't understand that the db-lib version of sqlite is not wanted and has a different version, so it thinks libsqlite3 is not needed: raco setup: unused dependency detected for package: "myapp" on package: "libsqlite3" -- 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/162dc097-5bce-455a-9869-399ee5457359n%40googlegroups.com.
Re: [racket-users] problem of gui layout using side-by-side frames
I think instead of fidgeting around with OS dependent stuff to align frames side by side, I would take another approach (inspired by other applications): 1. per default the application is just a big window with multiple sections divided with panels, splits, tabs, etc. 2. some of those areas might be useful as sepparate frames for some users, add a button "undock" 3. clicking that button creates a frame and reparents the panel into the newly created frame 4. button changes to "dock" 5. clicking it reparents the panel back to where it was originally and deletes the frame There might be some coding needed to save and restore state about what has been undocked and the last positions of the windows, so that can be restored when the application is restarted. (although some OS's may restore window positions themselves if they have unique titles??) What I like about that approach is that it gives the user choice and can be ignored if its not needed. gneuner2 schrieb am Donnerstag, 12. August 2021 um 15:17:34 UTC+2: > > On 8/11/2021 10:44 PM, Don Green wrote: > > > > When I specify 2 frames to be side-by-side using racket/gui, I believe > > I would have no problem if all my prospective client platform did not > > have a vertical Operating System taskbars. > > Since I do have such a taskbar I must use code that takes the width of > > the taskbar into account. > > Since I intend to distribute to others who may have: > > a) no vertical taskbar; or > > b) a wider vertical taskbar; or > > c) multiple vertical taskbars > > no single offset can be used and it is outside the scope of the > > racket/gui to know what the offset would need to be. > > I am currently of the belief that I should refrain from using > > side-by-side frames. > > The upshot is that I can then no longer use menus either because menus > > can only exist in frames and I would need more that the single > > top-level frame. > > Any suggestions? > > I am currently thinking I should use the panel-tab with a couple of > > panels each containing an editor-canvas and place buttons on these > > panels instead of using menus. -- > > I don't quite understand the problem - a frame can have another frame as > its parent (supporting Windows "multiple document interface"). If you > need side-by-side frames with menus, then why not do that inside an > enclosing top-level frame? > > Also pop-up menus have no parent and can be used anywhere. > > And if you really are ambitious, you could make the menubar% class work > within panels as well as frames. This has been mentioned occasionally > over the years, but AFAIK nobody ever has bothered to look into it. > -- 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/e7bcc139-ebbb-4842-a7e7-65e6f2967b24n%40googlegroups.com.
Re: [racket-users] problem of gui layout using side-by-side frames
> Allowing (un)docking is a good idea (if applicable), but switching > between panels and frames is unnecessarily complicated ... a frame can > be drawn floating or docked, resizeable or not, with or without borders, > system menu, captions, toolbar, menubar, etc. - so visually it can be > made to /appear/ as if a panel when docked, and as if a window when > undocked. It's a lot easier to just redraw the frame(s) with different > settings than to try to maintain multiple different object hierarchies > or to try to reassign parentage on the fly (which is mistake prone if > many functions are handled by the parent). > >From my (limited but some) experience of working with rackets gui, I definitively would prefer reparenting (or maybe even dynamic reconstruction) over, trying to syncronize window movements with other floating windows. Maybe create some kind of mixin for un-/dockable panels or just a single class that you can use multiple times, but haven't worked out the details just a bit similar to old stuff I did. What you describe makes me think that maybe you describe this from a perspective of using windows apis directly? Where that may be easier? Anyways in the end pick an approach run with it make it work, in general this thread seems to vague / there isn't a clear objective and it runs into multiple directions... -- 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/e7a8ecff-7070-4943-8d2c-08cb4790c8fbn%40googlegroups.com.
[racket-users] Re: Is there a way to format keys/values like raise-arguments-error
I am not really aware of a function that does this you could try digging into the implementation of raise-arguments-error, usually I roll my own implementation depending on what I really want to output. racket/format and its ~a, ~v, etc. have a lot of useful optional keyword arguments like #:align #:pad-string #:width etc. This isn't totally what you want, but maybe it has something that is useful to you. This or similar code is what I have used sometimes: #lang racket (define current-prefix-length (make-parameter 0)) (define (prefixln #:prefix [prefix ""] #:align [align 'left] . message) (displayln (apply ~a (list* (~a prefix #:width (current-prefix-length) #:align align) message (define-syntax-rule (with-indent body ...) (parameterize ([current-prefix-length (+ (current-prefix-length) 2)]) body ...)) (define (example-func1) (prefixln "start of example func1") (with-indent (example-func2)) (prefixln "end of example func1")) (define (example-func2) (prefixln "start of example func2") (prefixln "end of example func2")) (module+ main (displayln "Hello checkout these values:") (define example-values (hash 'foo 123 'this-is-a-long-key "some value" 'blabla #f "cake" "is a lie")) ;; ugly oneliner to calculate prefix width (current-prefix-length (+ 2 (foldl max 0 (map (compose1 string-length ~a) (hash-keys example-values) (for ([(k v) (in-hash example-values)]) ;; probably sorting or assoc list would make sense too... (prefixln #:prefix (~a k ": ") #:align 'right v)) (current-prefix-length 0) (displayln "") (displayln "indentation through multiple nested calls:") (with-indent (example-func1))) If you use a current-prefix-string parameter instead you can create other interesting things like lines indented with indentation level indicators, etc.: indent0 | indent1 | | indent2 | indent1 indent0 But I am getting too off-topic... Simon david@gmail.com schrieb am Mittwoch, 8. September 2021 um 15:41:56 UTC+2: > raise-arguments-errors produces neatly stacked key/value pairs with > whitespace arranged such that values line up even when keys are of > different lengths. Is there an easy way to get that for something that is > not an error? I've been through both The Printer and the > raise-arguments-error sections in the Reference and can't find anything. > > For example: > > (doit "x" 1 "foo" 2 "super" 3) > > Returns the string "x 1\nfoo 2\super 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. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/de65e4a2-7cd3-4347-949f-d8a1f457961en%40googlegroups.com.
Re: [racket-users] Re: Is there a way to format keys/values like raise-arguments-error
I like the apply max instead of foldl, quite a bit easier. Instead of `(format "\t~a" (~a (~a k #:width width) v #:separator "\t"))` I prefer one of these: (~a "\t" (~a k #:width width) "\t" v) (~a #:separator "\t" "" (~a k #:width width) v) -- 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/d652f06d-81ed-4a5c-983c-d1716f838a38n%40googlegroups.com.
Re: the end of the [racket-users] mailing list and the migration to Discourse as a forum for Racket
I searched for "Etan Wexler" on google groups and found other older messages, but they seem more normal, human written. But I can't quite decide whether this latest message is human art, or maybe ai art / an ai or a bot conversing. What I find strange is the repetitions within the text, but that might be an "intentional" choice, whether human or AI. Interestingly Discourse is mistyped as Discursive, I didn't know that word as non-native speaker, it means to digress / "to wander from the subject" and the text seems to do that. So that could both be a human using irony or an AI seeing it as an prompt to do that. While the message reminds me of early videos I saw about GPT-2 and AI generated texts, within the context of the other messages I am not really sure. The earlier messages make me think, the text is written by a human that likes word puzzles and experimenting with different styles of expression, without leaving an explanation of what is actually meant. I guess we are reaching a point were we can't be sure anymore whether there is a human typing anymore. I also wonder whether all captchas are completely useless by now. At least videos like this make me think that is the case: OpenAI GPT-3 - Good At Almost Everything! 🤖 https://www.youtube.com/watch?v=_x9AwxfjxvE I guess we will have to wait and see, whether there will be other messages. Simon dexte...@gmail.com schrieb am Dienstag, 23. November 2021 um 09:12:25 UTC+1: > This is by far the strangest message I've ever read about Racket. It > comes a close second to that all-caps spam we get constantly on the mailing > list! I'd pay good money to know what's written between the lines. It > sounds like really, really passive-aggressive. > > Dex > > On Monday, November 22, 2021 at 3:55:08 PM UTC+1 johnbclements wrote: > >> I’m … super confused by this message. Did I miss something? I feel like >> this message has a subtext that I’m completely missing. >> >> John >> >> > On Nov 22, 2021, at 08:06, Etan Wexler wrote: >> > >> > The stewards of Racket have decided that it’s time to give up on the >> mailing list (that is, racket-users, to which this message is a >> contribution). The stewards of Racket have designated another forum for >> Racket as the successor to racket-users. This other forum for discussing >> Racket has as its basis the software named “Discourse”, which is >> open‐source. Enlisting is prerequisite to contributing to the Discursive >> forum for Racket. Enlisting is prerequisite to receiving as Internet mail >> the contributions to the Discursive forum for Racket. The stewards of >> Racket have published a facility for enlisting as a participant in the >> Discursive forum for Racket. >> > >> >> -- 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/bef44030-ad55-44b2-ab39-ae82df9bf95fn%40googlegroups.com.