Re: [racket-users] or/c, parametric->/c, and contract-first-order-passes?

2017-11-29 Thread Robby Findler
Maybe this line:

https://github.com/racket/racket/blob/master/racket/collects/racket/contract/private/parametric.rkt#L105

should be:

   #:first-order (λ (c) (if (barrier-contract-positive? c)
(barrier-contract-pred c) (λ (x) #t)))

?

Robby


On Tue, Nov 28, 2017 at 8:02 PM, Ben Greenman
 wrote:
> The other day, I wanted to write a contract for a function that takes
> any kind of vector and does something depending on whether the vector
> is mutable. The contract was basically the one below:
>
> ```
> #lang racket
>
> (define/contract (f v)
>   (parametric->/c [A]
> (-> (or/c (vectorof A #:immutable #true)
>   (vectorof A #:immutable #false))
> any))
>   (void))
> ```
>
> When I try to call this function, I get an error "none of the branches
> of the or/c matched".
>
> It looks like this error is because `contract-first-order-passes?`
> returns #false if the vector I pass to `f` has any elements.
>
> Two questions:
>
> 1. Could `(contract-first-order-passes? ctc val)` return `#true` if
> `ctc` is from a `parametric->/c` ? (I feel like it shouldn't but I
> don't know why not)
>
> 2. If not, would `or/c` be better off using a
> `contract-first-order-fails?` predicate?
>
> --
> 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 https://groups.google.com/d/optout.

-- 
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 https://groups.google.com/d/optout.


Re: [racket-users] Plot - Choosing the number of mesh lines independently from the number of samples

2017-11-29 Thread Marduk Bolaños
Thank you Ben! I will give it a try.

-- 
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 https://groups.google.com/d/optout.


Re: [racket-users] Plot - Choosing the number of mesh lines independently from the number of samples

2017-11-29 Thread Marduk Bolaños
Thank you Ben! I will give it a try.

On Wednesday, November 29, 2017 at 6:04:38 PM UTC+1, Ben Greenman wrote:
>
> I don't think this is currently possible. 
>
> To implement this, I think the `for-2d-sample` loop here needs to change: 
>
> https://github.com/racket/plot/blob/master/plot-lib/plot/private/plot3d/surface.rkt#L28
>  
>
> (I guess there should be 2 loops, one to draw the surface and one to 
> draw the lines) 
>
> On Wed, Nov 29, 2017 at 8:30 AM, Marduk Bolaños  > wrote: 
> > Dear all, 
> > 
> > Recently, I made a 3D plot with surface3d, but had to increase the 
> > number of samples from the default value in order to obtain a 
> > smooth surface. Unfortunately, this change also increased the 
> > number of mesh lines, which resulted in a very dark surface. The 
> > appearance improved by painting the lines with a lighter color, 
> > but what I would really like to do is to choose the number of 
> > mesh lines that are drawn on the high-sample smooth surface. 
> > 
> > Is it currently possible? And if not, what would you suggest in 
> > order to implement it? 
> > 
> > Thanks in advance. 
> > 
> > Best, 
> > Marduk 
> > 
> > -- 
> > 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...@googlegroups.com . 
> > For more options, visit https://groups.google.com/d/optout. 
>

-- 
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 https://groups.google.com/d/optout.


Re: [racket-users] Include Documentation from a scribble/lp2 File: "identifier `doc' not included [...]" Error

2017-11-29 Thread Ben Greenman
> * Would have never been able to deduce this from the info you referenced...

Good point. Here's a pull request for changing the docs:
https://github.com/racket/scribble/pull/154

-- 
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 https://groups.google.com/d/optout.


Re: [racket-users] Include Documentation from a scribble/lp2 File: "identifier `doc' not included [...]" Error

2017-11-29 Thread Christian

>
> Try changing the include-section to import the `doc` submodule: 
>
> @include-section[(submod "sub-scribble.rkt" doc) 
>
>
> I got this idea from the 2nd paragraph of the "scribble/lp2 language" 
> docs: 
> http://docs.racket-lang.org/scribble/lp.html#%28mod-path._scribble%2Flp2%29 
>

* Great, thanks!

* Would have never been able to deduce this from the info you referenced...

Cheers,
Christian

-- 
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 https://groups.google.com/d/optout.


Re: [racket-users] Include Documentation from a scribble/lp2 File: "identifier `doc' not included [...]" Error

2017-11-29 Thread Ben Greenman
Try changing the include-section to import the `doc` submodule:

@include-section[(submod "sub-scribble.rkt" doc)


I got this idea from the 2nd paragraph of the "scribble/lp2 language" docs:
http://docs.racket-lang.org/scribble/lp.html#%28mod-path._scribble%2Flp2%29


On Wed, Nov 29, 2017 at 7:15 AM, Christian <7enderh...@gmail.com> wrote:
> overview.scrbl:
> #lang scribble/base
> @include-section["sub-scribble.rkt"]
>
> sub-scribble.rkt:
> #lang scribble/lp2
> @title{Sub Scribble!}
> Oh yeah.
> @chunk[<*>]
>
> gives:
> only-in: identifier `doc' not included in nested require spec in:
> "sub-scribble.rkt"
>
> * What to do to include the documentation part from a scribble/lp2 file?
>
> Thanks,
> Christian
>
> --
> 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 https://groups.google.com/d/optout.

-- 
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 https://groups.google.com/d/optout.


Re: [racket-users] Plot - Choosing the number of mesh lines independently from the number of samples

2017-11-29 Thread Ben Greenman
I don't think this is currently possible.

To implement this, I think the `for-2d-sample` loop here needs to change:
https://github.com/racket/plot/blob/master/plot-lib/plot/private/plot3d/surface.rkt#L28

(I guess there should be 2 loops, one to draw the surface and one to
draw the lines)

On Wed, Nov 29, 2017 at 8:30 AM, Marduk Bolaños  wrote:
> Dear all,
>
> Recently, I made a 3D plot with surface3d, but had to increase the
> number of samples from the default value in order to obtain a
> smooth surface. Unfortunately, this change also increased the
> number of mesh lines, which resulted in a very dark surface. The
> appearance improved by painting the lines with a lighter color,
> but what I would really like to do is to choose the number of
> mesh lines that are drawn on the high-sample smooth surface.
>
> Is it currently possible? And if not, what would you suggest in
> order to implement it?
>
> Thanks in advance.
>
> Best,
> Marduk
>
> --
> 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 https://groups.google.com/d/optout.

-- 
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 https://groups.google.com/d/optout.


[racket-users] Re: how can I approximate syntax properties with `make-rename-transformer`?

2017-11-29 Thread Matthew Butterick
Seems like this works well enough, where I approximate the 
rename-transformer rather than the syntax property.

(define-syntax (mb stx)
 (syntax-case stx ()
   [(_ . args) (with-syntax ([args (syntax-property #'args 'key 
'value)])
 #'(other-module-begin . args))]))



On Tuesday, November 28, 2017 at 9:05:07 PM UTC-8, Jack Firth wrote:
>
> What about passing the configuration data to `other-module-begin` via 
> keyword arguments or tagged expressions in the body of the 
> `(other-module-begin ...)` expansion? Is there a particular reason `mb` and 
> `other-module-begin` need to communicate with syntax properties?
>
> On Tuesday, November 28, 2017 at 7:15:50 PM UTC-8, Matthew Butterick wrote:
>>
>> I'm making a #%module-begin macro, but I want to delegate it to an 
>> existing one. 
>>
>> OK, let's start with a rename transformer: 
>>
>> (provide (rename-out [mb #%module-begin])) 
>> (define-syntax mb (make-rename-transformer #'other-module-begin)) 
>> (define-syntax other-module-begin (λ (stx) #'foo)) 
>>
>> That works, but I also need to pass some extra data to 
>> `other-module-begin` that controls how it's configured during this 
>> delegation. 
>>
>> OK, let's add a syntax property. But wrapping the property around the 
>> transformer doesn't work, because a rename transformer is not `syntax?`: 
>>
>> (provide (rename-out [mb #%module-begin])) 
>> (define-syntax mb (syntax-property (make-rename-transformer 
>> #'other-module-begin) 'foo "bar")) 
>> (define-syntax other-module-begin (λ (stx) #'foo)) 
>>
>> ;; syntax-property: contract violation 
>>
>>
>> I can wrap the property around the target identifier, but the syntax 
>> property doesn't stick: 
>>
>> (provide (rename-out [mb #%module-begin])) 
>> (define-syntax mb (make-rename-transformer (syntax-property 
>> #'other-module-begin 'foo "bar"))) 
>> (define-syntax other-module-begin (λ (stx) #'foo)) 
>>
>> (syntax-property #'mb 'foo) ; #f 
>>
>>
>> Other possibilities with equivalent effect?
>
>

-- 
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 https://groups.google.com/d/optout.


Re: [racket-users] Configuration as main file (was Re: #lang languages and cyclic dependencies)

2017-11-29 Thread Neil Van Dyke




On 11/28/2017 11:58 PM, Jack Firth wrote:

What if the configuration file was the main module of your app, instead
of something imported by your app?


If you want to combine this with per-user customization in Racket code, 
the 3rd message in the following thread suggests one way to handle 
executables smoothly:


Subject: low-friction app extensibility in racket
Date: Thu, 6 Jul 2017 05:53:40 -0400
https://groups.google.com/forum/#!topic/racket-users/6hn9J-r0Nek

--
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 https://groups.google.com/d/optout.


[racket-users] Configuration as main file (was Re: #lang languages and cyclic dependencies)

2017-11-29 Thread Tony Garnock-Jones
On 11/28/2017 11:58 PM, Jack Firth wrote:
> What if the configuration file was the main module of your app, instead
> of something imported by your app?

I've tried this, and it works well. I haven't used a custom config #lang
yet, but even with regular old Racket, it works very well.

For example:
https://github.com/tonyg/racket-pkg-website/blob/master/configs/tonyg.rkt

Cheers,
  Tony

-- 
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 https://groups.google.com/d/optout.


[racket-users] Plot - Choosing the number of mesh lines independently from the number of samples

2017-11-29 Thread Marduk Bolaños
Dear all,

Recently, I made a 3D plot with surface3d, but had to increase the
number of samples from the default value in order to obtain a
smooth surface. Unfortunately, this change also increased the
number of mesh lines, which resulted in a very dark surface. The
appearance improved by painting the lines with a lighter color,
but what I would really like to do is to choose the number of
mesh lines that are drawn on the high-sample smooth surface.

Is it currently possible? And if not, what would you suggest in
order to implement it?

Thanks in advance.

Best,
Marduk

-- 
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 https://groups.google.com/d/optout.


[racket-users] Include Documentation from a scribble/lp2 File: "identifier `doc' not included [...]" Error

2017-11-29 Thread Christian
overview.scrbl:
#lang scribble/base
@include-section["sub-scribble.rkt"]

sub-scribble.rkt:
#lang scribble/lp2
@title{Sub Scribble!}
Oh yeah.
@chunk[<*>]

gives:
only-in: identifier `doc' not included in nested require spec in: 
"sub-scribble.rkt"

* What to do to include the documentation part from a scribble/lp2 file?

Thanks,
Christian

-- 
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 https://groups.google.com/d/optout.