Re: [racket] Question about round

2011-09-29 Thread Pierpaolo Bernardi
#i42 is an inexact integer, there's noting notable about them. 43.0 is another one. Cheers 2011/9/29, Mark Engelberg : > I'm a bit baffled by this behavior: > >> (exact? (round (sin 30))) > #f >> (integer? (round (sin 30))) > #t >> > > How is it possible to have an inexact integer? > > I would

Re: [racket] Learning Scheme and Racket

2011-10-05 Thread Pierpaolo Bernardi
Why not add to the help desk or to racket-lang.org a Bibliography page, containing references to all the relevant papers in one place? Cheers P. _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users

Re: [racket] Looping and let-values

2011-10-25 Thread Pierpaolo Bernardi
On Sun, Oct 23, 2011 at 23:29, Jens Axel Søgaard wrote: > Would it make sense for let-values to support the following? > (let-values loop ([(first next) (sequence-generate* '(a b c))]) >   (when first >     (display first) (newline) >     (call-with-values next loop))) I wished for this feature

Re: [racket] if problem

2012-02-29 Thread Pierpaolo Bernardi
On Wed, Feb 29, 2012 at 12:14, ROELOF WOBBEN wrote: > Hello, > > I have made this : > > (define (string-insert s1 i) >   (if(> (string-length s1) 0)  (string-append (substring s1 0 i) "-" > (substring s1 i (string-length s1) > > But on the if I get a this message : > > if: expected a question

Re: [racket] Fwd: Re: Is this a good design

2012-03-02 Thread Pierpaolo Bernardi
On Fri, Mar 2, 2012 at 09:41, Roelof Wobben wrote: > I did some study on that chapter but I cannnot make it work, > This is what I have so  far : > > ;;String -> String > ;; Get the first character of a string (s) if there is one. error otherwise. > ;; given "" expected "a" > ;; given "" exp

[racket] strange loops

2012-03-06 Thread Pierpaolo Bernardi
Hello, I was expecting the procedure 'fa' below to run in constant memory, as, in my understanding, It doesn't use any non-tail recursive loops, it does not build any data structure, and only performs arithmetic operations on small integers. But some of my assumptions must be wrong, as the calls

Re: [racket] strange loops

2012-03-06 Thread Pierpaolo Bernardi
On Tue, Mar 6, 2012 at 14:08, Danny Yoo wrote:> > This looks like something out of WPI programming competiton, if I'm not > mistaken.  :) No, it's from Project Euler. ;^) Racket Users list: http://lists.racket-lang.org/users

Re: [racket] strange loops

2012-03-06 Thread Pierpaolo Bernardi
On Tue, Mar 6, 2012 at 13:56, Robby Findler wrote: > The body of a for loop is not in tail position wrt to the for loop > (you can see this in Check Syntax-- there is a gap in the tail arrows > between the let that binds 'next-z' and the call to 'next-z'. Duh! thanks. Now it's obvious. On 06-0

[racket] Unicode art

2012-03-21 Thread Pierpaolo Bernardi
Hello, not sure if this is a DrRacket or font question. I'm doing drawings with the unicode box drawing characters, like this: > (q '(31 13) #t 'L) () ╶┬─┬───┬─┬─┐ ╷│╷└──┐╵┌──╴╷╵╷│ │╵├┬─┐└┬┘┌──┼─┘│ ├┬┘╵╷└┐│╶┴┬╴│┌─┤ │╵┌─┴┐╵│╶┐│╶┤│╷│ │╶┘┌╴└─┴─┘│╷╵╵│╵ └──┴──┴┴──┴╴ > (q '(31 13) #t 'H) ()

Re: [racket] Unicode art

2012-03-21 Thread Pierpaolo Bernardi
On Wed, Mar 21, 2012 at 15:37, Vincent St-Amour wrote: > Using the same font in a different application, do you get the same > gaps? If so, it's probably a font issue. It's not clear to me where the issue is. Attached, two screen captures. In DrRacket both light and heavy lines present the same

Re: [racket] Unicode art

2012-03-21 Thread Pierpaolo Bernardi
Emacs, behaves like notepad. hmmm <> Racket Users list: http://lists.racket-lang.org/users

Re: [racket] Unicode art

2012-03-22 Thread Pierpaolo Bernardi
On Wed, Mar 21, 2012 at 17:44, Robby Findler wrote: > Yes, I think that's right. Here's a patch to set that spacing to 0. > Does that make the problem go away? Yes, that was it! However, it fixes the editor panel, but not the interaction window. Image attached. Thanks. <>

Re: [racket] Unicode art

2012-03-26 Thread Pierpaolo Bernardi
On Sun, Mar 25, 2012 at 03:25, Robby Findler wrote: > So I've pushed a change to DrRacket that adds a preference. The > preference defaults to "no additional spacing" under windows and "one > extra pixel" (the 5.2.1 behavior) everywhere else. > > Please let me know if things start to look strange

Re: [racket] do loops in racket, also srfi/25 query

2012-03-26 Thread Pierpaolo Bernardi
On Mon, Mar 26, 2012 at 01:31, Joe Gilray wrote: > Hi Tom, > > thanks for the comments. > > As far as reading the data into a vector, that can be accomplished with > "(define vec (read in))"  I was more interested in how to create an srfi/25 > array from that vector. (apply array (shape 0 3 0 3)

Re: [racket] do loops in racket, also srfi/25 query

2012-03-28 Thread Pierpaolo Bernardi
On Tue, Mar 27, 2012 at 18:55, Joe Gilray wrote: > Thanks (again) Rodolfo, > > Do people use the srfi/25 arrays much?  Or is the normal practice to simply > use vector with a little "reference arithmetic"? The most normal practice, I think, is to use nested vectors, maybe with a few ad-hoc help f

Re: [racket] ufo structure problem

2012-03-30 Thread Pierpaolo Bernardi
Hello Roelof, On Fri, Mar 30, 2012 at 09:32, Roelof Wobben wrote: > (define (show-ufo ufo) >  (place-image BLU (ufo-loc u) MTS)) > > But still I can't get the show-ufo work. Check carefully the name of your variables! Doesn't DrRacket give you an explicative error message in this case? P. __

Re: [racket] Racket Question

2012-03-30 Thread Pierpaolo Bernardi
On Fri, Mar 30, 2012 at 07:03, Brandon T wrote: > Hi i have a question that i could not find an answer to on your site, not > could i find an answer on stack overload. By default, racket prints the > first 25 digits of a irrational fraction. i.e. > >>1/998 > 0.0010020040080160320641282... > > wher

Re: [racket] ufo structure problem

2012-04-02 Thread Pierpaolo Bernardi
On Fri, Mar 30, 2012 at 16:56, Roelof Wobben wrote: > Op 30-3-2012 12:17, Pierpaolo Bernardi schreef: > >> On Fri, Mar 30, 2012 at 11:53, Roelof Wobben  wrote: >>> >>> Op 30-3-2012 9:46, Pierpaolo Bernardi schreef: >>> >>>> Hello Roelof, >

Re: [racket] key event problem

2012-04-18 Thread Pierpaolo Bernardi
On Wed, Apr 18, 2012 at 11:17, Roelof Wobben wrote: > Hello, > > I try to make a function which controls the key-events. > > The function does only have to react on backspace , left , right . > Give no reaction on tab , rubout or the other keys with a length more then > 1. > When given another key

Re: [racket] key event problem

2012-04-18 Thread Pierpaolo Bernardi
On Wed, Apr 18, 2012 at 12:32, Pierpaolo Bernardi wrote: > maybe: > > (define (edit e k) >  (cond ((key=? "right" k) >         (if (zero? (string-length (editor-post e))) >           e >           )) >        ((key=? "left" k) >         (if (zero

Re: [racket] key event problem

2012-04-18 Thread Pierpaolo Bernardi
On Wed, Apr 18, 2012 at 12:39, Roelof Wobben wrote: > Op 18-4-2012 12:32, Pierpaolo Bernardi schreef: > >> On Wed, Apr 18, 2012 at 11:17, Roelof Wobben  wrote: >>> >>> Hello, >>> >>> I try to make a function which controls the key-events. >>&

Re: [racket] Mutable state vs RAM on fire

2012-05-03 Thread Pierpaolo Bernardi
On Thu, May 3, 2012 at 1:45 PM, Rüdiger Asche wrote: > uhm... am I mistaken, or is there one recursive call to fast-expt in a non > tail recursive position? Schouldn't that be unwound? The calls nest only upto log_2(n), so, why worry? Racket Users list: http://lists.rack

Re: [racket] `def' ?

2012-05-10 Thread Pierpaolo Bernardi
On Thu, May 10, 2012 at 5:54 PM, Greg Hendershott wrote: > Should `def' be added as an alias for `define'? > > Possible reasons why: > 2. Name shortening seems to be a current theme. MALA TEMPORA CVRRVNT Racket Users list: http://lists.racket-lang.org/users

Re: [racket] `def' ?

2012-05-10 Thread Pierpaolo Bernardi
On Thu, May 10, 2012 at 9:26 PM, ozzloy-racket-users wrote: > am i the only one that thinks not having abbreviated names for anything is > good? no. > i like not having "def".  especially if it's going to be redundant. > i see this as a slippery slope i don't want to go down. > it annoys me when

Re: [racket] first and rest etc. only work on proper lists

2012-05-15 Thread Pierpaolo Bernardi
On Mon, May 14, 2012 at 8:16 PM, Jay McCarthy wrote: > They could be identical, but they are different because one set is > about lists and the other is about pairs. The fact that pairs may be > used to implement lists is immaterial. > > You should really never use the c[ad]*r functions unless you

Re: [racket] first and rest etc. only work on proper lists

2012-05-15 Thread Pierpaolo Bernardi
On Tue, May 15, 2012 at 1:31 PM, Robby Findler wrote: > FWIW, the list? check that is inside first and rest caches its result > in the header information in the cons cells it traverses. I see. I was missing this piece of information. Cheers P. Racket Users list: http://l

Re: [racket] first and rest etc. only work on proper lists

2012-05-15 Thread Pierpaolo Bernardi
On Tue, May 15, 2012 at 1:49 PM, Matthew Flatt wrote: > At Tue, 15 May 2012 06:31:13 -0500, Robby Findler wrote: >> FWIW, the list? check that is inside first and rest caches its result >> in the header information in the cons cells it traverses. > > In other words, `first and `rest' are amortized

Re: [racket] [racket-dev] `string-split'

2012-05-25 Thread Pierpaolo Bernardi
On Thu, Apr 19, 2012 at 6:55 PM, namekuseijin wrote: > while we're at it, why do you guys make the order or arguments like that? > > like, these are easier to read than in the order available in racket: > > (string-split "," "6,5,1,12,13,8,15,9,3,7,4,2,14,10,11") > (sort < '(6 5 1 12 13 8 15 9 3

Re: [racket] complex sort or how to sort lines

2012-05-25 Thread Pierpaolo Bernardi
On Fri, May 25, 2012 at 6:16 PM, Don Green wrote: > Given the output of Racket's read-words/line function, which produces a list > of lists. Each word is in a list, each group of words on a line is in a > list, all within a list. > > Any ideas on how to sort on the car (first element) of each list

Re: [racket] Congratulations to Matthias: SIGPLAN Achievement Award

2012-06-13 Thread Pierpaolo Bernardi
Congratulations to Matthias! Racket Users list: http://lists.racket-lang.org/users

Re: [racket] Congratulations to Shriram: Milner Young Researcher Award

2012-06-13 Thread Pierpaolo Bernardi
Congratulations Shriram! Great day in PLT land. 8^) Racket Users list: http://lists.racket-lang.org/users

Re: [racket] querying the machine's system time...

2012-06-19 Thread Pierpaolo Bernardi
On Sat, Jun 16, 2012 at 6:23 AM, Matthew Flatt wrote: > I'm confused by the question. Maybe you have and old version where > 'seconds->date' accepts only integers? The current version accepts a real, > and so fractional seconds can be in the argument to 'seconds->date'. BTW, related to seconds-

Re: [racket] What math do you want to do in Racket?

2012-06-30 Thread Pierpaolo Bernardi
I want in racket all that my hp50g can do. And since you are at it, you could also port the combinatorica library to racket. I hope all of you have enjoyed the extra second we have just had today! Cheers! P. 2012/7/1, Neil Toronto : > Being a glutton for punishment, I've decided to write a `m

Re: [racket] What math do you want to do in Racket?

2012-06-30 Thread Pierpaolo Bernardi
We *all* had it just before 00:00 UTC, about 110 minutes ago. I'm afraid you wasted your second. 8^) 2012/7/1, Todd O'Bryan : > Hey, now. Some of us haven't had that extra second, yet. Don't ruin it > for us. :-) > > On Sat, Jun 30, 2012 at 8:44 PM, Pierpaolo

Re: [racket] Racket Virtual Machine runs out of memory

2012-07-20 Thread Pierpaolo Bernardi
Btw, I have a boolean vectors library that you can use as is or as a starting point. I cannot send it to you until monday, but you can find an old copy in the archives of this ml, googling for my name + boolean vector. 2012/7/20, Harry Spier : > Thanks Eli, > > I probably have to go the route yo

Re: [racket] newbie drracket usage questions

2012-07-31 Thread Pierpaolo Bernardi
On Tue, Jul 31, 2012 at 7:52 AM, D Herring wrote: > On 07/31/2012 01:15 AM, Richard Cleis wrote: >> > I am looking for functions that search for racket functions and return > racket data structures that describe them. The key pieces of information is > the name (so it can be used) and the source

Re: [racket-users] Room for descriptions

2015-07-03 Thread Pierpaolo Bernardi
BTW, since you are looking at the preferences, I wish there was a way to have automatic conversion of square brackets to parentheses *always*. That is, I don't want square brackets in my racket code, but I like the convenience of typing them over typing parentheses. Looks like a combination of pre

Re: [racket-users] Room for descriptions

2015-07-03 Thread Pierpaolo Bernardi
On Fri, Jul 3, 2015 at 8:36 PM, Neil Van Dyke wrote: > BTW, Emacs users can get this feature through Quack. > The feature turns causes a typed "[" to insert "(". > > Separately, typed "]" always inserts the character to agree with the > matching open paren/bracket. > > To really insert "[", do th

Re: [racket-users] How to return summary from the inner loop?

2015-07-10 Thread Pierpaolo Bernardi
If I understand correctly the spec, this should do what you ask? (define (validate-ranges value-list low-list high-list) (for/fold ((failures 0)) ((low (in-list value-list)) (high (in-list high-list))) (for/fold ((failures 0)) ((value (in-list value-lis

Re: [racket-users] How to return summary from the inner loop?

2015-07-10 Thread Pierpaolo Bernardi
On Fri, Jul 10, 2015 at 10:45 PM, Pierpaolo Bernardi wrote: > If I understand correctly the spec, this should do what you ask? which, fixing the typo, becomes: (define (validate-ranges value-list low-list high-list) (for/fold ((failures 0)) ((low (in-list low-l

Re: [racket-users] How to return summary from the inner loop?

2015-07-10 Thread Pierpaolo Bernardi
On Fri, Jul 10, 2015 at 11:11 PM, Stephen Chang wrote: > Perhaps I don't understand the problem, but why is the inner loop necessary? He asked how to test each value against each of the limit pairs. I assume this is a simplified/demo problem and in the problem he really cares about there's a rea

Re: [racket-users] Re: How to return summary from the inner loop?

2015-07-10 Thread Pierpaolo Bernardi
On Fri, Jul 10, 2015 at 11:40 PM, Pekka Niiranen wrote: > Thanks Sir, > > This was exactly what I tried to reason. > It never occured to me that parameter "failure" can be used > in both for/fold -constructs. I must fix once again my code. Sigh. I fixed a mistake, and renamed one of the two failu

Re: [racket-users] What limits would you put on racket?

2015-07-27 Thread Pierpaolo Bernardi
On Fri, Jul 24, 2015 at 4:31 PM, Hendrik Boom wrote: > You might be interested in the language Styx, the language that goes with > the Inferno operating system. I believe it uses reference counting up > front, with full garbage collection as a backstop. The language is called Limbo. Styx is In

Re: [racket-users] `divides?` from math/number-theory slow?

2015-08-24 Thread Pierpaolo Bernardi
On Mon, Aug 24, 2015 at 1:25 PM, Jens Axel Søgaard wrote: > It looks very odd to me. Maybe this is due to calling TR functions from plain Racket? -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receivin

Re: [racket-users] Question about structuring recursive code

2015-09-23 Thread Pierpaolo Bernardi
On Wed, Sep 23, 2015 at 3:20 PM, Kaushik Ghose wrote: > e.g. > > (define (f-recur x y) > (if (< x 1) > 10 > (f-recur-2 x y))) > > (define (f-recur-2 x y) > ... something complex here > (f-recur x' y') (define (f-recur x y) (cond ((< x 1) 10) (else

Re: [racket-users] Question about structuring recursive code

2015-09-23 Thread Pierpaolo Bernardi
On Wed, Sep 23, 2015 at 6:18 PM, Kaushik Ghose wrote: > Can I have any statements in this block that I could have in a (define ...) > block? Can I have (defines ) for example? Yes, and yes :) -- You received this message because you are subscribed to the Google Groups "Racket Users" group. T

Re: [racket-users] racket users fight for their right to colon keywords

2015-10-14 Thread Pierpaolo Bernardi
On Wed, Oct 14, 2015 at 11:34 PM, Neil Van Dyke wrote: > Alex Knauth wrote on 10/14/2015 04:37 PM: >> >> You can use >> #lang colon-kw racket >> for :kw syntax, and >> #lang kw-colon racket >> for kw: syntax. > > > If the standard `#lang racket` and `#lang racket/base` don't support > `:keyword` o

Re: [racket-users] Re: racket users fight for their right to colon keywords

2015-10-22 Thread Pierpaolo Bernardi
On Thu, Oct 22, 2015 at 8:09 PM, Andrew Gwozdziewycz wrote: > Surely there are books about this subject. Does anyone have any > recommendations for future self? This course has a module on voting theory: https://www.coursera.org/course/mathphil The course is not heavy-handed and can be taken ev

Re: [racket-users] reading UTF-16 from a file

2015-11-13 Thread Pierpaolo Bernardi
On Fri, Nov 13, 2015 at 9:45 AM, Tim Hanson wrote: > hi, > > I was hoping yesterday to read UTF-16 characters from a file I think you need reencode-input-port. > p.s. maybe there's an easier way to get an arbitrary counter than what i did > here? > > (define (integers-starting-from n) > (stre

Re: [racket-users] Counterintuitive performance results

2016-01-08 Thread Pierpaolo Bernardi
I tried swapping the two expressions. The result is that the one executing first is always slower than the one executing second. So, probably the timing is dominated by some memory/GC/locality effect rather than the difference between set-member? and set-members? On Fri, Jan 8, 2016 at 10:29 PM,

Re: [racket-users] (help ...) form in command-line REPL vs. Dr. Racket

2016-01-26 Thread Pierpaolo Bernardi
On Wed, Jan 27, 2016 at 12:35 AM, Brian Adkins wrote: > Just out of curiosity, does this work for anyone else? In other words, in the > Dr. Racket repl: > > (require racket/help) > (help filter) > > does that scroll down to the filter description in section 4.9, or is your > URL missing the anc

Re: [racket-users] (help ...) form in command-line REPL vs. Dr. Racket

2016-01-26 Thread Pierpaolo Bernardi
On Wed, Jan 27, 2016 at 12:46 AM, Brian Adkins wrote: > Ok, this is odd, it works with both Chrome and Safari *if* they're not > already open when (help filter) is evaluated. If they are already open, the > URL is missing the anchor. In my case, the default browser is Chrome, and it was alread

Re: [racket-users] a little bug

2016-02-05 Thread Pierpaolo Bernardi
On my system it behaves almost exactly as described by Jon (6.3, windows). The one difference is that DrRacket hasn't crashed yet, but the Task manager reports one processor at 100% and memory use slowly growing. Currently is at 7.5 GB. On Fri, Feb 5, 2016 at 2:29 PM, Anthony Carrico wrote:

[racket] Keyboard input in DrRacket

2011-03-18 Thread Pierpaolo Bernardi
Hello, in italian keyboards the character ~ is missing, and, on windows, the usual way of entering it (Alt-126) does not work in DrRacket. Could \tilde be added to the list of keyboard macros recognized by M-\ ? Alternatively, is there a way to enter ~ in DrRacket that I have missed? (other than

Re: [racket] Keyboard input in DrRacket

2011-03-18 Thread Pierpaolo Bernardi
On Fri, Mar 18, 2011 at 13:11, Robby Findler wrote: > On Fri, Mar 18, 2011 at 6:46 AM, Pierpaolo Bernardi > wrote: >> Could \tilde be added to the list of keyboard macros recognized by M-\ ? > > It is called \sim. Oops. Thanks. __

Re: [racket] Keyboard input in DrRacket

2011-03-18 Thread Pierpaolo Bernardi
On Fri, Mar 18, 2011 at 13:27, Casey Klein wrote: > On Fri, Mar 18, 2011 at 7:11 AM, Robby Findler > wrote: >> On Fri, Mar 18, 2011 at 6:46 AM, Pierpaolo Bernardi >> wrote: >>> Could \tilde be added to the list of keyboard macros recognized by M-\ ? >> >>

Re: [racket] Keyboard input in DrRacket

2011-03-18 Thread Pierpaolo Bernardi
On Fri, Mar 18, 2011 at 13:37, Robby Findler wrote: > How about this? Make a file somewhere, put the code below in it and > then use edit|keybindings|add user-defined keybindings... and point to > the file. > > You will probably have to change the "c:c;c:t" to something that isn't > used on your k

Re: [racket] struct-copy with sub-types

2011-03-25 Thread Pierpaolo Bernardi
On Wed, Mar 23, 2011 at 00:49, Nadeem Abdul Hamid wrote: > Is there anything like struct-copy that works to functionally update a > field value in a structure, where the field happens to be defined in > the super-type? In the example below, I want to "functionally update" > a field of the sub stru

Re: [racket] struct-copy with sub-types

2011-03-25 Thread Pierpaolo Bernardi
On Fri, Mar 25, 2011 at 16:17, Nadeem Abdul Hamid wrote: > Ok, yes, on second thought, I guess it is fine. With your fix, > > (struct-copy sub (sub 1 2 3) [c 4])   ==> (sub 1 2 4) > (struct-copy sub (sub 1 2 3) [b 4])   ==> (sub 1 4 3) > (struct-copy base (sub 1 2 3) [b 4]) ===> (base 1 4) > > is

Re: [racket] struct-copy with sub-types

2011-03-25 Thread Pierpaolo Bernardi
On Fri, Mar 25, 2011 at 16:32, Robby Findler wrote: >> Isn't the second case the case Robby said it still doesn't work? > > Oh, sorry, yes: you'd have to write this: > >  (struct-copy sub (sub 1 2 3) [b #:parent base 4]) > > or else it would be a syntax error. OK. The examples clarified this. __

Re: [racket] Newbie question: Teach Yourself Scheme in Fixnum Days - macros

2011-03-30 Thread Pierpaolo Bernardi
On Wed, Mar 30, 2011 at 11:31, John Sampson wrote: > What is the best source for learning about macros in Racket, assuming no > previous > knowledge of macros? Have you already tried the Getting Started docs in the Help Desk? _ For list-related a

Re: [racket] Newbie question: Teach Yourself Scheme in Fixnum Days - macros

2011-03-30 Thread Pierpaolo Bernardi
On Wed, Mar 30, 2011 at 12:29, John Sampson wrote: > Do you think these give a better explanation of macros? On the whole, I have > found Teach Yourself Scheme > relatively easy to follow. I read TYSIFD many years ago and I don't remember exactly what it says about macros. >From your first post

Re: [racket] Newbie question: Teach Yourself Scheme in Fixnum Days - macros

2011-03-30 Thread Pierpaolo Bernardi
On Wed, Mar 30, 2011 at 11:31, John Sampson wrote: > Hello - > > I am going through TYSIFD which is said to be compatible with mzScheme. > > Descriptions of macros seem to be different depending which book one reads. > TYSIFD advises the reader to 'require' the defmacro library > - '(require (li

[racket] Out of memory

2011-04-04 Thread Pierpaolo Bernardi
Hello, in this racket: Welcome to DrRacket, version 5.1.0.4--2011-03-26(fe75ed9/a) [3m]. Language: racket [custom]; memory limit: 128 MB. (windows XP) this program: #lang racket (define (test n exp) (let ((v (make-vector n))) (for ((i (in-range n))) (vector-set! v i (expt (random)

Re: [racket] Out of memory

2011-04-04 Thread Pierpaolo Bernardi
On Mon, Apr 4, 2011 at 16:19, Jos Koot wrote: > I think you have to increase the memory limit. With limit 128 Mb Racketb > consequently runs out of memory on my system. > The program runs well with limit 256 Mb. Yes, I know this. But this function should not consume memory in the loop. I forgot

Re: [racket] Out of memory

2011-04-04 Thread Pierpaolo Bernardi
On Mon, Apr 4, 2011 at 16:04, Pierpaolo Bernardi wrote: > The function looks fine to me. So, what is the problem? I mean, fine as it shouldn't run out of memory. I am aware that the function is not testing what I wanted to test, but that's not the point

Re: [racket] How to use structure inside define-syntax ?

2011-04-21 Thread Pierpaolo Bernardi
On Thu, Apr 21, 2011 at 15:36, Jos Koot wrote: > That is identical to my (corrected) answer :) > You just were 3 minutes quicker than I was. Arrived to me both dated 15:26 ;^) _ For list-related administrative tasks: http://lists.racket-lang.o

Re: [racket] empty hash tables

2011-05-30 Thread Pierpaolo Bernardi
BTW, since the topic of empty tables has been brought up: I am often (mildly) annoyed by the fact that make-hash takes 0 or 1 argument, while make-immutable-hash takes only 1 argument, forcing me to write (make-immutable-hash '()).. Is there a reason for this lack of simmetry? P.

Re: [racket] empty hash tables

2011-05-30 Thread Pierpaolo Bernardi
On Mon, May 30, 2011 at 10:30, Marijn wrote: > Hi Pierpaolo, > > On 05/30/11 10:24, Pierpaolo Bernardi wrote: >> BTW, since the topic of empty tables has been brought up: I am often >> (mildly) annoyed by the fact that make-hash takes 0 or 1 argument, >> while make-

Re: [racket] in praise of if's mandatory else clause

2011-05-31 Thread Pierpaolo Bernardi
On Tue, May 31, 2011 at 07:07, Richard Cleis wrote: > Buggy loops can also be avoided by reducing the problem.  These leap-year > cases are less troubling if the function that really matters is used: the > days in a given year. > > (define (days-in-year year) (if (= 0 (remainder year 4)) 366 365

Re: [racket] in praise of if's mandatory else clause

2011-05-31 Thread Pierpaolo Bernardi
On Tue, May 31, 2011 at 15:40, Matthias Felleisen wrote: > > Hey, here is what I had written: see purpose statement: > > ;; N -> Boolean > ;; simplistic definition > (define (leap-year? y) >  (= (remainder y 4) 0)) Ach. I missed the comment. 8^) P.

Re: [racket] Bloom filter?

2011-06-06 Thread Pierpaolo Bernardi
On Mon, Jun 6, 2011 at 17:45, Robby Findler wrote: > On Mon, Jun 6, 2011 at 8:24 AM, Erich Rast wrote: >> I had something similar in mind but was wondering about the >> space-efficiency of a vector of booleans. Does the compiler represent >> this as a memory area where each boolean corresponds to

Re: [racket] macro expansion function in Scheme

2011-07-12 Thread Pierpaolo Bernardi
On Tue, Jul 12, 2011 at 13:49, Bas Steunebrink wrote: > Ciao a tutti, > > I'm looking for a Scheme function that can perform macro expansion on a > quoted expression. I bet someone has implemented such a thing before, but I > can't find it. Maybe someone can point me in the right direction? http:

Re: [racket] A question about code-style (and memory usage)

2011-08-04 Thread Pierpaolo Bernardi
On Thu, Aug 4, 2011 at 10:19, Stephan Houben wrote: > And then there are combining characters vs. precomposed characters. This one can be avoided by specifying that source gets normalized on read. _ For list-related administrative tasks: http:/

Re: [racket-users] Regexp question matching a whole string

2018-04-22 Thread Pierpaolo Bernardi
On Sun, Apr 22, 2018 at 10:40 PM, Zelphir Kaltstahl wrote: > Ah OK, I understand that additional newline. Since the code matching the > regex is run before that newline gets in, the newline will be on the > input port. > > In DrRacket I observe the following: > > (I remembered that there are negat

Re: [racket-users] My gmail auto receives new top-level entries from [Racket Users] but not reply entries...

2019-01-15 Thread Pierpaolo Bernardi
On Wed, Jan 16, 2019 at 12:04 AM infodeveloperdon wrote: > > Hi, > It has been awhile since I've been posting questions to [Racket Users]. > Previously, my gmail account would receive both my query entry and every > reply entry. (Of course, it actually received all entries and replies entered >

Re: [racket-users] Problem with # and mutable lists

2016-04-10 Thread Pierpaolo Bernardi
On Sun, Apr 10, 2016 at 1:29 PM, Joan Martin wrote: > Hello, > I try to write a programme (a game), where I use lots of mutable lists (named > environment).Something like this: > (define environment > (mcons (mcons (mcons 1 (mcons (mcons 2(mcons 5(mcons 8 '('() )) > (mcons

Re: [racket-users] Case vs. Match

2016-06-03 Thread Pierpaolo Bernardi
On Sat, Jun 4, 2016 at 1:23 AM, Gustavo Massaccesi wrote: > > [...] I saw in the docs that case specifically mentions it can > distribute in log(n) time [...] > but both expand to a bunch of nested if, nothing fancy that may run in > O(log(N)). > (I don't expect that it has a smarter implementat

Re: [racket-users] Can't display accented characters at the Windows console

2016-09-02 Thread Pierpaolo Bernardi
Hello, > I'm new to Racket and would like to know what is the trick to make accented > characters display correctly at the Windows command prompt. For example, > when I write at the Racket prompt: >> "número" > then it returns: > "n´┐¢mero" Here you can read an old discussion about this topic: h

Re: [racket-users] TR issue with the type of expt

2016-09-27 Thread Pierpaolo Bernardi
On Tue, Sep 27, 2016 at 3:23 PM, Tim Brown wrote: > I believe (because I can’t think of a counterexample) that > (expt Real Real) is never Complex; and therefore expt can be of type > (Real Real -> Real). What about (expt -1 1/2) ? -- You received this message because you are subscribed to the

Re: [racket-users] How to 'apply' a function with optional parameters?

2016-10-29 Thread Pierpaolo Bernardi
On Sat, Oct 29, 2016 at 5:31 PM, wrote: > At the certain point of the program I get > a list as parameter 'lst', which contains > the sublists of strings. I wrote this > function: > > > (define (to-txt lst) > (if (empty? lst) > lst > (let ((line (car lst))) > (begin > (di

Re: [racket-users] eval:check and floating-point precision

2016-11-26 Thread Pierpaolo Bernardi
On Sat, Nov 26, 2016 at 11:37 AM, luis.osa.gdc wrote: > Hi, everyone! > ``` > (check-= (t-test bacteria-a bacteria-b) 13.0 0.1) > ``` > > In short: is there a way to specify tolerance in `eval:check`? Perhaps, instead of checking directly the result of t-test you can check (good-enough (t-test .

Re: [racket-users] chaining operations on bignum not scalable

2017-07-29 Thread Pierpaolo Bernardi
Il giorno 29 luglio 2017, alle ore 20:48, rom cgb ha scritto: >Hi, >Probably due to all operations not being in-place, chaining operations on >bignums is very costful. >for example, using bitwise-bit-field[1] on bignums is atrocious. >I also tried >  (define (reverse-bits n) >    (for/fold ([

Re: [racket] hello..

2013-11-29 Thread Pierpaolo Bernardi
ESC-x and ALT-x usually are synonims. With ALT-x you can keep ALT pressed and repeat only the x. The ESC variant is useful on classical keyboards which do not have an ALT key or equivalent. On Fri, Nov 29, 2013 at 7:30 PM, Michael Jensen wrote: > I have a question/suggestion. if this is goi

Re: [racket] hello..

2013-11-29 Thread Pierpaolo Bernardi
On Fri, Nov 29, 2013 at 9:25 PM, Robby Findler wrote: > To find other keys that do the same thing (there aren't any others, I don't > believe, that work in on all platforms with the default settings), you can > use the menu item "Show Active Keybindings" in the "Edit" menu. Search for > "put-prev

Re: [racket] ~r behavior with respect to the sign

2013-12-24 Thread Pierpaolo Bernardi
On Tue, Dec 24, 2013 at 4:30 PM, Dmitry Pavlov wrote: > Hello, > > It seems that ~r formatting function, when given a negative > number and a #:min-width argument, does not treat the "-" > character as part of the number bound by #:min-width, > and moreover, it detaches the "-" from the number: U

Re: [racket] Problem around Creating Excutables

2014-01-01 Thread Pierpaolo Bernardi
On Thu, Jan 2, 2014 at 1:05 AM, 亀田馬志 wrote: > Does anybody know how to tell Racket's compiler "I wanna see this in UTF-8"? Are you sure that your DOS windows is using UTF-8? AFAIK if you do nothing racket sends UTF-8 to the console. Maybe your console is not using UTF-8. If this is the case yo

Re: [racket] Problem around Creating Excutables

2014-01-02 Thread Pierpaolo Bernardi
On Thu, Jan 2, 2014 at 4:09 PM, 亀田馬志 wrote: > Is this O.K? or do I have to put (flush-output) every time after (display)? without flush-output what you write in the stream remains in a buffer and is actually written out only when the buffer is full. You must use flush-output when you want to be

Re: [racket] Generating comparable symbols

2014-01-15 Thread Pierpaolo Bernardi
On Wed, Jan 15, 2014 at 8:43 AM, Eric Dobson wrote: > I'm not sure what you mean by random, but does gensym do what you want? I think Marco means interned. Gensym produces uninterned symbols. AFAIK, and checking briefly the manual, there doesn't seem to exists a single function to do this. But i

Re: [racket] FYI: A new Racket-powered startup

2014-02-05 Thread Pierpaolo Bernardi
On Wed, Feb 5, 2014 at 12:38 AM, Gustavo Massaccesi wrote: > Why are you using Racket, and why it's "better" than C? Can you make an example of something that's worse than C? Racket Users list: http://lists.racket-lang.org/users

Re: [racket] Use of map and eval to evaluate symbol in namespace

2014-07-26 Thread Pierpaolo Bernardi
On Sun, Jul 27, 2014 at 5:10 AM, Henry Lenzi wrote: > #lang racket > > #| > > Dear Racketeers - > > I would like to create a little function > that would write a line of a medical recipe. > > I would pass to "read" a shorthand form, > and the program would expand the text. Like so: > > When I answ

Re: [racket] Use of map and eval to evaluate symbol in namespace

2014-08-11 Thread Pierpaolo Bernardi
On Mon, Aug 11, 2014 at 8:07 AM, Matthew Flatt wrote: > +1 > > In the grand scheme of things, using `eval` to solve a problem (because > you want to get something done now) is nowhere near as bad as, say, but, to come back to the original question, in order to not confuse further the OP: in this

[racket] flood-fill?

2014-10-05 Thread Pierpaolo Bernardi
Hello, here's a couple of dumb questions: I did not find a flood-fill method for bitmaps. Am I right it's not there, or I missed it? I tried implementing one myself, but the result is way too slow to be useful. Any recommendation? Cheers P. Racket Users list: http://lis

Re: [racket] flood-fill?

2014-10-05 Thread Pierpaolo Bernardi
On Sun, Oct 5, 2014 at 10:30 PM, Jens Axel Søgaard wrote: > Maybe this can be used? > > https://github.com/acmeism/RosettaCodeData/blob/master/Task/Bitmap-Flood-fill/Racket/bitmap-flood-fill.rkt Yes! Much better than mine. Thank you. However, it uses a straight deep-first recursion with no auxi

Re: [racket] flood-fill?

2014-10-11 Thread Pierpaolo Bernardi
ps://github.com/acmeism/RosettaCodeData/blob/master/Task/Bitmap-Flood-fill/Racket/bitmap-flood-fill.rkt > > /Jens Axel > > > 2014-10-05 22:14 GMT+02:00 Pierpaolo Bernardi : >> Hello, >> >> here's a couple of dumb questions: I did not find a flood-fill method >

Re: [racket] flood-fill?

2014-10-13 Thread Pierpaolo Bernardi
sing the code for (still lot of work to do): https://farm6.staticflickr.com/5599/15337830979_c4bccae56a_o.png https://farm4.staticflickr.com/3940/15337812549_5ec924e207_o.png P. > At Sat, 11 Oct 2014 20:59:09 +0200, > Pierpaolo Bernardi wrote: >> >> For the record, in case some

Re: [racket] find-system-path under debugger

2014-11-30 Thread Pierpaolo Bernardi
I think you need define-runtime-path instead. Here's an example of its use: ;; Access a file "data.txt" at run-time that is originally ;; located in the same directory as the module source file: (define-runtime-path sofa.dll (format "sofa-~a-~a~a" sofa-version arch "")) P. ===

Re: [racket] why a segfault on the command line, but not in DrRacket?

2014-12-30 Thread Pierpaolo Bernardi
Just for excluding any possibility of user error: do you use any unsafe features? On Tue, Dec 30, 2014 at 8:43 PM, Matthew Butterick wrote: > No, it's all Racket libraries. > > OTOH I may be the one causing the memory-management problems. The issues are > arising in my typesetting program, which

Re: [racket] Racketrivia: Using ' as an identifier suffix

2015-01-08 Thread Pierpaolo Bernardi
On Thu, Jan 8, 2015 at 10:49 PM, Neil Van Dyke wrote: > I generally recommend against using non-ASCII characters in Racket source > code. > > Besides the human readability question (and the searchability question), > non-ASCII still presents a significant risk of your characters getting > corrupte

Re: [racket] Calculating cumulative sum of the list

2015-01-22 Thread Pierpaolo Bernardi
Here's a straightforward way: (define (cumulative-sum list) (let loop ([list list] [acc 0]) (if (null? list) list (let ([s (+ (first list) acc)]) (cons s (loop (rest list) s)) On Thu, Jan 22, 2015 at 2:53 PM, Alexandr M wrote: > Hello, > > I am trying to replicate

  1   2   >