Re: [racket-users] Re: Pretty display of tabular data?
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. > > https://bitbucket.org/jadudm/tbl/ > > (I'll add Github as a second push destination shortly.) > > There's a story about how I'm at the point of writing this library. > There are now several projects announced on this list, all of them deal with data analysis on one way or the other. Would it be possible to join forces and merge these projects so that we end up with one library that servers multiple purposes equally well? Something where the final product is greater than the sum of its parts... Or perhaps these libraries have aims that are so different from each other that the only thing they share is a very abstract concept of "table"? Alex. -- 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: Pretty display of tabular data?
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. https://bitbucket.org/jadudm/tbl/ (I'll add Github as a second push destination shortly.) There's a story about how I'm at the point of writing this library. The short version is that I would like to be able to do simple exploratory data analysis with relatively small data in simple ways. The word "simple" is grossly loaded in this context, so I'll just say that I want a library that supports introductory exploratory data analysis in an HtDP context, and I want it to have a pedagogic growth path, so that if students go off to use Python/NumPy/SciPy, or R/Tidyverse (or, horrors, plain R), then they've had the conceptual base to know what they want to do, even if the syntax, semantics, and learning materials are against them. This was a first dive into starting to think seriously about syntax-case and syntax-parse, and that probably led me down roads that were not entirely productive. I did a lot of implementation work as I explored. In the last few days, I threw out 3000 lines of exploration, and rewrote it in 300, much more of which is tests. In particular, I decided that everything I wanted to do could be handled by an in-memory SQLite database, I could leverage Ryan's excellent 'sql' library, and in doing, effectively design a small "language" (API? interface? perhaps someday a #lang?) that wraps operations on that data. However, the design of that is subject to discussion and debate, and it might be that the library ultimately encapsulates more than one interface, so that different kinds of data questions can be asked differently. So, the abstractive lift of using db/sql was huge, and I also like rackunit/chk. I'm also wrapping some parts of plot, so that I can have really, really short pathways to investigating data. It's early days on the pieces (which, in the rewrite, I sprinted based depth to instead stitch a complete pipeline in the name of proof-of-concepting the choice to backend to SQLite). Wrapping everything under a single require, etc., hasn't happened yet, testing is reasonably underway, and documentation on the rewrite is currently lagging. #lang racket (require tbl/reading/gsheet tbl/plot) ;; The source Google Sheet: http://bit.ly/cities-gsheet ;; read-gsheet takes a version published/shared as a CSV (define T (read-gsheet "http://bit.ly/cities-csv";)) (show (scatter T "LonD" "LatD")) These two lines let me read in a CSV published via Google Sheets, and get a scatterplot in DrRacket. So, that's a long story. However, I'd welcome dialogue. I may come back with some specific questions. For the moment, I'm exploring. I had (and will have again) the ability to slurp in SQL databases (SQLite, MySQL, etc.), I currently do CSV files, and would like to output a number of these formats as well. In terms of plotting, I'd like to support basics (think early chapters of Tukey) with some customization, but ultimately know that I can always drop down to full 'plot' if I need to. The output of the table question is so that students can have a richer view into the tables they're working with. A lot of good pointers were in this thread. That's long, but there you go. That's the story. A short version may be "I'm standing on the shoulders of giants," because the rewrite feels like a wrapper around sql and db... which, frankly, is lovely. (And, I'm almost starting to understand how to use the various quasiquoting syntactic forms in the sql language to build my own frankensteined queries...) Cheers, M On Wed, Mar 13, 2019 at 4:59 PM wrote: > I've wanted this too, and got the sense that working with `snip%` instead > of `gen:custom-write` was 1) the way to go and 2) very difficult. Are you > planning on using this in some open source code you have right now in a > github repo or something similar? I'd like to bookmark it. > > On Wednesday, March 13, 2019 at 11:19:07 AM UTC-7, Matt Jadud wrote: >> >> Hi all, >> >> I have a tabular data type that I'd like (I think) to be able to render >> it either in ASCII or in a prettier way in the Interactions pane. I've >> explored gen:write and friends, and can get the struct to display the way I >> want---with ASCII. Essentially easy-peasy. >> >> What I wonder is: am I able to do something prettier? Can I encapsulate >> some kind of styled rendering as a snip%, or... something... so that I can >> render the first 5 and last 5 rows of a table with bolding of headers, >> etc.? >> >> I don't know where to start, essentially, if I wanted to try and do this. >> Or, perhaps it is not particularly doable. >> >> Pointers to examples in codebases are welcome (if such examples exist), >> and I can work from there. Or, indications that this might be really >> difficult are also welcome. >> >> Cheers, >> Matt >> >> (Apologies if this someho
Re: [racket-users] Writing scribble?
I was going to say... is ESC-B some kind of shortcut from one of those "text editors" I hear people talk about? ;) (I should have remembered that DrR has bindings for many Emacs shortcuts...) Also, thanks for the reminder about the prefs/bindings; this is essentially the first time I've spent significant time poking at Scribble, and the shortcuts that are useful are different, so they're in my unlearned-space. I appreciate the pointers. Cheers, M On Wed, Mar 13, 2019 at 8:16 PM Robby Findler wrote: > It is control-left and control-right to go by words in DrRacket. If > you go to Edit|Keybindings|Show Active Keybindings and type "word" > you'll see those and the ones Matthias mentioned and some other > word-related keystrokes. > > Robby > > On Wed, Mar 13, 2019 at 1:24 PM Matt Jadud wrote: > > > > Hi all, > > > > I assume people use DrRacket to write Scribblings. > > > > I'll be writing text, and want to move back one word. On the Mac, most > of the time I can hit Option-LeftArrow, and I go back one word. > > > > I DrRacket, this takes me back an expression, which in Scribble is a > whole paragraph. > > > > Are there shortcuts for moving around Scribble documents that I don't > know? Do people use other tools to write Scribblings? > > > > Cheers, > > Matt > > > > -- > > 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] Writing scribble?
It is control-left and control-right to go by words in DrRacket. If you go to Edit|Keybindings|Show Active Keybindings and type "word" you'll see those and the ones Matthias mentioned and some other word-related keystrokes. Robby On Wed, Mar 13, 2019 at 1:24 PM Matt Jadud wrote: > > Hi all, > > I assume people use DrRacket to write Scribblings. > > I'll be writing text, and want to move back one word. On the Mac, most of the > time I can hit Option-LeftArrow, and I go back one word. > > I DrRacket, this takes me back an expression, which in Scribble is a whole > paragraph. > > Are there shortcuts for moving around Scribble documents that I don't know? > Do people use other tools to write Scribblings? > > Cheers, > Matt > > -- > 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.
[racket-users] Re: Pretty display of tabular data?
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 column-count (length (car items))) (define picts '()) (for (([row index] (in-indexed items))) (define font (if (= index 0) ;; header (send the-font-list find-or-create-font 12 'default 'normal 'normal) (send the-font-list find-or-create-font 10 'default 'normal 'normal))) (define color (if (= index 0) (make-object color% #x77 #x88 #x99) (make-object color% #x2f #x4f #x4f))) (define face (cons color font)) (for ([item (in-list row)]) (set! picts (cons (text (~a item) face) picts (let ((p0 (table column-count (reverse picts) lc-superimpose cc-superimpose 15 3))) (cc-superimpose (filled-rounded-rectangle (+ (pict-width p0) 20) (+ (pict-height p0) 20) -0.1 #:draw-border? #f #:color "LightYellow") p0))) Will produce [image: Capture.PNG] You can control how the text in the columns is aligned as well and gives you full flexibility on how each cell is displayed (it can be an arbitrary pict). The disadvantage is that the output is not interactive, and for large sets of data it is impractical, still, you can get really nice results for small amounts of data. A snip% would also be feasible, and this would allow to implement scrolling and other nice interactive features, but that is more of a weekend project, not a "before my morning coffee one" like the above code :-) Alex. On Thursday, March 14, 2019 at 2:19:07 AM UTC+8, Matt Jadud wrote: > > Hi all, > > I have a tabular data type that I'd like (I think) to be able to render it > either in ASCII or in a prettier way in the Interactions pane. I've > explored gen:write and friends, and can get the struct to display the way I > want---with ASCII. Essentially easy-peasy. > > What I wonder is: am I able to do something prettier? Can I encapsulate > some kind of styled rendering as a snip%, or... something... so that I can > render the first 5 and last 5 rows of a table with bolding of headers, > etc.? > > I don't know where to start, essentially, if I wanted to try and do this. > Or, perhaps it is not particularly doable. > > Pointers to examples in codebases are welcome (if such examples exist), > and I can work from there. Or, indications that this might be really > difficult are also welcome. > > Cheers, > Matt > > (Apologies if this somehow comes through twice... I sent it to plt-scheme > first...) > -- 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: Pretty display of tabular data?
I've wanted this too, and got the sense that working with `snip%` instead of `gen:custom-write` was 1) the way to go and 2) very difficult. Are you planning on using this in some open source code you have right now in a github repo or something similar? I'd like to bookmark it. On Wednesday, March 13, 2019 at 11:19:07 AM UTC-7, Matt Jadud wrote: > > Hi all, > > I have a tabular data type that I'd like (I think) to be able to render it > either in ASCII or in a prettier way in the Interactions pane. I've > explored gen:write and friends, and can get the struct to display the way I > want---with ASCII. Essentially easy-peasy. > > What I wonder is: am I able to do something prettier? Can I encapsulate > some kind of styled rendering as a snip%, or... something... so that I can > render the first 5 and last 5 rows of a table with bolding of headers, > etc.? > > I don't know where to start, essentially, if I wanted to try and do this. > Or, perhaps it is not particularly doable. > > Pointers to examples in codebases are welcome (if such examples exist), > and I can work from there. Or, indications that this might be really > difficult are also welcome. > > Cheers, > Matt > > (Apologies if this somehow comes through twice... I sent it to plt-scheme > first...) > -- 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] Writing scribble?
esc-b, esc-f > On Mar 13, 2019, at 2:24 PM, Matt Jadud wrote: > > Hi all, > > I assume people use DrRacket to write Scribblings. > > I'll be writing text, and want to move back one word. On the Mac, most of the > time I can hit Option-LeftArrow, and I go back one word. > > I DrRacket, this takes me back an expression, which in Scribble is a whole > paragraph. > > Are there shortcuts for moving around Scribble documents that I don't know? > Do people use other tools to write Scribblings? > > Cheers, > Matt > > -- > 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] Pretty display of tabular data?
I started with the good text-table library, but found I wanted more and more other drawing tools and ended up making something pict-like for the terminal. On Wed, Mar 13, 2019 at 2:26 PM Jay McCarthy wrote: > > 90% of the reason I made `raart` is because of this. > > https://docs.racket-lang.org/raart/index.html#%28def._%28%28lib._raart%2Fdraw..rkt%29._table%29%29 > > (require raart > (draw-here (table (text-rows THE-TABULAR-DATA))) > > Jay > > On Wed, Mar 13, 2019 at 2:19 PM Matt Jadud wrote: > > > > Hi all, > > > > I have a tabular data type that I'd like (I think) to be able to render it > > either in ASCII or in a prettier way in the Interactions pane. I've > > explored gen:write and friends, and can get the struct to display the way I > > want---with ASCII. Essentially easy-peasy. > > > > What I wonder is: am I able to do something prettier? Can I encapsulate > > some kind of styled rendering as a snip%, or... something... so that I can > > render the first 5 and last 5 rows of a table with bolding of headers, etc.? > > > > I don't know where to start, essentially, if I wanted to try and do this. > > Or, perhaps it is not particularly doable. > > > > Pointers to examples in codebases are welcome (if such examples exist), and > > I can work from there. Or, indications that this might be really difficult > > are also welcome. > > > > Cheers, > > Matt > > > > (Apologies if this somehow comes through twice... I sent it to plt-scheme > > first...) > > > > -- > > 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. > > > > -- > -=[ Jay McCarthy http://jeapostrophe.github.io]=- > -=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=- > -=[ Moses 1:33: And worlds without number have I created; ]=- -- -=[ Jay McCarthy http://jeapostrophe.github.io]=- -=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=- -=[ Moses 1:33: And worlds without number have I created; ]=- -- 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] Pretty display of tabular data?
Not sure how much this would help you, but there's a `text-table`package. It's fairly simple though. Docs: https://docs.racket-lang.org/text-table/index.html On Wed, Mar 13, 2019 at 6:19 PM Matt Jadud wrote: > Hi all, > > I have a tabular data type that I'd like (I think) to be able to render it > either in ASCII or in a prettier way in the Interactions pane. I've > explored gen:write and friends, and can get the struct to display the way I > want---with ASCII. Essentially easy-peasy. > > What I wonder is: am I able to do something prettier? Can I encapsulate > some kind of styled rendering as a snip%, or... something... so that I can > render the first 5 and last 5 rows of a table with bolding of headers, > etc.? > > I don't know where to start, essentially, if I wanted to try and do this. > Or, perhaps it is not particularly doable. > > Pointers to examples in codebases are welcome (if such examples exist), > and I can work from there. Or, indications that this might be really > difficult are also welcome. > > Cheers, > Matt > > (Apologies if this somehow comes through twice... I sent it to plt-scheme > first...) > > -- > 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] Pretty display of tabular data?
90% of the reason I made `raart` is because of this. https://docs.racket-lang.org/raart/index.html#%28def._%28%28lib._raart%2Fdraw..rkt%29._table%29%29 (require raart (draw-here (table (text-rows THE-TABULAR-DATA))) Jay On Wed, Mar 13, 2019 at 2:19 PM Matt Jadud wrote: > > Hi all, > > I have a tabular data type that I'd like (I think) to be able to render it > either in ASCII or in a prettier way in the Interactions pane. I've explored > gen:write and friends, and can get the struct to display the way I > want---with ASCII. Essentially easy-peasy. > > What I wonder is: am I able to do something prettier? Can I encapsulate some > kind of styled rendering as a snip%, or... something... so that I can render > the first 5 and last 5 rows of a table with bolding of headers, etc.? > > I don't know where to start, essentially, if I wanted to try and do this. Or, > perhaps it is not particularly doable. > > Pointers to examples in codebases are welcome (if such examples exist), and I > can work from there. Or, indications that this might be really difficult are > also welcome. > > Cheers, > Matt > > (Apologies if this somehow comes through twice... I sent it to plt-scheme > first...) > > -- > 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. -- -=[ Jay McCarthy http://jeapostrophe.github.io]=- -=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=- -=[ Moses 1:33: And worlds without number have I created; ]=- -- 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] Writing scribble?
Hi all, I assume people use DrRacket to write Scribblings. I'll be writing text, and want to move back one word. On the Mac, most of the time I can hit Option-LeftArrow, and I go back one word. I DrRacket, this takes me back an expression, which in Scribble is a whole paragraph. Are there shortcuts for moving around Scribble documents that I don't know? Do people use other tools to write Scribblings? Cheers, Matt -- 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] Pretty display of tabular data?
Hi all, I have a tabular data type that I'd like (I think) to be able to render it either in ASCII or in a prettier way in the Interactions pane. I've explored gen:write and friends, and can get the struct to display the way I want---with ASCII. Essentially easy-peasy. What I wonder is: am I able to do something prettier? Can I encapsulate some kind of styled rendering as a snip%, or... something... so that I can render the first 5 and last 5 rows of a table with bolding of headers, etc.? I don't know where to start, essentially, if I wanted to try and do this. Or, perhaps it is not particularly doable. Pointers to examples in codebases are welcome (if such examples exist), and I can work from there. Or, indications that this might be really difficult are also welcome. Cheers, Matt (Apologies if this somehow comes through twice... I sent it to plt-scheme first...) -- 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: Season of docs participation
It looks great, but I have a hard time understanding the gist of it. The rules are written in fine prints like the Terms of Service of an insurance company. What benefits does Google actually brings in that event? Couldn't we just make a campaign on our networks to ask students in summer vacation for help or something? Helping write documentation is becoming one of my main goal in Racket because I really enjoy writing doc (so every time I see a package that I want to use, but is not documented, I make a PR with some basic scribble files). So this looks like a great opportunity to get more people involved, but it looks like I'm missing something. Is Google paying for that time? Do they bring some "technical experts" as "mentor" or something? Is it something well known in the US? (that would explain I don't get a thing about the vocabulary used) -- 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.