Re: [racket-users] From Clojure to Racket

2018-08-31 Thread Ben Greenman
+1, especially for the at-exp post -- 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

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

2018-08-31 Thread Matthew Butterick
> On Aug 31, 2018, at 4:14 PM, Alex Harsanyi wrote: > > Thanks for this solution, it works. While I understand what is being done, I > do not understand why it is necessary >From the docs: "The path is normally computed by taking a relative path result from expr and adding it to a path

Re: [racket-users] From Clojure to Racket

2018-08-31 Thread Ben Kovitz
On Thursday, August 23, 2018 at 3:48:03 PM UTC-4, Greg Hendershott wrote: > This is a bit rough and old but: > > https://github.com/greghendershott/racket-clojure-cheat-sheet > You are too modest! I found your blog, and it's definitely got the kind of information I'm looking for. For

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-statement`? > > > One

[racket-users] (eighth RacketCon) in St. Louis on September 29th & 30th - Early registration ends next week

2018-08-31 Thread Jay McCarthy
Remember that (eighth RacketCon) in St. Louis on September 29th & 30th http://con.racket-lang.org The early registration will end week. http://con.racket-lang.org The schedule of speakers and events is up. http://con.racket-lang.org We hope to see you all there! Tell your friends!

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

2018-08-31 Thread Matthias Felleisen
#lang racket (require racket/runtime-path db (for-syntax racket/base syntax/parse)) (define-syntax (define-sql-statement stx) (syntax-parse stx [(_ name #;path) (define location (syntax-source #'name)) (define-values (path file _) (split-path location)) (with-syntax ([path

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

2018-08-31 Thread Matthew Butterick
> 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-statement`? One option, using `syntax-source` to get the starting directory: #lang racket (require

Re: [racket-users] Using match on hash tables with optional keys

2018-08-31 Thread David Storrs
Summary of the thread: "Hey, here's this thing I'd like to do. Is there a way to do it?" T = : "Nope. Here's some suggestions, though." T = 22 hours: "Here, let me add that feature to the language." Man, I love this community. Thank you to everyone. On Fri, Aug 31, 2018 at 5:46 AM, Ryan

[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 match on hash tables with optional keys

2018-08-31 Thread Ryan Culpepper
On 8/31/18 4:28 AM, Greg Hendershott wrote: A general trick for optional values with match is something like (or pat (app (λ _ default-value) pat)). But that doesn't work for hash-table which uses [pat path] for each mapping. (At least I couldn't see how.) Here's _a_ way you could write this as