Re: [racket-users] processing calling-site identifiers with a macro

2016-04-24 Thread Alex Knauth
> On Apr 24, 2016, at 7:21 PM, Matthew Butterick wrote: > > This probably has an obvious answer in the syntax library but the problem is > new to me. > > The `definer-macro` below wants to bind identifiers that have been introduced > at the caller site. Case 1 works as

Re: [racket-users] processing calling-site identifiers with a macro

2016-04-24 Thread Matthias Felleisen
>From the hip: Can your name-producing macro consume (val-producing-macro) and >then just directly generate the case-2 macro call directly: #lang racket (require rackunit) (define-syntax-rule (definer-macro ids vals) (match-define ids vals)) (define-syntax-rule (val-producing-macro) (list 1

[racket-users] processing calling-site identifiers with a macro

2016-04-24 Thread Matthew Butterick
This probably has an obvious answer in the syntax library but the problem is new to me. The `definer-macro` below wants to bind identifiers that have been introduced at the caller site. Case 1 works as expected. But consider case 2, where another macro picks up identifiers from the calling

Re: [racket-users] Alternative to interfaces/type classes in Typed Racket

2016-04-24 Thread Matthias Felleisen
Yes, that’s what I meant. But beware! This is a quasi OO style. — Matthias p.s. In plain Racket, structs serve as an opaque carrier of values. > On Apr 24, 2016, at 1:56 PM, Benjamin Greenman > wrote: > > > On Sun, Apr 24, 2016 at 1:47 PM, Daniel Karch

Re: [racket-users] Alternative to interfaces/type classes in Typed Racket

2016-04-24 Thread Benjamin Greenman
On Sun, Apr 24, 2016 at 1:47 PM, Daniel Karch wrote: > how this could be done with structures One way is to consider the struct definition as an interface. Then different values can implements the same interface & be used in a uniform way. Here's a struct that I used as

Re: [racket-users] Alternative to interfaces/type classes in Typed Racket

2016-04-24 Thread Matthias Felleisen
> On Apr 24, 2016, at 9:05 AM, Daniel Karch wrote: > > Hi, > > I recently started learning Racket and like it so far. Since I very much > prefer statically typed languages, I am leaning towards Typed Racket. > > In a small program I am writing I would like to have a

[racket-users] Alternative to interfaces/type classes in Typed Racket

2016-04-24 Thread Daniel Karch
Hi, I recently started learning Racket and like it so far. Since I very much prefer statically typed languages, I am leaning towards Typed Racket. In a small program I am writing I would like to have a function that accepts a value of an abstract type and then calls a function on that type

Re: [racket-users] hash-clear*

2016-04-24 Thread Damien Mattei
On Sunday, April 24, 2016 at 12:15:23 PM UTC+2, Ben Greenman wrote: > I think you want hash-clear! because I think you're using a mutable hashtable. > > > hash-clear! is for mutable hashtables (built with make-hash, added to with > hash-add!) and returns void after it updates its argument >

Re: [racket-users] hash-clear*

2016-04-24 Thread Benjamin Greenman
I think you want hash-clear! because I think you're using a mutable hashtable. hash-clear! is for mutable hashtables (built with make-hash, added to with hash-add!) and returns void after it updates its argument hash-clear is for immutable hashes (build with hash or for/hash, added to with

[racket-users] hash-clear*

2016-04-24 Thread Damien Mattei
hi, what is the best way to clear a hash table, hash-clear or hash-clear! ? if the hash-table is defined in a code at top-level and used in functions as a global variable, the issue i have is that when at REPL i use a first time my function (that use hash-table) it's ok but when i reuse the