[racket-users] Re: plotting multiple data sets on one set of axes

2020-04-12 Thread greadey
Thanks, Alex.   I managed to get that working a treat.

On Saturday, 11 April 2020 08:38:05 UTC+1, Alex Harsanyi wrote:
>
>
> The renderers  that you pass on to the `plot` function can be manipulated 
> outside the call to plot, so you can read the datasets you need, construct 
> a renderer for each one, group them in a list and pass them on to plot.  I 
> am not familiar with Matlab, but based on your description, you can 
> implement hold-on and hold-off as follows:
>
> #lang racket
> (require plot)
>
> (define the-renderers '())
>
> (define (hold-on renderer)
>   (set! the-renderers (cons renderer the-renderers)))
>
> (define (hold-off)
>   (begin0
> (plot (reverse the-renderers))
> (set! the-renderers '(
>
> ;; add a renderer for SIN
> (hold-on (function sin 0 10))
>
> ;; add a renderer for COS
> (hold-on (function cos 0 10))
>
> ;; Show the plot
> (hold-off)
>
> Alternatively, if you want a separate plot for each function, you can 
> implement hold-off as follows:
>
> (define (hold-off-2)
>   (begin0
> (for/list ([renderer (reverse the-renderers)])
>   (plot renderer))
> (set! the-renderers '(
>
> Alex.
>
> On Thursday, April 9, 2020 at 2:35:04 PM UTC+8, greadey wrote:
>>
>> Hi All,
>>
>> Can anyone give me some pointers on plotting multiple data sets on one 
>> set of axes.  Plotting two or more data sets on one set of axes is easy if 
>> you know in advance what the data is called;
>>
>> (plot (list
>>   (lines set1)
>>   (points set2))
>>  #:x-label "x" #:y-label "y")
>>
>> however I have a list of data sets generated from reading a bunch of 
>> files in a directory and I wish to loop through the list and add each 
>> data-set to an existing set of axes.
>>
>> Iterating through the data and plotting each set results in multiple plot 
>> windows.
>>
>> In summary I am looking for something similar to Matlab's "hold on" e.g.
>>
>> ;Pseudo Matlab code
>>
>> figure()
>> for idx = 1 : numel(list-of (list-of vector-pairs))
>> plot(list-of (list-of vector-pairs))(idx)
>> hold on
>> end
>> hold off
>>
>> I have got (plot-new-window? #t), however as far as I know this is just 
>> causing a plot to appear in a new window rather than directly in the repl.
>>
>> Many thanks,
>>
>> greadey.
>>
>

-- 
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/3c0dad34-68a0-4c2a-abf3-b81f53655b3a%40googlegroups.com.


Re: [racket-users] Unfinished S-Expressions in scribbled code blocks

2020-04-12 Thread Ben Greenman
> What is the proper way of typesetting (in scribble) parts of racket code
> which do not form complete S-expression?

The proper way is to make a #lang (in particular, a `read-syntax`)
that deals with incomplete S-expressions.

I don't know if anyone has done / attempted this.

An improper way is to use `verbatim` for now and do without color:

```
#lang scribble/manual

@(define (mycode #:indent [indent 0] . content*)
   (nested #:style 'code-inset (apply verbatim #:indent indent content*)))

... and here are the requires:

@mycode|{
(require
}|

.. with the first one being this and we need that for 

@mycode[#:indent 2]|{
  (only-in ffi/unsafe ptr-set! _uint32)
}|
```

-- 
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/CAFUu9R4gvGL8hoVQj4Ui_A4FDABbugnvTEJT%2BpACOoh-t4nMBA%40mail.gmail.com.


Re: [racket-users] Unfinished S-Expressions in scribbled code blocks

2020-04-12 Thread Dominik Pantůček
Nope, even with eval:alts and eval:result(s) I cannot produce the
results I want.

Btw, I am subscribed to the list.


Cheers,
Dominik

On 12. 04. 20 17:22, Sage Gerard wrote:
> Does scribble/examples offer what you need?
> 
> 
> 
>  Original Message 
> On Apr 12, 2020, 4:23 AM, Dominik Pantůček <
> dominik.pantu...@trustica.cz> wrote:
> 
> 
> Hello fellow Racketeers,
> 
> I've started a small side project and as a part of that I want to write
> some articles interspersed with code. Scribble was a natural choice for
> that task.
> 
> So I started with #lang scribble/manual as usual and after writing some
> text, I tried to do something like the following:
> 
> 
> #lang scribble/manual
> 
> ... and here are the requires:
> 
> @racketblock{
> (require
> }
> 
> .. with the first one being this and we need that for 
> 
> @racketblock{
> (only-in ffi/unsafe ptr-set! _uint32)
> }
> 
> ...
> 
> 
> Of course it renders the racketblocks as string, silly me. So I go for
> @racketblock[] but that - in @-syntax translates to S-expressions with
> "(require" (without the quotes) definitely not being a valid
> S-expression. And therefore scribble cannot handle it.
> 
> Looking at [1] leaves me with an impression that it is not possible to
> typeset parts of racket code in scribble. Only valid S-expressions (and
> the #lang line, of course).
> 
> Using scribble/lp2 I can get closer to my wanted result, but really it
> just works around the issue by forming valid S-expressions and expanding
> chunks inside those.
> 
> What is the proper way of typesetting (in scribble) parts of racket code
> which do not form complete S-expression?
> 
> And yes, I know this is rather strange requirement, but in this
> particular case, I am pretty sure, I want to work with parts of
> S-expressions without balanced parentheses. (Although the minimal
> example definitely does not answer "why").
> 
> I assume I must have overlooked something, of course.
> 
> Cheers,
> Dominik
> 
> [1] https://docs.racket-lang.org/scribble/scribble_manual_code.html
> 
> --
> 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/d4473bd1-5b9c-b658-2989-df0a143d7ae9%40trustica.cz.
> 
> -- 
> 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/kB7sQQDkefoEq86xajF1QifjjY-cWMqDfbxhD08dN2NqNBNnRn-8u6HX7lOA_JFhClSvgMhJdHxpI9MdEaB3oOpOQHEKNRFn1KCSexM86bg%3D%40sagegerard.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/977981fa-97c1-15ac-fcae-84cbb5330e4e%40trustica.cz.


Re: [racket-users] Unfinished S-Expressions in scribbled code blocks

2020-04-12 Thread Sage Gerard
Does scribble/examples offer what you need?

 Original Message 
On Apr 12, 2020, 4:23 AM, Dominik Pantůček wrote:

> Hello fellow Racketeers,
>
> I've started a small side project and as a part of that I want to write
> some articles interspersed with code. Scribble was a natural choice for
> that task.
>
> So I started with #lang scribble/manual as usual and after writing some
> text, I tried to do something like the following:
>
> 
> #lang scribble/manual
>
> ... and here are the requires:
>
> @racketblock{
> (require
> }
>
> .. with the first one being this and we need that for 
>
> @racketblock{
> (only-in ffi/unsafe ptr-set! _uint32)
> }
>
> ...
> 
>
> Of course it renders the racketblocks as string, silly me. So I go for
> @racketblock[] but that - in @-syntax translates to S-expressions with
> "(require" (without the quotes) definitely not being a valid
> S-expression. And therefore scribble cannot handle it.
>
> Looking at [1] leaves me with an impression that it is not possible to
> typeset parts of racket code in scribble. Only valid S-expressions (and
> the #lang line, of course).
>
> Using scribble/lp2 I can get closer to my wanted result, but really it
> just works around the issue by forming valid S-expressions and expanding
> chunks inside those.
>
> What is the proper way of typesetting (in scribble) parts of racket code
> which do not form complete S-expression?
>
> And yes, I know this is rather strange requirement, but in this
> particular case, I am pretty sure, I want to work with parts of
> S-expressions without balanced parentheses. (Although the minimal
> example definitely does not answer "why").
>
> I assume I must have overlooked something, of course.
>
> Cheers,
> Dominik
>
> [1] https://docs.racket-lang.org/scribble/scribble_manual_code.html
>
> --
> 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/d4473bd1-5b9c-b658-2989-df0a143d7ae9%40trustica.cz.

-- 
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/kB7sQQDkefoEq86xajF1QifjjY-cWMqDfbxhD08dN2NqNBNnRn-8u6HX7lOA_JFhClSvgMhJdHxpI9MdEaB3oOpOQHEKNRFn1KCSexM86bg%3D%40sagegerard.com.


Re: [racket-users] typed mutable fields in structures.

2020-04-12 Thread Ben Greenman
Yes, that's right.

I think TR could support this choice ... the typechecket
(tc-structs.rkt) seems to know about the per-field mutability that
comes from a struct info.

On 4/11/20, Hendrik Boom  wrote:
> I noticed that in regular Racket, when defining a structure, it is
> possible for each field to be mutable independent of the other fields.
>
> In Typed Racke I find the choice only of making all the fields or none
> of them mutable.
>
> Is this correct, or have I missed something?
>
> -- 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/20200411141747.ijbhuadzsy5r56ge%40topoi.pooq.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/CAFUu9R5ZDO73_Th-VPRPk8%3Da6yWdstmGg6Fh9SKu1eTL%2BZqw4Q%40mail.gmail.com.


[racket-users] Unfinished S-Expressions in scribbled code blocks

2020-04-12 Thread Dominik Pantůček
Hello fellow Racketeers,

I've started a small side project and as a part of that I want to write
some articles interspersed with code. Scribble was a natural choice for
that task.

So I started with #lang scribble/manual as usual and after writing some
text, I tried to do something like the following:


#lang scribble/manual

... and here are the requires:

@racketblock{
(require
}

.. with the first one being this and we need that for 

@racketblock{
 (only-in ffi/unsafe ptr-set! _uint32)
}

...


Of course it renders the racketblocks as string, silly me. So I go for
@racketblock[] but that - in @-syntax translates to S-expressions with
"(require" (without the quotes) definitely not being a valid
S-expression. And therefore scribble cannot handle it.

Looking at [1] leaves me with an impression that it is not possible to
typeset parts of racket code in scribble. Only valid S-expressions (and
the #lang line, of course).

Using scribble/lp2 I can get closer to my wanted result, but really it
just works around the issue by forming valid S-expressions and expanding
chunks inside those.

What is the proper way of typesetting (in scribble) parts of racket code
which do not form complete S-expression?

And yes, I know this is rather strange requirement, but in this
particular case, I am pretty sure, I want to work with parts of
S-expressions without balanced parentheses. (Although the minimal
example definitely does not answer "why").

I assume I must have overlooked something, of course.


Cheers,
Dominik


[1] https://docs.racket-lang.org/scribble/scribble_manual_code.html

-- 
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/d4473bd1-5b9c-b658-2989-df0a143d7ae9%40trustica.cz.