Re: [racket-users] How to implement a hash function for different types?

2019-08-02 Thread Jon Zeppieri
On Sat, Aug 3, 2019 at 1:35 AM Jon Zeppieri  wrote:
>
> On Sat, Aug 3, 2019 at 12:52 AM Jesse Wang  wrote:
> >
> > If I want to turn the hash code into array index in a hash table, do I need 
> > to
> > apply another uniform hash function such as md5 on the result of 
> > equal-hash-code?
> >
>
> That wouldn't accomplish anything. [...]

Sorry! My response assumed that you're concerned with the hash codes
themselves colliding, but of course you're concerned about the codes
modulo the length of the table (or bit-masked) colliding. (I've been
thinking too much about immutable hashes lately, which aren't actually
hash tables.)

So, yes, applying a cryptographic hash function to the result could
help with this case, but at some point you need to consider whether
the improvement is worth the cost. Cryptographic hash functions are
usually a lot more expensive to compute than the hash functions
commonly used in hash tables.

---

I just saw your response. If you're concerned about performance, you
should try it out and measure. Collisions certainly do slow down hash
tables, but so do expensive hash functions. It's a trade-off.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAKfDxxwm2PqGKu-PWyd5TtqiCpJy%2BWVeAimAUkOU3dtJqMOKNg%40mail.gmail.com.


Re: [racket-users] How to implement a hash function for different types?

2019-08-02 Thread Jesse Wang


On Saturday, August 3, 2019 at 1:36:01 PM UTC+8, Jon Zeppieri wrote:
>
> On Sat, Aug 3, 2019 at 12:52 AM Jesse Wang  > wrote: 
> > 
> > If I want to turn the hash code into array index in a hash table, do I 
> need to 
> > apply another uniform hash function such as md5 on the result of 
> equal-hash-code? 
> > 
>
> That wouldn't accomplish anything. The defining feature of a function 
> is that the output depends solely on the input. Applying the same 
> function to colliding hash codes will get you more colliding hash 
> codes, only at a higher cost. 
>

I think you are right here.
 

>
> If you're going to implement your own hash tables instead of using the 
> ones that Racket provides, you can use whatever hash function you 
> want, but in that case you want to start with the key itself, not with 
> the result of Racket's hash function. Hash functions, by their very 
> nature, tend to discard information. If you start with the result of 
> Racket's hash functions, you're not going to be able to do better than 
> them. 


What I want is a uniform hash function for different types.
Racket's equal-hash-code seems to give non-uniform hash codes for different 
types
of primitive types, so I wonder how Racket achieves good performance in a
hash table with different primitive type keys at the same time...

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/fc2ded74-043e-413c-b1da-6b3a06837f8d%40googlegroups.com.


Re: [racket-users] How to implement a hash function for different types?

2019-08-02 Thread Jon Zeppieri
On Sat, Aug 3, 2019 at 12:52 AM Jesse Wang  wrote:
>
> If I want to turn the hash code into array index in a hash table, do I need to
> apply another uniform hash function such as md5 on the result of 
> equal-hash-code?
>

That wouldn't accomplish anything. The defining feature of a function
is that the output depends solely on the input. Applying the same
function to colliding hash codes will get you more colliding hash
codes, only at a higher cost.

If you're going to implement your own hash tables instead of using the
ones that Racket provides, you can use whatever hash function you
want, but in that case you want to start with the key itself, not with
the result of Racket's hash function. Hash functions, by their very
nature, tend to discard information. If you start with the result of
Racket's hash functions, you're not going to be able to do better than
them.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAKfDxxzKbh%3D80P7D10b-kxzky4QzkxU6WR_bR7jZDcSr_8dMLg%40mail.gmail.com.


Re: [racket-users] How to implement a hash function for different types?

2019-08-02 Thread Jesse Wang


On Saturday, August 3, 2019 at 9:52:28 AM UTC+8, Jon Zeppieri wrote:
>
> On Fri, Aug 2, 2019 at 9:37 PM Justin Zamora  > wrote: 
> > 
> > Racket doesn't implement hash tables using a hash function. If I 
> > recall correctly, it uses b-trees as the representation for a hash 
> > table.  The Racket reference states that "Immutable hash tables 
> > actually provide O(log N) access and update. Since N is limited by the 
> > address space so that log N is limited to less than 30 or 62 
> > (depending on the platform), log N can be treated reasonably as a 
> > constant." See. https://docs.racket-lang.org/reference/hashtables.html 
> > 
> > Justin 
> > 
> > On Fri, Aug 2, 2019 at 9:22 PM Jesse Wang  > wrote: 
> > > 
> > > Racket allows different types of keys in a single hash, so there must 
> be a hash function that works for different types(different primitive 
> types), I wonder how Racket implements this under the hood. 
> > > Also, If I want to implement a hash table which allows different types 
> of keys, how can I implement such a hash function in Racket? 
> > > 
> > > Thanks! 
> > > 
> > > -- 
>
>
> - Racket has both mutable and immutable hashes. Both use hash 
> functions -- both use the same hash functions, but these hash 
> functions take into account what kind of data they're called on. See 
>
> https://github.com/racket/racket/blob/master/racket/src/cs/rumble/hash-code.ss.
>  
>
> - Immutable hashes are implemented as hash array-mapped tries in 
> Racket "classic" and Patricia tries in Racket-on-Chez. 
> - There are equal?-, eqv?-, and eq?-based hashes (both mutable and 
> immutable). 
> - Each equivalence relation has a corresponding hash function. 
> (Actually equal? hash two corresponding hash functions: 
> equal-hash-code? and equal-secondary-hash-code?.) 
> - Struct types can provide their own implementations of equal?, 
> equal-hash-code, and equal-secondary-hash-code (see gen:equal+hash). 
> - So: the built-in hashes can be used with new data types. 
>


It seems for functions like equal-hash-code and eq-hash-code, different 
primitive type
have different rules for calculating the hash value, for example:

> (equal-hash-code 123)
123
> (equal-hash-code '123)
123
> (equal-hash-code "123")
115049109349
> (equal-hash-code 123.0)
1432682342767248795

the result hash values are not uniformly distributed.
If I want to turn the hash code into array index in a hash table, do I need 
to
apply another uniform hash function such as md5 on the result of 
equal-hash-code? 

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/0d0f42f8-0a5a-4039-8ce5-d999ab123bc3%40googlegroups.com.


[racket-users] Re: How to implement a hash function for different types?

2019-08-02 Thread Jesse Wang


On Saturday, August 3, 2019 at 9:22:16 AM UTC+8, Jesse Wang wrote:
>
> Racket allows different types of keys in a single hash, so there must be a 
> hash function that works for different types(different primitive types), I 
> wonder how Racket implements this under the hood.
> Also, If I want to implement a hash table which allows different types of 
> keys, how can I implement such a hash function in Racket?
>
> Thanks!
>

It seems for functions like equal-hash-code and eq-hash-code, different 
primitive type
have different rules for calculating the hash value, for example:

> (equal-hash-code 123)
123
> (equal-hash-code '123)
123
> (equal-hash-code "123")
115049109349
> (equal-hash-code 123.0)
1432682342767248795

the result hash values are not uniformly distributed.
If I want to turn the hash code into array index in a hash table, do I need 
to
apply another uniform hash function such as md5 on the result of 
equal-hash-code?

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/eea3bd1a-7a4f-48fe-97e0-ba65738a7ae1%40googlegroups.com.


[racket-users] Location of included text

2019-08-02 Thread Hendrik Boom
On Fri, Aug 02, 2019 at 10:07:05PM +0200, Jens Axel Søgaard wrote:
> Den tor. 1. aug. 2019 kl. 13.25 skrev Hendrik Boom :
> 
> > (2) When I use include-section from the main file, the actual text in
> > the main file appears first, and the included files are all saved up ane
> > emitted after the text in the main file.  I expected the sections to be
> > included where the include-section command was instead of being saved to
> > the end.
> >
> 
> Here is a typical example of how include-section is intended to be used:
> 
> https://github.com/racket/scribble/blob/master/scribble-doc/scribblings/scribble/internals.scrbl
> 
> 
> The "main" file doesn't do anything, but use include other sections.
> So a "solution" is to move the text you have in your main file into a
> separate file.
> 
> And because I was curious, I looked up the defintion of  include-section:
> 
> (define-syntax (include-section stx)
>   (syntax-case stx ()
> [(_ mod)
>  (with-syntax ([doc-from-mod (datum->syntax #'mod 'doc)])
>(unless (module-path? (syntax->datum #'mod))
>  (raise-syntax-error #f "not a module path" stx #'mod))
>#'(begin
>(require (only-in mod [doc-from-mod doc]))
>doc))]))
> 
> So it does nothing but requiring the scribble file (which is a module
> exporting  doc-from-mod).
> It's renamed on import (because we might need to include several documents).
> Then it is simply inserted into the document at the place  include-section
> is used.

Which makes it all the more puzzling why the included text appears to 
float to the end.  See the small test case I posted earlier in this 
thread.

-- hendrik

> 
> /Jens Axel

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20190803035812.smicokmtdr2r737n%40topoi.pooq.com.


Re: [racket-users] How to implement a hash function for different types?

2019-08-02 Thread Jon Zeppieri
On Fri, Aug 2, 2019 at 9:37 PM Justin Zamora  wrote:
>
> Racket doesn't implement hash tables using a hash function. If I
> recall correctly, it uses b-trees as the representation for a hash
> table.  The Racket reference states that "Immutable hash tables
> actually provide O(log N) access and update. Since N is limited by the
> address space so that log N is limited to less than 30 or 62
> (depending on the platform), log N can be treated reasonably as a
> constant." See. https://docs.racket-lang.org/reference/hashtables.html
>
> Justin
>
> On Fri, Aug 2, 2019 at 9:22 PM Jesse Wang  wrote:
> >
> > Racket allows different types of keys in a single hash, so there must be a 
> > hash function that works for different types(different primitive types), I 
> > wonder how Racket implements this under the hood.
> > Also, If I want to implement a hash table which allows different types of 
> > keys, how can I implement such a hash function in Racket?
> >
> > Thanks!
> >
> > --


- Racket has both mutable and immutable hashes. Both use hash
functions -- both use the same hash functions, but these hash
functions take into account what kind of data they're called on. See
https://github.com/racket/racket/blob/master/racket/src/cs/rumble/hash-code.ss.
- Immutable hashes are implemented as hash array-mapped tries in
Racket "classic" and Patricia tries in Racket-on-Chez.
- There are equal?-, eqv?-, and eq?-based hashes (both mutable and immutable).
- Each equivalence relation has a corresponding hash function.
(Actually equal? hash two corresponding hash functions:
equal-hash-code? and equal-secondary-hash-code?.)
- Struct types can provide their own implementations of equal?,
equal-hash-code, and equal-secondary-hash-code (see gen:equal+hash).
- So: the built-in hashes can be used with new data types.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAKfDxxziv4rx0Rpb1yo%3D_ssTBWrrFh0gOGvDVxVsO_fQ-db6Ng%40mail.gmail.com.


Re: [racket-users] How to implement a hash function for different types?

2019-08-02 Thread Justin Zamora
Racket doesn't implement hash tables using a hash function. If I
recall correctly, it uses b-trees as the representation for a hash
table.  The Racket reference states that "Immutable hash tables
actually provide O(log N) access and update. Since N is limited by the
address space so that log N is limited to less than 30 or 62
(depending on the platform), log N can be treated reasonably as a
constant." See. https://docs.racket-lang.org/reference/hashtables.html

Justin

On Fri, Aug 2, 2019 at 9:22 PM Jesse Wang  wrote:
>
> Racket allows different types of keys in a single hash, so there must be a 
> hash function that works for different types(different primitive types), I 
> wonder how Racket implements this under the hood.
> Also, If I want to implement a hash table which allows different types of 
> keys, how can I implement such a hash function in Racket?
>
> Thanks!
>
> --
> 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.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/ad183814-d9f1-454b-b1a2-d1a9b394f49d%40googlegroups.com.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CA%2B80D0W3sAX0h-QQvZ-6tiZZo6QFzNZNOGxxYhGHJ07LhtPVwQ%40mail.gmail.com.


[racket-users] How to implement a hash function for different types?

2019-08-02 Thread Jesse Wang
Racket allows different types of keys in a single hash, so there must be a 
hash function that works for different types(different primitive types), I 
wonder how Racket implements this under the hood.
Also, If I want to implement a hash table which allows different types of 
keys, how can I implement such a hash function in Racket?

Thanks!

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/ad183814-d9f1-454b-b1a2-d1a9b394f49d%40googlegroups.com.


[racket-users] Re: possible bug related to syntax-shift-phase-level

2019-08-02 Thread Yongming Shen
Got my answer from another 
discussion: 
https://groups.google.com/d/msg/racket-users/qW-NZN2pwgk/y309YUwqEwAJ


On Saturday, July 27, 2019 at 12:56:33 AM UTC-4, Yongming Shen wrote:
>
> Hi,
>
> It seems that after an identifier has been shifted 
> by syntax-shift-phase-level, the original identifier can bind the shifted 
> identifier, but not the other way around. I think the correct behavior is 
> that neither should bind the other. The following code can be used to test 
> this.
>
> (define-syntax bind-test0
>
>   (lambda (stx)
>
> (define id #'x)
>
> (define shifted-id (syntax-shift-phase-level id -1))
>
> (syntax-case stx ()
>
>   [(_ e)
>
> #`(let ([#,id e])
>
>  (displayln #,shifted-id))])))
>
>
> (define-syntax bind-test1
>
>   (lambda (stx)
>
> (define id #'x)
>
> (define shifted-id (syntax-shift-phase-level id -1))
>
> (syntax-case stx ()
>
>   [(_ e)
>
> #`(let ([#,shifted-id e])
>
>  (displayln #,id))])))
>
>
> (bind-test0 100) would display 100, but (bind-test1 100) would raise an 
> error. I'm new to Racket, so if this is in fact the correct behavior, a 
> pointer to some related documentation would be appreciated.
>
>
> Thanks,
>
> Yongming
>
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/4a31b9c2-7fcf-4bec-bfc3-3aaa44df1cc3%40googlegroups.com.


Re: [racket-users] a question related to bound-identifier=?

2019-08-02 Thread Yongming Shen
I see. Thank you for the clear and detailed explanation!

On Friday, August 2, 2019 at 8:37:15 AM UTC-4, Matthew Flatt wrote:
>
> This is certainly confusing. 
>
> The missing piece of the puzzle has to do with expansion in an 
> immediate module body. In that context, the macro expander adds the 
> module's "inside-edge" scope (unshifted) to the result of any macro 
> expansion. So, the expander is adding back the inside-edge scope that 
> is effectively removed by phase shifting in `bind-test0`. 
>
> If you use `bind-test0` in a more nested position, then it behaves the 
> way you expected: 
>
>  (let () 
>(bind-test0 5)) 
>
>
> The addition of an inside-edge scope by the expander is the same as for 
> an internal definition context. See sections 1.2.3.8 and 1.2.3.9 in the 
> reference: 
>
>
> https://docs.racket-lang.org/reference/syntax-model.html?q=internal%20definition#%28part._intdef-body%29
>  
>
> The idea behind the inside-edge scope addition is to ensure that any 
> binding form that appears as during an expansion is constrained to bind 
> within the definition scope (i.e., not establish a binding for some 
> arbitrary other context). The affect on the `let` binding here seems 
> like an unfortunate side effect of the way that constraint is 
> implemented. 
>
> At Mon, 29 Jul 2019 14:05:01 -0700 (PDT), Yongming Shen wrote: 
> > I think I found a case where id-a binds id-b when (would-bind? id-a 
> id-b) 
> > returns #f: 
> > 
> > (define-syntax bind-test0 
> > 
> >   (lambda (stx) 
> > 
> > (define id #'x) 
> > 
> > (define shifted-id (syntax-shift-phase-level id -1)) 
> > 
> > (displayln (would-bind? id shifted-id)) 
> > 
> > (syntax-case stx () 
> > 
> >   [(_ e) 
> > 
> > #`(let ([#,id e]) 
> > 
> >  (displayln #,shifted-id))]))) 
> > 
> > (bind-test0 100) would print #f then 100. However, if shifted-ld and id 
> are 
> > swapped in (let ...), an undefined identifier error will be raised, 
> which 
> > is consistent with the return value of (would-bind? ...). Is there a bug 
> in 
> > how (let ...) handles identifiers with shifted phase levels? 
> > 
> > Thanks, 
> > Yongming 
> > 
> > 
> > On Friday, July 26, 2019 at 7:07:49 AM UTC-4, Matthew Flatt wrote: 
> > > 
> > > At Thu, 25 Jul 2019 18:55:18 -0700 (PDT), Yongming Shen wrote: 
> > > > Based on my understanding, (bound-identifier=? id-a id-b) only 
> returns 
> > > true 
> > > > if id-a would bind id-b AND id-b would bind id-a. Also based on my 
> > > > understanding, id-a will bind id-b doesn't imply that id-b will bind 
> > > id-a. 
> > > > So, if I only want to check whether id-a will bind id-b, which 
> function 
> > > > should I use? 
> > > 
> > > There's not a predicate like that right now (I guess only because we 
> > > haven't needed it). 
> > > 
> > > Here's one way to implement the predicate: 
> > > 
> > >  (define (would-bind? a b) 
> > >(subset? (list->set (hash-ref (syntax-debug-info a) 'context)) 
> > > (list->set (hash-ref (syntax-debug-info b) 'context 
> > > 
> > > A built-in operation would work the same way, except that it could be 
> > > more efficient by not serializing scopes to a list in debugging 
> > > information and then converting the list back to a set. 
> > > 
> > > 
> > > Matthew 
> > > 
> > > 
> > 
> > -- 
> > 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...@googlegroups.com . 
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/racket-users/b1a999bb-cc3a-4da8-ae31-11e5a3bf
>  
> > f7d6%40googlegroups.com. 
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/b38e0132-4f62-4baa-8970-c07bdbc7f038%40googlegroups.com.


Re: [racket-users] Re: Racket2 possibilities

2019-08-02 Thread Yongming Shen
I don't mind the parentheses. But I think Racket is kind of bloated and 
fragmented (I'm new to Racket, but this is the impression that I got so 
far). There are a lot of forms that are doing similar but slightly 
different things (e.g., the many let forms), and features that are not well 
integrated (the OO system comes to mind). I think it is amazing that all 
the features and forms that Racket provides can be reduced to a small set 
of core forms, but programmers don't write programs in the core forms, and 
I think it is the responsibility of the language designer to carefully 
craft a small set of forms and features that a programmer can use directly 
to solve most of the "ordinary programming problems" productively. 
Otherwise, personal extensions will flourish, and the ecosystem will be 
unnecessarily fragmented.

On Friday, August 2, 2019 at 6:44:41 AM UTC-4, Hendrik Boom wrote:
>
> On Fri, Aug 02, 2019 at 01:49:23AM -0700, Yongming Shen wrote: 
> > On the topic of making Racket 2 more appealing to new users. As a new 
> user 
> > myself, I have one (likely uninformed) suggestion: 
> > 
> > Design and promote a "boring core subset" that an experienced programmer 
> > can pick up easily and be as productive as when using an "ordinary 
> > programming language", without writing any macros. Macros are awesome, 
> > language-oriented programming is also awesome, if Racket 2 without them 
> can 
> > be as appealing (minus third-party library aspects) to programmers as 
> > Python/Ruby/Go/..., then Racket 2 plus them will certainly win hearts. 
>
> If you ignore the ability to define macros, isn't Racket already more 
> or less what you propose?  Except, perhaps, for all the parentheses? 
>
> -- hendrik 
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/ddbbb0d0-89b5-4738-8eda-dc5dccdb6581%40googlegroups.com.


Re: [racket-users] Unwelcome surprises using Scribble on a 90,000-word novel

2019-08-02 Thread Jens Axel Søgaard
Den tor. 1. aug. 2019 kl. 13.25 skrev Hendrik Boom :

> (2) When I use include-section from the main file, the actual text in
> the main file appears first, and the included files are all saved up ane
> emitted after the text in the main file.  I expected the sections to be
> included where the include-section command was instead of being saved to
> the end.
>

Here is a typical example of how include-section is intended to be used:

https://github.com/racket/scribble/blob/master/scribble-doc/scribblings/scribble/internals.scrbl


The "main" file doesn't do anything, but use include other sections.
So a "solution" is to move the text you have in your main file into a
separate file.

And because I was curious, I looked up the defintion of  include-section:

(define-syntax (include-section stx)
  (syntax-case stx ()
[(_ mod)
 (with-syntax ([doc-from-mod (datum->syntax #'mod 'doc)])
   (unless (module-path? (syntax->datum #'mod))
 (raise-syntax-error #f "not a module path" stx #'mod))
   #'(begin
   (require (only-in mod [doc-from-mod doc]))
   doc))]))

So it does nothing but requiring the scribble file (which is a module
exporting  doc-from-mod).
It's renamed on import (because we might need to include several documents).
Then it is simply inserted into the document at the place  include-section
is used.

/Jens Axel

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CABefVgzTcXRy-fzdVMeDpyuUEn3qX6BP3T6keprpD_Sc8oBhYQ%40mail.gmail.com.


Re: [racket-users] Unwelcome surprises using Scribble on a 90,000-word novel

2019-08-02 Thread Benjamin Yeung
On Fri, Aug 2, 2019 at 12:22 PM Hendrik Boom  wrote:
>
> On Fri, Aug 02, 2019 at 10:46:26AM -0400, Benjamin Yeung wrote:
> >
> > On Thu, Aug 1, 2019 at 7:25 AM Hendrik Boom  wrote:
> > >
> > > (1) Some of the @ commands I use are intended to cause conditional
> > > inclusion of their contents, dependong on a command-line arameter (which
> > > haven't yet implemented in scribble.  This is so I can keep my athor's
> > > notes about the text in the text itself, read them while looking at
> > > drafts, but have them removed for the final reader's copy.
> > >
> > > I've tested this by defining one of these operations (@snip) to delete
> > > all its contents all of the time, and that works.  (Command line
> > > dependence will come later).
> > >
> > > But it is not possible to snip out entire sections.  In particular,
> > >@snip{
> > >   @include-section{"author-only-section.scrbl"}
> > >}
> > > fails, complaining that there's a nested require.
> > >
> > > Is there some way around this?
> > >
> >
> > "Wrap" the "author-only-section.scrbl" material in a little bit of 
> > packaging:
> >
> > #lang scribble/base
> > @(provide author-only-section)
> >
> > @(define author-only-section
> > @section{ @; Or a different structure/block as appropriate
> > This is the content of the author-only-section.
> > })
>
> Would this mean that the author-only-section could not itself have
> other @include-sections within it, being nested within a define?  A
> minor flaw in my case, because I don't actually do that.  And I could
> use the same mechanism if I needed to.

Yes, that's one of the drawbacks of this way of addressing your issue.
Another is that if you change this from a section to a subsection (or
otherwise change the depth), you need to be careful about modifying
the optional file accordingly.

I hope this accomplishes what you need!

Benjamin Yeung

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAL%2BBSUL6iQ%3D0SeSTgUNqMYfG_fb1KZA0eDJSWSdXrFbjqfur-w%40mail.gmail.com.


[racket-users] Scribble text included out of order

2019-08-02 Thread Hendrik Boom
On Thu, Aug 01, 2019 at 07:41:46AM -0400, Benjamin Lerner wrote:
> On 8/1/19 7:25 AM, Hendrik Boom wrote:

> 
> > (2) When I use include-section from the main file, the actual text in
> > the main file appears first, and the included files are all saved up ane
> > emitted after the text in the main file.  I expected the sections to be
> > included where the include-section command was instead of being saved to
> > the end.
> > 
> > Is there some way to force immediate rather than deferred inclusion?
> > Text that is intended to frame a section, before and after, no
> > longer does.  The only way around this seems to be to put the after-text
> > into the section itself, which is *not* the structure I want.
> 
> How are you invoking scribble? If you’re using the |-html| argument (rather
> than |-htmls|) or |-pdf|, I think it should be producing a single file in
> the manner you expect, /unless/ you have sectioning commands in the included
> file, in which case I’m not sure what it does.

So I made a small case that exhibits this.  Presumably I'm doing 
something wrong if no one else has this problem.

Main file testmain.scrbl:

#lang scribble/base

foo
foo

@include-section["testsect.scrbl"]


bar bar


Section testsect.scrbl:

#lang scribble/base

onion
soup


The command to run scribble:

scribble testmain.scrbl


The resulting testmain.html file read in firefox and cut and pasted 
into this email:

foo foo

bar bar
1 

onion soup


Of course there's also a sidebar -- a table of contents with ??? 
instead of titles, because I didn't have any titles.

It's quite clear that the included section comes after *all* the text 
in the main file, instead of being interspersed where the 
@include-section occurred.

-- hendrik

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20190802194102.hu6t3rrthydmpkb4%40topoi.pooq.com.


[racket-users] drracket notebook mode and ipython/jupyter (Was: DrRacket2?)

2019-08-02 Thread Neil Van Dyke
Prior racket-users discussion on a hypothetical DrRacket Notebook Mode 
and the existing IPython/Jupyter kernel include:


2018-12-20
https://groups.google.com/forum/#!topic/racket-users/MsAh2aBU5Sw

2019-06-26
https://groups.google.com/d/msg/racket-users/XQXYxtCM2-k/AbTTqMqlAgAJ

2019-07-24
https://groups.google.com/d/msg/racket-users/XQXYxtCM2-k/C97eRavaBQAJ

Someone with funding or a person-month of volunteer time should do 
DrRacket Notebook Mode, something like described in that first thread.  
It will be a good thing.  And then other people will be inspired to make 
more language support progress on the data science and blogging/sharing 
possibilities.


--
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/a547a3bd-5ccd-45b9-2db8-8c24495c114c%40neilvandyke.org.


Re: [racket-users] DrRacket2?

2019-08-02 Thread Stephen De Gabrielle
On Fri, 2 Aug 2019 at 17:50, Sean Bailey  wrote:

> I will mention that there is a Racket kernel for Jupyter. I use Jupyter
> notebooks a great deal for teaching, but haven’t used the Racket kernel
> beyond installing it and basic testing.
>

I’m probably wrong but the thing that is keeping me away is that it is
Racket on python - if I want to ‘serious work’* I will have to code
Python.**
  Am I wrong?


(*  Who am I kidding - I never serious work)
(**  I have coded a little python -  just a couple of weeks fixing bugs for
money - I’m more interested in Racket now)

>
> Anyone have experience with using Racket with Jupyter?
>



On Aug 2, 2019, 12:27 -0400, Stephen De Gabrielle ,
> wrote:
>
> Hi,
> I’ve just posted a DrRacket2 issue on the RFC’s github
> https://github.com/racket/racket2-rfcs/issues/96
>
> Is a DrRacket2 needed?
> Who is it for?
> What functionality should it have?
> What should it look like?
>
>
> My first suggestion is a 'notebook mode' like Jupyter notebooks.
>
> FYI did you know you can run DrRacket from inside DrRacket
> try (require drracket/drracket) in the interactions-repl
>
> Kind regards
>
> Stephen
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/CAGHj7-%2Brfi%3DvYPPkSLiLWaWDUJiFjQ3Swa0XJtYzecrBefWi0w%40mail.gmail.com
> 
> .
>
> --


-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAGHj7-LYrZ6Y8n0M6HPGykTygOFRR%3DTLzRvUzciuqFWDhVEuXg%40mail.gmail.com.


Re: [racket-users] DrRacket2?

2019-08-02 Thread Sean Bailey
I will mention that there is a Racket kernel for Jupyter. I use Jupyter 
notebooks a great deal for teaching, but haven’t used the Racket kernel beyond 
installing it and basic testing.

Anyone have experience with using Racket with Jupyter?
On Aug 2, 2019, 12:27 -0400, Stephen De Gabrielle , 
wrote:
> Hi,
> I’ve just posted a DrRacket2 issue on the RFC’s github  
> https://github.com/racket/racket2-rfcs/issues/96
> > Is a DrRacket2 needed?
> > Who is it for?
> > What functionality should it have?
> > What should it look like?
>
> My first suggestion is a 'notebook mode' like Jupyter notebooks.
>
> FYI did you know you can run DrRacket from inside DrRacket
> try (require drracket/drracket) in the interactions-repl
>
> Kind regards
>
> Stephen
> --
> 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.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/CAGHj7-%2Brfi%3DvYPPkSLiLWaWDUJiFjQ3Swa0XJtYzecrBefWi0w%40mail.gmail.com.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/3d8cbfa2-d624-47eb-b3b8-f5cd3c71f3f9%40Spark.


[racket-users] DrRacket2?

2019-08-02 Thread Stephen De Gabrielle
Hi,
I’ve just posted a DrRacket2 issue on the RFC’s github
https://github.com/racket/racket2-rfcs/issues/96

> Is a DrRacket2 needed?
> Who is it for?
> What functionality should it have?
> What should it look like?


My first suggestion is a 'notebook mode' like Jupyter notebooks.

FYI did you know you can run DrRacket from inside DrRacket
try (require drracket/drracket) in the interactions-repl

Kind regards

Stephen

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAGHj7-%2Brfi%3DvYPPkSLiLWaWDUJiFjQ3Swa0XJtYzecrBefWi0w%40mail.gmail.com.


Re: [racket-users] Unwelcome surprises using Scribble on a 90,000-word novel

2019-08-02 Thread Hendrik Boom
On Fri, Aug 02, 2019 at 10:46:26AM -0400, Benjamin Yeung wrote:
> On Fri, Aug 2, 2019 at 7:25 AM Hendrik Boom  wrote:
> >
> > So I see two ways forward on the snipped include front:
> >
> > (1) Write a preprocessor along the lines of the C presprocessor, but a
> > lot simpler, that handles the include-section[]s by actually copying
> > them into the preprocessed copy of everything.
> >
> > or
> >
> > (3) Invent a completely new include mechanism.  One that
> > explicitly calls the scribble reader on the included file and then
> > returns a resulting list of items as its contribution to the main text.
> > Some subtlety would be required here.
> 
> Sorry for both being late to this discussion for possibly bringing up
> something that you may already have attempted, but did you try
> wrapping your "author-only" sections and defining an identifier for
> it?  It might be a bit of a compromise of the two items you've
> referenced here, as it does need some extra code, but at least you
> don't need an external tool and it's a very modest amount of
> additional engineering.  I had in mind something like:
> 
> On Thu, Aug 1, 2019 at 7:25 AM Hendrik Boom  wrote:
> >
> > (1) Some of the @ commands I use are intended to cause conditional
> > inclusion of their contents, dependong on a command-line arameter (which
> > haven't yet implemented in scribble.  This is so I can keep my athor's
> > notes about the text in the text itself, read them while looking at
> > drafts, but have them removed for the final reader's copy.
> >
> > I've tested this by defining one of these operations (@snip) to delete
> > all its contents all of the time, and that works.  (Command line
> > dependence will come later).
> >
> > But it is not possible to snip out entire sections.  In particular,
> >@snip{
> >   @include-section{"author-only-section.scrbl"}
> >}
> > fails, complaining that there's a nested require.
> >
> > Is there some way around this?
> >
> 
> "Wrap" the "author-only-section.scrbl" material in a little bit of packaging:
> 
> #lang scribble/base
> @(provide author-only-section)
> 
> @(define author-only-section
> @section{ @; Or a different structure/block as appropriate
> This is the content of the author-only-section.
> })

Would this mean that the author-only-section could not itself have 
other @include-sections within it, being nested within a define?  A 
minor flaw in my case, because I don't actually do that.  And I could 
use the same mechanism if I needed to.


> 
> --
> 
> Then in the file where it is conditionally included:
> 
> #lang scribble/base
> Pre-snip text.
> 
> @(require "author-only-section.scrbl")
> @snip{@author-only-section}
> 
> Post-snip text.
> 
> --
> 
> Of course, you can use a macro, as was alluded to above, to clean up
> the `require` boilerplate.  Does that do something close enough to
> what you want without adding too much bulk?

It's not being done often enough to warrant a macro.  It is being done 
often enough to warrant a mechanism.  I think this one will work.

-- hendrik

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20190802162227.s6u2eshp6wm2ykdu%40topoi.pooq.com.


Re: [racket-users] Unwelcome surprises using Scribble on a 90,000-word novel

2019-08-02 Thread Benjamin Yeung
On Fri, Aug 2, 2019 at 7:25 AM Hendrik Boom  wrote:
>
> So I see two ways forward on the snipped include front:
>
> (1) Write a preprocessor along the lines of the C presprocessor, but a
> lot simpler, that handles the include-section[]s by actually copying
> them into the preprocessed copy of everything.
>
> or
>
> (3) Invent a completely new include mechanism.  One that
> explicitly calls the scribble reader on the included file and then
> returns a resulting list of items as its contribution to the main text.
> Some subtlety would be required here.

Sorry for both being late to this discussion for possibly bringing up
something that you may already have attempted, but did you try
wrapping your "author-only" sections and defining an identifier for
it?  It might be a bit of a compromise of the two items you've
referenced here, as it does need some extra code, but at least you
don't need an external tool and it's a very modest amount of
additional engineering.  I had in mind something like:

On Thu, Aug 1, 2019 at 7:25 AM Hendrik Boom  wrote:
>
> (1) Some of the @ commands I use are intended to cause conditional
> inclusion of their contents, dependong on a command-line arameter (which
> haven't yet implemented in scribble.  This is so I can keep my athor's
> notes about the text in the text itself, read them while looking at
> drafts, but have them removed for the final reader's copy.
>
> I've tested this by defining one of these operations (@snip) to delete
> all its contents all of the time, and that works.  (Command line
> dependence will come later).
>
> But it is not possible to snip out entire sections.  In particular,
>@snip{
>   @include-section{"author-only-section.scrbl"}
>}
> fails, complaining that there's a nested require.
>
> Is there some way around this?
>

"Wrap" the "author-only-section.scrbl" material in a little bit of packaging:

#lang scribble/base
@(provide author-only-section)

@(define author-only-section
@section{ @; Or a different structure/block as appropriate
This is the content of the author-only-section.
})

--

Then in the file where it is conditionally included:

#lang scribble/base
Pre-snip text.

@(require "author-only-section.scrbl")
@snip{@author-only-section}

Post-snip text.

--

Of course, you can use a macro, as was alluded to above, to clean up
the `require` boilerplate.  Does that do something close enough to
what you want without adding too much bulk?

Benjamin Yeung

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAL%2BBSUJvBUpoatd7kQTsBsq_9xwakY8J8WaPo20Z8BtXrkjPpw%40mail.gmail.com.


[racket-users] Re: evaluating Scribble for prose

2019-08-02 Thread 'Joel Dueck' via Racket Users
On Thursday, August 1, 2019 at 10:14:09 AM UTC-5, David Storrs wrote:
>
>
> A) Could conditionally include sections depending on environment variables 
> or command-line switches
> B) Could seamlessly generate PDF, MOBI, EPUB, and clean and valid HTML 
> that either inlines the CSS or links to a specified CSS file as specified 
> at publication time.  (The inline option is important for when publishing 
> on Amazon.)
> C) Handles UTF-8 correctly
>
>
>
I’m not going to just come in here and scream “POLLEN!”

But, I think Pollen is ideal for this.

It does HTML very well and puts you a lot closer to the HTML/CSS "metal" 
than Scribble does. Your HTML/CSS output can look and be structured pretty 
much however you want. The “downside” is that there are no prepackaged 
templates, you have to be able to do HTML and CSS yourself. But that’s not 
an issue for you!

It doesn’t come with PDF or ebook support “built in”. But the fact that 
adding it is so conceptually straightforward is kind of why I ended up 
learning Racket. I’ve published books to both HTML and print-ready PDF from 
the same set of Pollen source files. MOBI and EPUB are (IIRC) mostly weird 
subsets of HTML/CSS so supporting them would mainly be a matter of some 
wrapper code in the corresponding template to package everything correctly.

And of course it’s UTF-8 friendly.

Scribble is great for Racket docs. But its document model is extremely 
heavy and opinionated for simple works of prose.

And talking of separating content from presentation, Pollen is kind of the 
ultimate framework for this. You decide what markup you want and don’t 
want, and you decide exactly what that markup will produce for your 
different output targets. This can be different for each project. Each of 
your Pollen projects has its own custom “markup engine” sitting right there 
alongside the prose sources. If you decide you want one of your tags to 
produce different output than before, you update your pollen.rkt file and 
may not even need to touch your prose sources. So your markup can be as 
light or as heavy as you wish, and as separate from any particular output 
format as you wish.

(This post seeems like it may have been specially designed to trigger me 
into blurting out the stock Pollen elevator pitch. If so, it worked!)

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/f7e805c1-c400-403c-9962-2bef31787e76%40googlegroups.com.


Re: [racket-users] a question related to bound-identifier=?

2019-08-02 Thread Matthew Flatt
This is certainly confusing.

The missing piece of the puzzle has to do with expansion in an
immediate module body. In that context, the macro expander adds the
module's "inside-edge" scope (unshifted) to the result of any macro
expansion. So, the expander is adding back the inside-edge scope that
is effectively removed by phase shifting in `bind-test0`.

If you use `bind-test0` in a more nested position, then it behaves the
way you expected:

 (let ()
   (bind-test0 5))


The addition of an inside-edge scope by the expander is the same as for
an internal definition context. See sections 1.2.3.8 and 1.2.3.9 in the
reference:

https://docs.racket-lang.org/reference/syntax-model.html?q=internal%20definition#%28part._intdef-body%29

The idea behind the inside-edge scope addition is to ensure that any
binding form that appears as during an expansion is constrained to bind
within the definition scope (i.e., not establish a binding for some
arbitrary other context). The affect on the `let` binding here seems
like an unfortunate side effect of the way that constraint is
implemented.

At Mon, 29 Jul 2019 14:05:01 -0700 (PDT), Yongming Shen wrote:
> I think I found a case where id-a binds id-b when (would-bind? id-a id-b) 
> returns #f:
> 
> (define-syntax bind-test0
> 
>   (lambda (stx)
> 
> (define id #'x)
> 
> (define shifted-id (syntax-shift-phase-level id -1))
> 
> (displayln (would-bind? id shifted-id))
> 
> (syntax-case stx ()
> 
>   [(_ e)
> 
> #`(let ([#,id e])
> 
>  (displayln #,shifted-id))])))
> 
> (bind-test0 100) would print #f then 100. However, if shifted-ld and id are 
> swapped in (let ...), an undefined identifier error will be raised, which 
> is consistent with the return value of (would-bind? ...). Is there a bug in 
> how (let ...) handles identifiers with shifted phase levels?
> 
> Thanks,
> Yongming
> 
> 
> On Friday, July 26, 2019 at 7:07:49 AM UTC-4, Matthew Flatt wrote:
> >
> > At Thu, 25 Jul 2019 18:55:18 -0700 (PDT), Yongming Shen wrote: 
> > > Based on my understanding, (bound-identifier=? id-a id-b) only returns 
> > true 
> > > if id-a would bind id-b AND id-b would bind id-a. Also based on my 
> > > understanding, id-a will bind id-b doesn't imply that id-b will bind 
> > id-a. 
> > > So, if I only want to check whether id-a will bind id-b, which function 
> > > should I use? 
> >
> > There's not a predicate like that right now (I guess only because we 
> > haven't needed it). 
> >
> > Here's one way to implement the predicate: 
> >
> >  (define (would-bind? a b) 
> >(subset? (list->set (hash-ref (syntax-debug-info a) 'context)) 
> > (list->set (hash-ref (syntax-debug-info b) 'context 
> >
> > A built-in operation would work the same way, except that it could be 
> > more efficient by not serializing scopes to a list in debugging 
> > information and then converting the list back to a set. 
> >
> >
> > Matthew 
> >
> >
> 
> -- 
> 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.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/b1a999bb-cc3a-4da8-ae31-11e5a3bf
> f7d6%40googlegroups.com.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/5d442e79.1c69fb81.255a0.bd82SMTPIN_ADDED_MISSING%40gmr-mx.google.com.


Re: [racket-users] Unwelcome surprises using Scribble on a 90,000-word novel

2019-08-02 Thread Hendrik Boom
On Thu, Aug 01, 2019 at 05:58:03PM -0500, Robby Findler wrote:
> On Thu, Aug 1, 2019 at 12:54 PM Hendrik Boom  wrote:
> > At present, @include-section invokes require.  Does it need to?  Does
> > it actually export identifiers to the invoking scribble file?  Or is
> > this just a convenient way of getting it to process the #lang line and
> > treat the included file with scribble (or, I suppose, other) syntax and
> > semantics?
> 
> Each #lang scribble/base (or other scribble languages) program turns
> into a module that exports `doc`. @include-section[] uses that fact to
> do its work. I think changing this aspect of scribble is not likely to
> work well but if you wanted some other way (that wasn't section-based)
> to break up your book then you could probably build it. Alternatively,
> going with the flow would entail deciding to break up files only based
> on the sectioning structure (roughly).  :)

So I see two ways forward on the snipped include front:

(1) Write a preprocessor along the lines of the C presprocessor, but a 
lot simpler, that handles the include-section[]s by actually copying 
them into the preprocessed copy of everything.

or

(2) Separate the snipped sections by separating them into a separate 
document.  Thus the main document would no longer contain those 
sections in any form whatsoever.

or

(3) Invent a completely new include mechanism.  One that 
explicitly calls the scribble reader on the included file and then
returns a resulting list of items as its contribution to the main text.  
Some subtlety would be required here.


The first approach has the disadvantage that the line numbers in 
scribble error messages would no longer be correct.  Is there anything 
like C's #line directive to set line numbers?

It has the advantage that the paragraph-formatting could be changed at 
the same time, replacing spaces at the beginning of the line with and 
extra newline.

But it really goes against the grain to apply an external preprocessor 
to a language as flexible as Racket.

The second is probably the simplest workaround.

The third would likely require more knowledge of scribble internals 
than I have, but it might otherwise be easy to implement.

-- hendrik

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20190802112544.5pralwfyxzkg37yb%40topoi.pooq.com.


Re: [racket-users] Re: Racket2 possibilities

2019-08-02 Thread Hendrik Boom
On Fri, Aug 02, 2019 at 01:49:23AM -0700, Yongming Shen wrote:
> On the topic of making Racket 2 more appealing to new users. As a new user 
> myself, I have one (likely uninformed) suggestion:
> 
> Design and promote a "boring core subset" that an experienced programmer 
> can pick up easily and be as productive as when using an "ordinary 
> programming language", without writing any macros. Macros are awesome, 
> language-oriented programming is also awesome, if Racket 2 without them can 
> be as appealing (minus third-party library aspects) to programmers as 
> Python/Ruby/Go/..., then Racket 2 plus them will certainly win hearts.

If you ignore the ability to define macros, isn't Racket already more 
or less what you propose?  Except, perhaps, for all the parentheses?

-- hendrik

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20190802104435.wpqn5vqbcmxzlfte%40topoi.pooq.com.


[racket-users] Re: Racket2 possibilities

2019-08-02 Thread Yongming Shen
On the topic of making Racket 2 more appealing to new users. As a new user 
myself, I have one (likely uninformed) suggestion:

Design and promote a "boring core subset" that an experienced programmer 
can pick up easily and be as productive as when using an "ordinary 
programming language", without writing any macros. Macros are awesome, 
language-oriented programming is also awesome, if Racket 2 without them can 
be as appealing (minus third-party library aspects) to programmers as 
Python/Ruby/Go/..., then Racket 2 plus them will certainly win hearts.


On Saturday, July 20, 2019 at 2:49:13 PM UTC-4, Matthew Flatt wrote:
>
> This message is intended as a prose form of what I said at RacketCon, 
> but it includes some extra explanation triggered by the discussion so 
> far. Where that happens, I apologize that it isn't in the form of a 
> more direct response in the original thread. 
>
> The Racket2 Idea 
>  
>
> Racket's design and implementation is on solid ground, and from this 
> point, it can continue to evolve and improve in many ways. No matter 
> how Racket evolves, the community is committed to preserving what we 
> have achieved: today's `#lang racket` programs will run in the future, 
> and today's `#lang racket` modules can be used in future Racket 
> programs. At the same time, the current language design may be close to 
> a local maximum, and it's not in the nature of the Racket community to 
> be satisfied with a local maximum. 
>
> By starting all programs with `#lang`, we have created a path to leap 
> from one peak of design to a different, higher peak without sacrificing 
> the old one and while staying Rackety. Roughly, that's what we mean by 
> "Racket2". The name "Racket2" stands for some language that builds on 
> the current Racket technology and implementation, but that may not 
> directly accommodate the same bindings and expression forms that appear 
> in the body of a `#lang racket` module. 
>
> Although we could literally write `#lang racket2` for modules in the 
> new language, "Racket2" is normally understood as a placeholder for a 
> more distinct name. As a matter of branding, perhaps the language would 
> be called "Racket X" for some good X --- shortened to "X" in some 
> contexts --- and Racket X program would be written with `#lang X` line 
> at the top. Maybe the name depends on how different Racket2 turns out 
> to be from Racket, so it makes sense to pick a name later. 
>
> Venturing out from Racket's current peak opens a large space of 
> possibilities, so the first step is to agree on a set of goals to be 
> met by the next peak. The goals can serve as a starting point for 
> developing roadmap for deciding on technical details in a follow-up 
> process. 
>
> Possible Language Changes 
> - 
>
> The Racket community has long discussed possibilities for Racket2. Here 
> are a few potential changes from the wish list: 
>
> * Rename functions to make the conventions more uniform, and make 
>   better use of keyword arguments to reduce names and increase 
>   consistency. 
>
> * Change structures types to have more or fewer features. 
>
> * Use generic datatypes (such as streams) pervasively, instead of 
>   writing code that expects a particular concrete representation (such 
>   as lists). 
>
> * Make strings immutable by default (e.g., result of `format` or 
>   `string-append`). 
>
> * Adjust the semantics of common syntax forms, such as raising an error 
>   on fall-through for `cond` or `match`, and change the meaning of some 
>   primitives, such as making `integer?` mean "exact integer". 
>
> * Make pattern matching more pervasive and available by default. 
>
> * Change module, evaluation, and loading callbacks (e.g., protocol for 
>   `current-module-name-resolver`) to improve errors and extensibility. 
>
> More changes have been suggested, and no doubt many other changes would 
> make sense. As a first cut, to synthesize some principles from these 
> ideas --- as a way of selecting which wishes should be tackled and how 
> --- the current wish list might be organized and summarized by two 
> overall goals: 
>
> * Make the language more consistent 
>
>   Consistency means making terminology and binding names more 
>   consistent, and it means unifying related syntactic constructs. For 
>   example, the `define` and `define-syntax` forms should perhaps be 
>   less syntactically distinct. Similarly, pattern matching and syntax 
>   matching seem closely related and could benefit from using the same 
>   pattern language. Also, pattern matching should be pervasively 
>   available among binding forms. Etc. 
>
> * Make the language constructs more generic 
>
>   In many ways, the current Racket language and libraries encourage 
>   the use of concrete data structures instead of abstract datatypes. 
>   The `map` function works on lists, for example, not arbitrary 
>   streams, and even `for` demands concrete declarations