Re: [racket-users] Re: nested for loops and suggested alternatives

2019-02-10 Thread travis . hinkelman
For the benefit of other beginners, I think there was a small typo in prop-projection.v1 where the intention was to call that function recursively rather than calling pop-projection in the body of pop-projection.v1. The typo is corrected below: (define (pop-projection.v1 A n iter) (if (zero?

Re: [racket-users] Re: nested for loops and suggested alternatives

2019-02-10 Thread Matthias Felleisen
> On Feb 10, 2019, at 7:26 PM, Alex Harsanyi wrote: > > One way to do this is for `pop-abundances` to have an extra parameter, the > list of previous abundances, and whenever the function is called recursively, > it adds the current abundance to this list and passes it on to the next call.

Re: [racket-users] Re: nested for loops and suggested alternatives

2019-02-10 Thread Alex Harsanyi
On Monday, February 11, 2019 at 8:01:47 AM UTC+8, travis.h...@gmail.com wrote: > > Thanks, Daniel, this is helpful. I think that I understand your code, but > it is a still a foreign way of thinking for me. Of course, that is a big > part of why I'm learning Racket, i.e., to make programming

Re: [racket-users] Re: nested for loops and suggested alternatives

2019-02-10 Thread travis . hinkelman
Thanks, Daniel, this is helpful. I think that I understand your code, but it is a still a foreign way of thinking for me. Of course, that is a big part of why I'm learning Racket, i.e., to make programming with lists and recursion more natural. One key gap for me is how to build up data

Re: [racket-users] Finding the right font%

2019-02-10 Thread Matthew Flatt
The `get-face-list` function returns the list of available face names. Or use `get-font-from-user` for a GUI window that contains the same list. At Sun, 10 Feb 2019 11:43:52 -0800, Jordan Johnson wrote: > Hi all, > > I’m using a typeface (Espinosa Nova >

[racket-users] Finding the right font%

2019-02-10 Thread Jordan Johnson
Hi all, I’m using a typeface (Espinosa Nova ) comprised of twelve distinct fonts. When I use the pict or 2htdp/image library to create an image of some text — e.g., > (text "Foo bar!" 24 "Espinosa Nova") ; pict lib — Racket gives me

Re: [racket-users] Molis hai documentation

2019-02-10 Thread 'John Clements' via Racket Users
Yes, this should appear in the web page. FWIW, raco commands come with a standard “—help” flag: raco molis-hai --help raco molis-hai [ ... ] where is one of -b , --bits : Number of bits of entropy -n , --passwords : Number of passwords generated -o , --model-order : Order of the

Re: [racket-users] Strange behavior from regexp-match*

2019-02-10 Thread Matthew Flatt
This looks like a bug in the regexp matcher. (The examples run without error on Racket CS, which has a new implementation of the matcher.) I'll work on a repair. Meanwhile,as you've noted that the bug seems to be related to `\W`, using something else in place of `\W` is probably the easiest

Re: [racket-users] raco distribute creating too many subdirectories

2019-02-10 Thread Philip McGrath
I think this is probably a consequence of the quirk of `define-runtime-path` with directories that I reported at: https://github.com/racket/racket/issues/2336 I'm still not clear on whether the current behavior is intended and, if so, how one ought to do this sort of thing to work robustly with

Re: [racket-users] Strange behavior from regexp-match* (solution: Use Racket on Chez)

2019-02-10 Thread Rebelsky, Samuel
Laurent, Thanks for the idea. Unfortunately, that doesn't seem to make a difference. Here's a search involving only 8000 characters. > (regexp-match* #px"\\W\\wat" (substring book 24000 32000)) . . ../../Applications/Racket v7.2/collects/racket/private/kw.rkt:1325:47: substring: ending index

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:

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

[racket-users] Strange behavior from regexp-match*

2019-02-10 Thread Rebelsky, Samuel
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

Re: [racket-users] Re: nested for loops and suggested alternatives

2019-02-10 Thread Gustavo Massaccesi
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

[racket-users] Molis hai documentation

2019-02-10 Thread Hendrik Boom
The page https://docs.racket-lang.org/molis-hai/index.html specifies there are command line parameters, but does not say what they are. In particular, I'm wondering how to specify: the order the number of bits of entropy It does mention the -t flag to specify the source text. It's not

Re: [racket-users] Re: nested for loops and suggested alternatives

2019-02-10 Thread Daniel Prager
Thanks for the screenshot Travis. Just for fun, here's a version in Racket that eschews assignment, vectors and for loops, in favour of recursion and lists ... #lang racket (define years 30) (define prop-female 0.5) (define egg-surv 0.6) (define fecundity '(0 0 200 400 800)) (define survival

Re: [racket-users] Re: nested for loops and suggested alternatives

2019-02-10 Thread Jens Axel Søgaard
> > Performance Warning: Indexing the elements of arrays created in untyped >> Racket is currently 25-50 times slower than doing the same in Typed Racket, >> due to the overhead of checking higher-order contracts. We are working on >> it. > > I have no idea how to improve that (the timings are old

Re: [racket-users] raco distribute creating too many subdirectories

2019-02-10 Thread P. Baillet
Hello, After some analysis, I found out this is because I was using `(define-runtime-path` the wrong way. My code uses FFI and at some point, I thought it would be wise to use code I didn’t understand. The following snippet reproduces the issue: ``` #lang racket (require

Re: [racket-users] Re: nested for loops and suggested alternatives

2019-02-10 Thread travis . hinkelman
I played around a bit with the math/matrix library. Actually, my first idea for a Racket learning project was to rewrite the code in the R popbio package (https://cran.r-project.org/web/packages/popbio/popbio.pdf) in Racket. But I bailed on that when I saw that eigendecomposition was still on

Re: [racket-users] Re: nested for loops and suggested alternatives

2019-02-10 Thread Daniel Prager
Hi Travis Would you mind sharing your results from R (and now Racket)? I'm having a play with the Racket code, and would like to check I'm not breaking anything as I refactor it. Dan -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To

[racket-users] Re: nested for loops and suggested alternatives

2019-02-10 Thread travis . hinkelman
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

Re: [racket-users] Re: nested for loops and suggested alternatives

2019-02-10 Thread Alex Harsanyi
On Sunday, February 10, 2019 at 4:47:52 PM UTC+8, Philip McGrath wrote: > > You may also want to look into the math/array > and math/matrix > libraries. > looking at the code, it seems to me that

Re: [racket-users] Re: nested for loops and suggested alternatives

2019-02-10 Thread Philip McGrath
You may also want to look into the math/array and math/matrix libraries. -Philip On Sun, Feb 10, 2019 at 3:42 AM Alex Harsanyi wrote: > This line looks suspicious: > > (define results

[racket-users] Re: nested for loops and suggested alternatives

2019-02-10 Thread Alex Harsanyi
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