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 opti
> 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
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 opti
#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 p
> 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 rac
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
6 matches
Mail list logo