Re: [racket-users] Re: Copy keybinding in DrRacket not working

2020-11-23 Thread Laurent
On Sun, Nov 22, 2020 at 7:45 PM Dimaugh Silvestris <
dimaughsilvest...@gmail.com> wrote:

> So I tried adding a custom keybinding using c:c, and now when I open
> DrRacket, I get the error:
> < /home/dimaugh/prog/rkt/keybindings.rkt:
> map-function in keymap%: "c:c" is already mapped as a non-prefix key>>
>

This seems like there was another keybinding with the *prefix* c:c (say
c:c;c:x for example).

In the search bar of Edit->Keybindings->Show Active Keybindings, type
"c:c", maybe you'll see several entries matching this prefix.

If not, I don't know :)

-- 
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/CABNTSaEgFQrs9mfjN%2B_4TDgkLErKoPgEQ34wDx%2B%3Dy6qebHb9HQ%40mail.gmail.com.


Re: [racket-users] Help implementing an early return macro

2020-10-28 Thread Laurent
I've also had the same issues for a long time, and condd was almost good
enough, but the #:do is too specific.
But recently I'm using something much simpler (no continuation) and
straightforward: cond/else
https://github.com/Metaxal/bazaar/blob/master/cond-else.rkt

By contrast to other approaches—which I usually try a few times then
discard—I'm using this form regularly.

It does precisely what you request (early return without continuations),
but keeps both the readable cond and else structure while removing all
unnecessary parentheses.
Your example would look like this:

(define x (random 10))
(cond/else
  [(not (even? x))
   (log-info "x wasn't even, x = ~a" x)
   -1]
  #:else
  (define y (random 10))
  #:cond
  [(not (even? y))
   (log-info "y wasn't even, y = ~a" y)
   -1]
  #:else
  (+ x y))

You say you don't like the keywords, but I find that they actually increase
readability.

On Wed, Oct 28, 2020 at 10:54 AM Jack Firth  wrote:

> So I'm a little tired of writing code like this:
>
> (define x ...)
> (cond
>   [(take-shortcut? x) (shortcut x)]
>   [else
>(define y (compute-y x))
>(cond
> [(take-other-shortcut? x y) (other-shortcut x y)]
> [else
>  (define z ...)
>  (cond ...)])])
>
> That is, I have some logic and that logic occasionally checks for
> conditions that make the rest of the logic irrelevant, such as an empty or
> false input or something else that should trigger an early exit. Each check
> like this requires me to write a cond whose else clause wraps the
> remainder of the body, leading to an awkward nesting of cond forms. I
> don't have this issue when the early exits involve raising exceptions: in
> those cases I can just use when and unless like so:
>
> (define x ...)
> (unless (passes-check? x) (raise ...))
> (define y ...)
> (unless (passes-other-check? x y) (raise ...))
> (define z ...)
> ...
>
> I'm aware of a few macros in the racket ecosystem that try to solve this
> problem. For example, Jay wrote a blog post
>  that creates a
> condd form that's like cond but allows embedded definitions using a #:do
> keyword. I've also seen various approaches that use escape continuations to
> implement the early exit. There's drawbacks I'm not happy about however:
>
>-
>
>For cond-like macros that allow embedded definitions, it looks too
>different from regular straight-line Racket code. I like my function bodies
>to be a sequence of definitions and expressions, with minimal nesting, just
>like the when and unless version above. I don't have to use a keyword
>or extra parentheses to signal whether a form is a definition or a when
>/ unless check in error-raising code, why should I have to do that in
>code that uses early returns?
>-
>
>Continuation-based solutions impose a nontrivial performance penalty
>and have complex semantics. I don't like that the generated code behaves
>differently from the cond tree I would normally write. What happens if
>I stick an early exit inside a lambda? Or a thread? What if I set up a
>continuation barrier? Does that matter? I don't know and I don't want to
>think about that just to write what would be a simple if (condition) {
>return ... } block in other languages.
>
> So I wrote a basic macro for this and I have some questions about how to
> make it more robust. The macro is called guarded-block and it looks like
> this:
>
> (guarded-block
>   (define x (random 10))
>   (guard (even? x) else
> (log-info "x wasn't even, x = ~a" x)
> -1)
>   (define y (random 10))
>   (guard (even? y) else
> (log-info "y wasn't even, y = ~a" y)
> -1)
>   (+ x y))
>
> Each guard clause contains a condition that must be true for evaluation
> to proceed, and if it isn't true the block takes the else branch and
> finishes. So the above would expand into this:
>
> (block
>   (define x (random 10))
>   (cond
> [(not (even? x))
>  (log-info "x wasn't even, x = ~a" x)
>  -1]
> [else
>  (define y (random 10))
>  (cond
>[(not (even? y))
> (log-info "y wasn't even, y = ~a" y)
> -1]
>[else (+ x y)])]))
>
> This part I got working pretty easily. Where I hit problems, and where I'd
> like some help, is trying to extend this to support two important features:
>
>-
>
>I should be able to define macros that *expand* into guard clauses.
>This is important because I want to implement a (guard-match 
> else  ...) form that's like match-define
>but with an early exit if the pattern match fails. I'd also really like to
>add a simple (guard-define   else
> ...) form that expects option-expression to produce an
>option
>
> 
>(a value that is either (present v) or absent) and tries to unwrap it,
>like the guard let construct in Swift
>

Re: [racket-users] [DrRacket] Is there a way to go to last edit location?

2020-10-12 Thread Laurent
I couldn't find an easy way to do this. (As a hack, I even tried undo+redo,
but this also includes cursor movements apparently, so it doesn't help.)

AFAICT, the undo history is buried under several private layers, so it's
inaccessible from `send` (and thus currently not accessible from
Quickscript), but a plugin may do. Augmenting `on-insert`:
https://docs.racket-lang.org/gui/text_.html?q=on-insert#%28meth._%28%28%28lib._mred%2Fmain..rkt%29._text~25%29._on-insert%29%29
to record the last insert position should work.


On Fri, Oct 9, 2020 at 10:46 AM Rock Nie  wrote:

> Hi,
>
> When I am using DrRacket recently, I often find myself wanting to go back
> to the last edit location which I can do in other editors. However, I did
> not find a similar function in DrRacket. Is there a way to do this? With a
> plugin maybe?
>
> Rock
>
> --
> 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/CABygVQzM_8A3c0inxigGyz48pOnttx2r2XER0gDzidStcuOF-w%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/CABNTSaE4gJAoeJcO9EbDegA6UC9qqS7whJR0PEC8nnORZhz5cg%40mail.gmail.com.


Re: [racket-users] Re: Memory usage of (port->lines ...) is extreamly high

2020-09-24 Thread Laurent
Quick comment: of you don't need to load the whole file but want to parse
it line by line, use `in-lines` which is memory-efficient.

On Thu, Sep 24, 2020, 11:46 Hong Yang  wrote:

> Update with memory dump log attached.
>
> 1. With out (set! input empty), call (collect-garbage) doesn't help
> 2. Call (set! input empty) and (collect-garbage), memory reduce dramaticly.
>
> ; 214M(VIRT)/101M(RSS) without open any file
> (let loop()
>   (sleep 5)  ; Waiting here so that I can check it via top/ps
>   (dump-memory-stats)
>   (collect-garbage)
>   (set! input empty)  ; Even not help with this line, it works after
> called (collect-garbage) explicity.
>   (loop))
>
> On Thursday, September 24, 2020 at 6:14:55 PM UTC+8 Hong Yang wrote:
>
>> Hi Racketer
>>
>> I'm trying to load a log file which size is 600MB, then I found the
>> program exhausted 3 GB resident memory just for load all the content of it
>> via (port->lines...). I do have enough RAM but it looks like some thing
>> went wrong here, and I do need to load them all into RAM for my use case so
>> (read-line ...) doesn't help me.
>>
>> Any comment would be preciated.
>>
>> Here is may programe:
>>
>> #!/usr/bin/racket
>> #lang racket
>>
>> ; Load input as list of lines
>> (define (input-load-lines file-name)
>>   (if (file-exists? file-name)
>>   (let* ([input (open-input-file file-name)]
>>  [lines (port->lines input)])
>> (close-input-port input)
>> lines)
>>   empty))
>>
>> ; Racket 7.8, compile from source code, (none cs mode)
>> ; 100M of log requires 0.5G runtime memory
>> ; 300M of log requires 1.5G runtime memory
>> ; 600M of log requires 3.0G runtime memory
>> ;
>> ; Reference
>> ;   racket/collects/racket/port.rkt :106
>> ;   racket/collects/racket/private/portlines.rkt :11
>>
>> (define input (input-load-lines "main.log"))
>>
>> ; 214M(VIRT)/101M(RSS) without open any file
>> (let loop()
>>   (sleep 5) ; Waiting here so that I can check it via top/ps
>>   (set! input empty) ; event not help with this line
>>   (loop))
>>
>> Thanks
>> Hong
>>
> --
> 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/07c41b96-87ba-473a-ad0e-0cec71dc4024n%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/CABNTSaG_X9qSmAvP%3D0SWp2ozF9FePBi38_%2B5wQGaQaaf5N21mg%40mail.gmail.com.


Re: [racket-users] Is this running in DrRacket or as a script?

2020-09-02 Thread Laurent
You can use a `drracket` submodule:

(module+ drracket
 (foo)
 (bar))

but you need to configure DrRacket to recognize it: Click on the
bottom-left button about languages, and at the bottom of "Dynamic
Properties", click on "Submodules to run", then "Add submodule option" and
add "drracket".

After this, when you run a module from within DrRacket, it will
automatically run the `drracket` submodule, but this submodule will *not*
be run from the command line (by default).

(I also uncheck the "main" submodule as I use this one only for the command
line.)

HTH,
Laurent




On Wed, Sep 2, 2020 at 8:44 AM Stefan Schmiedl 
wrote:

> Greetings,
>
> I find myself coding some more in DrRacket on my local Win10 PC.
> The finished program is to be run on a remote linux server.
>
> I like to keep the code set up for the production environment
> but to test it locally I need to configure some things differently.
>
> Currently I'm doing this manually by commenting/uncommenting a sexp
> with the required modifications.
>
> Is there a function around that allows me to do something like
>
> (when (running-in-dr-racket?)
>   (foo)
>   (bar))
>
> Thanks,
> s.
>
> --
> 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/26327196.20200902094324%40gmail.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/CABNTSaHRMNb8_efegWNC4x68tgo3Q96-ja7ZKHTgSi0Ap86K1g%40mail.gmail.com.


Re: [racket-users] drracket -- getting the buffer's current filename?

2020-09-01 Thread Laurent
What do you want this for, more precisely?

On Tue, Sep 1, 2020 at 3:35 PM ibar...@radford.edu 
wrote:

> When running from inside drracket, `(find-system-path 'run-file)`
> understandable returns the DrRacket executable.  Is there a way for me to
> further find the name of the source-file, in that situation?
>
> --Ian
>
>
> --
> 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/88284b4f-7772-4fde-b754-6e06e6dbad57n%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/CABNTSaFTX%2BeOUX4qP-v8KL_p%2BL_bTAR8qQmJ%3D7se7dnWuJ-rgQ%40mail.gmail.com.


Re: [racket-users] Re: Application Templates!

2020-08-20 Thread Laurent
My understanding is that Framework is born out of DrRacket, expecting that
some of its tools may be useful in other contexts (like, say, keymaps).


On Thu, Aug 20, 2020 at 3:11 PM Deren Dohoda  wrote:

> > I think Racket would benefit by a suite of applications which are small
> but
> > not trivial and with a source code which is commented in more detail
> than a
> > regular application
> I would kill to understand the intended use of the framework library. I
> don't understand what I'm supposed to do with it at all. Does anyone have
> an application written with framework that I can look at? Or could we make
> a small template with some framework features like autosave which are quite
> unique to framework over racket/gui? I feel very stupid asking but my
> desire to try it has exceeded my embarrassment in this regard.
>
> Deren
>
> --
> 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/c754b4a3-9073-4ecd-9815-7491ad96cf89n%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/CABNTSaGAHqYPKtU-dTnOQ5ZNO0tMWuTgrRW8w8o2iNeZc7bEYg%40mail.gmail.com.


Re: [racket-users] Re: Application Templates!

2020-08-20 Thread Laurent
Stephen's work may still be quite useful, as it provides a set of really
minimal (almost?) working examples that explain the specifics of various
tools.

I say keep it up, Stephen!

On Thu, Aug 20, 2020 at 5:33 AM Alex Harsanyi 
wrote:

> I am not sure that a template in the style of "dotnet new" is directly
> applicable for Racket --  the .Net framework is, well a framework. which is
> a library that expects the users to structure their own programs in certain
> ways.  The templates fill the need of setting up the boilerplate code for
> different kind of applications as required by the .Net framework.  Racket
> applications don't need large amounts of "setup code", most of the code is
> very specific to the application itself, so not sure what a template would
> contain apart from very basic things.
>
> I think Racket would benefit by a suite of applications which are small
> but not trivial and with a source code which is commented in more detail
> than a regular application.  I attempted to do this with my blog posts,
> some of which describe more-or-less complete applications (most of them
> games). The entire source code is in a single file which can be run
> directly and is available as a GitHub Gist linked from the blog posts.
>
> Here are some examples:
>
> * ishido game (936 lines):
> https://gist.github.com/alex-hhh/2e204b3a9d9d7094f65a0b585d0b7480
> * tetris game (893 lines):
> https://gist.github.com/alex-hhh/2233aee39852f4e0aead4af4cafb40d5
> * chess board (893 lines):
> https://gist.github.com/alex-hhh/4817c4d0353e40b72108e7e753c3d0da
> * password generator GUI (346 lines):
> https://gist.github.com/alex-hhh/6acbbb8ebca47c4cfaa2540499494af6
> * password generator, command line (142 lines):
> https://gist.github.com/alex-hhh/27286f4609ea0c989675e5c946ca39de
>
> These are of course not templates, but they could serve as the starting
> points for users who already have some experience with programming and want
> to try out some more complex programs.
>
> Alex.
>
> On Thursday, August 20, 2020 at 5:49:37 AM UTC+8 Stephen De Gabrielle
> wrote:
>
>> I’ve started a small collection!
>>
>> https://github.com/racket-templates
>>
>> These are GitHub templates so you use them by clicking ‘use this
>> template‘ on the repo
>>
>> I’m looking for more ideas/contributions;
>> From the top of my head;
>> - ‘worker service’ (dotnet new has this)
>> - DrRacket plugin
>> - Keybinding package
>> - Teachpack
>> - raco command
>> - scribble (multiple)
>> - pollen (multiple)
>> - slideshow
>> - racket embedded in c app
>>
>> Can you suggest(or submit) any others?
>>
>> <> the reasons is to give new users another way ins>>
>>
>> Are language specific templates a good idea?
>> - typed racket
>> - datalog
>> - parenlog
>> - rosette
>>
>>
>>   Thoughts suggestions criticisms appreciated!
>>
>> Stephen
>>
>> On Wed, 19 Aug 2020 at 00:02, Stephen De Gabrielle 
>> wrote:
>>
>>> I got jealous that dot net has dotnet new with lots of templates so I
>>> made a GitHub template for a cli command
>>> https://github.com/spdegabrielle/cli-command
>>>
>>> If you have an idea for a template you should make one!
>>>
>>> If you have a cool package that can be demonstrated as an application
>>> maybe consider a template as a way to introduce new Racketeers to your
>>> package?
>>>
>>> Best
>>>
>>> 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/856e1c7a-5afc-42d8-89f0-6b6fb81158d5n%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/CABNTSaEHswSSwNH5ojDqR74OTjq_gKeV9pWCnd8UC3AsKcUvjQ%40mail.gmail.com.


Re: [racket-users] Scribble and structs

2020-08-12 Thread Laurent
I have no idea about custom-write, but for the duplicate keys, maybe you
installed the collection multiple times? Take a look at the output of `raco
pkg show` maybe.

On Wed, Aug 12, 2020 at 12:08 PM Deren Dohoda 
wrote:

> Hi racketeers,
>
> I have two questions. The first is: is there a way to have scribble /
> sandbox use the gen:custom-write property of a structure? When I use
> @examples the output is just the bare structure output, not using the
> gen:custom-write procedure.
>
> Second, I am working on a very simple polynomial library using 7.7 and
> during the creation of the docs I receive this warning:
> "WARNING: collected information for key multiple times: '(dep ((lib
> "simple-polynomial/main.rkt") polynomial?)); values: #t #t"
> among other similar warnings all seeming to point to the procedure
> polynomial?.
>
> This would lead me to believe I have somehow required or defined things
> multiple times. However my "main.rkt" is just a one file require and an
> all-from-out. The underlying library does not use (provide (struct-out
> ...)), I only (provide polynomial?).
>
> Do structs somehow mess with scribble here? A small search reveals only a
> single posting from the developers library with the comment "fix your
> library." Love to, but what's the problem?
>
> Thanks for any thoughts,
> Deren
>
> --
> 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/2ffd6a24-8437-4a7e-b688-74135a866673n%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/CABNTSaFi8JZaMUkGOXXorTGN0Cj0yW8LZJ5Ukh0sy%3D9RiOR6_A%40mail.gmail.com.


Re: [racket-users] Racket GUI: text aligned to the left of other text

2020-08-12 Thread Laurent
You can also cheat by writing the name with the same color as the
background on the next lines (kind of like \vphantom in LaTeX). This has
the advantage of aligning based on the length of each name instead of
pushing everything to the right of the longest name, while working for any
font.

A better approach to achieve the same result is to do a real \vphantom by
writing the text in a separate box, obtaining the width and then inserting
a blank snip of the same width.

But if you use a fixed-width font, you can of course replace the names with
spaces on the next lines.

On Mon, Aug 10, 2020 at 8:32 PM Christopher Lemmer Webber <
cweb...@dustycloud.org> wrote:

> Hello,
>
> I'm building a little chat application with Racket.  Overall Racket's
> GUI tools are quite comfortable, and I'm just using Rakcet's text editor
> stuff to build the chat.  But a fairly standard thing to do with chat
> applications is to have text like:
>
> (Beware, fixed width ascii art ahead)
>
>  ..
>  | FooChat Deluxe  [X]|
>  ||
>  | File  Blah |
>  ||
>  |  | It's snowing outside!! | alice   |
>  || In August  | bob |
>  |  | Nevermind, the snow is a representation of | carol   |
>  | | collective anxiety about the world | |
>  || Oh okay it is snowing then | |
>  ||
>  | [Better go get some snow shoes then___] [Send] |
>  ''
>
> The core idea there being that usernames left-align to the text.
>
> I'm not sure what's the nicest way to do this, though I've taken a guess
> that maybe the "Show/Hide Line Numbers" in DrRacket is the best example.
> I'd be happy to look at that but I can't really find it in the drracket
> repository and am not sure where it would be?
>
> (I guess one other complication is that if you copy-pasta text it would
> be great to still be able to copy paste the names too, but I can think
> of some kludgery that might make that possible.)
>
>  - Chris
>
> --
> 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/87lfime1pm.fsf%40dustycloud.org
> .
>

-- 
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/CABNTSaEaoT0GKBBjXuHGvxkwk_ygex6EXtr7_tQajw7chaVzZA%40mail.gmail.com.


Re: [racket-users] Racket News - Issue 36

2020-08-04 Thread Laurent
Thanks Paulo, very interesting and useful as usual!

This version of the featured paper "Hygienic macro expansion" is a little
more readable:
https://prl.ccs.neu.edu/img/kffd-tr-1986.pdf

Or would Matthias be able to provide a freshly compiled version maybe? :)
(I would be truly impressed if the tex file still existed somewhere!)

On Tue, Aug 4, 2020 at 10:41 AM Paulo Matos  wrote:

> Racket News Issue 36 is here!
> https://racket-news.com/2020/08/racket-news-issue-36.html
>
> Grab yourself your favourite cup and pour in some good ol'coffee.
> Enjoy!
>
> Paulo Matos
>
> --
> 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/81b9b4d9-5e81-41b6-83dc-b33f3f67dab0n%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/CABNTSaFMFZrJPgHg2FyLPmxngz%3D2o2zAFJ4xS1o7vrsRJxwcmA%40mail.gmail.com.


Re: [racket-users] ask the type of a value

2020-08-03 Thread Laurent
and yet:

> (for-each
   (λ (x) (printf "~a: ~a\n" (~v x #:min-width 28) (struct->vector x)))
   `(hello "hello" 43110 #f #(h e l l o) #"hello" (h e l l o)
   ,(new frame% [label ""])))

hello   : #(struct:symbol ...)
"hello" : #(struct:string ...)
43110   : #(struct:fixnum-integer ...)
#f  : #(struct:false ...)
#(h e l l o): #(struct:vector ...)
#"hello": #(struct:byte-string ...)
(h e l l o) : #(struct:pair ...)
#(struct:object:frame% ...) : #(struct:object:frame% ...)

;)


On Mon, Aug 3, 2020 at 4:20 PM Alexis King  wrote:

> In general, the answer is “no,” mostly because it’s not clear in Racket
> what “the type of a value” means. It’s difficult to come up with a
> definition that would be useful enough to satisfy your criterion of not
> “having to guess it first.” Consider: suppose you had a hypothetical
> `type-of` operation that returned a value’s type:
>
> (type-of 'hello) ; => 'symbol
> (type-of "hello") ; => 'string
>
> Now suppose you apply type-of to a value you know nothing about and get
> back 'widget. Well, you don’t know what a widget is, so that didn’t
> actually get you any further from where you started: you still don’t know
> what to do with the value.
>
> Furthermore, types are not actually disjoint. You can write a struct
> definition with properties like prop:procedure and prop:evt, and if a
> struct has both, should type-of return the struct’s name, 'procedure, or
> 'evt? It’s not really clear. You might be able to come up with some more
> sophisticated system with (potentially multiple) inheritance that could
> capture these relationships, but I can say with confidence that no such
> system currently exists in Racket.
>
> Alexis
>
> > On Aug 3, 2020, at 09:19, Hendrik Boom  wrote:
> >
> > In plain, untyped Racket:
> >
> > It is possible to ask if a value is a symbol with symbol?
> > It is possible to ask if a value is a string with string?
> > etc.
> >
> > Is there a way to ask the type of a value without having to guess it
> first?
> >
> > -- 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/C561F2A9-0C78-4EDA-A401-4FB067D79849%40gmail.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/CABNTSaGUiZWoU9mZbqMjB04FSu_kFOGrgyv0riU8TuKtffB_dg%40mail.gmail.com.


Re: [racket-users] ask the type of a value

2020-08-03 Thread Laurent
Maybe try `struct->vector`, which works on any value iirc (from mobile,
can't test)

On Mon, Aug 3, 2020, 15:19 Hendrik Boom  wrote:

> In plain, untyped Racket:
>
> It is possible to ask if a value is a symbol with symbol?
> It is possible to ask if a value is a string with string?
> etc.
>
> Is there a way to ask the type of a value without having to guess it first?
>
> -- 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/20200803141931.t4v4nc2e5d4afx6f%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/CABNTSaEcetXOrk77n1RdFKDteQm_sp-8w8VN7qB54qpi-jMs5A%40mail.gmail.com.


Re: [racket-users] “If you could have a wish granted, what would you like to see next in Racket?”

2020-07-23 Thread Laurent
Just in case (not sure how relevant this is to you):
https://docs.racket-lang.org/reference/Sandboxed_Evaluation.html?q=with-limits#%28form._%28%28lib._racket%2Fsandbox..rkt%29._with-limits%29%29
Works pretty well, but there are some caveats: if an object can be reached
outside of the `with-limits` scope, it's not counted.

On Thu, Jul 23, 2020 at 5:42 PM George Neuner  wrote:

>
> On 7/23/2020 8:30 AM, Stephen De Gabrielle wrote:
> > “If you could have a wish granted, what would you like to see next in
> > Racket?”
> >
> >
> https://www.reddit.com/r/Racket/comments/hwe49b/if_you_could_have_a_wish_granted_what_would_you/?utm_source=share_medium=ios_app_name=iossmf
> > or [original
> > twitter](https://twitter.com/racketlang/status/1286020900660404232?s=20)
> >
>
> SIMD ops.  !!!
>
> Limits on resources used by individual VMs.  ulimit works only at the
> process level (so only indirectly affects in-process "thread" places),
> and Windows has no simple equivalent:  I am aware of Windows "job
> objects", but there are no user controls for them.
>
>
> George
>
> --
> 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/8b3d3265-616d-e93e-4cd3-01b3ca91a474%40comcast.net
> .
>

-- 
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/CABNTSaELD1rHr3_dBw61KkLYzo5x%2B68WOywAG7AMDGC7ffrLGg%40mail.gmail.com.


Re: [racket-users] coding style query

2020-05-27 Thread Laurent
I use markdown syntax for that:
The function `function` functions like `functions` but for a single
function `proc`.

I've seen others use `function' instead.

On Wed, May 27, 2020 at 7:04 PM Jens Axel Søgaard 
wrote:

> Den ons. 27. maj 2020 kl. 19.56 skrev Hendrik Boom  >:
>
>> Is there an accepted convention about how to use a symbol used in a
>> program within a comment so it's clear the comment is using it as a
>> program symbol and not as an ordinary English word?
>>
>
> Not sure. Sometimes I surround the symbol with two spaces to each side
> instead of just one.
> Can't remember where I picked that habit up.
>
> /Jens Axel
> https://racket-stories.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/CABefVgyY%3DGY%2BOTNxfEZLkaZaqpZi%3DGF6%3DVgrPThRJoY7_g%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/CABNTSaGpc%2B12732wkQjV10XfT%3DCjHB6Fea7sV-JkhT%2BJsMV%2BDQ%40mail.gmail.com.


Re: [racket-users] GUI executable creating an annoying command line window

2020-05-26 Thread Laurent
Does it change anything if you use #lang racket/gui instead of #lang racket
(require racket/gui)?

On Tue, May 26, 2020 at 10:00 AM Philip Benade 
wrote:

> Hi All
>
> I have been trying to create a simple GUI with the racket/gui library. For
> the most part it works but alongside my GUI it also creates a command line
> window. You can see a screenshot of this in the attached picture. I found
> this discussion when I searched for a solution:
> https://groups.google.com/forum/#!topic/racket-users/QmvqWtm1x28 In that
> case it was happening because there were things that did not return void.
> In my case however it is not printing anything, there isn't even any white
> space.
>
> I am using the "Create Executable" option from the "Racket" heading in
> Dr.Racket's menu. I set the Type to be "Distribution (to install on other
> machines)" and the Base to "GRacket" and keep the "Embed DLLs in the
> executable" check box checked. Is there some setting or something I can
> change to make this window to go away?
>
> I have attached my program's .rtk file in case anyone needs it to see what
> I'm doing wrong.
>
> Regards
> Philip
>
> --
> 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/3387d77b-e9a6-4777-a46b-ac897596702e%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/CABNTSaG8MPUg7wWCe%2BGyROFnDCM9KoJ8A6eUujXYhUR1QC1y6g%40mail.gmail.com.


Re: [racket-users] Re: Strange behaviour of ptr-ref + ptr-add(?)

2020-05-10 Thread Laurent
Awesome, thanks Matthew!

On Sun, May 10, 2020 at 2:05 PM Matthew Flatt  wrote:

> Although `_double*` isn't currently meant to be handled there ---
> there's no `ptr-ref/_double` specialization --- you're right that the
> problem is in the `ptr-ref/double` and similar specializations in CS.
>
> I've pushed a repair.
>
> Thanks for the report, Laurent!
>
> At Sun, 10 May 2020 13:57:50 +0200, Jens Axel Søgaard wrote:
> > I can confirm that the bug is present in the latest snapshot of Racket CS
> > on macOS.
> >
> > FWIW  _double* is missing in this list, but I am not sure it whether it
> is
> > supposed to be handled here.
> >
> https://github.com/racket/racket/blob/920c899ba866ce59a0387862286521e3cc1dabfb/
> > racket/src/schemify/ptr-ref-set.rkt#L46
> >
> > /Jens Axel
> >
> > Den søn. 10. maj 2020 kl. 10.51 skrev Laurent  >:
> >
> > > Correction:
> > > It's not Mac vs Linux, it's Racket BC (works) vs CS (doesn't work)
> > >
> > > On Sun, May 10, 2020 at 9:49 AM Laurent 
> wrote:
> > >
> > >> Hi all,
> > >>
> > >> We're trying to figure out why the last case below doesn't work on
> > >> Linux, but works on MacOS. Does anyone have an explanation?
> > >> The docs suggest that _double* shouldn't be different from _double for
> > >> _reading_ values.
> > >>
> > >> More precisely,
> > >>
> > >> #lang racket
> > >> (require ffi/unsafe)
> > >>
> > >> (define N 10)
> > >> (define pt (malloc N _double 'atomic-interior))
> > >> (for ([i (in-range N)])
> > >>   (ptr-set! pt _double* i (+ 2. i)))
> > >>
> > >> ;; works
> > >> (for/list ([i (in-range N)])
> > >>   (ptr-ref pt _double i))
> > >>
> > >> ;; works
> > >> (for/list ([i (in-range N)])
> > >>   (ptr-ref (ptr-add pt i _double) _double*))
> > >>
> > >> ;; doesn't work!
> > >> (for/list ([i (in-range N)])
> > >>   (ptr-ref (ptr-add pt i _double) _double))
> > >>
> > >> --
> > >> Output:
> > >> (2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0)
> > >> (2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0)
> > >> (2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0)
> > >>
> > >> --
> > > 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/CABNTSaFmfgTpTrWzfcxL%2BxQCqtge5
> > Ls1eKW%2Bp0ftd%3D0q554ALg%40mail.gmail.com
> > >
> > <
> https://groups.google.com/d/msgid/racket-users/CABNTSaFmfgTpTrWzfcxL%2BxQCqtge
> > 5Ls1eKW%2Bp0ftd%3D0q554ALg%
> 40mail.gmail.com?utm_medium=email_source=footer>
> > > .
> > >
> >
> >
> > --
> > --
> > Jens Axel Søgaard
> >
> > --
> > 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/CABefVgzNsmOEx3LV%3DvmV--gu3UD6k
> > HZsRCfPQm0kn32Vo_ziKw%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/5eb7fc00.1c69fb81.a8f09.1621SMTPIN_ADDED_MISSING%40gmr-mx.google.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/CABNTSaEvYoB%3DY8-NNLgD2GnHmcUXTqQhfS4drxgzFA%3D07Cuj-g%40mail.gmail.com.


Re: [racket-users] Re: Strange behaviour of ptr-ref + ptr-add(?)

2020-05-10 Thread Laurent
Bug report here:
https://github.com/racket/racket/issues/3173

On Sun, May 10, 2020 at 12:58 PM Jens Axel Søgaard 
wrote:

> I can confirm that the bug is present in the latest snapshot of Racket CS
> on macOS.
>
> FWIW  _double* is missing in this list, but I am not sure it whether it is
> supposed to be handled here.
>
> https://github.com/racket/racket/blob/920c899ba866ce59a0387862286521e3cc1dabfb/racket/src/schemify/ptr-ref-set.rkt#L46
>
> /Jens Axel
>
> Den søn. 10. maj 2020 kl. 10.51 skrev Laurent :
>
>> Correction:
>> It's not Mac vs Linux, it's Racket BC (works) vs CS (doesn't work)
>>
>> On Sun, May 10, 2020 at 9:49 AM Laurent  wrote:
>>
>>> Hi all,
>>>
>>> We're trying to figure out why the last case below doesn't work on
>>> Linux, but works on MacOS. Does anyone have an explanation?
>>> The docs suggest that _double* shouldn't be different from _double for
>>> _reading_ values.
>>>
>>> More precisely,
>>>
>>> #lang racket
>>> (require ffi/unsafe)
>>>
>>> (define N 10)
>>> (define pt (malloc N _double 'atomic-interior))
>>> (for ([i (in-range N)])
>>>   (ptr-set! pt _double* i (+ 2. i)))
>>>
>>> ;; works
>>> (for/list ([i (in-range N)])
>>>   (ptr-ref pt _double i))
>>>
>>> ;; works
>>> (for/list ([i (in-range N)])
>>>   (ptr-ref (ptr-add pt i _double) _double*))
>>>
>>> ;; doesn't work!
>>> (for/list ([i (in-range N)])
>>>   (ptr-ref (ptr-add pt i _double) _double))
>>>
>>> --
>>> Output:
>>> (2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0)
>>> (2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0)
>>> (2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0)
>>>
>>> --
>> 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/CABNTSaFmfgTpTrWzfcxL%2BxQCqtge5Ls1eKW%2Bp0ftd%3D0q554ALg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/racket-users/CABNTSaFmfgTpTrWzfcxL%2BxQCqtge5Ls1eKW%2Bp0ftd%3D0q554ALg%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
>
>
> --
> --
> Jens Axel Søgaard
>
>

-- 
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/CABNTSaFY5Xn8DvhTekTSkWx7%3DkW3yvSrZTMZ605zSRvw_CM1eQ%40mail.gmail.com.


[racket-users] Re: Strange behaviour of ptr-ref + ptr-add(?)

2020-05-10 Thread Laurent
Correction:
It's not Mac vs Linux, it's Racket BC (works) vs CS (doesn't work)

On Sun, May 10, 2020 at 9:49 AM Laurent  wrote:

> Hi all,
>
> We're trying to figure out why the last case below doesn't work on
> Linux, but works on MacOS. Does anyone have an explanation?
> The docs suggest that _double* shouldn't be different from _double for
> _reading_ values.
>
> More precisely,
>
> #lang racket
> (require ffi/unsafe)
>
> (define N 10)
> (define pt (malloc N _double 'atomic-interior))
> (for ([i (in-range N)])
>   (ptr-set! pt _double* i (+ 2. i)))
>
> ;; works
> (for/list ([i (in-range N)])
>   (ptr-ref pt _double i))
>
> ;; works
> (for/list ([i (in-range N)])
>   (ptr-ref (ptr-add pt i _double) _double*))
>
> ;; doesn't work!
> (for/list ([i (in-range N)])
>   (ptr-ref (ptr-add pt i _double) _double))
>
> --
> Output:
> (2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0)
> (2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0)
> (2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0)
>
>

-- 
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/CABNTSaFmfgTpTrWzfcxL%2BxQCqtge5Ls1eKW%2Bp0ftd%3D0q554ALg%40mail.gmail.com.


[racket-users] Strange behaviour of ptr-ref + ptr-add(?)

2020-05-10 Thread Laurent
Hi all,

We're trying to figure out why the last case below doesn't work on
Linux, but works on MacOS. Does anyone have an explanation?
The docs suggest that _double* shouldn't be different from _double for
_reading_ values.

More precisely,

#lang racket
(require ffi/unsafe)

(define N 10)
(define pt (malloc N _double 'atomic-interior))
(for ([i (in-range N)])
  (ptr-set! pt _double* i (+ 2. i)))

;; works
(for/list ([i (in-range N)])
  (ptr-ref pt _double i))

;; works
(for/list ([i (in-range N)])
  (ptr-ref (ptr-add pt i _double) _double*))

;; doesn't work!
(for/list ([i (in-range N)])
  (ptr-ref (ptr-add pt i _double) _double))

--
Output:
(2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0)
(2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0)
(2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0)

-- 
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/CABNTSaFm-CCOpFfiJX-x_Mo-zikRkqaDWzWEGSC5azjp0Jq_Bg%40mail.gmail.com.


Re: [racket-users] Quickscript of the day: Extract to function

2020-05-10 Thread Laurent
Major update:
- put-function is much faster, by triggering check-syntax as early as
possible and avoiding its re-computation.
- More warnings and error reporting (in particular regarding mutated
variables).
- Added more information at the top of the script file, in particular some
caveats.

Please report bugs here:
https://github.com/Metaxal/quickscript-extra/issues

If you have already installed this:
raco pkg update quickscript-extra
and if DrRacket is open, click on "Scripts | Manage scripts | Unload
persistent scripts" to restart the script.

On Thu, May 7, 2020 at 12:52 PM Stephen De Gabrielle <
spdegabrie...@gmail.com> wrote:

> Awesome - keep them coming.
>
> You should feature one in each Racket-News!
>
> Stephen
>
> On Thu, 7 May 2020 at 10:33, Laurent  wrote:
>
>> Have you ever wanted to extract a block of code out of its context and
>> wrap it in a function?
>>
>> Have you ever *not* done it because of the cognitive load(*) of figuring
>> out the function arguments and the return values?
>>
>> Well, now it's as easy as Ctrl-Shift-X and Ctrl-Shift-Y. Using
>> check-syntax, the extract-function and put-function scripts figure out what
>> goes in and out for you.
>>
>> Video: https://www.youtube.com/watch?v=XinMxDLZ7Zw
>> `raco pkg install quickscript-extra` to install, or
>> `raco pkg update quickscript-extra` if it's already installed.
>>
>> (*) a.k.a. laziness ;)
>>
>> --
>> 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/CABNTSaHpOYQM2X3TW%3DHYGP7_CTA8jCaj4Euh0mcjnus1aOdt-g%40mail.gmail.com
>> <https://groups.google.com/d/msgid/racket-users/CABNTSaHpOYQM2X3TW%3DHYGP7_CTA8jCaj4Euh0mcjnus1aOdt-g%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
> --
> 
>

-- 
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/CABNTSaGB7iXj469Un70eqNqg8W0Pqc8muT8NDd5WY1pQv%2BJeXg%40mail.gmail.com.


Re: [racket-users] A convenient assertion macro - with one caveat

2020-05-07 Thread Laurent
Check out `make-check-location` and friends, and maybe `with-check-info*`
https://docs.racket-lang.org/rackunit/api.html?q=define-check#%28def._%28%28lib._rackunit%2Fmain..rkt%29._make-check-location%29%29

You may have to combine with the syntax-information extracted from the
syntax object `stx`.


On Thu, May 7, 2020 at 10:22 AM Dexter Lagan  wrote:

> Hi,
>
>   I made a simple macro which saves me the trouble of defining a test
> module, requiring RackUnit and then declaring '(module+ test' after each
> procedure definition, as I like to keep unit tests close by. The repo :
>
> https://github.com/DexterLagan/assert
>
>   Here's the macro, apologies for the broken formatting :
>
> (define-syntax (assert stx)
> (syntax-parse stx
> [(_ ?a ?b)
> #'(module+ test
> (require rackunit)
> (check-equal? ?a ?b #'?a))]
> [(_ ?a)
> #'(module+ test
> (require rackunit)
> (check-true ?a #'?a))]))
>
> The macro works great, and I was able to pipe through an assertion message
> through rackunit's check-equal? and other procedures.
> I have one question however: would there be a way to make DrRacket point
> to the failed assertion line instead of the macro itself when a failure
> occurs? Here's a screenshot of how it looks like at the moment:
>
> [image: assert.PNG]
>
>   It would be even better if DrRacket highlighted the (assert ...) line
> itself, but I'm asking a bit much :) If assert is an actual module, I'm not
> sure where DrRacket would then point at.
> I also have doubts about whenever Racket will remove the test module once
> compiled. Since macros are processed at compile-time, I'm guessing it would
> remove the test module right after, but let me know if you have a more
> definite answer.
>
> Dex
>
> --
> 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/CACUENrLX%3D9ix2kv9MNpp3nNoSN%3DsWBx%2BFTRdwNyNA7EiVWQ0mA%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/CABNTSaFdxOGAFw9cZcPqVxb6pXFT68WMuCNMta8dBG5GeLW74A%40mail.gmail.com.


[racket-users] Quickscript of the day: Extract to function

2020-05-07 Thread Laurent
Have you ever wanted to extract a block of code out of its context and wrap
it in a function?

Have you ever *not* done it because of the cognitive load(*) of figuring
out the function arguments and the return values?

Well, now it's as easy as Ctrl-Shift-X and Ctrl-Shift-Y. Using
check-syntax, the extract-function and put-function scripts figure out what
goes in and out for you.

Video: https://www.youtube.com/watch?v=XinMxDLZ7Zw
`raco pkg install quickscript-extra` to install, or
`raco pkg update quickscript-extra` if it's already installed.

(*) a.k.a. laziness ;)

-- 
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/CABNTSaHpOYQM2X3TW%3DHYGP7_CTA8jCaj4Euh0mcjnus1aOdt-g%40mail.gmail.com.


Re: [racket-users] Matching groups of optional elements

2020-05-05 Thread Laurent
If you insist on using match, you can do it with a loop:

#lang racket

(define (parsel l)
  (match l
[(list-rest req1 req2 r)
 (cons (list req1 req2)
   (let loop ([r r])
 (match r
   ['() '()]
   [(list-rest opt1 opt2 opt3 opt4 r2)
(cons (list opt1 opt2 opt3 opt4)
  (loop r2))])))]))

(parsel '(RequiredA RequiredB Name Age First Last Name Age First Last)) ;
works
(parsel '(RequiredA RequiredB Name Age First Last Name Age First )) ; match
error



On Tue, May 5, 2020 at 3:52 AM David Storrs  wrote:

> Thanks, Phillip.
>
> On Mon, May 4, 2020 at 10:44 PM Philip McGrath 
> wrote:
>
>> Depending on your requirements, I would consider using `syntax-parse` at
>> runtime: this is easily written with its `~seq` patterns, and you get nicer
>> error reporting.
>>
>> Here's an example—I use syntax classes for clarity, but they aren't
>> necessary, if you prefer to be more concise:
>>
>> #lang racket
>>
>> (require syntax/parse
>>  rackunit)
>>
>> (define-splicing-syntax-class person-cols
>>   (pattern (~seq "Name" "Age" "First" "Last")))
>>
>> (define-syntax-class csv-header
>>   (pattern ("RequiredA" "RequiredB" person:person-cols ...)))
>>
>> (define valid-header?
>>   (syntax-parser
>> [:csv-header
>>  #t]
>> [_
>>  #f]))
>>
>> ;; legal column arrangements:
>> (check-true
>>  (valid-header? #'("RequiredA" "RequiredB")))
>> (check-true
>>  (valid-header? #'("RequiredA" "RequiredB" "Name" "Age" "First" "Last")))
>> (check-true
>>  (valid-header?
>>   #'("RequiredA" "RequiredB" "Name" "Age" "First" "Last" "Name" "Age"
>> "First" "Last")))
>>
>> ;; illegal:  if an optional group is present, it must have all 4 columns
>> (check-false
>>  (valid-header?
>>   #'("RequiredA" "RequiredB" "Name" "Age" "First" "Last" "Name")))
>>
>>
>> On Mon, May 4, 2020 at 10:39 PM Michael MacLeod <
>> michaelmmacl...@gmail.com> wrote:
>>
>>> I'm not sure this is possible with only using `match` patterns. A
>>> combination of the `list-rest` and `app` patterns as well as the `in-slice`
>>> procedure from `racket/sequence` should do the trick, though:
>>>
>>> #lang racket
>>>
>>> (require racket/match)
>>>
>>> (define (collect-optional-vals x)
>>>   (for/list ([y (in-slice 4 x)])
>>> y))
>>>
>>> (match '(req-a req-b name1 age1 first1 last1 name2 age2 first2 last2)
>>>   [(list-rest req-a req-b (app collect-optional-vals optional-vals))
>>>(list req-a req-b optional-vals)])
>>>
>>> On Mon, May 4, 2020 at 7:16 PM David Storrs 
>>> wrote:
>>>
 I'm trying to write a parser for a CSV file with optional columns.
 Simplified version:  There are 2 mandatory columns, after which there can
 be 0+ 4-column groups describing a person.  Each group has the same column
 headers.

 ; legal column arrangements:
 RequiredA RequiredB
 RequiredA RequiredB Name Age First Last
 RequiredA RequiredB Name Age First Last Name Age First Last


 ; illegal:  if an optional group is present, it must have all 4 columns
 RequiredA RequiredB Name Age First Last Name

 I thought I could do this straightforwardly with `match`, but I'm
 wrong.  Can someone point me to the way to write such a match clause?


 Various failed attempts:
 (list reqA reqB (opt1 opt2 opt3 opt4) ...)   ; syntax error. matching
 clauses do not do grouping like this
 (list reqA reqB (list opt1 opt2 opt3 opt4) ...) ; didn't expect this to
 work since it would specify an embedded list.  I was right.

 This one surprised me:
 (match row
   [(list required1 required2 (and opt1 opt2 opt3 opt4) ...)
(list opt1 opt2 opt3 opt4)])

 This distributes the ... over the four items inside the 'and' clause
 such that each of the 'optionalN' identifiers matches all remaining
 elements.
 '(("Name" "Age" "First" "Last")
 ("Name" "Age" "First" "Last")
 ("Name" "Age" "First" "Last")
 ("Name" "Age" "First" "Last"))

 In hindsight it makes sense -- the 'and' causes it to match the element
 across all four patterns.  They all match because they are identifiers and
 therefore match anything.  Then the '...' causes it to do that for all
 remaining elements, generating lists into each of the identifiers because
 that's what '...' does.

 --
 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/CAE8gKocCPSgVQG_aMSC%3DQJAmAtxvmCN8vqpwsankKnCJZAOotw%40mail.gmail.com
 
 .

>>> --
>>> You 

Re: [racket-users] Should I stop sending packages to the catalog?

2020-05-01 Thread Laurent
For your second point, you can never really know what other work depends on
your package. You could display a message in the new package or in the
readme for example, but that's likely not going to work well for
various reasons. (but see my last comment)

However, what Jay is saying I believe (correct me if I'm wrong), is that
you can just create a tag for the previous version, modify your current
package 'my-package' on the pkg server to refer to that tag, and create a
new package 'my-package2' on the pkg server pointing to master. The pkg
catalog is going to be cluttered with all backward-incompatible version
numbers but a) Jay doesn't seem to be worried about that b) it's currently
not the case (meaning, people don't do that currently, but maybe they
should?).

Old users won't see the breaking change, and new users will see and use the
new version on the catalog (or clone directly from github). What's missing
again is a way to tell old users that a new package is available with new
features, but I think Jay was saying some time ago that this should be the
purpose of mailing lists and other media.



On Fri, May 1, 2020 at 2:23 PM Hendrik Boom  wrote:

> On Fri, May 01, 2020 at 06:12:55AM -0700, Jesse Alama wrote:
> > On Thursday, April 30, 2020 at 2:57:45 PM UTC+2, Jay McCarthy wrote:
> > >
> > >
> > > This is simply a social standard though. There is nothing that
> > > technically prevents you from breaking compatibility, except that your
> > > users may be upset. You can post things on the package server that
> > > follows any rules you want, including conflicting with any other
> > > packages.
> > >
> >
> > I'd like to second this point. There's nothing stopping you from pushing
> > whatever you want to your repo, and hence distributing whatever you want
> > via the package server. I've pushed breaking changes to my packages
> before,
> > and no one has complained, so I guess I didn't break any part of the
> > interface that they were using. (Or I have no users of my stuff at all,
> > which is certainly possible!)
> >
> > I don't know how many packages mention, in their description, that
> they're
> > experimental, explicitly warning me that the interface is unstable and
> > likely to change. I use 'em anyway because they offer useful
> functionality.
> > I don't recall being nailed by breaking changes, but perhaps I'm just
> > getting lucky.
> >
> > What exactly is the claim, anyway, about the package server not allowing
> > breaking changes? Is it that if you do a breaking change to your
> package,
> > then it's possible that other people's packages correspondingly break?
> If
> > so, then I think that's not a very interesting claim. Does the claim at
> > issue just amount to a restatement of the ethos that Jay mentioned about
> > trying to ensure backwards compatibility for a long time?
> >
> > (All this said, I'd like to learn more about setting up custom package
> > catalogs, as Alex mentioned, to take matters even more into your own
> hands.)
>
> Is there a mechanism for, when you know you are making a breaking change
> in a package, at least being warned about other packages that may break
> as a result?
>
> And is there a mechanism for testing those other packages before
> committing your breaking package to the public repository?
>
> -- 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/04ebf61c-54b3-4f58-96aa-f5bdc5f2b457%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/20200501132344.4nwjgebdlyttwkzu%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/CABNTSaGQGFVL%3D4jhaV6WJH6b5QU52rfk-rJ4mbrhvCntO2AZDQ%40mail.gmail.com.


Re: [racket-users] Rhombus project plan

2020-04-30 Thread Laurent
Also, if I remember correctly, the timings given in the said (excellent)
tutorial are very conservative or outdated. If you have a multicore
machine, it will speed up the process by up to a factor 8.

On Thu, Apr 30, 2020, 15:42 Sam Tobin-Hochstadt 
wrote:

> On Thu, Apr 30, 2020 at 9:09 AM Ben Greenman
>  wrote:
> >
> > On 4/29/20, Sorawee Porncharoenwase  wrote:
> > > (Not directly related to Rhombus) Speaking of “how to contribute”, I
> find
> > > that it is not friendly at all to setup stuff in order to contribute to
> > > Racket core and main distribution. According to
> > >
> https://blog.racket-lang.org/2017/09/tutorial-contributing-to-racket.html,
> > > if I want to make a change to, say, https://github.com/racket/math, I
> > > should start with:
> > >
> > > $ raco pkg update --no-setup --catalog https://pkgs.racket-lang.org
> math
> > > $ raco pkg update --clone math
> > >
> > > The estimated time to run the above two commands is ONE HOUR! The
> second
> > > command in particular seems to compile every Racket packages (why does
> it
> > > need to do that?!?) which takes a lot of time.
> >
> > That second command recompiles only the packages that depend on math.
> > Unfortunately there are a lot of them.
>
> To follow up on that, here are some strategies for reducing that time:
>
> 1. Start with Minimal Racket, install "math", then follow the steps
> above. That will just rebuild `math`, not everything that depends on
> it, since they won't be installed.
>
> 2. (Dangerous) Do the following:
>$ raco pkg update --no-setup --clone math # fast
>$ raco setup math
>
> This will only setup "math", and thus be faster, but will potentially
> cause other parts of the installation to not work correctly until you
> run "raco setup".
>
> Making the original commands go faster would require one of three
> things (in increasing order of difficulty): detecting that many zo
> files can be re-used from the previous installation in some fashion,
> making Typed Racket faster, or making Racket macro expansion more
> incremental.
>
> Sam
>
> --
> 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/CAK%3DHD%2BZ5k%2BFk2guk8sxe8gs-kQ9NcKJLkHGeWprrucFzqZ%2BABA%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/CABNTSaHpG5ACme4ZWiAhmrJ6avbJs2k3jXMoPfLB1CJEDBWjqQ%40mail.gmail.com.


Re: [racket-users] Re: Should I stop sending packages to the catalog?

2020-04-30 Thread Laurent
Alex, that looks like an interesting workflow. Maybe worth a blog post? ;)

On Thu, Apr 30, 2020 at 12:11 AM Alex Harsanyi 
wrote:

>
> You could both send packages to the package catalog and instruct your
> users to use a different package source if they wish to use old versions.
> I don't see these two options in conflict with each other.
>
> As an application writer, I am on the other side of this problem, by
> depending on other packages. Having limited time to work on my project I
> want to upgrade package dependencies at my own pace.   The solution I found
> is to use git submodules and add each package as a submodule to my
> application.  I  construct a catalog of these packages, at an exact git
> commit, and simply run a raco pkg install, knowing that the exact version
> that I want will be there.  From time to time, I update these submodules
> and allow some time for fixing any problems that might result from these
> updates.  This has worked reasonably well so far, and I can reliably
> reconstruct older versions of the application knowing that all dependencies
> will be correct for that old version.
>
> For my part, for any packages that my application depends on, their
> authors can make any breaking changes they want, as this will not
> immediately break my application.  At a later date I can review these
> changes, update my application and move to the new version.
>
> The only downside is that installed packages are at "user scope" rather
> than "application scope" so once installed from the git submodules, that
> package becomes available to all applications on my computer.   So far this
> has not been a real issue, although I had to uninstall, switch catalogs and
> re-install a few times.
>
> I personally regard pkgs.racket-lang.org as the source for the latest
> package versions, for users which just started using the package. Users who
> need precise versioning, can always setup their own package catalogs (i
> discovered that it is a really simple process)
>
> Alex.
>
>
> On Thursday, April 30, 2020 at 12:47:25 AM UTC+8, Sage Gerard wrote:
>>
>> April 9th in the #general Slack channel taught me that there was no clean
>> way to
>> release a breaking change in a package. I'm open to working on version
>> pinning
>> support in raco pkg provided that a maintainer can walk me through some
>> code.
>>
>> In the meantime, as much as I appreciate the efforts made in the current
>> system,
>> I'm considering stopping my contributions to the package catalog until
>> further notice.
>> I'm open to submitting packages if I am confident in their longevity, but
>> I don't want
>> to end up in the position I've been in for the last few weeks when
>> planning a release.
>> That position being an inability to release an edition that is not in
>> some way "aware"
>> of a prior edition. In my view, changing the package/collection name is an
>> example of that problem, not a solution to it.
>>
>> I'm considering asking my users to specify different package sources in
>> their info.rkt
>> files when dealing with my work. Before I commit to that decision, I
>> wanted to tap into
>> those of you who have already been here. How have you handled breaking
>> changes
>> for your projects? How have you communicated with your users to make sure
>> they
>> were adequately prepared? Am I being too black-and-white about this?
>>
>> *~slg*
>>
>>
>> --
> 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/b3b54ccf-b4f1-425e-802a-110d5ac26591%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/CABNTSaE5MN8qDaKd7VF1qL%3DbRhktAw017jyVzUe4O8sFkK%3D0QQ%40mail.gmail.com.


Re: [racket-users] Reflecting on context arity

2020-03-28 Thread Laurent
Follow up on Ben's idea:
Take n as an optional argument, init value #f.
On first application of f on the first values, continue n-map with
n=received number of values. Once arrived at the empty lists you know how
many values you should have.
At each iteration, you can even check that the number of values doesn't
change (or take the max?).

The only corner case is when provided with empty lists from the start, in
which case either the user can specify the init value for n if it is known,
or you can throw an exception.


On Sat, Mar 28, 2020, 00:40 Ben Greenman 
wrote:

> procedure-result-arity is very limited
>
> if you can find a way to call `f` once, though, you could assume that
> its result arity never changes
>
> --
> 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/CAFUu9R6YDx9%2BF27dHW3N1P%3DMK_UuzfrWqo01kigM4fBKxxFXUA%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/CABNTSaEPkeTeMOS_wv9t774mVcBAbE5pqa4aaRfdvRXkCqRDCA%40mail.gmail.com.


Re: [racket-users] Limiting consecutive identical elements with match

2019-12-04 Thread Laurent
I don't know what the exact specs are, but what should be the return values
for '(a a a b b c) and '(a a b b b c) ?

(I can't test right now but I suspect the match approach might miss one)



On Wed, Dec 4, 2019, 23:56 Matthew Butterick  wrote:

>
> On Dec 4, 2019, at 3:26 PM, 'Joel Dueck' via Racket Users <
> racket-users@googlegroups.com> wrote:
>
> I like the trick of using list* to match _ on any number of trailing
> elements. The grammar given in the docs doesn't seem to include it; I'm
> curious by what rule is it "allowed" as a pattern?
>
>
> It's a synonym for the `list-rest` match pattern.
>
>
>
> --
> 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/B5F3E54D-B800-481D-8FE3-A03C6B4F565E%40mbtype.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/CABNTSaFDxwS5NBoe5cB76sL%2BwcxX8kxMoGWdkyzpRVEH7u0r%3Dg%40mail.gmail.com.


Re: [racket-users] Re: GUI (get-directory)

2019-11-23 Thread Laurent
There may be some examples on Rosetta code, or at least Racket snippets
could be added:
https://rosettacode.org/wiki/Category:GUI

On Sat, Nov 23, 2019, 00:23 Martin DeMello  wrote:

> One helpful thing to do is expand the GUI section of awesome-racket
> https://github.com/avelino/awesome-racket
>
> I just sent them a PR for GUI-helpers.
>
> martin
>
> On Thu, Nov 21, 2019 at 9:21 AM James Platt  wrote:
>
>>
>> On Nov 20, 2019, at 3:31 AM, Jack Firth wrote:
>>
>> > Would it have helped if the get-directory documentation had included
>> examples? Many parts of Racket's documentation are lacking in example code,
>> especially the less-commonly-encountered parts.
>>
>> Indeed, I have previously mentioned the lack of examples as a general
>> problem.  However, many potential examples may already be written in the
>> form of test code.  There is a way to add a sandbox to Scribble which
>> allows you to write test code and documentation at the same time.  It would
>> be great if this could be made easier to set up and then promoted for wider
>> use.  One place where it has been used is the struct++ package.
>>
>> See:
>> https://docs.racket-lang.org/struct-plus-plus/index.html
>>
>> https://github.com/dstorrs/struct-plus-plus/blob/master/scribblings/struct-plus-plus.scrbl
>>
>> Also, as David Storrs has mentioned, it would be good if we can find a
>> way to make it easier for more people to contribute to the documentation.
>> See, for example, the thread "Wanted: Easier way to contribute docs" on
>> this forum from June of 2017.
>>
>> If we can direct more of the energy of this community into, not just
>> improving the documentation, but the way we do documentation, it would be a
>> major improvement.  Requiring lots of parentheses doesn't bother me.  Lack
>> of infix notation doesn't bother me.  Lack of documentation does.
>>
>> James
>>
>> --
>> 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/934E0BEE-5840-4596-975F-410C3770DBA6%40biomantica.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/CAFrFfuEd7b3Y_aQ5rHq32tDE_iR06nrJp2J1RRaDsWaYKBhpkg%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/CABNTSaH0dp2OeNyi9krhzCXospGGRrY5qgY_zZCbqKND8VGg6g%40mail.gmail.com.


Re: [racket-users] Determining if 2 lists share a common element

2019-11-14 Thread Laurent
On Thu, Nov 14, 2019 at 3:11 AM Andrew  wrote:

> I have this:
>
> (define (related? a1 a2)
>   (if (equal? a1 a2)
>   true
>   (related? (member (rest ("proc that calls list" a1)) (rest ("proc
> that calls list" a2)))
>  (member a1 ("proc that calls list" a2))
>

I can't make sense of the last 2 lines. `(member x l)` returns a sublist of
l starting with x if l contains x, otherwise false. If your two calls to
`member` returns #f, then the next call to related? will compare (equal? #f
#f) and thus return #t, which is not what you want.

Furthermore, in your first call to `member`, the first argument you pass is
a list, which is suspicious.

To get a better sense of what is happening, a general advice  (works for
all programming languages) is to print the values of your variables, for
example:
(define (related? a1 a2)
  (displayln (list 'a1: a1 'a2: a2))
  (if (equal? a1 a2)
  true
  (related? (member (rest ("proc that calls list" a1))
(rest ("proc that calls list" a2)))
(member a1 ("proc that calls list" a2)

-- 
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/CABNTSaEzBFBF-OZZYo0c0sB4PLt87-qNZhs6z-tgLLo3abnOpg%40mail.gmail.com.


Re: [racket-users] horizontal alignment in a message% or equivalent

2019-10-13 Thread Laurent
If I remember correctly, I think you want to add a spacer box at the right
of your message% in the same panel:
https://docs.racket-lang.org/gui/grow-box-spacer-pane_.html?q=message%25
so that the message takes only the space it needs and is thus flushed to
the left.


On Sun, Oct 13, 2019 at 8:11 AM Martin DeMello 
wrote:

> I'm trying to create a message% with the text left-justified rather than
> centred, and have been searching through the docs with no luck. Is there a
> way to do it, or a widget I should be using instead? My use case is to
> provide a status message at the bottom of a frame.
>
> martin
>
> --
> 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/CAFrFfuHv8WAVnSSQibmQ7DOFoJjw_HyVkXm_7Y-2He4fPQ30Hw%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/CABNTSaE5Q%2BvbO66nm5QUqCFkT4MfQTyAyypiwO1tH%2B%3Dj6KJn-g%40mail.gmail.com.


Re: [racket-users] continuations for search

2019-09-12 Thread Laurent
Hendrik,

There is also the all too often forgotten iterative deepening depth-first
search algorithm:
https://en.wikipedia.org/wiki/Iterative_deepening_depth-first_search
which has the advantages of both, at a very small cost in search time
compared to doing depth-first search with the right cut-off depth bound
from the start.

There are several other considerations to ponder regarding which algorithm
is the right one (backward model, state size, duplicate checking, cost of
continuations, size growth of the search tree, etc.), but I'll abstain for
now unless you want more details.

-- 
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/CABNTSaG0QVorRohByDurLjU__2z%3DSgkCzOjz5C5Q9DYTVRZiwQ%40mail.gmail.com.


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 process it, so the example now becomes:
>>
>> #lang racket
>> (require data-frame)
>>
>> (define df (df-read/csv "worldcities.csv" #:quoted-numbers? #t))
>>
>> (define ((is-city? name) v)
>>   (equal? (vector-ref v 0) name))
>>
>> (df-select* df "city" "country" "lat" "lng" #:filter (is-city? "Perth"))
>>
>> ;; Produces:
>>
>> ;; '#(#("Perth" "Australia" -31.955 115.84)
>> ;;  #("Perth" "United Kingdom" 56.4003 -3.47))
>>
>> Alex.
>>
>>
>> On Saturday, September 7, 2019 at 8:13:28 AM UTC+8, Alex Harsanyi wrote:
>>>
>>>
>>> That database is simple enough to use directly, not sure if it needs a
>>> separate package:
>>>
>>> #lang racket
>>> (require data-frame)
>>>
>>> ;; The worldcities.csv file has all values quoted, so df-read/csv reads
>>> them
>>> ;; all as strings.  Convert a series to numbers.
>>> (define (->numeric df series)
>>>   (df-add-derived df series (list series) (lambda (v) (string->number (car
>>> v)
>>>
>>> (define df (df-read/csv "worldcities.csv"))
>>>
>>>   ;; Convert numeric series to numbers
>>> (for ([series '("lat" "lng" "population")])
>>>   (->numeric df series))
>>>
>>> (define ((is-city? name) v)
>>>   (equal? (vector-ref v 0) name))
>>>
>>> (df-select* df "city" "country" "lat" "lng" #:filter (is-city? "Perth"))
>>>
>>> ;; The above call produces:
>>>
>>> ;; '#(#("Perth" "Australia" -31.955 115.84)
>>> ;;#("Perth" "United Kingdom" 56.4003 -3.47))
>>>
>>>
>>>
>>> Alex.
>>>
>>> On Friday, September 6, 2019 at 8:37:59 PM UTC+8, Laurent wrote:
>>>>
>>>> There's a small free database here too:
>>>> https://simplemaps.com/data/world-cities
>>>>
>>>> I started writing a simple query system for it this morning (csv->rktd,
>>>> then just list of assoc operations).
>>>>
>>>> On Fri, Sep 6, 2019 at 1:35 PM Sage Gerard 
>>>> wrote:
>>>>
>>>>> Would geonames help?
>>>>> http://www.geonames.org/
>>>>>
>>>>>
>>>>>  Original Message 
>>>>> On Sep 6, 2019, 8:28 AM, Hendrik Boom < hen...@topoi.pooq.com> wrote:
>>>>>
>>>>>
>>>>> On Thu, Sep 05, 2019 at 10:42:01PM -0700, Alex Harsanyi wrote:
>>>>> ...
>>>>> >
>>>>> > >
>>>>> > > A package containing a database of the positions of the major
>>>>> cities and
>>>>> > > countries would be nice too :)
>>>>> > >
>>>>> >
>>>>> >
>>>>> > A general facility able to resolve location names to GPS coordinates
>>>>> would
>>>>> > be a lot of work, and I don't have time for such a thing. Sorry.
>>>>>
>>>>> There must be a GPS database of cities available somewhere already.
>>>>>
>>>>> -- 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...@googlegroups.com.
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/racket-users/20190906122801.w5yhwfbzkods2fqr%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...@googlegroups.com.
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/racket-users/yGI9c5OlIwdUQNOQy4KIEMKSfaYia4pr4LkSRukDwvb1sTFJfIQ1As6ca3i8jKqz42EV74CWvr4wdmfhQIcDtbniv7KDj4PqI0Giw-t9q_c%3D%40sagegerard.com
>>>>> <https://groups.google.com/d/msgid/racket-users/yGI9c5OlIwdUQNOQy4KIEMKSfaYia4pr4LkSRukDwvb1sTFJfIQ1As6ca3i8jKqz42EV74CWvr4wdmfhQIcDtbniv7KDj4PqI0Giw-t9q_c%3D%40sagegerard.com?utm_medium=email_source=footer>
>>>>> .
>>>>>
>>>>> --
>> 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/d4353473-061d-4651-aedc-425351833968%40googlegroups.com
>> <https://groups.google.com/d/msgid/racket-users/d4353473-061d-4651-aedc-425351833968%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
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/CABNTSaHeZf9Su-VDBhW3wsPQfEborx6op43TKnXQi71mOVEdBg%40mail.gmail.com.


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" #:quoted-numbers? #t))
>
> (define ((is-city? name) v)
>   (equal? (vector-ref v 0) name))
>
> (df-select* df "city" "country" "lat" "lng" #:filter (is-city? "Perth"))
>
> ;; Produces:
>
> ;; '#(#("Perth" "Australia" -31.955 115.84)
> ;;  #("Perth" "United Kingdom" 56.4003 -3.47))
>
> Alex.
>
>
> On Saturday, September 7, 2019 at 8:13:28 AM UTC+8, Alex Harsanyi wrote:
>>
>>
>> That database is simple enough to use directly, not sure if it needs a
>> separate package:
>>
>> #lang racket
>> (require data-frame)
>>
>> ;; The worldcities.csv file has all values quoted, so df-read/csv reads
>> them
>> ;; all as strings.  Convert a series to numbers.
>> (define (->numeric df series)
>>   (df-add-derived df series (list series) (lambda (v) (string->number (car
>> v)
>>
>> (define df (df-read/csv "worldcities.csv"))
>>
>>   ;; Convert numeric series to numbers
>> (for ([series '("lat" "lng" "population")])
>>   (->numeric df series))
>>
>> (define ((is-city? name) v)
>>   (equal? (vector-ref v 0) name))
>>
>> (df-select* df "city" "country" "lat" "lng" #:filter (is-city? "Perth"))
>>
>> ;; The above call produces:
>>
>> ;; '#(#("Perth" "Australia" -31.955 115.84)
>> ;;#("Perth" "United Kingdom" 56.4003 -3.47))
>>
>>
>>
>> Alex.
>>
>> On Friday, September 6, 2019 at 8:37:59 PM UTC+8, Laurent wrote:
>>>
>>> There's a small free database here too:
>>> https://simplemaps.com/data/world-cities
>>>
>>> I started writing a simple query system for it this morning (csv->rktd,
>>> then just list of assoc operations).
>>>
>>> On Fri, Sep 6, 2019 at 1:35 PM Sage Gerard  wrote:
>>>
>>>> Would geonames help?
>>>> http://www.geonames.org/
>>>>
>>>>
>>>>  Original Message 
>>>> On Sep 6, 2019, 8:28 AM, Hendrik Boom < hen...@topoi.pooq.com> wrote:
>>>>
>>>>
>>>> On Thu, Sep 05, 2019 at 10:42:01PM -0700, Alex Harsanyi wrote:
>>>> ...
>>>> >
>>>> > >
>>>> > > A package containing a database of the positions of the major
>>>> cities and
>>>> > > countries would be nice too :)
>>>> > >
>>>> >
>>>> >
>>>> > A general facility able to resolve location names to GPS coordinates
>>>> would
>>>> > be a lot of work, and I don't have time for such a thing. Sorry.
>>>>
>>>> There must be a GPS database of cities available somewhere already.
>>>>
>>>> -- 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...@googlegroups.com.
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/racket-users/20190906122801.w5yhwfbzkods2fqr%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...@googlegroups.com.
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/racket-users/yGI9c5OlIwdUQNOQy4KIEMKSfaYia4pr4LkSRukDwvb1sTFJfIQ1As6ca3i8jKqz42EV74CWvr4wdmfhQIcDtbniv7KDj4PqI0Giw-t9q_c%3D%40sagegerard.com
>>>> <https://groups.google.com/d/msgid/racket-users/yGI9c5OlIwdUQNOQy4KIEMKSfaYia4pr4LkSRukDwvb1sTFJfIQ1As6ca3i8jKqz42EV74CWvr4wdmfhQIcDtbniv7KDj4PqI0Giw-t9q_c%3D%40sagegerard.com?utm_medium=email_source=footer>
>>>> .
>>>>
>>>> --
> 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/d4353473-061d-4651-aedc-425351833968%40googlegroups.com
> <https://groups.google.com/d/msgid/racket-users/d4353473-061d-4651-aedc-425351833968%40googlegroups.com?utm_medium=email_source=footer>
> .
>

-- 
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/CABNTSaHJ%3DRWdnNqxrPG%2B-1vmm74%3DoxQxHXjwH--j%3D%3D673TWcaA%40mail.gmail.com.


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

2019-09-06 Thread Laurent
There's a small free database here too:
https://simplemaps.com/data/world-cities

I started writing a simple query system for it this morning (csv->rktd,
then just list of assoc operations).

On Fri, Sep 6, 2019 at 1:35 PM Sage Gerard  wrote:

> Would geonames help?
> http://www.geonames.org/
>
>
>  Original Message 
> On Sep 6, 2019, 8:28 AM, Hendrik Boom < hend...@topoi.pooq.com> wrote:
>
>
> On Thu, Sep 05, 2019 at 10:42:01PM -0700, Alex Harsanyi wrote:
> ...
> >
> > >
> > > A package containing a database of the positions of the major cities
> and
> > > countries would be nice too :)
> > >
> >
> >
> > A general facility able to resolve location names to GPS coordinates
> would
> > be a lot of work, and I don't have time for such a thing. Sorry.
>
> There must be a GPS database of cities available somewhere already.
>
> -- 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/20190906122801.w5yhwfbzkods2fqr%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/yGI9c5OlIwdUQNOQy4KIEMKSfaYia4pr4LkSRukDwvb1sTFJfIQ1As6ca3i8jKqz42EV74CWvr4wdmfhQIcDtbniv7KDj4PqI0Giw-t9q_c%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/CABNTSaGD22%2B4t9WP0yqQPArO9wGdhfqan%3DJCe9JkrkF5Bbmu0w%40mail.gmail.com.


Re: [racket-users] Re: Listing All Programs

2019-09-05 Thread Laurent
Adam,

I strongly recommend you take a look at Levin Search (aka Universal
Search), which enumerates and runs programs by dovetailing in a smart way:
http://people.idsia.ch/~juergen/mljssalevin/node4.html
http://www.scholarpedia.org/article/Universal_search#Universal_search

This avoids the halting problem including the running time in the
complexity: If a program q solves the problem in time Tq, then Levin Search
solves the problem in time Tq / wq, where wq = 2^-l(q) with l(q) being the
size in bits of program q. In other words, Levin Search solves all search
problems at least as fast as the fastest program within a constant factor
that depends on the inverse of the prior of the program.

IMO, Levin Search is one of the most important algorithms ever.


On Thu, Sep 5, 2019 at 7:13 PM Sage Gerard  wrote:

> In all honesty, I think you are asking for something so broad that it
> would be more practical if you ran experiments and simulations against the
> specific space you are curious about. Once you do that enough times you'll
> be able to pick out the patterns. I'm not convinced there is an off-shelf
> design for what you want without a patent attached to it.
>
> *~slg*
>
>
> ‐‐‐ Original Message ‐‐‐
> On Thursday, September 5, 2019 2:09 PM, Sage Gerard 
> wrote:
>
> It almost sounds like you want a cleaner interface for defining a neural
> net.
>
> *~slg*
>
>
> ‐‐‐ Original Message ‐‐‐
> On Thursday, September 5, 2019 2:07 PM, Adam Golding <
> adamgold...@gmail.com> wrote:
>
> At this point I don't need the search (through the space of all programs)
> to be efficient I just need it to be 'total' in that every program would be
> reached given a countable infinity of time.  Then I could alter this search
> to search the same space in a different order (still total) and compare
> empirically which is 'more efficient' (depends what programs you're
> searching for).  For example, enumerating possible racket programs from
> shortest to longest source would be one order, and enumerating them from
> shortest to longest runtime would be another...
>
> On Thursday, 5 September 2019 13:53:29 UTC-4, Sage Gerard wrote:
>
>> Thanks, that helps.
>>
>> In the way I read this, it sounds like you want a program that computes
>> the most efficient search algorithm regardless of the context in which said
>> algorithm is used.
>>
>> Is that accurate?
>>
>> *~slg*
>>
>>
>> ‐‐‐ Original Message ‐‐‐
>> On Thursday, September 5, 2019 1:48 PM, Adam Golding 
>> wrote:
>>
>> Basically I want to enumerate programs with as few assumptions as
>> possible aka enumerate the largest set of programs I can--I want to be able
>> to enumerate them in a variety of different orders to compare search
>> strategies.
>>
>> On Thursday, 5 September 2019 13:46:54 UTC-4, Adam Golding wrote:
>>
>>> I want to try automating programming as search where I have various
>>> methods to enumerate the set of all programs in different orders (fastest
>>> to halt first?  shortest source code first? etc.) and filter out certain
>>> programs almost like evolutionary programming.  I don't have a specific
>>> application in mind really, I wanted to have various enumerators to
>>> experiment with, not unlike the opening of "New Kind of Science", where
>>> Wolfram generates all possible CA programs and then categorizes them
>>> according to their behavior.
>>>
>>> The idea also came up recently in this context:
>>> https://www.facebook.com/adamgolding/posts/10106973704058242
>>>
>>> On Thursday, 5 September 2019 13:17:32 UTC-4, Sage Gerard wrote:
>>>
 This question can be read a couple of different ways too. What are you
 trying to do once you have the answer you are looking for?



  Original Message 
 On Sep 5, 2019, 1:13 PM, Adam Golding < adamg...@gmail.com> wrote:


 What is the shortest program listing the largest list of programs that
 can be listed without looping?

 On Thursday, 5 September 2019 11:10:59 UTC-4, dvanhorn wrote:

> How about this: a stream of strings which can be be parsed and
> compiled.  (Note that this will loop when it gets to the first program
> that makes the compiler loop; luckily it's inefficient enough that
> you'll never actually get there.)
>
> #lang racket
> (define valid-progs
>   (for/stream ([p strings]
>#:when (valid p))
> p))
>
> (define strings
>   (stream-cons ""
>(for*/stream ([s strings]
>  [i (in-range 0 #x10)]
>  #:when (not (<= #xD800 i #xDFFF)))
>  (string-append (string (integer->char i)) s
>
> (define (valid x)
>   (with-handlers ([exn:fail? (λ _ #f)])
> (compile (with-input-from-string x
>(λ () (begin0 (read)
>  (unless (eof-object? (read))
>

Re: [racket-users] Listing All Programs

2019-09-05 Thread Laurent
Although it's not about checking, but generating, which *may* be easier.
(Though if one can generate all syntactically valid programs in program
size order, then checking is just a matter of checking for membership in
the list of all programs of size less than the program. This list can be
huge however.)

At least it's very simple to generate all 'syntactically' valid Turing
machines ;)

On Thu, Sep 5, 2019 at 2:56 PM David Van Horn  wrote:

> But whether a program is syntactically valid is not an easy thing to
> decide in a language like racket...
>
> On Thu, Sep 5, 2019, 9:45 AM Laurent  wrote:
>
>> Probably only those that output Chaitin's constant ;)
>>
>> But otherwise I would guess "syntactically valid", in which case it would
>> be easier to consider only lambdas with only one argument.
>>
>> Though if you want to also use all of Racket's primitives (that is,
>> including I/O), then good luck. My closest guess would be:
>> (for/list ([i (in-naturals)])
>>   (mflatt i))
>>
>> On Thu, Sep 5, 2019 at 2:31 PM David Van Horn 
>> wrote:
>>
>>> What do you mean by valid?
>>>
>>> On Thu, Sep 5, 2019, 9:05 AM Adam Golding  wrote:
>>>
>>>> What is the shortest/smallest racket program (ithat enumerates all and
>>>> only valid racket programs?
>>>>
>>>> --
>>>> 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/0b83b7d7-ea3e-434a-b6c4-f394a97fe4fd%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/racket-users/0b83b7d7-ea3e-434a-b6c4-f394a97fe4fd%40googlegroups.com?utm_medium=email_source=footer>
>>>> .
>>>>
>>> --
>>> 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/CAFJHQkGS_%3DM9G%3DGaLXZgctO6UC_cR9VpqjXt5q211UOeOq2dFw%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/racket-users/CAFJHQkGS_%3DM9G%3DGaLXZgctO6UC_cR9VpqjXt5q211UOeOq2dFw%40mail.gmail.com?utm_medium=email_source=footer>
>>> .
>>>
>>

-- 
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/CABNTSaGqXagO98Ttx1-rjmqSrdNyHn4m_UUd5_xazF-xiW2O_Q%40mail.gmail.com.


Re: [racket-users] Pict combiners in list form?

2019-09-05 Thread Laurent
Or as a simple hack you can redefine `apply' as a one letter binding like
`~'.

On Thu, Sep 5, 2019 at 12:52 PM Robby Findler 
wrote:

> Although this is a bit tedious and I write that too much too ... maybe
> they should call "flatten" on their arguments or just accept a list of
> picts?
>
> Robby
>
> On Wed, Sep 4, 2019 at 10:16 PM David Thrane Christiansen <
> da...@davidchristiansen.dk> wrote:
>
>> Hi Hendrik,
>>
>> I use apply for that.  Eg (apply hbl-append (pict-width (t " "))
>> my-list-of-picts).
>>
>> David
>>
>> On Wed, Sep 4, 2019, 20:06 Hendrik Boom  wrote:
>>
>>> Is there a way to call the pict combiners (such as ht-append) giving it
>>> a
>>> list of argument picts instead of a varying number of argument picts?
>>>
>>> Perhaps another set of append functions, or another way of calling
>>> functions
>>> in Racket?  I find myself writing list-folowing recursions every time I
>>> want
>>> this.
>>>
>>> -- 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/20190905030628.rg4uoaac3zro7ztr%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/CAF_itEs8niKiFSvwfoxYs%3D_o-DEa0Etmph_zL_jren0CqzLSFA%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/CAL3TdONXAk9r95T-4Byv9pc9%3DRtBy35df-anqQvJOn8B6YO8aA%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/CABNTSaHxRpUjDhYKikUAztu8_0DFgsBVNUAQKHXYrLt81UVeiw%40mail.gmail.com.


Re: [racket-users] Listing All Programs

2019-09-05 Thread Laurent
Probably only those that output Chaitin's constant ;)

But otherwise I would guess "syntactically valid", in which case it would
be easier to consider only lambdas with only one argument.

Though if you want to also use all of Racket's primitives (that is,
including I/O), then good luck. My closest guess would be:
(for/list ([i (in-naturals)])
  (mflatt i))

On Thu, Sep 5, 2019 at 2:31 PM David Van Horn  wrote:

> What do you mean by valid?
>
> On Thu, Sep 5, 2019, 9:05 AM Adam Golding  wrote:
>
>> What is the shortest/smallest racket program (ithat enumerates all and
>> only valid racket programs?
>>
>> --
>> 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/0b83b7d7-ea3e-434a-b6c4-f394a97fe4fd%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/CAFJHQkGS_%3DM9G%3DGaLXZgctO6UC_cR9VpqjXt5q211UOeOq2dFw%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/CABNTSaFts7ZaLTW3%3DzM-OSW%3D-OMiZwTyxvgAWVk0pDaq0yKazg%40mail.gmail.com.


Re: [racket-users] images in racket files

2019-07-19 Thread Laurent
Looks like your best bet is to save the pict as a bitmap in a separate
file, then load it in your module and export this value.
>From the top of my head:
where the pic is produced:
(send (pict->bitmap my-pict) save-bitmap "path-to/the-bitmap-file.png" 'png)
(or maybe: right click on the snip then save?)
then
(provide my-pic)
(define my-pic (bitmap "path-to/the-bitmap-file.png"))


On Fri, Jul 19, 2019 at 4:56 PM Stephen De Gabrielle <
spdegabrie...@gmail.com> wrote:

> Hi,
> I'm trying to export an 'pict' image i have pasted in a DrRacket file,
> e.g.
> #lang racket
> (require pict)
> (define my-pasted-image )
> (provide  my-pasted-image )
>
> I can specify it in (provide ..) , but attempting to reference it causes
> this error
>
> ../../../../Applications/Racket
> v7.3/collects/racket/private/more-scheme.rkt:261:28: write: cannot marshal
> value that is embedded in compiled code
>   value: (object:image-snip% ...)
> >
>
>
> any ideas?
>
> --
> 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-%2B-cP2zYHSODSASqDGYb1NUPCDy_hscoT4RU5VqQhr%3D2A%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/CABNTSaF5v9iekEx8br4qe8j_N2JYrN7spJb-fv0sPGZqsVJzpQ%40mail.gmail.com.


Re: [racket-users] Re: Impromptu racket meetup in London Friday, 19 July at 12pm-3pm

2019-07-16 Thread Laurent
Good idea. I might come between 12pm and 1pm.

On Fri, Jul 12, 2019 at 8:36 PM zeRusski  wrote:

> argh, wish you'd go with after work hours or the weekend. Sorry, won't be
> able to make it.
>
> On Friday, 12 July 2019 09:20:58 UTC-6, Stephen De Gabrielle wrote:
>>
>> Hi,
>>
>> Next Friday, 19 July at 12pm-3pm there will be an impromptu Racket meetup
>> at the cafe at the British Library 'The Last Word'.
>> https://goo.gl/maps/M62e4b9JK7c1oaA69
>>
>> No agenda. All welcome. Spread the word!
>>
>> I'll be drinking tea, eating cake(I hope), and will be easily identified
>> as a the man with racket logo on his laptop. Updates on this thread.
>>
>> 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/08648123-28e8-46ff-9bf8-20f0cb11d1dd%40googlegroups.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CABNTSaETaLbbQ9_6jns8%2Byn5hcSheWQqhxYObtr2cb4zV6MzYQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] returning GUI elements in function?

2019-07-09 Thread Laurent
There are several ways to solve this (including deriving classes), but the
simplest for you right now is probably to have `initialize-progress-bar'
return the gui widgets (in particular `gauge' and `msg'), assign the values
to `the-gauge' and `the-msg' (say) from the return values of
`(initialize-progress-bar)` call, and then pass these values to
`update-progress-bar' so that `gauge' and `msg' have the correct values
there.

Does that make sense?

On Tue, Jul 9, 2019 at 7:23 AM Travis Hinkelman 
wrote:

> Hi All,
>
> I was playing around with creating a progress bar. The basic idea was
> straightforward.
>
> #lang racket/gui
>
> (define frame (new frame%
>[label "Progress Bar"]
>[width 300]))
>
> (define hpane (new horizontal-pane%
>[parent frame]))
>
> (define gauge (new gauge%
>[label ""]
>[parent hpane]
>[range 100]))
>
> (define msg (new message%
>  [parent hpane]
>  [auto-resize #t]
>  [label "0%"]))
>
> (send frame show #t)
>
> (for ([i (in-range 1 101)])
>   (sleep 0.05)
>   (send gauge set-value i)
>   (send msg set-label (string-append (~a i) "%")))
>
>
> When I tried to take the next step of wrapping this up into a couple of
> functions, I was completely lost. I don't know how to initialize a frame
> with child elements by calling a function because all of the elements of
> the frame only exist in the function and not at the top-level (probably
> butchering the jargon here; hopefully it makes sense). I wasn't really sure
> where to look to learn more about doing such a thing. Here is some
> pseudocode to try to further illustrate my confusion.
>
> (define (initialize-progress-bar)
>   ;; insert code that creates progress bar
>   ;; i.e., from defining frame to sending frame in code above)
>
> (define (update-progress-bar new-value)
>   (send gauge set-value new-value)
>   (send msg set-label (string-append (~a new-value) "%")))
>
> (initialize-progress-bar)
> (for ([i (in-range 1 101)])
>   (sleep 0.05)
>   (update-progress-bar i))
>
> Thanks,
>
> Travis
>
> --
> 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/61a3ea75-d285-45d1-90d4-de569c441c8d%40googlegroups.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CABNTSaEaaAaQSneGi2yOR4dv_0hOz_WYbaQ4v19q4%2BuXY_E%3Dhw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] anyone using single-flonums?

2019-05-30 Thread Laurent
If no one is really relying on them as of today, then I would strongly
support allowing Matthew to break things and move fast. If anyone has a
real need for such a data structure it can still probably be implemented
later as a third-party library, possibly extended to
user-specified-precision flonums.

I suspect that if Matthew feels a need to ask about this, this means the
price of backward compatibility to pay for all of us may be quite
significant.

Personally, I have supported them in the past but not really used them, and
I'm happy to revise my code accordingly.

On Thu, May 30, 2019 at 11:37 AM Hendrik Boom 
wrote:

> On Thu, May 30, 2019 at 12:10:37PM +0200, Konrad Hinsen wrote:
> > Am 29.05.19 um 17:52 schrieb Matthew Flatt:
> >
> > > Does anyone use single-flonums in Racket?
> >
> > Right now, no, but I have used them briefly in a past project, for
> testing
> > the impact of single-precision on a numerical algorithm.
> >
> > The main reason to use single-precision floats nowadays is cutting memory
> > use in half, both because it is sometimes a scarce resource and because a
> > smaller memory footprint means better cache utilisation. Single-precision
> > arrays thus matter more than individual numbers. I have even seen
> > half-precision floats being used for the same reason. With the current
> > interest in "big data" and machine learning, I expect this tendency to
> > increase.
>
> Way back in the 60's, on a decimal computer, when memories were small, a
> friend reduced floating point precision to two digits in order to save
> space.  Two digits isn't much, but it ws enough.
>
> -- 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/20190530103744.j2l7kmog7xznu6pr%40topoi.pooq.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CABNTSaFqqhr6jC-pYVXEiw25ffJ6GO%2BSwkmrhUdxFJ3Q4UV2TQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Racket v7.3

2019-05-16 Thread Laurent
Thank you all for the new release!

On Wed, May 15, 2019 at 7:05 PM 'John Clements' via Racket Users <
racket-users@googlegroups.com> wrote:

> - Racket's IO system has been refactored to improve performance
>  and simplify internal design.
>

Is it mild overall performance improvement, or are there cases where there
can be a big boost? (Like "previous bottlenecks have become highways" kind
of improvement)

-- 
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/CABNTSaEotkhQ_yK8n60fkFgkOmULX061eoj-LmDfhSBopA4h1Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Re: Online IDE’s for Racket ?

2019-05-01 Thread Laurent
Rollapp looks interesting, but when I want to sign in with my gmail account
it requires to get information about all my linked email addresses. That
really seems unnecessary to me, so I didn't try it.

On Fri, Apr 26, 2019 at 9:59 PM Stephen De Gabrielle <
spdegabrie...@gmail.com> wrote:

> Yes - WeScheme is awesome - and so is
> http://pasterack.org
>
> Suggestion: upvote racket on repl.it so you can run it from everywhere:
>
> https://repl.it/language-requests/p/racket
>
> (I know it is unlikely to be as good as the full DrRacket or racket-mode
> experience)
>
> S.
>
> On Wed, 24 Apr 2019 at 19:58, Stephen Foster 
> wrote:
>
>> Wow!  This is is cool.
>>
>> Also +1 -- since I'm interested in this very topic and curious to know
>> what's out there.
>>
>> P.S. You probably already know about wescheme.org, right?
>>
>>
>> On Tuesday, April 23, 2019 at 5:17:40 AM UTC-7, Stephen De Gabrielle
>> wrote:
>>>
>>> Hi
>>>
>>> I found that you can run DrRacket on rollApp virtualisation platform[1].
>>>
>>> Are there any other online IDE’s for Racket? I’m interested in both
>>> in-browser repl/editor combinations or virtualised DrRacket.
>>>
>>> Stephen
>>>
>>> [1] rollApp DrRacket free version does not permit saving. Signup
>>> required. https://www.rollapp.com/app/drracket
>>>
>>> --
>>> 
>>>
>> --
>> 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.
>

-- 
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] finding the package that a function is defined in

2019-04-28 Thread Laurent
For DrRacket there's a quickscript in the quickscript-extra package, called
"provided-by" (not sure which of "by" or "from" is the appropriate English
form here...). It searches all(?) installed libraries for you and reports
the packages that export the identifier under the keyboard cursor. There's
a small load time on the first use of the script.

(If the script dared to export the `search-exact` form, it would be usable
also as a non-DrRacket script, as long as quickscript is installed. But it
doesn't dare, as of now.)

On Sat, Apr 27, 2019 at 2:49 PM Jack Rosenthal  wrote:

> If you're looking for a way to speed up your workflow, if you use
> racket-mode in Emacs, you can press "C-c C-." with the symbol in
> question at point, and you'll get a handy search page with this in your
> browser:
>
> contract-out  provided from racket/contract/base, racket/contract, racket
>
> "provided from" answers your question ;)
>
> Jack
>
> --
> Jack M. Rosenthal
> http://jack.rosenth.al
>
> If Java had true garbage collection, most programs would
> delete themselves upon execution.
> -- Robert Sewell
>
> --
> 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] color-maps for the plot package

2019-03-20 Thread Laurent
This is a fantastic idea, Alex. (While I'm at it, thanks for all your other
projects related to the GUI, they are really cool.)

I'm *very* much in favour of all your points, (1) to (4).

I've had uses of different colors scheme for academic papers, and the
default palette doesn't work well for me. I haven't tried the matplotlib
palettes, but my various attempts have never been entirely satisfactory.
Here's an excerpt from some of my stabs:
https://github.com/Metaxal/bazaar/blob/master/plot.rkt#L133
(this includes a palette generator to maximize color difference, line 376+,
which I find much better than the default palette, but it doesn't take into
account the specifics of the human eye.)

Just a side note: the #:color argument is already quite flexible and
accepts things like '(10 20 30), which is pretty nice.



On Wed, Mar 20, 2019 at 4:17 AM Alex Harsanyi 
wrote:

>
>
> On Wednesday, March 20, 2019 at 10:35:51 AM UTC+8, Ben Greenman wrote:
>>
>> > Could you (or Ben or Matt) elaborate on how do you see this work for
>> non
>> > plot programs?
>>
>> I'm thinking a color-map% object would define a possibly-infinite
>> sequence of colors that look nice in some way. The colors might be
>> useful anywhere where someone wants a "rainbow" of colors ... maybe
>> for:
>>
>> - fonts in a slideshow (colorblind-friendly? grayscale-friendly?),
>> - coloring the error messages made by a linter or program analyzer,
>> - drawing a sunset, etc.
>>
>
> The examples listed above might be better served by other color choosing
> mechanisms, for example, I have implemented some color manipulation code
> based
> on https://tallys.github.io/color-theory/, you can find it here:
> https://github.com/alex-hhh/data-frame/blob/master/private/colors.rkt .
> In
> particular the `pick-color` function might do something similar to what
> Pyret
> is using (as suggested by Justin Zamora).
>
> Other solutions are also possible, including using gradient color maps, but
> this is a larger scope that I originally planned for and I don't have
> the time to prepare and submit a patch for such changes.
>
> My proposal is more limited, to allow plot users to produce good looking
> plots
> with minimum effort.  What I propose is:
>
> (1) Add a mechanism (via parameters) to replace the `pen-colors` and
> `brush-colors` vectors in the plot package with custom defined colors.
> This
> means that the existing `->pen-color` and `->brush-color` functions would
> now
> return a different color depending on what `pen-colors` or `brush-colors`
> are
> installed.  This also has the benefit that the existing mechanism of
> specifying numbers for colors will now work with color maps:
>
> (plot (list (function sin -5 5 #:color 1)))
>
> (2) "Borrow" the qualitative color maps from matplotlib, so the user has
> some
> nice predefined set of colors to choose from for their plots.
>
> Also, possibly the following backwards incompatible changes:
>
> (3) change the default set of `pen-colors` and `brush-colors` to one of the
> new color maps, so the nicer colors are on by default.
>
> (4) change the default plot behavior so that a different color is chosen
> for
> each renderer, this means that things like the code below would result in
> different colors used for the `sin` and `cos` functions:
>
> (plot (list (function sin -5 5) (function cos -5 5)))
>
> If others think that (1) and (2) are worthwhile doing, I will submit a PR,
> so
> we can discuss the API an implementation over something more concrete.  I
> am
> open discussion for points (3) and (4).
>
> For the more broader color map changes, if the improvements are split up in
> small incremental tasks, I will be happy to help out, as time allows.
>
> Alex.
>
> --
> 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] printing decimals

2019-03-15 Thread Laurent
You're probably looking for `real->decimal-string`.

Also take a look at ~r instead of ~a, as the former is only for numbers.

On Fri, Mar 15, 2019 at 5:57 PM  wrote:

> Hi all,
>
> I've been looking through the docs for a way to print decimals to a
> defined precision.
>
> I can get close to what I want using something like ~a and giving it a set
> width without having to build a function to do so. I mean I can build a
> function to do as its just a bit of string manip but it feels really odd
> that there doesn't seem to be a built in way to do so even though we try to
> keep all the decimals in fractional notation to maintain precision as long
> as possible in racket.
>
> any ideas anyone or am I just being blind and its right there in the docs
> somewhere?
>
> thanks,
> Scott
>
> --
> 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] Pretty display of tabular data?

2019-03-13 Thread Laurent
Not sure how much this would help you, but there's a `text-table`package.
It's fairly simple though.
Docs: https://docs.racket-lang.org/text-table/index.html

On Wed, Mar 13, 2019 at 6:19 PM Matt Jadud  wrote:

> Hi all,
>
> I have a tabular data type that I'd like (I think) to be able to render it
> either in ASCII or in a prettier way in the Interactions pane. I've
> explored gen:write and friends, and can get the struct to display the way I
> want---with ASCII. Essentially easy-peasy.
>
> What I wonder is: am I able to do something prettier? Can I encapsulate
> some kind of styled rendering as a snip%, or... something... so that I can
> render the first 5 and last 5 rows of a table with bolding of headers,
> etc.?
>
> I don't know where to start, essentially, if I wanted to try and do this.
> Or, perhaps it is not particularly doable.
>
> Pointers to examples in codebases are welcome (if such examples exist),
> and I can work from there. Or, indications that this might be really
> difficult are also welcome.
>
> Cheers,
> Matt
>
> (Apologies if this somehow comes through twice... I sent it to plt-scheme
> first...)
>
> --
> 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] tree-layout, many many thanks

2019-02-27 Thread Laurent
A long time ago I had a need for this too, so I just made one for me:
https://github.com/Metaxal/bazaar/blob/master/slideshow/slideshow-tree.rkt

The behaviour is a bit different from pict/tree-layout.
There's an example usage in the drracket submodule at the end of the file
that produces:
[image: Screenshot from 2019-02-27 13-39-22.png]






On Tue, Feb 26, 2019 at 11:41 PM 'John Clements' via Racket Users <
racket-users@googlegroups.com> wrote:

> I wanted to format binary search trees for a data structures exam. I spent
> literally hours trawling through old source code to see how I’d done it
> before… graphviz? tikzpicture? … before giving up and doing what I should
> have done in the first place, looking in the racket docs. Tree-layout does
> exactly what I want, renders to .pdf, and I’m done.
>
> My major mistake: looking elsewhere!
>
> John
>
> --
> 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] Cannot use case+else inside match+else

2019-02-27 Thread Laurent
Good point. I wasn't sure that would work---it does.

On Wed, Feb 27, 2019 at 1:28 PM Jens Axel Søgaard 
wrote:

> I suppose you could (re)require it again.
>
> ons. 27. feb. 2019 kl. 14.19 skrev Laurent :
>
>> Wait, that means that in an interactive session, if you ever happen to
>> redefine `else', you can't use `case' anymore?
>>
>> On Tue, Feb 26, 2019 at 5:03 AM Ben Greenman 
>> wrote:
>>
>>> Here's a suggestion for the docs:
>>>
>>> https://github.com/racket/racket/pull/2505
>>>
>>> --
>>> 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.
>>
> --
> --
> Jens Axel Søgaard
>
>

-- 
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] Cannot use case+else inside match+else

2019-02-27 Thread Laurent
Wait, that means that in an interactive session, if you ever happen to
redefine `else', you can't use `case' anymore?

On Tue, Feb 26, 2019 at 5:03 AM Ben Greenman 
wrote:

> Here's a suggestion for the docs:
>
> https://github.com/racket/racket/pull/2505
>
> --
> 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] Strange behavior from regexp-match*

2019-02-10 Thread Laurent
Not sure what the actual problem is, but may be this excerpt from the docs
is relevant:

  The internal size of a regexp value is limited to 32 kilobytes; this
limit roughly corresponds to a source string with 32,000 literal characters
or 5,000 operators.

Source:
http://docs.racket-lang.org/reference/regexp.html?q=regular%20expressions#%28tech._regular._expression%29

Maybe you need to split the book in chunks of 32kB.


On Sun, Feb 10, 2019 at 3:59 PM Rebelsky, Samuel 
wrote:

> Dear Racket Users,
>
> Some of my students are getting strange results from regexp-match* and I'm
> hoping that someone on the list might be able to explain what's happening.
>
> They've selected the book at
> http://www.gutenberg.org/cache/epub/37499/pg37499.txt, which is encoded
> in UTF-8.  The students are searching a book from Project Gutenberg for
> words that start with any letter and then "at", using the regular
> expression #px"\\W.at".  Here's the behavior we're seeing.
>
> Welcome to DrRacket, version 7.2 [3m].
> Language: racket, with debugging; memory limit: 128 MB.
> > (define port (open-input-file "pg37499.txt"))
> > (define book (port->string port))
> > (close-input-port port)
> > (string-length book)
> 616649
> > (regexp-match* #px"\\W.at" book)
> . . ../../Applications/Racket v7.2/collects/racket/private/kw.rkt:1325:47:
> substring: ending index is smaller than starting index
>   ending index: 24053
>   starting index: 24055
>   valid range: [0, 616649]
>   string: "\uFEFFProject Gutenberg's Napoleon's Letters to Josephine, by
> Henry Foljambe Hall\r\n\r\nThis eBook is for the use of any…
>
> I was trying to extract the portion that creates the error.  Strangely
> enough, if we just work with some substrings of the book that include the
> approximate indices, regexp-match* seems to work fine.  But not all such
> substrings.
>
> > (regexp-match* #px"\\W.at" (substring book 0 25000))
> '(" Dat" " rat" " lat" " Cat" "  at" " lat" "\ndat" " dat" " Cat" " bat" "
> bat" " bat" " lat" "\r\nat" ", at" " rat" " pat" " lat" ", at" " nat" "
> nat" "\r\nat" "\r\nat" " pat" " nat" "\nnat" "\r\nat" " Cat" "\ngat" " nat")
> > (regexp-match* #px"\\W.at" (substring book 0 10))
> . . ../../Applications/Racket v7.2/collects/racket/private/kw.rkt:1325:47:
> substring: ending index is smaller than starting index
>   ending index: 24053
>   starting index: 24055
>   valid range: [0, 10]
>   string: "\uFEFFProject Gutenberg's Napoleon's Letters to Josephine, by
> Henry Foljambe Hall\r\n\r\nThis eBook is for the use of any...
> > (regexp-match* #px"\\W.at" (substring book 24000 25000))
> '(" nat")
> > (regexp-match* #px"\\W.at" (substring book 24000 5))
> . . ../../Applications/Racket v7.2/collects/racket/private/kw.rkt:1325:47:
> substring: ending index is smaller than starting index
>   ending index: 53
>   starting index: 55
>   valid range: [0, 26000]
>   string: "are in my\r\npossession. Had these been of a political nature,
> much as I should\r\nprize any relics of such a man, yet th...
>
> We also see the same error with similar patterns that start with \\W.
>
> > (regexp-match* #px"\\W[a-zA-Z]at" (substring book 24000 5))
> . . ../../Applications/Racket v7.2/collects/racket/private/kw.rkt:1325:47:
> substring: ending index is smaller than starting index
>   ending index: 53
>   starting index: 55
>   valid range: [0, 26000]
>   string: "are in my\r\npossession. Had these been of a political nature,
> much as I should\r\nprize any relics of such a man, yet th...
> > (regexp-match* #px"\\W\\wat" (substring book 24000 5))
> . . ../../Applications/Racket v7.2/collects/racket/private/kw.rkt:1325:47:
> substring: ending index is smaller than starting index
>   ending index: 53
>   starting index: 55
>   valid range: [0, 26000]
>   string: "are in my\r\npossession. Had these been of a political nature,
> much as I should\r\nprize any relics of such a man, yet th…
>
> Any ideas?
>
> Thanks!
>
> -- SamR
>
> Samuel A. Rebelsky - He, Him, His
> Professor of Computer Science
> Grinnell College, 1116 8th Avenue, Grinnell, Iowa 50112
>
> The opinions expressed herein are my own, and should not be attributed to
> Grinnell College, Grinnell's Department of Computer Science, SIGCSE,
> SIGCAS, any other organizations with which I am affiliated, my family, or
> even most sentient beings.
>
> --
> 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] Re: nested for loops and suggested alternatives

2019-02-10 Thread Laurent
perhaps more importantly:

-- (build-vector 5 (lambda (_) (make-vector 5 0)))
-- (make-vector 5 (build-vector 5 (lambda (_) 0)))

On Sun, Feb 10, 2019 at 3:16 PM Gustavo Massaccesi 
wrote:

> To understand the problem, it will be useful to understand the difference
> between
>
> -- (make-vector 5 (make-vector 5))
> -- (build-vector 5 (lambda (_) (build-vector 5 (lambda (_) 0
> -- (for/vector ([_ 5]) (for/vector ([_ 5]) 0))
>
> Gustavo
>
> On Sun, Feb 10, 2019 at 7:24 AM  wrote:
>
>> Yes, this was the problem. I now have results that match the output from
>> R. I've updated the gist with your line for the correct way to create a
>> vector of vectors. I will have to spend some more time to understand the
>> make-vector behavior. Perhaps my thinking is too constrained by my R
>> experience where many functions are "vectorized"? I guess the part that was
>> confusing me (and still is) is why make-vector worked as expected (by me)
>> for my inner vector but not my outer vector. Thanks!
>>
>>
>> On Sunday, February 10, 2019 at 12:42:53 AM UTC-8, Alex Harsanyi wrote:
>>>
>>> This line looks suspicious:
>>>
>>>  (define results (make-vector years (make-vector (vector-length
>>> fecundity) 0)))
>>>
>>> The "(make-vector (vector-length fecundity) 0)" expression will create a
>>> single vector, than it creates the outer vector will all elements pointing
>>> to it.  It is not a matrix, but a "column" vector where each element is
>>> referencing the same row vector.  This means that if you update an element
>>> in one of the rows, the same value will "appear" in all other rows. The
>>> only row that is different is the first one which you initialize in the
>>> line:
>>>
>>> (vector-set! results 0 (make-vector (vector-length fecundity) 10))
>>>
>>> What you probably want is a vector of vectors, which can be built like
>>> this
>>>
>>> (define results (for/vector ([index (in-range years)]) (make-vector
>>> (vector-length fecundity) 0)))
>>>
>>> Alex.
>>>
>>>
>>>
>>> On Sunday, February 10, 2019 at 3:40:42 PM UTC+8, travis.h...@gmail.com
>>> wrote:

 Hi All,

 I'm an R programmer that has recently started learning Racket. I
 decided to start by trying to create a simple age-structured population
 model. In R, I would initialize a matrix and use nested for loops to move
 through the elements of the matrix and propagate the population forward
 through time. For my first attempt in Racket (
 https://gist.github.com/hinkelman/3ee6115cdd7f0a4c8f1672b7d8df5c27), I
 used for* to loop through a vector of vectors. The code in that gist
 doesn't quite work. There is apparently something wrong with how I'm using
 vector-set! such that "rows" in my vector of vectors are being updated
 prematurely. I would greatly appreciate it if someone could point out what
 I'm doing wrong there. I'm also interested in suggestions for alternative
 approaches because it seems unlikely that I have written this code in
 idiomatic Racket.

 Thanks,

 Travis

 P.S. If it is helpful, here is a gist (
 https://gist.github.com/hinkelman/d5b8414b0c6383057d7846509a724bbf)
 with the R code that I was trying to write in Racket.

>>> --
>> 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.
>

-- 
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] Re: read-from-string(-all)

2019-02-07 Thread Laurent
aha, here it is!
The closest form is then `(call-with-input-string str (λ(in)(port->list
read in)))'.
Thanks Sam and Alex!

On Wed, Feb 6, 2019 at 10:01 PM Sam Tobin-Hochstadt 
wrote:

> Also, almost that `read-all` function is provided as `port->list` from
> `racket/port`.
>
> Sam
>
> On Wed, Feb 6, 2019 at 6:25 AM Alex Harsanyi 
> wrote:
> >
> > (read-from-string "123") is equivalent to `(call-with-input-string "123"
> read)` while read-from-string-all can be replaced by:
> >
> > (define (read-all in)
> >   (let loop ([result '()])
> > (let ((v (read in)))
> >   (if (eof-object? v)
> >   (reverse result)
> >   (loop (cons v result))
> >
> > > (call-with-input-string "123 456" read-all)
> > '(123 456)
> >
> > although I am not sure it is a good idea to call read on strings
> received from the user...
> >
> > Alex.
> > On Wednesday, February 6, 2019 at 6:49:57 PM UTC+8, Laurent Orseau wrote:
> >>
> >> read-from-string and read-from-string-all are convenient functions, but
> they belong to the mzlib/string library, which is deprecated. I can't find
> an existing replacement in racket/string or racket/base. Is there one with
> a different name?
> >
> > --
> > 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.
>

-- 
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] Re: read-from-string(-all)

2019-02-06 Thread Laurent
Oh nice, I didn't know we could do that one!
Point taken :)

I suppose (hope?) you can still use sandboxing with memory limits for this?

On Wed, Feb 6, 2019 at 11:52 AM Alex Harsanyi 
wrote:

>
>
> On Wednesday, February 6, 2019 at 7:36:40 PM UTC+8, Laurent Orseau wrote:
>>
>> On Wed, Feb 6, 2019 at 11:25 AM Alex Harsanyi 
>> wrote:
>>
>> although I am not sure it is a good idea to call read on strings received
>>> from the user...
>>>
>>
>> They're not eval'ed,
>>
>>
> Try: (call-with-input-string "#100[]" read)
>
> Alex.
>
> --
> 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] Re: read-from-string(-all)

2019-02-06 Thread Laurent
On Wed, Feb 6, 2019 at 11:25 AM Alex Harsanyi 
wrote:

> (read-from-string "123") is equivalent to `(call-with-input-string "123"
> read)` while read-from-string-all can be replaced by:
>
> (define (read-all in)
>   (let loop ([result '()])
> (let ((v (read in)))
>   (if (eof-object? v)
>   (reverse result)
>   (loop (cons v result))
>
> > (call-with-input-string "123 456" read-all)
> '(123 456)
>

Thanks Alex. I just wanted to make sure I wasn't overlooking something
before writing my own version.  (and I'm particularly interested in the
-all variant.)


> although I am not sure it is a good idea to call read on strings received
> from the user...
>

They're not eval'ed, it's only data (for plotting, etc.). And the user is
me, using text copied from the output of some program (after some
grep/sed-ing).

-- 
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] read-from-string(-all)

2019-02-06 Thread Laurent
read-from-string and read-from-string-all are convenient functions, but
they belong to the mzlib/string library, which is deprecated. I can't find
an existing replacement in racket/string or racket/base. Is there one with
a different name?

-- 
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] Quickscript error on first startup of Racket 7.2

2019-02-04 Thread Laurent
On Mon, Feb 4, 2019 at 9:55 PM Robby Findler 
wrote:

> > Possibly. I'm not sure what would be the best option yet, I'll think
> about it but I welcome suggestions.
>
> I think the main thing should be to avoid any uncaught exceptions (if
> they happen while quickscript starts up, it will get disabled; if they
> happen later, they'll be labelled "internal error"s). How exactly to
> save the information and show it to the user in a nice way seems like
> there are lots of things to try out!
>

Currently, exceptions raised from building the menu or running the scripts
are caught by quickscript and displayed in a message box. I've just changed
the title of the box to "Quickscript caught an exception" to be clearer.
Another option would be to have a quickscript log accessible from the menu
(and a quickscript console?).

-- 
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] Quickscript error on first startup of Racket 7.2

2019-02-04 Thread Laurent
On Sun, Feb 3, 2019 at 7:00 PM Robby Findler 
wrote:

>
>
> On Sun, Feb 3, 2019 at 11:50 AM Laurent  wrote:
>
>> I've pushed a repair. It should be integrated with the next racket
>> nightly release I suppose.
>>
>> The fix is to check the compiled version of all scripts in the library,
>> and if it differs from the current racket version it gets recompiled. The
>> bonus is that scripts that have not been compiled yet will now be, which
>> means faster loading time when triggering them.
>>
>> The caveat is that dependencies are not recompiled. This means that if a
>> script depends on a package/collection that hasn't been migrated/updated
>> yet, an error may be displayed on DrRacket startup (but appart from this
>> script DrRacket should still work fine).
>>
>
> Can this error be caught and captioned with a better message or, even
> better, perhaps be integrated somehow into quickscript? (Maybe putting
> something into the menu or some other place somehow?)
>

Possibly. I'm not sure what would be the best option yet, I'll think about
it but I welcome suggestions.


> @Robby: I've tested this manually, by installing an old version of racket,
>> and compiling scripts with the old one while running the new version of
>> drracket, but I'm not sure how to automate this properly (as in "write a
>> portable test file"). Have you done something like this before?
>>
>
> Maybe save an old compiled file, putting it into place and then starting
> up drr the way that other test suites start it up, and checking that it
> starts up successfully?
>

That's a neat idea! It should simplify the process a big deal. 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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Quickscript error on first startup of Racket 7.2

2019-02-03 Thread Laurent
I've pushed a repair. It should be integrated with the next racket nightly
release I suppose.

The fix is to check the compiled version of all scripts in the library, and
if it differs from the current racket version it gets recompiled. The bonus
is that scripts that have not been compiled yet will now be, which means
faster loading time when triggering them.

The caveat is that dependencies are not recompiled. This means that if a
script depends on a package/collection that hasn't been migrated/updated
yet, an error may be displayed on DrRacket startup (but appart from this
script DrRacket should still work fine).

Feedback more than welcome.

@Robby: I've tested this manually, by installing an old version of racket,
and compiling scripts with the old one while running the new version of
drracket, but I'm not sure how to automate this properly (as in "write a
portable test file"). Have you done something like this before?


On Fri, Feb 1, 2019 at 1:37 PM Laurent  wrote:

> Okay then, I'll work on a fix tomorrow.
>
> On Fri, Feb 1, 2019 at 1:23 PM Robby Findler 
> wrote:
>
>> I can't say concretely what will go wrong I am sorry to say. There are
>> just a number of moving parts and I can't quite see how they will fail to
>> fit together. I am just basing this on my vague, holistic understanding of
>> how things work currently. (There are no places where on set of sources is
>> used with multiple versions in the standard distribution and nontrivial
>> work has gone into making that case work out and maintain that invariant.)
>>
>> In other words, go for it! We have a fallback if this don't work out. :)
>>
>> Robby
>>
>> On Fri, Feb 1, 2019 at 7:01 AM Laurent  wrote:
>>
>>> On Fri, Feb 1, 2019 at 11:30 AM Robby Findler <
>>> ro...@eecs.northwestern.edu> wrote:
>>>
>>>> My feeling is that our compilation infrastructure isn't really set up
>>>> to work like that currently. In general things will probably be smoother if
>>>> there is only the expectation that a given set of files is used with only
>>>> one version at a time.
>>>>
>>>> It is possible that someone may use multiple versions of DrRacket on
>>>> their computer switching between them or even having them open at the same
>>>> time.
>>>>
>>>
>>> Frankly, for any application, if one has multiple versions open at the
>>> same time and things go wrong, I don't see how one can blame the developers
>>> with a straight face—the one legitimate case is probably when you're one of
>>> the developers yourself.
>>>
>>> If you want to use several versions but not at the same time (which is
>>> also asking for trouble in any case), then recompilation on startup should
>>> work nicely anyway, just requiring a little more time. Copying the same
>>> scripts in different folders will very likely mean divergence of source at
>>> some point and likely frustration for the user.
>>>
>>> Or am I missing something?
>>>
>>>
>>>>
>>>> Robby
>>>>
>>>> On Fri, Feb 1, 2019 at 4:12 AM Laurent 
>>>> wrote:
>>>>
>>>>> Thanks for bringing this up.
>>>>>
>>>>> Indeed the compile option from the quickscript menu should work, but
>>>>> it's not ideal.
>>>>>
>>>>> I'm not a big fan of the copy option. (To me that sounds like asking
>>>>> for trouble, but I may be wrong.)
>>>>>
>>>>> A nicer solution may be to simply check if the scripts are compiled
>>>>> with the current version, and if not just silently compile them on 
>>>>> DrRacket
>>>>> startup? The user could also be querried if that's better.
>>>>>
>>>>> On Thu, Jan 31, 2019, 23:02 Greg Trzeciak >>>>
>>>>>> As long as the user-scripts won't be lost (i.e. the scripts will be
>>>>>> copied over) it sounds OK.
>>>>>>
>>>>>> On Thursday, January 31, 2019 at 10:42:08 PM UTC+1, Robby Findler
>>>>>> wrote:
>>>>>>>
>>>>>>> Probably it is best if quickscript (either silently or after asking)
>>>>>>> copied scripts from a version-specific directory to a new
>>>>>>> (version-specific) one, much like how the pkg system works.
>>>>>>>
>>>>>>> Robby
>>>>>>>
>>>>>>> On Thu, Jan 31, 2019 at 3:38 PM Greg Trzeciak 
>>&g

[racket-users] Re: From Guido to Matthias (was: Python's append vs Racket's append and helping novices understand the implications)

2019-02-03 Thread Laurent
Ouch!! :-D

On Sun, Feb 3, 2019 at 3:40 PM Matthias Felleisen 
wrote:

>
>
> On Feb 3, 2019, at 10:12 AM, Laurent  wrote:
>
> When was that and what was the outcome of this meeting?
>
>
>
> Nothing. It was a waste of my time. — Matthias
>
>

-- 
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] From Guido to Matthias (was: Python's append vs Racket's append and helping novices understand the implications)

2019-02-03 Thread Laurent
Now you just peaked my curiosity!

When was that and what was the outcome of this meeting?

On Sat, Feb 2, 2019 at 11:00 PM Matthias Felleisen 
wrote:

>
> [[ p.s. For my very first Python program (a couple of days before meeting
> with GvR), I used Python’s append and was annoyed beyond belief. ]]
>

-- 
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] drracket migrate: package is currently installed in a wider scope

2019-02-01 Thread Laurent
Thanks for the fast fix Matthew!
It should help at least for those who install the nightlies but haven't
upgraded yet.

On Fri, Feb 1, 2019 at 4:46 PM Matthew Flatt  wrote:

> At Fri, 1 Feb 2019 15:45:02 +0000, Laurent wrote:
> > Okay, I think the problem is that DrRacket's dependency installed
> > quickscript, and trying to migrate your own version of quickscript
> > afterwards fails because it's already there.
>
> Although the package-migrate tool was intended to skip packages that
> are already installed, this example hits a corner that we didn't
> anticipate --- although, in retrospect, it's not an unlikely case:
>
>  1) the package is installed, but as a dependency of some other
> explicitly installed package; and
>
>   2) the existing install is in a wider scope than the target scope for
>  migration.
>
> In that case, the migration tool attempts to upgrade "auto-installed as
> a dependency" to "explicitly installed", and that fails due to being in
> the wrong scope.
>
> One the solution is to have migrate not try to upgrade a package from
> auto-installed if it's already installed, and I've pushed that change.
> It doesn't help with 7.1 -> 7.2, but it should help in the future.
>
> --
> 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] ~v in drracket vs commandline

2019-02-01 Thread Laurent
But I should add that that's not a big deal to me now, since at least now I
know how to work around it.

On Fri, Feb 1, 2019 at 4:06 PM Laurent  wrote:

> Or better yet, maybe replace the choice between print and write to a
> boolean choice on the initial value of 'print-as-expression'.
>
> Ideally, changing this value at the top of the module to evaluate would
> overwrite this default though.
>
> On Fri, Feb 1, 2019 at 4:04 PM Sam Tobin-Hochstadt 
> wrote:
>
>> Could it be changed to also set `(print-as-expression)` appropriately?
>>
>> Sam
>>
>> On Fri, Feb 1, 2019 at 11:02 AM Robby Findler
>>  wrote:
>> >
>> > Ah, right! I forgot about that setting. Yes, what you describe is
>> > exactly what happens.
>> >
>> > Robby
>> >
>> > On Fri, Feb 1, 2019 at 9:57 AM Laurent 
>> wrote:
>> > >
>> > > I think I've found the problem.
>> > >
>> > > In the preferences, I chose 'Output syntax | Output style | write'
>> which seems to force the behaviour of (print-as-expression #f) without
>> actually changing the parameter.
>> > >
>> > > After changing this preference to print, I observe a consistent
>> behaviour between DrRacket and command line.
>> > >
>> > >
>> > >
>> > > On Fri, Feb 1, 2019 at 3:48 PM Laurent 
>> wrote:
>> > >>
>> > >> I'm in #lang racket for DrRacket, and I assume it's the same for the
>> command line when merely starting "$ racket"
>> > >>
>> > >>
>> > >> On Fri, Feb 1, 2019 at 3:39 PM Robby Findler <
>> ro...@eecs.northwestern.edu> wrote:
>> > >>>
>> > >>> This setting is controlled by the language of the original file (so
>> > >>> the one in the definitions window in DrRacket or the one you are
>> > >>> "inside" in the repl if you're in one). Possibly those are different
>> > >>> for you, Laurent?
>> > >>>
>> > >>> Robby
>> > >>>
>> > >>> On Fri, Feb 1, 2019 at 9:33 AM Sam Tobin-Hochstadt <
>> sa...@cs.indiana.edu> wrote:
>> > >>> >
>> > >>> > I see the same behavior in DrRacket as in command line racket.
>> > >>> >
>> > >>> > On Fri, Feb 1, 2019 at 10:19 AM Laurent 
>> wrote:
>> > >>> > >
>> > >>> > > I'm seeing a difference that I can't explain. In the
>> interactions below, look for the leading quote in the output string on the
>> commandline, and its absence in DrRacket.
>> > >>> > >
>> > >>> > > The same problem happens when running a module containing the
>> same code, so it's not a top-level issue.
>> > >>> > >
>> > >>> > > Is there another parameter that controls this quoting mechanism
>> that I don't know about?
>> > >>> > >
>> > >>> > > In DrRacket:
>> > >>> > > > (~v 'auie)
>> > >>> > > "auie"
>> > >>> > > > (print-as-expression)
>> > >>> > > #t
>> > >>> > >
>> > >>> > > On the command line:
>> > >>> > > Welcome to Racket v7.2.0.3.
>> > >>> > > > (~v 'auie)
>> > >>> > > "'auie"
>> > >>> > > > (print-as-expression)
>> > >>> > > #t
>> > >>> > >
>> > >>> > > --
>> > >>> > > 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.
>> > >
>> > > --
>> > > 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] ~v in drracket vs commandline

2019-02-01 Thread Laurent
Or better yet, maybe replace the choice between print and write to a
boolean choice on the initial value of 'print-as-expression'.

Ideally, changing this value at the top of the module to evaluate would
overwrite this default though.

On Fri, Feb 1, 2019 at 4:04 PM Sam Tobin-Hochstadt 
wrote:

> Could it be changed to also set `(print-as-expression)` appropriately?
>
> Sam
>
> On Fri, Feb 1, 2019 at 11:02 AM Robby Findler
>  wrote:
> >
> > Ah, right! I forgot about that setting. Yes, what you describe is
> > exactly what happens.
> >
> > Robby
> >
> > On Fri, Feb 1, 2019 at 9:57 AM Laurent  wrote:
> > >
> > > I think I've found the problem.
> > >
> > > In the preferences, I chose 'Output syntax | Output style | write'
> which seems to force the behaviour of (print-as-expression #f) without
> actually changing the parameter.
> > >
> > > After changing this preference to print, I observe a consistent
> behaviour between DrRacket and command line.
> > >
> > >
> > >
> > > On Fri, Feb 1, 2019 at 3:48 PM Laurent 
> wrote:
> > >>
> > >> I'm in #lang racket for DrRacket, and I assume it's the same for the
> command line when merely starting "$ racket"
> > >>
> > >>
> > >> On Fri, Feb 1, 2019 at 3:39 PM Robby Findler <
> ro...@eecs.northwestern.edu> wrote:
> > >>>
> > >>> This setting is controlled by the language of the original file (so
> > >>> the one in the definitions window in DrRacket or the one you are
> > >>> "inside" in the repl if you're in one). Possibly those are different
> > >>> for you, Laurent?
> > >>>
> > >>> Robby
> > >>>
> > >>> On Fri, Feb 1, 2019 at 9:33 AM Sam Tobin-Hochstadt <
> sa...@cs.indiana.edu> wrote:
> > >>> >
> > >>> > I see the same behavior in DrRacket as in command line racket.
> > >>> >
> > >>> > On Fri, Feb 1, 2019 at 10:19 AM Laurent 
> wrote:
> > >>> > >
> > >>> > > I'm seeing a difference that I can't explain. In the
> interactions below, look for the leading quote in the output string on the
> commandline, and its absence in DrRacket.
> > >>> > >
> > >>> > > The same problem happens when running a module containing the
> same code, so it's not a top-level issue.
> > >>> > >
> > >>> > > Is there another parameter that controls this quoting mechanism
> that I don't know about?
> > >>> > >
> > >>> > > In DrRacket:
> > >>> > > > (~v 'auie)
> > >>> > > "auie"
> > >>> > > > (print-as-expression)
> > >>> > > #t
> > >>> > >
> > >>> > > On the command line:
> > >>> > > Welcome to Racket v7.2.0.3.
> > >>> > > > (~v 'auie)
> > >>> > > "'auie"
> > >>> > > > (print-as-expression)
> > >>> > > #t
> > >>> > >
> > >>> > > --
> > >>> > > 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.
> > >
> > > --
> > > 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] ~v in drracket vs commandline

2019-02-01 Thread Laurent
I think I've found the problem.

In the preferences, I chose 'Output syntax | Output style | write' which
seems to force the behaviour of (print-as-expression #f) without actually
changing the parameter.

After changing this preference to print, I observe a consistent behaviour
between DrRacket and command line.



On Fri, Feb 1, 2019 at 3:48 PM Laurent  wrote:

> I'm in #lang racket for DrRacket, and I assume it's the same for the
> command line when merely starting "$ racket"
>
>
> On Fri, Feb 1, 2019 at 3:39 PM Robby Findler 
> wrote:
>
>> This setting is controlled by the language of the original file (so
>> the one in the definitions window in DrRacket or the one you are
>> "inside" in the repl if you're in one). Possibly those are different
>> for you, Laurent?
>>
>> Robby
>>
>> On Fri, Feb 1, 2019 at 9:33 AM Sam Tobin-Hochstadt 
>> wrote:
>> >
>> > I see the same behavior in DrRacket as in command line racket.
>> >
>> > On Fri, Feb 1, 2019 at 10:19 AM Laurent 
>> wrote:
>> > >
>> > > I'm seeing a difference that I can't explain. In the interactions
>> below, look for the leading quote in the output string on the commandline,
>> and its absence in DrRacket.
>> > >
>> > > The same problem happens when running a module containing the same
>> code, so it's not a top-level issue.
>> > >
>> > > Is there another parameter that controls this quoting mechanism that
>> I don't know about?
>> > >
>> > > In DrRacket:
>> > > > (~v 'auie)
>> > > "auie"
>> > > > (print-as-expression)
>> > > #t
>> > >
>> > > On the command line:
>> > > Welcome to Racket v7.2.0.3.
>> > > > (~v 'auie)
>> > > "'auie"
>> > > > (print-as-expression)
>> > > #t
>> > >
>> > > --
>> > > 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.
>>
>

-- 
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] ~v in drracket vs commandline

2019-02-01 Thread Laurent
I'm in #lang racket for DrRacket, and I assume it's the same for the
command line when merely starting "$ racket"


On Fri, Feb 1, 2019 at 3:39 PM Robby Findler 
wrote:

> This setting is controlled by the language of the original file (so
> the one in the definitions window in DrRacket or the one you are
> "inside" in the repl if you're in one). Possibly those are different
> for you, Laurent?
>
> Robby
>
> On Fri, Feb 1, 2019 at 9:33 AM Sam Tobin-Hochstadt 
> wrote:
> >
> > I see the same behavior in DrRacket as in command line racket.
> >
> > On Fri, Feb 1, 2019 at 10:19 AM Laurent 
> wrote:
> > >
> > > I'm seeing a difference that I can't explain. In the interactions
> below, look for the leading quote in the output string on the commandline,
> and its absence in DrRacket.
> > >
> > > The same problem happens when running a module containing the same
> code, so it's not a top-level issue.
> > >
> > > Is there another parameter that controls this quoting mechanism that I
> don't know about?
> > >
> > > In DrRacket:
> > > > (~v 'auie)
> > > "auie"
> > > > (print-as-expression)
> > > #t
> > >
> > > On the command line:
> > > Welcome to Racket v7.2.0.3.
> > > > (~v 'auie)
> > > "'auie"
> > > > (print-as-expression)
> > > #t
> > >
> > > --
> > > 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.
>

-- 
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] drracket migrate: package is currently installed in a wider scope

2019-02-01 Thread Laurent
Okay, I think the problem is that DrRacket's dependency installed
quickscript, and trying to migrate your own version of quickscript
afterwards fails because it's already there.

I guess the solution would be to remove *your* previous version of
quickscript, then trying to migrate again. (No need to remove
quickscript-extra, if you've installed it, since it is not in DrRacket's
dependencies.)

Glad you like it in any case :)

On Fri, Feb 1, 2019 at 2:47 PM andrew blinn  wrote:

> Hi Laurent!
>
> I may be misattributing the error. I did indeed already have quickscript
> installed as part of my previous installation. After updating, when I tried
> to restore my previous packages (which include quickscript), it aborts with
> the titular error, whose body text implicates the fact that quickscript is
> already installed. My expectation would be that it would proceed to
> reinstall the other non-conflicting packages, but this doesn't happen. In
> any case, the issue seems to lie with the package restore functionality,
> not quickscript itself.
>
> Loving quickscript, by the way. Installed it immediately after your
> racketcon presentation.
>
> On Friday, February 1, 2019 at 5:16:54 AM UTC-5, Laurent Orseau wrote:
>>
>> Hi Andrew,
>>
>> I don't quite understand what role quickscript being part of the main
>> distribution plays here. Can you give some more details about your issue?
>>
>> Just in case, the only change is that quickscript is by default a
>> dependency of DrRacket, which just means that if you didn't have it before,
>> now you would. But it shouldn't change anything else AFAIU.
>>
>> On Thu, Jan 31, 2019, 20:28 andrew blinn >
>>> After updating to 7.2, I got this message after trying to use the "copy
>>> from version" menu option in the package manager to restore my packages
>>> from 7.1, due to quickscript being added to the standard distribution. This
>>> seems like it should be a simple enough issue to address, but I was unable
>>> to find any way to continue and restore the other non-conflicting packages
>>> through the GUI.
>>>
>>> Searching revealed nothing, so I've manually reinstalled my packages. I
>>> thought I'd make a post here though in case there's a simpler solution.
>>>
>>> --
>>> 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.
>

-- 
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] ~v in drracket vs commandline

2019-02-01 Thread Laurent
I'm seeing a difference that I can't explain. In the interactions below,
look for the leading quote in the output string on the commandline, and its
absence in DrRacket.

The same problem happens when running a module containing the same code, so
it's not a top-level issue.

Is there another parameter that controls this quoting mechanism that I
don't know about?

In DrRacket:
> (~v 'auie)
"auie"
> (print-as-expression)
#t

On the command line:
Welcome to Racket v7.2.0.3.
> (~v 'auie)
"'auie"
> (print-as-expression)
#t

-- 
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] Quickscript error on first startup of Racket 7.2

2019-02-01 Thread Laurent
Okay then, I'll work on a fix tomorrow.

On Fri, Feb 1, 2019 at 1:23 PM Robby Findler 
wrote:

> I can't say concretely what will go wrong I am sorry to say. There are
> just a number of moving parts and I can't quite see how they will fail to
> fit together. I am just basing this on my vague, holistic understanding of
> how things work currently. (There are no places where on set of sources is
> used with multiple versions in the standard distribution and nontrivial
> work has gone into making that case work out and maintain that invariant.)
>
> In other words, go for it! We have a fallback if this don't work out. :)
>
> Robby
>
> On Fri, Feb 1, 2019 at 7:01 AM Laurent  wrote:
>
>> On Fri, Feb 1, 2019 at 11:30 AM Robby Findler <
>> ro...@eecs.northwestern.edu> wrote:
>>
>>> My feeling is that our compilation infrastructure isn't really set up to
>>> work like that currently. In general things will probably be smoother if
>>> there is only the expectation that a given set of files is used with only
>>> one version at a time.
>>>
>>> It is possible that someone may use multiple versions of DrRacket on
>>> their computer switching between them or even having them open at the same
>>> time.
>>>
>>
>> Frankly, for any application, if one has multiple versions open at the
>> same time and things go wrong, I don't see how one can blame the developers
>> with a straight face—the one legitimate case is probably when you're one of
>> the developers yourself.
>>
>> If you want to use several versions but not at the same time (which is
>> also asking for trouble in any case), then recompilation on startup should
>> work nicely anyway, just requiring a little more time. Copying the same
>> scripts in different folders will very likely mean divergence of source at
>> some point and likely frustration for the user.
>>
>> Or am I missing something?
>>
>>
>>>
>>> Robby
>>>
>>> On Fri, Feb 1, 2019 at 4:12 AM Laurent  wrote:
>>>
>>>> Thanks for bringing this up.
>>>>
>>>> Indeed the compile option from the quickscript menu should work, but
>>>> it's not ideal.
>>>>
>>>> I'm not a big fan of the copy option. (To me that sounds like asking
>>>> for trouble, but I may be wrong.)
>>>>
>>>> A nicer solution may be to simply check if the scripts are compiled
>>>> with the current version, and if not just silently compile them on DrRacket
>>>> startup? The user could also be querried if that's better.
>>>>
>>>> On Thu, Jan 31, 2019, 23:02 Greg Trzeciak >>>
>>>>> As long as the user-scripts won't be lost (i.e. the scripts will be
>>>>> copied over) it sounds OK.
>>>>>
>>>>> On Thursday, January 31, 2019 at 10:42:08 PM UTC+1, Robby Findler
>>>>> wrote:
>>>>>>
>>>>>> Probably it is best if quickscript (either silently or after asking)
>>>>>> copied scripts from a version-specific directory to a new
>>>>>> (version-specific) one, much like how the pkg system works.
>>>>>>
>>>>>> Robby
>>>>>>
>>>>>> On Thu, Jan 31, 2019 at 3:38 PM Greg Trzeciak 
>>>>>> wrote:
>>>>>> >
>>>>>> > I had quickscript already installed when upgrading Racket.
>>>>>> >
>>>>>> > On DrRacket startup I got the following error:
>>>>>> >
>>>>>> > Error in script file "run-in-interactions.rkt":
>>>>>> read-compiled-linklet: version mismatch
>>>>>> >   expected: "7.2"
>>>>>> >   found: "6.90.0.24"
>>>>>> >   in:
>>>>>> C:\Users\Myself\AppData\Roaming\Racket\quickscript\user-scripts\compiled\run-in-interactions_rkt.zo
>>>>>>
>>>>>> >
>>>>>> > After closing the message box DrRacket is opening with no problems
>>>>>> >
>>>>>> > Deleting compiled folder removes the error on the next start up
>>>>>> (and so would probably running "Compile Scripts and  reload" from Script
>>>>>> menu).
>>>>>> > But since quickscript is now part of DrRacket - the error may
>>>>>> reappear in the next upgrades since it looks like user-scripts is not
>>>>>> rec

Re: [racket-users] Quickscript error on first startup of Racket 7.2

2019-02-01 Thread Laurent
On Fri, Feb 1, 2019 at 11:30 AM Robby Findler 
wrote:

> My feeling is that our compilation infrastructure isn't really set up to
> work like that currently. In general things will probably be smoother if
> there is only the expectation that a given set of files is used with only
> one version at a time.
>
> It is possible that someone may use multiple versions of DrRacket on their
> computer switching between them or even having them open at the same time.
>

Frankly, for any application, if one has multiple versions open at the same
time and things go wrong, I don't see how one can blame the developers with
a straight face—the one legitimate case is probably when you're one of the
developers yourself.

If you want to use several versions but not at the same time (which is also
asking for trouble in any case), then recompilation on startup should work
nicely anyway, just requiring a little more time. Copying the same scripts
in different folders will very likely mean divergence of source at some
point and likely frustration for the user.

Or am I missing something?


>
> Robby
>
> On Fri, Feb 1, 2019 at 4:12 AM Laurent  wrote:
>
>> Thanks for bringing this up.
>>
>> Indeed the compile option from the quickscript menu should work, but it's
>> not ideal.
>>
>> I'm not a big fan of the copy option. (To me that sounds like asking for
>> trouble, but I may be wrong.)
>>
>> A nicer solution may be to simply check if the scripts are compiled with
>> the current version, and if not just silently compile them on DrRacket
>> startup? The user could also be querried if that's better.
>>
>> On Thu, Jan 31, 2019, 23:02 Greg Trzeciak >
>>> As long as the user-scripts won't be lost (i.e. the scripts will be
>>> copied over) it sounds OK.
>>>
>>> On Thursday, January 31, 2019 at 10:42:08 PM UTC+1, Robby Findler wrote:
>>>>
>>>> Probably it is best if quickscript (either silently or after asking)
>>>> copied scripts from a version-specific directory to a new
>>>> (version-specific) one, much like how the pkg system works.
>>>>
>>>> Robby
>>>>
>>>> On Thu, Jan 31, 2019 at 3:38 PM Greg Trzeciak 
>>>> wrote:
>>>> >
>>>> > I had quickscript already installed when upgrading Racket.
>>>> >
>>>> > On DrRacket startup I got the following error:
>>>> >
>>>> > Error in script file "run-in-interactions.rkt":
>>>> read-compiled-linklet: version mismatch
>>>> >   expected: "7.2"
>>>> >   found: "6.90.0.24"
>>>> >   in:
>>>> C:\Users\Myself\AppData\Roaming\Racket\quickscript\user-scripts\compiled\run-in-interactions_rkt.zo
>>>>
>>>> >
>>>> > After closing the message box DrRacket is opening with no problems
>>>> >
>>>> > Deleting compiled folder removes the error on the next start up (and
>>>> so would probably running "Compile Scripts and  reload" from Script menu).
>>>> > But since quickscript is now part of DrRacket - the error may
>>>> reappear in the next upgrades since it looks like user-scripts is not
>>>> recompiled during upgrade.
>>>> >
>>>> > G.
>>>> >
>>>> > --
>>>> > 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.
>>>
>> --
>> 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] drracket migrate: package is currently installed in a wider scope

2019-02-01 Thread Laurent
Hi Andrew,

I don't quite understand what role quickscript being part of the main
distribution plays here. Can you give some more details about your issue?

Just in case, the only change is that quickscript is by default a
dependency of DrRacket, which just means that if you didn't have it before,
now you would. But it shouldn't change anything else AFAIU.

On Thu, Jan 31, 2019, 20:28 andrew blinn  After updating to 7.2, I got this message after trying to use the "copy
> from version" menu option in the package manager to restore my packages
> from 7.1, due to quickscript being added to the standard distribution. This
> seems like it should be a simple enough issue to address, but I was unable
> to find any way to continue and restore the other non-conflicting packages
> through the GUI.
>
> Searching revealed nothing, so I've manually reinstalled my packages. I
> thought I'd make a post here though in case there's a simpler solution.
>
> --
> 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] Quickscript error on first startup of Racket 7.2

2019-02-01 Thread Laurent
Thanks for bringing this up.

Indeed the compile option from the quickscript menu should work, but it's
not ideal.

I'm not a big fan of the copy option. (To me that sounds like asking for
trouble, but I may be wrong.)

A nicer solution may be to simply check if the scripts are compiled with
the current version, and if not just silently compile them on DrRacket
startup? The user could also be querried if that's better.

On Thu, Jan 31, 2019, 23:02 Greg Trzeciak  As long as the user-scripts won't be lost (i.e. the scripts will be copied
> over) it sounds OK.
>
> On Thursday, January 31, 2019 at 10:42:08 PM UTC+1, Robby Findler wrote:
>>
>> Probably it is best if quickscript (either silently or after asking)
>> copied scripts from a version-specific directory to a new
>> (version-specific) one, much like how the pkg system works.
>>
>> Robby
>>
>> On Thu, Jan 31, 2019 at 3:38 PM Greg Trzeciak  wrote:
>> >
>> > I had quickscript already installed when upgrading Racket.
>> >
>> > On DrRacket startup I got the following error:
>> >
>> > Error in script file "run-in-interactions.rkt": read-compiled-linklet:
>> version mismatch
>> >   expected: "7.2"
>> >   found: "6.90.0.24"
>> >   in:
>> C:\Users\Myself\AppData\Roaming\Racket\quickscript\user-scripts\compiled\run-in-interactions_rkt.zo
>>
>> >
>> > After closing the message box DrRacket is opening with no problems
>> >
>> > Deleting compiled folder removes the error on the next start up (and so
>> would probably running "Compile Scripts and  reload" from Script menu).
>> > But since quickscript is now part of DrRacket - the error may reappear
>> in the next upgrades since it looks like user-scripts is not recompiled
>> during upgrade.
>> >
>> > G.
>> >
>> > --
>> > 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.
>

-- 
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] updated Racket-on-Chez status

2019-01-31 Thread Laurent
Just wanted to say thank you for the update and for the honest report.

I look forward to using Racket CS, and to seeing how easily new features
can be incorporated :)

On Tue, Jan 29, 2019 at 2:49 PM Matthew Flatt  wrote:

> Here's a new status report on Racket CS:
>
>  http://blog.racket-lang.org/2019/01/racket-on-chez-status.html
>
> Short version: Racket CS is done in a useful sense, but we'll wait
> until it gets better before making it the default Racket
> implementation.
>
>
> 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.
> 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] Are the terms "function" and "procedure" synonymous in Racket?

2019-01-14 Thread Laurent
I'm not entirely sure where I got that from, but to me a procedure is a
("impure") function with possible side effects (printing, mutating a global
variable, sending emails, etc.). By contrast, in any given context, a
function is (again, to me) synonymous with "pure function"(*) and can be
called with the same values and will always return the same value, and
could in principle be substituted with any other function implementating
the same input-output specification without changing the meaning of the
whole program.

(*) https://en.wikipedia.org/wiki/Pure_function

On Sun, Jan 13, 2019 at 8:30 PM George Neuner  wrote:

>
> On 1/13/2019 1:49 PM, Alexis King wrote:
>
> Disclaimer: this answer is extremely non-authoritative.
>
>
> Ditto.
>
> I think that, in Racket, the terms are used more or less interchangeably.
> The technical term is “procedure”, but as you point out, the term
> “function” is also used to mean the same thing. I don’t believe there is
> any distinction there that would be universally understood.
>
> On the other hand, in How to Design Programs (and its various teaching
> languages), my understanding is that “function” is the correct term and
> “procedure” is strongly discouraged. The documentation on implementing new
> teachpacks supports this understanding, in a section entitled Prohibited
> Words
> .
> It states explicitly that “function” should be used instead of “procedure”,
> “selector”, “constructor”, or any number of other terms. It includes the
> following justification:
>
> These guidelines use few terms intentionally, emphasizing
> commonality among concepts rather than technical precision (which most
> students do not appreciate anyway).
>
>
> I imagine others on this list who wrote the above words can give a more
> authoritative answer should they find this one inadequate. :)
>
> Alexis
>
>
>
> Back in the day, "procedures" and "functions" were both considered a form
> of "subroutine"  [see compiler texts from 70s .. 90s].  They were
> distinguished from inline (GOTO) subroutines by being lexically scoped and
> taking arguments.   Additionally, there was the distinction that (like its
> mathematical counterpart) a "function" computed something and returned a
> value (or values), while a "procedure" primarily was intended to create
> side effects and (importantly) DID NOT return a value.
>
> Pascal enshrined that last distinction in its syntax, but it existed
> already in earlier languages.
>
> Scheme uses the term "procedure" I *think* because it was influenced by
> Algol.  For whatever reason, Algol called subroutines "proc" consistently
> regardless of whether they returned a value.  Possibly Algol's designers
> did that deliberately to avoid association with mathematical "functions".
>
> Racket began as PLT Scheme and remains (relatively) closely associated
> with Scheme.  So it's not surprising that there are wrinkles in the
> documentation.
>
>
> Aside:  also back in the day, the term  "pure procedural"  referred to
> programming without functions.  PP subsumed the notion of CPS, but was not
> synonymous with it - if the language supported it, procedures were
> permitted [in Ada parlance] to have "OUT" or "INOUT" parameters, through
> which results could be passed back up the call chain.
>
>
> To Ellen:  You might wish to educate your students re: the history.  For
> modern use I think Alexis is right - the terms are used more or less
> interchangeably and the historical distinctions largely have become
> meaningless.
>
> YMMV,
> George
>
> --
> 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] Re: Why enter/run a submodule in the REPL?

2018-12-13 Thread Laurent
Personally, I use a 'drracket' submodule so that this submodule isn't
executed from the command line, but gets executed from within DrRacket.
This is particularly useful to avoid outputting graphical objects (such as
plots) that can't be displayed on the command line.

After pressing Run in Dracket, entering the submodule allows me to access
whatever is defined in the submodule from the interactions window.

The 'drracket' submodule is not officially supported, but you can add it
yourself in the "Submodules to run" list in DrRacket.


On Thu, Dec 13, 2018 at 10:28 AM Stephen De Gabrielle <
spdegabrie...@gmail.com> wrote:

> Hi,
>
> I suppose a better question is what do any racketeers use ‘submodules to
> run’ in DrRacket? And if so- what for?
>
> Stephen
>
> On Wed, 12 Dec 2018 at 00:21, Stephen De Gabrielle <
> spdegabrie...@gmail.com> wrote:
>
>> Hi,
>>
>> #lang racket
>> (displayln "This is the main module")
>> (module+ drracket
>>   (define foo 'FOO)
>>   (displayln "This is the drracket submodule"))
>>
>> Execute and DrRacket displays "This is the main module" in the
>> interactions window
>> type
>> (require (only-in racket/enter dynamic-enter!)
>>   (only-in syntax/location quote-module-path))
>> (dynamic-enter! (quote-module-path drracket))
>>
>> and bindings defined in the submodule are then available; e.g.
>> > foo
>> 'FOO
>>
>> Why and how do I use this for interactive development, scripting and
>> debugging?
>>
>> There is also a DrRacket function (Submodules to Run), but I can't find
>> any documentation for it.
>>
>>
>> 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.
> 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] Destructuring a list in (for ...)

2018-11-23 Thread Laurent
Maybe you could have something like (in-match ...) ?

On Fri, Nov 23, 2018 at 4:54 PM Alexis King  wrote:

> The trouble, sadly, is that this grammar is ambiguous. In
>
>   (for ([(x y) s])
> )
>
> should (x y) be parsed as a single match pattern or as two binders for a
> two-valued sequence (such as one produced by in-hash, for example)? You
> could make it unambiguous in various ways, such as by requiring uses of
> match patterns to all use the multi-valued binder syntax (with an extra set
> of parens), but that’s a bit clumsy. Unfortunately, I can’t think of any
> particularly elegant way to support match patterns in for loop binders in a
> backwards-compatible way.
>
> Alexis
>
> > On Nov 22, 2018, at 20:14, Greg Hendershott 
> wrote:
> >
> >> (define-syntax (match-for stx)
> >
> > That's nice.
> >
> > Sometimes I wish I could do the general thing -- use `match` patterns
> > in the binding clauses for any `for`-family form.
> >
> > I often do something like this:
> >
> >(define xs (list (cons 1 2) (cons 3 4)))
> >
> >(for ([x (in-list xs)])
> >  (match-define (cons a b) x)
> >  (use a b))
> >
> > Instead it would be nice to write:
> >
> >(for ([(match-define (cons a b)) (in-list xs)])
> >  (use a b))
> >
> > Or even just:
> >
> >(for ([(cons a b c) (in-list xs)])
> >  (use a b))
> >
> > In the grammar, `id` becomes `id-or-match-pattern`.
> >
> > On the other hand, this would only really help in simple
> > `match-define` destructuring -- as opposed to using `match` to handle
> > variations in the data. And although I do the former a lot, I do the
> > latter even more.
>
> --
> 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] colon keywords

2018-09-24 Thread Laurent
On Sun, Sep 23, 2018 at 6:41 PM Neil Van Dyke  wrote:

> Laurent wrote on 9/19/18 8:29 AM:
> > I don't mind `#:`, but I'd prefer to write `[#:foo 5]` rather than
> > `#:foo [foo 5]`, that is, I don't like the repetition of the name (I
> > first came to Racket precisely to avoid repeating code).
>
> [...]

> So... What do people think of a `#lang` that is mostly `racket/base`,
> but with a few additions, maybe something like the following?
>
> * Symbols that start with `:` (and aren't `:` exactly) read as keywords.
>

-1, I'm fine with reader syntax '#'.


> * The popular `lambda`-ish and `define`-ish forms add support for [what
> Laurent said above]
>

+1

* The `let`-ish forms add terse support for frequent multiple-value LHS
> (without burdening single-value LHS, nor increasing rightward drift).
>

+1, yes please.

* The `struct` definition forms also generate constructors with keyword
> arguments for fields.
>

+1, or by symbol (but keyword is easier to check for correctness at compile
time maybe).


> * Support for embedded documentation for pro (ideally, also `provide`d
> by the module for both Scribble complete document generation and perhaps
> online help fragments), together with shorthand for define+provide+doc
> (and maybe contracts too).
>

+1, I think.


> * Support for terse embedded unit tests (e.g., you don't have to type
> out `(module+ test` all the time), and some standard lightweight unit
> test definitions (maybe not RackUnit nor Overeasy, since we can improve
> upon both) that work with the Racket package CI stuff.
>

Dunno, maybe.


> * Maybe have a small language tweak to try to encourage people to know
> what they're doing before they use `eval`, and/or to make the use of
> such a powerful and oft-misused feature by a module more prominent.
>

That might just need a documentation tweak, like a margin note saying
"Warning: Very often people think of using eval when better, faster and
safer solution are available but depend on the case. Ask for help on the
mailing list <...@...> if your unsure."?


> * Look at making the "info.rkt" metadata optionally embeddable in
> single-source-file packages.  I can talk more about why one might want
> this sometime, but one of the big cases involves lightweight and
> interface-oriented modularity practices by default for well-engineered
> closed-source systems, and low-friction selective open sourcing.  (I
> think this also requires tweaking more than just the `#lang` itself.)
>

Maybe as a submodule?
I'd be happy with a one-file package; I firmly believe in the
path-of-least-resistance philosophy (allow for quick and dirty first, but
equally importantly also to easily gradually improve).


> * Look at richer version/compatibility specification and confidence for
> package dependencies, and possibly also add in simultaneous multiple
> version support and/or other ways of providing backward compatibility.
>

Dunno, maybe. There are pros and cons, in terms of complexity.


> * Tolerate square brackets, unless and until we someday find a much
> better use for them (replacing `send` isn't good enough, but maybe
> someday for vectors/arrays in dense numerical work). :)
>

Not sure what you mean. I use square brackets a lot in `let`, `cond` and
friends. That makes reading much easier to me.

For vectors I sometimes use `@` or `@?` for vector-ref,  `!` or `@!` for
vector-set!, and `@?!` for a vector-update!:
(@?! my-vector index λ(x)(+ (* 2 x) 3))
is even simpler than
my_vector[index] = 2 * my_vector[index]) + 3

Maybe @ variant should be generics though.

While we're on the wish-list:

* Use '_'  in place of '-' for word symbol appending. I've grown unfond of
'-' word separators, and I heretically prefer '_' because I find it
visually easier to group words with '_', and '-' also clashes with the
minus sign, which makes it harder to read calculations. But I usually don't
use '_' to avoid being frown upon too much :-/

-- 
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: FW: [racket-users] colon keywords

2018-09-24 Thread Laurent
Same here, I've grown happy with the #:keyword notation because it is a
reader thing, not a symbol.

The other nice option would be like Python and others to make procedure
implicitly take dictionaries to allow choosing at each call site between
position-based and name-based argument passing for each argument. I guess
if the dictionary's arguments of the caller is accessible at compile time,
it should be feasible to lose nothing in terms of run-time speed.
Dictionary building and passing at run-time would likely be slower though.

On Mon, Sep 24, 2018 at 3:08 AM Eric Griffis  wrote:

> Thanks for the crisp explanation, Jos. This is exactly my concern.
>
> Eric
>
>
> On Sun, Sep 23, 2018, 2:38 PM Jos Koot  wrote:
>
>>  Forgot to include the users group.
>>
>> -Original Message-
>> From: Jos Koot [mailto:jos.k...@gmail.com]
>> Sent: 23 September 2018 21:37
>> To: 'Tomasz Rola'
>> Subject: RE: [racket-users] colon keywords
>>
>> MHO, adhere to #:foo,
>> because :foo is a permitted identifier.
>> I prefer a clear distinction between keywords and identifiers.
>> Just like the sharp sign is used in many other output.
>> Jos
>>
>> -Original Message-
>> From: racket-users@googlegroups.com [mailto:racket-users@googlegroups.com]
>> On Behalf Of Tomasz Rola
>> Sent: 23 September 2018 18:50
>> To: Racket-Users List
>> Cc: Neil Van Dyke; Tomasz Rola
>> Subject: Re: [racket-users] colon keywords
>>
>> On Wed, Sep 19, 2018 at 04:56:05AM -0400, Neil Van Dyke wrote:
>> > Currently, in main Racket reader, `#:` starts a keyword, as in `#:foo`.
>> >
>> > Who on this email list would also like (or not like) `:` to start a
>> > keyword, as in `:foo`?
>>
>>
>> --
>> 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.
>

-- 
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] colon keywords

2018-09-19 Thread Laurent
I don't mind `#:`, but I'd prefer to write `[#:foo 5]` rather than `#:foo
[foo 5]`, that is, I don't like the repetition of the name (I first came to
Racket precisely to avoid repeating code).

When I expressed that a few years ago, I was told it would be unlikely to
change in the future though, which is perfectly understandable given how
deeply this goes.



On Wed, Sep 19, 2018 at 1:15 PM Christopher Lemmer Webber <
cweb...@dustycloud.org> wrote:

> I am wary of this.  I really don't have a strong preference either way,
> my suspicion is it's mostly "what did you become famliar with initially"
> kind of thing.  :keyword is more Common Lisp'ish, #:keyword matches
> other Schemes I've used.
>
> But:
>  - I'd rather not have *two* keyword syntaxes in Racket at the same
>time.
>  - But removing #: from the language would break tons of packages.
>  - Maybe if #lang racket2 ever happened that would be a good place for
>this, and the ability to have multiple #langs allows us to survive
>an upgrade easier than say, the Python 2 to 3 upgrade was (which I
>was in the trenches for, and was a decade long headache).
>Let's try to avoid breaking things that exist currently, anyway.
>  - It's such a small cosmetic change I don't see why it's worth it.
>If it bothers you a lot, there's a #lang path.
>
> My $.02,
>  - cwebb
>
> Neil Van Dyke writes:
>
> > I recall multiple discussions about colon keywords over the many
> > years, but (it's 5am) temporarily forgot that Jay did a poll 3 years
> > ago.
> >
> > Jay's results summary quoted and linked below.
> >
> > I think 3 years means it's time to go from these results, to either
> > changing Racket, or expecting "preference #langs" to become more of a
> > thing. (Again, from a software engineering perspective, I'd
> > discourage "preference #langs"; but, from a love of programming
> > perspective, I'd understand.)
> >
> >
> > Jay McCarthy  wrote on Thu, 22 Oct 2015 13:43:50
> -0400:
> >> It has been a little more than a week and we've stopped getting results.
> >>
> >> The full results should be publicly available. Here is a summary:
> >>
> >>
> https://docs.google.com/forms/d/1HSwtxLhz5HWGMJjMXaO8LQyHJsdMkGbBlRa4fU7Sa34/viewanalytics
> >>
> >> and here is the raw data:
> >>
> >>
> https://docs.google.com/spreadsheets/d/1rZNNGwupMZTybxKRhukLdgA8VIA8oPlQ7nPk8Gv52Es/edit#gid=348615477
> >>
> >> My interpretation of the data is as follows:
> >> - The #:keyword syntax is liked fine with a rating of 5.67
> >> - The :keyword syntax is more loved with a rating of 6.9
> >> - But change is not popular, average of 5.1 with high standard deviation
> >> - People that really like #:keyword do not want a change and do not
> >> like :keyword
> >> - People that really like :keyword want a change
> >>
> >> I am genuinely surprised :keyword saw so much support and that
> >> change was so attractive to people.
> >>
> >> Naturally whenever you do stuff like this, you want to ask more
> >> questions, like what about keyword:, what about supporting both,
> >> etc.
> >>
> >> Jay
> > https://groups.google.com/d/msg/racket-users/3vOTC1FbieA/UsifvfWtBgAJ
>
> --
> 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] Cannot create an account on PLaneT

2018-09-08 Thread Laurent
It's because PLaneT is deprecated. The new package repository is located at:
http://pkgs.racket-lang.org/

HTH,
Laurent

On Sat, Sep 8, 2018 at 4:26 PM Sage Gerard  wrote:

> Hey all,
>
> I cannot seem to create an account on PLaneT. No confirmation emails (even
> in Spam). Tried two browsers with extensions disabled. System does not see
> that my account exists and I don't see contact info for reporting an issue
> via the "Need Help?" link. Who do I contact for troubleshooting?
>
> Sage
>
> --
> 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] Module dependencies

2018-05-28 Thread Laurent
You could also have a third file, test-a-and-b.rkt, that requires both
a.rkt and b.rkt and includes the test that depend on both files.


On Mon, May 28, 2018 at 10:08 AM Claes Wallin (韋嘉誠) 
wrote:

> (require) binds at compile time and creates a cycle, but by using
> (dynamic-require) you can get past compilation and only load the file at
> runtime, where the seemingly circular reference really isn't.
>
> --
>/c
>
> On Sun, May 27, 2018, 23:48 Matthias Felleisen 
> wrote:
>
>>
>> Modules cannot refer to each other in a cyclic fashion, including
>> submodules. — Matthias
>>
>>
>>
>> On May 27, 2018, at 8:33 AM, Brandon Irizarry 
>> wrote:
>>
>> Say I have two files, "file-a.rkt" and "file-b.rkt" that each contain a
>> submodule test, like so:
>>
>>
>> Contents of "file-a.rkt":
>>
>> #lang racket/base
>> (define (my-function) 'apple)
>> (module+ test
>> (require "file-b.rkt")
>> (other-function))
>>
>> Contents of "file-b.rkt":
>>
>> #lang racket/base
>> (define (other-function) 'orange)
>> (module+ test
>> (require "file-a.rkt")
>> (my-function))
>>
>> The require statements form a circular reference, even though running
>> file-b, along with its tests, shouldn't trigger file-a's tests.
>>
>> I've looked into compiling file-a and file-b, but that didn't work.
>>
>> - Brandon
>>
>>
>> --
>> 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.
>>
> --
> 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] Re: Simple loop control

2018-04-02 Thread Laurent
Indeed. If you omit `in-range', this can have a big cost on performance on
nested loops (I observe almost a factor 10 on this small example).

Note that you can also write a nested for loop with `for*':
(for* ([i (in-range 1)]
   [j (in-range 1000)])
  (void))




On Mon, Apr 2, 2018 at 10:33 AM, 若草春男 <whbug...@gmail.com> wrote:

> Thank you, Laurent.
>
> I mind the performance of in-range, but it seems to be no problem.
>
> #lang racket
>
> (time (for ([i (in-range 1)])
> (for ([j (in-range 1000)])
>   (void
>
> (time (do ([i 0 (+ i 1)]) ([= i 1])
> (do ([j 0 (+ j 1)]) ([= j 1000])
>   (void
>
> cpu time: 110 real time: 106 gc time: 0
> cpu time: 109 real time: 111 gc time: 0
>
> --
> 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] Simple loop control

2018-04-01 Thread Laurent
Take at look at Racket's `for' loops. They are very flexible.
The reference:
http://docs.racket-lang.org/reference/for.html?q=for#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._for%29%29
The guide with examples:
http://docs.racket-lang.org/guide/for.html


On Sun, Apr 1, 2018 at 10:14 AM, 若草春男  wrote:

> Hi, everyone.
>
> I want to write loops simpler.
>
> > (do ([i 1 (add1 i)]) ([= i 10]) (display i))
> 123456789
> > (for-each (lambda (i) (display i)) (range 1 10))
> 123456789
>
> In Common Lisp, I like the extended loop like "for" of C-language.
>
> [3]> (loop for i from 1 below 10 do (print i))
>
> 1
> 2
> 3
> 4
> 5
> 6
> 7
> 8
> 9
> NIL
>
> Please tell me the best solution.
>
> Haruo
>
> --
> 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] bookmarks?

2018-03-31 Thread Laurent
The quickscript-extra package (a DrRacket plugin) provides such a facility
(the 'bookmarks' script), among many other things:
https://pkgs.racket-lang.org/package/quickscript-extra

It's not perfect but should still be helpful. In case it doesn't suit you
needs, quickscript should allow you to easily write and test what you want.

Any feedback is more than welcome of course.

On Sat, Mar 31, 2018 at 11:31 AM, Geoffrey Knauth  wrote:

> This happens to me enough in DrRacket I thought I should ask.  I'm looking
> at some code.  I want to scroll around or search in the file for something
> to check, but later I want to come back to where I was.  In Emacs I'd set a
> mark and jump back to it.  Was the subject of bookmarks ever considered for
> DrRacket?
>
> --
> 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] (number->string -nan.0) == "+nan.0" ?

2018-02-06 Thread Laurent
Not sure there should be a -nan.0 to start with. NaN is an absorbing value
that shouldn't have a sign. I suspect it's because the + is a convenience
to trigger the number reader, and then an appeal to symmetry and analogy to
+inf.0 led to -nan.0?

On Mon, Feb 5, 2018 at 11:46 PM, Ben Greenman 
wrote:

> Looks like its for the same reason that (number->string -0) yields "0".
>
> +nan.0 is special, but -nan.0 is the same as (- +nan.0)
>
> http://docs.racket-lang.org/reference/numbers.html
>
> On Mon, Feb 5, 2018 at 6:41 PM, David Storrs 
> wrote:
> > I noticed that (number->string -nan.0) yields "+nan.0" instead of
> "-nan.0"
> > as I would have expected.  It's not an issue for me, but I was wondering
> why
> > this is?
> >
> > --
> > 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.
>

-- 
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] Adding interactive overlays to racket plots

2018-02-03 Thread Laurent
This is awesome! Thanks so much for doing this, I'm sure it's going to be
very handy.

On Sat, Feb 3, 2018 at 7:08 AM, Alex Harsanyi 
wrote:

>
> Hi Matthias,
>
> I updated the plot package to cover all the cases I had in mind for plot
> overlays and also updated my application to make use of these features,
> just to make sure that they are adequate.
>
> The pull request is here: https://github.com/racket/plot/pull/32, it
> would be good if I could get some feedback if my approach OK, or what needs
> to be changed.  What is missing is the documentation, but I would like to
> leave that until after the code is considered OK.  I wrote up some notes
> about the API here: https://github.com/alex-hhh/plot/wiki/overlays-notes
>
> I also did a write-up of the features, as well as some screenshots to
> illustrate what can be done with the new functionality.  You can find that
> here: https://alex-hhh.github.io/2018/02/interactive-overlays-
> with-the-racket-plot-package.html
>
> Best Regards,
> Alex.
>
> On Monday, January 29, 2018 at 11:18:39 PM UTC+8, Matthias Felleisen wrote:
>
> > This is dang cool. Yes please submit a PR.
>
> --
> 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] Read-only "editor" text with min-width of its content

2018-01-11 Thread Laurent
Maybe you can use snips% inside a single editor%?
Snips can be text or pictures or other things.


On Wed, Jan 10, 2018 at 9:58 PM, Christopher Lemmer Webber <
cweb...@dustycloud.org> wrote:

> Christopher Lemmer Webber writes:
>
> > Matthew Flatt writes:
> >
> >> At Wed, 10 Jan 2018 10:29:28 -0600, Christopher Lemmer Webber wrote:
> >>> I'm still not sure how to find out what the "total" height of the text
> >>> is in an editor.  Does anyone know how to look that up?
> >>
> >> I think the `get-extent` method will report the size you want.
> >
> > Thank you so much!  That plus the vertical-inset info gave me what I
> > needed:
> >
> > (let ((h-box (box 0)))
> >   (send test-text2 get-extent #f h-box)
> >   (send test-ec min-height (+ (inexact->exact (unbox h-box))
> >   (* (send test-ec vertical-inset) 2)))
> >   (send test-ec stretchable-height #f))
>
> Horray, this works!  I'm now able to display content and it's nicely
> line-wrapped, etc.
>
> Only one problem: Now I have a ton of "editors" which were probably
> never meant to be used like this for hundreds of little "microblogs". ;)
> The main issue is that scrolling with all these editor canvases in place
> is super slow and really chews up CPU.  (When I'm not scrolling, it
> seems fine.)
>
> I wonder if there are any obvious hacks I could perform?  Caching things
> (is it possible to grab a bitmap of the current text editor's display
> content?), replacing the canvases with blank content when not being
> looked at, etc?
>

-- 
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] Read-only "editor" text with min-width of its content

2018-01-10 Thread Laurent
On Wed, Jan 10, 2018 at 6:20 AM, Christopher Lemmer Webber <
cweb...@dustycloud.org> wrote:

> So now I've got some text that renders okay, it line wraps, etc etc.
> The problem is, I want to add a panel with a bunch of these, and I want
> each of these "rich text" things to be exactly the height of their
> contents.  I can't figure out how to do it... either I have
> stretchable-text set to #t and I'm stuck with whatever size it scales
> to, or I set stretchable-text to #f and the rich text canvas is only a
> few pixels high... not enough to see any content.
>

Maybe you can set the correct width and height afterwards using `min-width`
and `min-height`:
https://docs.racket-lang.org/gui/area___.html?q=min-height#%28meth._%28%28%28lib._mred%2Fmain..rkt%29._area~3c~25~3e%29._min-width%29%29

Also take a look at `reflow-container` for important information to keep in
mind:
https://docs.racket-lang.org/gui/area-container___.html?q=reflow#%28meth._%28%28%28lib._mred%2Fmain..rkt%29._area-container~3c~25~3e%29._reflow-container%29%29

-- 
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] Re: Lessons learned from writing a Conway's Game of Life implementation in big-bang

2018-01-06 Thread Laurent
On Fri, Jan 5, 2018 at 5:42 PM, Hendrik Boom  wrote:

> Long ago in the 60's, on an old PDP-11 running an early Unix, I
> implemented a Live using quad-trees for storage after I noticed by
> drawing on a lengthy printout that at each level of the quadtree, only
> about half of the quads has objects in them.  The empty ones I could
> leave out  of storage and not do much computation with them (except at
> the edges in case they wee to come back to life).
>
> I could get simply *huge* Life patterns on this rather small machine (by
> today's standards) without running out of RAM.  I did have to rescale
> the screen display several times.  A pixel ended up meaning something
> like "there is something in this 8x8 block".
>
> Well, what had to be used as a pixel on an ascii-text-only terminal.
>

Must have been incredible at the time!
Can you tell how close to the 1980's HashLife algorithm [1] your
implementation was? It seems quite related at least. The first time I saw
these exponential speed ups, I was blown away. People seeing your
implementation likely felt similarly.

I would love to see a clean Scheme/Racket implementation of HashLife.

[1] https://en.wikipedia.org/wiki/Hashlife, impressively implemented in
Golly [2]
[2] http://golly.sourceforge.net/

-- 
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] Retrieving some data from a module without evaluating it

2017-12-18 Thread Laurent
Thanks Steven, that's it. Looks like I messed up my grep search :)




On Sun, Dec 17, 2017 at 7:44 PM, Stephen De Gabrielle <
spdegabrie...@gmail.com> wrote:

> Is this what you are after?
>
> https://github.com/racket/racket/blob/master/racket/
> collects/racket/private/submodule.rkt
>
> /Applications/Racket v6.11/collects/racket/private/submodule.rkt
>
>
> Stephen
>
>
> On Sun, Dec 17, 2017 at 10:36 AM, Laurent <laurent.ors...@gmail.com>
> wrote:
>
>> Also, I can't find where module+ is defined. Anyone has a pointer?
>>
>> On Sun, Dec 17, 2017 at 9:34 AM, Laurent <laurent.ors...@gmail.com>
>> wrote:
>>
>>> Excellent, thanks a lot!
>>>
>>> On Sat, Dec 16, 2017 at 8:44 PM, Matthew Flatt <mfl...@cs.utah.edu>
>>> wrote:
>>>
>>>> [...]
>>>>
>>>  (set! submodule-content
>>>>(cons (syntax-local-introduce
>>>>   #`(begin
>>>>   (provide proc)
>>>>   (define proc (list (cons 'prop prop-val) ...
>>>>
>>>
>>> 1) I put all these macros in a separate module, to keep only the calls
>>> to `my-define` in "my-file.rkt". But then Racket was complaining about "no
>>> #%datum syntax transformer is bound" on "some value", that is, on
>>> `prop-val`. Some digging on the list told me that I could simply quote
>>> prop-val since this is supposed to be only data. And that works great.
>>>
>>> But for the sake of understanding, suppose that I have a racket/base
>>> expression like `(+ 3 4)` instead of "some value", then IIUC I need to give
>>> it some syntax location so that it can be interpreted correctly. Here, this
>>> location seems to be (inside?) the newly created submodule, but how do I
>>> refer to this place with `syntax/loc`?
>>>
>>>
>>> 2) Instead of `racket/base` for the submodule, I was thinking of using
>>> the `info` language, as it seems to be lighter and is made for data
>>> (although it does not seem to 'export' bindings). If I have to load many
>>> submodules of files like my-file.rkt, would there be a practical difference
>>> in terms of speed or memory, or can I just stick to racket/base (in the
>>> relatively unlikely case the user wants to use expressions in the
>>> `prop-val`s)?
>>>
>>>
>>> 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.
>> 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] Retrieving some data from a module without evaluating it

2017-12-17 Thread Laurent
Also, I can't find where module+ is defined. Anyone has a pointer?

On Sun, Dec 17, 2017 at 9:34 AM, Laurent <laurent.ors...@gmail.com> wrote:

> Excellent, thanks a lot!
>
> On Sat, Dec 16, 2017 at 8:44 PM, Matthew Flatt <mfl...@cs.utah.edu> wrote:
>
>> [...]
>>
>  (set! submodule-content
>>(cons (syntax-local-introduce
>>   #`(begin
>>   (provide proc)
>>   (define proc (list (cons 'prop prop-val) ...
>>
>
> 1) I put all these macros in a separate module, to keep only the calls to
> `my-define` in "my-file.rkt". But then Racket was complaining about "no
> #%datum syntax transformer is bound" on "some value", that is, on
> `prop-val`. Some digging on the list told me that I could simply quote
> prop-val since this is supposed to be only data. And that works great.
>
> But for the sake of understanding, suppose that I have a racket/base
> expression like `(+ 3 4)` instead of "some value", then IIUC I need to give
> it some syntax location so that it can be interpreted correctly. Here, this
> location seems to be (inside?) the newly created submodule, but how do I
> refer to this place with `syntax/loc`?
>
>
> 2) Instead of `racket/base` for the submodule, I was thinking of using the
> `info` language, as it seems to be lighter and is made for data (although
> it does not seem to 'export' bindings). If I have to load many submodules
> of files like my-file.rkt, would there be a practical difference in terms
> of speed or memory, or can I just stick to racket/base (in the relatively
> unlikely case the user wants to use expressions in the `prop-val`s)?
>
>
> 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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Retrieving some data from a module without evaluating it

2017-12-17 Thread Laurent
Excellent, thanks a lot!

On Sat, Dec 16, 2017 at 8:44 PM, Matthew Flatt  wrote:

> [...]
>
 (set! submodule-content
>(cons (syntax-local-introduce
>   #`(begin
>   (provide proc)
>   (define proc (list (cons 'prop prop-val) ...
>

1) I put all these macros in a separate module, to keep only the calls to
`my-define` in "my-file.rkt". But then Racket was complaining about "no
#%datum syntax transformer is bound" on "some value", that is, on
`prop-val`. Some digging on the list told me that I could simply quote
prop-val since this is supposed to be only data. And that works great.

But for the sake of understanding, suppose that I have a racket/base
expression like `(+ 3 4)` instead of "some value", then IIUC I need to give
it some syntax location so that it can be interpreted correctly. Here, this
location seems to be (inside?) the newly created submodule, but how do I
refer to this place with `syntax/loc`?


2) Instead of `racket/base` for the submodule, I was thinking of using the
`info` language, as it seems to be lighter and is made for data (although
it does not seem to 'export' bindings). If I have to load many submodules
of files like my-file.rkt, would there be a practical difference in terms
of speed or memory, or can I just stick to racket/base (in the relatively
unlikely case the user wants to use expressions in the `prop-val`s)?


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.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Retrieving some data from a module without evaluating it

2017-12-16 Thread Laurent
Consider the following setup:

The file "my-file.rkt" is a #lang racket module which contains some
definitions of some procedures. Running this file may have some side
effects.

In particular it contains some definitions like:
(my-define my-proc
([property1 "some value"] ; some properties of my-proc
 [property2 12])
(lambda (x) (displayln x) 3)) ; the actual procedure

where 'my-define' is for me to define.

>From the second file "loader.rkt" (which interacts with the user), I would
like to retrieve the property-s of each form declared with 'my-define' in
"my-file.rkt", *without* running the file (not even sandboxed, that is, it
must be fast).

The purpose is to tell the user what are the different my-procs in
my-file.rkt, along with its properties, so that s/he can choose whether to
evaluate the corresponding procedure.

I've played with 'dynamic-require' and submodules with some limited success
but couldn't achieve the goal above. Any idea?

(Also, I have several files like 'my-file.rkt' that the user can choose
from.)

Thanks,
Laurent

-- 
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] namespace-anchor->namespace and eval

2017-10-05 Thread Laurent
Ah so that was actually a bug then :) Thanks for fix!

On Thu, Oct 5, 2017 at 5:47 PM, Matthew Flatt <mfl...@cs.utah.edu> wrote:

> I've pushed a repair for this problem. It's a bug in the current
> expander that could be triggered by a just-right combination of
> `syntax-local-lift-expression` (as used by `new`) and `expand` (as used
> by errortrace, which is used by DrRacket).
>
> At Sun, 1 Oct 2017 16:05:16 +0100, Laurent wrote:
> > Hi,
> >
> > Does anyone know a good explanation as to why the following code works
> > depending on whether the apparently-useless line is commented out?
> >
> > #lang racket
> >
> > #;(new object%) ; uncommenting this raises an error
> >
> > (define-namespace-anchor nsa)
> > (define ns (namespace-anchor->namespace nsa))
> > (eval '(new object%) ns)
> >
> > The error is:
> > lifted.0.0: undefined;
> >  cannot reference an identifier before its definition
> > with syntax location on the eval line
> >
> > 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.
> > 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.
>

-- 
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] namespace-anchor->namespace and eval

2017-10-01 Thread Laurent
Hi,

Does anyone know a good explanation as to why the following code works
depending on whether the apparently-useless line is commented out?

#lang racket

#;(new object%) ; uncommenting this raises an error

(define-namespace-anchor nsa)
(define ns (namespace-anchor->namespace nsa))
(eval '(new object%) ns)

The error is:
lifted.0.0: undefined;
 cannot reference an identifier before its definition
with syntax location on the eval line

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.
For more options, visit https://groups.google.com/d/optout.


[racket-users] [ANN] MrEd Designer update

2017-09-30 Thread Laurent
A new version of MrEd Designer (package 'mred-designer') is available:
https://pkgd.racket-lang.org/pkgn/package/mred-designer

MrEd Designer is WYSIWYG program to create GUI applications for Racket.

The changes are relatively minor in quantity, but I've made a number of
small improvements to the ease of use, as it seems that was lacking and
could have put off those who wanted to try it casually.

In particular the installation and quick start should be more helpful now:
https://github.com/Metaxal/MrEd-Designer/blob/v3.16/README.md

The loading times (both of MrEd Designer and of the generated Racket files)
have been substantially improved too, thanks to tab-panel% 'now' being part
of racket/gui rather than framework.

-- 
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] tabular text display

2017-09-23 Thread Laurent
> > Awesome! You’ve saved me hours.
>
> One simple thing: could you add the tags “tabular” and maybe also “format”
> or “text”? I’m afraid that in its current form, I wouldn’t have found this
> package when searching for it.
>

Done!
Any other comments or suggestions welcome of course.

-- 
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.


  1   2   >