[racket-users] Simple macro issues

2019-09-08 Thread Simon Haines
I'm trying to write a macro that will turn a list of hex literals into a byte string. (hex a b c 1 2 3) ; #"\n\v\f\1\2\3" After many hours I have finally come up with this: #lang racket (define-syntax hex (syntax-rules () [(_ num ...) (bytes (let ([e (syntax-e #'num)])

Re: [racket-users] Simple macro issues

2019-09-08 Thread Simon Haines
Thanks Sorawee, So what is 'num' inside define-syntax-rule if not a syntax object? And why did my earlier attempt create a macro that tried to evaluate its arguments? In other words, what are the steps I need to take, or the realisations I need to make, to work back from "a: unbound identifier

Re: [racket-users] Simple macro issues

2019-09-08 Thread Sorawee Porncharoenwase
This works for me: #lang racket (define (hex:char x) (if (number? x) x (string->number (symbol->string x) 16))) (define-syntax-rule (hex num ...) (bytes (hex:char (quote num)) ...)) (hex a b c 1 2 3) ; #"\n\v\f\1\2\3" It’s almost always a mistake to use a function that

Re: [racket-users] [OT] Cities and GPS

2019-09-08 Thread Laurent
Nice :) On Sat, Sep 7, 2019 at 2:00 AM Alex Harsanyi wrote: > In fact, I updated the data frame package to be able to read the CSV file > directly, without having to process it, so the example now becomes: > > #lang racket > (require data-frame) > > (define df (df-read/csv "worldcities.csv"

Re: [racket-users] [OT] Cities and GPS

2019-09-08 Thread Laurent
This DB is even better: http://download.geonames.org/export/ On Sun, Sep 8, 2019 at 8:34 AM Laurent wrote: > Nice :) > > > On Sat, Sep 7, 2019 at 2:00 AM Alex Harsanyi > wrote: > >> In fact, I updated the data frame package to be able to read the CSV file >> directly, without having to

RE: [racket-users] transparency of structs?

2019-09-08 Thread jos.koot
Thanks, make-sibling-inspector does what I want. Jos -Mensaje original- De: Ben Greenman Enviado el: 08 September 2019 01:20 Para: jos.k...@gmail.com CC: Racket Users Asunto: Re: [racket-users] transparency of structs? I see the same results on Racket 7.0 and 6.5, so I don't think

[racket-users] Applicable sets and hashes?

2019-09-08 Thread Maciek Godek
Hi, is it possible to take Racket's hash tables and sets, and make them applicable (like in Clojure)? So that, for example (#hash((a . 1) (b . 2)) 'a) would be equivalent to (hash-ref #hash((a . 1) (b . 2)) 'a) and ((set 1 2 3) 1) would be equivalent to (set-member? (set 1 2 3) 1) --

Re: [racket-users] Applicable sets and hashes?

2019-09-08 Thread Ricardo Herdt
Hi Maciek, yes, it is. Take a look at rackjure: https://docs.racket-lang.org/rackjure/index.html#(part._dict-app) Regards, Ricardo Am 08.09.2019 11:51 schrieb Maciek Godek: Hi, is it possible to take Racket's hash tables and sets, and make them applicable (like in Clojure)? So that, for

[racket-users] On multilanguage programming

2019-09-08 Thread Hendrik Boom
I found an interesting document on the STEPS project, presenting the astonishing benefits of clever design and the use and improvisation of many, many programming languages in one project. http://www.vpri.org/pdf/tr2012001_steps.pdf -- hendrik (found in a document list

Re: [racket-users] Applicable sets and hashes?

2019-09-08 Thread Maciek Godek
Great, thanks! W dniu niedziela, 8 września 2019 11:57:47 UTC+2 użytkownik ricardo.g.herdt napisał: > > Hi Maciek, > > yes, it is. Take a look at rackjure: > > https://docs.racket-lang.org/rackjure/index.html#(part._dict-app) > > Regards, > > Ricardo > > > Am 08.09.2019 11:51 schrieb Maciek