Re: [racket-users] help on coding finite state automata

2015-10-12 Thread Linh Chi Nguyen
I dont know how the email group work. If someone keeps receiving emails out of interest, please notice me. Thanks Bryan for the suggestion, it's nice to know, however Im not able to afford upgrading now. And Matthias, for your notice of the spawning process ``` (define (randomise-over-fitness a

[racket-users] Puzzle

2015-10-12 Thread Jens Axel Søgaard
In DrRacket with just #lang racket in the definitions window. Click Run. Welcome to DrRacket, version 6.3.0.1--2015-10-12(a683542/a) [3m]. Language: racket; memory limit: 1024 MB. > (syntax->datum (expand #'(begin (define (sort v) v) (sort t '(begin (define-values (sort) (lamb

Re: [racket-users] Puzzle

2015-10-12 Thread Matthew Flatt
At Mon, 12 Oct 2015 13:23:48 +0200, Jens Axel Søgaard wrote: > In DrRacket with just #lang racket in the definitions window. > Click Run. > > Welcome to DrRacket, version 6.3.0.1--2015-10-12(a683542/a) [3m]. > Language: racket; memory limit: 1024 MB. > > > (syntax->datum (expand #'(be

[racket-users] setting default font face and size for a text%

2015-10-12 Thread David T. Pierson
I have a text% instance for which I want to optionally set the default style (font face and size). I want it to persist even if all text within the editor is erased. (My first attempt using the change-style method failed this requirement.) I've come up with the following, but is this the simples

Re: [racket-users] setting default font face and size for a text%

2015-10-12 Thread Robby Findler
That will work for newly typed text. Other code might changed the style and copying and pasting styled text may change it. You can use after-insert to change the style for those cases. Or maybe you want to allow that. There is also, in the framework, editor:standard-style-list which uses a global

[racket-users] Re: Case for net/url.rkt to read HTTP proxy servers from environment

2015-10-12 Thread Tim Brown
I’ve just created PR: PLT_HTTP_PROXY and PLT_NO_PROXY honoured #1089 It doesn’t use the standard HTTP_PROXY and NO_PROXY from the environment, since I want to be able to control the proxies for Racket obviously and separately from the rest of the environment. It’s kinda tested, and only documen

Re: [racket-users] help on coding finite state automata

2015-10-12 Thread Matthias Felleisen
I pushed some more changes. -- All automata code is now in the automata modules. -- It is now easy to explore different implementations of automata. 1. Eliminating your last side-effects came for free or possibly a small gain in performance. 2. Replacing your list-based automata with automa

Re: [racket-users] help on coding finite state automata

2015-10-12 Thread Gustavo Massaccesi
Sorry for not testing before posting, but in this code: (define (randomise-over-fitness accumulated-payoff-percentage population speed) (for/list ([n (in-range speed)]) [define r (random)] (for/and ([p (in-list population)] [a (in-list accumulated-payoff-percentage)]

Re: [racket-users] help on coding finite state automata

2015-10-12 Thread Matthias Felleisen
for/last: good point. Based on my previous experience with replacing imperative automata with functional ones, I don't think replacing the list-based population container with a vector per se will speed up things much. But the pairing up of neighbors might be a tad faster. Then again I woul

[racket-users] Formatting Function

2015-10-12 Thread Taro Annual
Hi, Please tell me the way of the following in racket? In C, printf("%02d", 2); In Common Lisp, (format t "~2,'0D" 2) -- 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 em

Re: [racket-users] Formatting Function

2015-10-12 Thread Deren Dohoda
Hi Taro, Probably racket/format is what you need to look at. http://docs.racket-lang.org/reference/strings.html#%28mod-path._racket%2Fformat%29 #lang racket/base (require racket/format) (define (this-format num) (~a #:min-width 3 #:align 'right #:pad-string "0" num)) (this-format 5) ;=> "

[racket-users] Re: Formatting Function

2015-10-12 Thread George Neuner
On Mon, 12 Oct 2015 12:28:56 -0400, Deren Dohoda wrote: >Probably racket/format is what you need to look at. >http://docs.racket-lang.org/reference/strings.html#%28mod-path._racket%2Fformat%29 Or SRFI 48: http://docs.racket-lang.org/srfi/srfi-std/srfi-48.html racket/format is more capable, b

Re: [racket-users] Naming for generalization of find-min and find-max?

2015-10-12 Thread Robby Findler
Ah, sorry Alex. I mean "maximal" in the sense of this wikipedia page (and also how I was taught in math class, so definitely a "mathy" word(!)): https://en.wikipedia.org/wiki/Maximal_element Robby On Sun, Oct 11, 2015 at 9:48 PM, Alex Knauth wrote: > > On Oct 11, 2015, at 10:41 PM, Nadeem Abdul

Re: [racket-users] Naming for generalization of find-min and find-max?

2015-10-12 Thread Daniel Prager
find-min and find-max are (already) good names in my opinion. They shorten both minimum / minimal (maximum / maximal), which works for both numbers (whence our intuition) and partial orders. How about find-min or find-max with an optional keyword argument #:order-by (defaulting to <)? I dislike "

Re: [racket-users] Naming for generalization of find-min and find-max?

2015-10-12 Thread Vincent St-Amour
Similar to what JCG suggested: `find-most`? Vincent On Mon, 12 Oct 2015 14:37:43 -0500, Daniel Prager wrote: > > find-min and find-max are (already) good names in my opinion. They > shorten both minimum / minimal (maximum / maximal), which works for both > numbers (whence our intuition) and par

[racket-users] [Intro-projects] First intro project

2015-10-12 Thread Gianluca Ciccarelli
Hi everyone, I have finished my first "recreational programming" assignment in Racket and I feel pretty proud, maybe more like a 3-year-old-proud than like a 30-cough-year-old-proud :) I followed the suggestion in the Intro-projects GitHub project, and linked my repository as an example for th

Re: [racket-users] Naming for generalization of find-min and find-max?

2015-10-12 Thread Martin DeMello
One problem with generalising find-max and find-min into a single hof is that they are closer in spirit to a fold than a find. The name find- makes you think that the passed in function should be a predicate on one element, not two. How about something like first-by? > (first-by stringstring secon

Re: [racket-users] Naming for generalization of find-min and find-max?

2015-10-12 Thread Greg Hendershott
Oh, I love a good bikeshedding thread! ;) I think JCG nailed it: most - It's not excessively numeric. - Unlike "best" it's not judge-y or normative. - The polarity isn't _too_ weird for negatives. (Although "least " might be smoother English, "most " or "most {un,in}-" is usually clear eno

Re: [racket-users] help on coding finite state automata

2015-10-12 Thread Matthias Felleisen
So I couldn't resist and wrote the vector-based, allocation-minimizing version of the program. I didn't get that much of a performance gain. I might still change the fitness representation (into a vector) or integrate it into 'population' (where it belongs from an SE perspective). I doubt thi

Re: [racket-users] Naming for generalization of find-min and find-max?

2015-10-12 Thread Robby Findler
That's a great name. :) Robby On Mon, Oct 12, 2015 at 4:59 PM, Greg Hendershott wrote: > Oh, I love a good bikeshedding thread! ;) > > I think JCG nailed it: > > most > > - It's not excessively numeric. > > - Unlike "best" it's not judge-y or normative. > > - The polarity isn't _too_ weird f

Re: [racket-users] Naming for generalization of find-min and find-max?

2015-10-12 Thread Matthew Butterick
> p.s. Although `find-most` is OK, IMO `find-` is usually a noise prefix > from the Department of Redundancy Department. Sort of like naming a > function `return-foo` instead of just `foo`. What else would a > function do except find or return foo? Agreed, but for this reason, `find-max` and `find

Re: [racket-users] Naming for generalization of find-min and find-max?

2015-10-12 Thread Alex Knauth
> On Oct 12, 2015, at 5:59 PM, Greg Hendershott > wrote: > > p.s. Although `find-most` is OK, IMO `find-` is usually a noise prefix > from the Department of Redundancy Department. Sort of like naming a > function `return-foo` instead of just `foo`. What else would a > function do except find or

Re: [racket-users] help on coding finite state automata

2015-10-12 Thread Alex Knauth
What about Alexis King's persistent vectors? > On Oct 12, 2015, at 6:14 PM, Matthias Felleisen wrote: > > > > So I couldn't resist and wrote the vector-based, allocation-minimizing > version of the program. I didn't get that much of a performance gain. > > I might still change the fitness r

Re: [racket-users] Naming for generalization of find-min and find-max?

2015-10-12 Thread Alex Knauth
The names `first-by` and `find-first-by` both sound good to me. Alexis? > On Oct 12, 2015, at 4:54 PM, Martin DeMello wrote: > > One problem with generalising find-max and find-min into a single hof is that > they are closer in spirit to a fold than a find. The name find- makes you > think th

Re: [racket-users] help on coding finite state automata

2015-10-12 Thread Matthias Felleisen
Take a crack at it. I am pretty sure I have introduced the proper level of representation independence (I can hear Ben laugh all the way now — Typed Racket doesn’t have types) and the typed documentation is pretty solid. (I’ll do types later to validate.) > On Oct 12, 2015, at 7:37 PM, Ale

Re: [racket-users] Naming for generalization of find-min and find-max?

2015-10-12 Thread Andrew Kent
... what about 'select' or 'select-by'? (If not... I'm just helping eliminate all the bad names... =) On Mon, Oct 12, 2015 at 7:39 PM Alex Knauth wrote: > The names `first-by` and `find-first-by` both sound good to me. > > Alexis? > > On Oct 12, 2015, at 4:54 PM, Martin DeMello > wrote: > > On

Re: [racket-users] Naming for generalization of find-min and find-max?

2015-10-12 Thread Alexis King
I’m not completely sold on `most`, but I’m close. I like that it’s terse and fairly obvious in what it does. The obvious downside is that it’s a little vague. The expression (most < lst) doesn’t read super well, IMO. I think passing a less-than? argument makes this function much closer conceptu

Re: [racket-users] Naming for generalization of find-min and find-max?

2015-10-12 Thread Alex Knauth
> On Oct 12, 2015, at 8:35 PM, Alexis King wrote: > > I’m not completely sold on `most`, but I’m close. I like that it’s terse and > fairly obvious in what it does. The obvious downside is that it’s a little > vague. The expression (most < lst) doesn’t read super well, IMO. > > I think passin

Re: [racket-users] [Intro-projects] First intro project

2015-10-12 Thread Greg Hendershott
Welcome to Racket! It's a lot of fun, and there's a ton of interesting stuff to learn about when you're ready. I glanced at your code and it seemed very understandable. I wish my earliest Racket code had been that good. Whenever you feel ready to care about writing "idiomatic" Racket code, you co

Re: [racket-users] Naming for generalization of find-min and find-max?

2015-10-12 Thread Alex Knauth
> On Oct 12, 2015, at 8:55 PM, Alex Knauth wrote: > > >> On Oct 12, 2015, at 8:35 PM, Alexis King wrote: >> In the same line of thought as `append-map`, the name `first-sort` has >> crossed my mind, but this feels just as opaque. The name `first-by` is very >> close, but it fails: that func