[racket-users] 2htdp/universe performance

2015-08-25 Thread Stephen Bloch
splay handlers that modify the model, or mouse handlers that draw to the display, causing the aforementioned display bugs. Stephen Bloch sbloch1...@gmail.com -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from thi

Re: [racket] Everything type-checks; on to benchmarking and optimization

2014-02-28 Thread Stephen Bloch
tion you were profiling) down from 22s to 15s. Replacing > the `index+'s with generic `+' and `assert's (to enforce `Index' > results) brings the running time down to 2.5s. Generic ‘+’, not ‘unsafe-fx+’? Should I be using racket/unsafe/ops at all? Stephen Bloch sbl...@adelphi

Re: [racket] Everything type-checks; on to benchmarking and optimization

2014-02-28 Thread Stephen Bloch
nas7aldecx7/NxsLBA5573 . Stephen Bloch sbl...@adelphi.edu signature.asc Description: Message signed with OpenPGP using GPGMail Racket Users list: http://lists.racket-lang.org/users

Re: [racket] Everything type-checks; on to benchmarking and optimization

2014-02-17 Thread Stephen Bloch
m… but even size 2048 has been taking hours or days to run. Stephen Bloch sbl...@adelphi.edu signature.asc Description: Message signed with OpenPGP using GPGMail Racket Users list: http://lists.racket-lang.org/users

Re: [racket] Everything type-checks; on to benchmarking and optimization

2014-02-17 Thread Stephen Bloch
unction that builds a random square matrix of a given size, to be handed to all three multiplication algorithms). > As Matthias said, if you can share your code, I'd be happy to have a > look. Sure. That may take a few hours: I have to run off to class now. Stephen Bloch sbl...@adelphi.e

[racket] question on pluggable modules

2013-11-03 Thread Stephen Bloch
of a graph-coloring problem, and I want to have students plug in their own algorithms for graph-coloring. C is the adjacency relation, the list of available colors, a couple of things like that. My students have never heard of parameterize, but that's the least of my worries right now.

Re: [racket] slides unit testing

2013-06-13 Thread Stephen Bloch
not what you're remembering, but you could take a look at http://home.adelphi.edu/sbloch/papers/func-imp-testing.pdf which is one of my slides from a conference talk. Stephen Bloch sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

Re: [racket] Beginner problem

2013-06-09 Thread Stephen Bloch
n to Systematic Program Design" is a subset of the picturing-programs library used in _Picturing Programs_, so if you follow the directions in chapter 0.3 of the book, all the examples in both the book and the MOOC should work. Dr. Stephen Bloch Math/CS Dept, Adelphi University sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

Re: [racket] Beginner problem

2013-06-09 Thread Stephen Bloch
n to Systematic Program Design" is a subset of the picturing-programs library used in _Picturing Programs_, so if you follow the directions in chapter 0.3 of the book, all the examples in both the book and the MOOC should work. Dr. Stephen Bloch Math/CS Dept, Adelphi University sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

Re: [racket] Some guidance and help for Section 4.5.1

2013-04-28 Thread Stephen Bloch
a list of numbers '(8 7 2) ; (my-function (rest numbers)) whatever type this returns 278 ; right answernumber 2783 … ])) Stephen Bloch sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

Re: [racket] Programmatically start a big-bang?

2013-04-21 Thread Stephen Bloch
nd I could understand it without worrying about macros :-) Stephen Bloch sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

Re: [racket] Rounding

2013-03-17 Thread Stephen Bloch
is on Scheme or Racket, see http://docs.oracle.com/javase/1.5.0/docs/api/java/math/RoundingMode.html and http://en.wikipedia.org/wiki/IEEE_floating_point#Rounding_rules Stephen Bloch sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

Re: [racket] naming structs that are members of other structs

2013-02-13 Thread Stephen Bloch
On Feb 13, 2013, at 12:47 PM, Dmitry Pavlov wrote: > Hello, > > I just figured that there is a thing in Racket coding style > that bothers me from time to time. That thing have never arised > in C-style languages. Right: in C-style languages there's a special "dot" syntax for getting at the f

Re: [racket] Checking whether running from DrRacket.

2013-02-13 Thread Stephen Bloch
this, then find the binary in the "bin" folder and run it, and it does nothing. Stephen Bloch sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

Re: [racket] Student having trouble running DrRacket -- suggestions?

2013-01-29 Thread Stephen Bloch
32-bit binary, and it worked. What puzzles me is why I didn't notice a problem until today. Stephen Bloch sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

Re: [racket] what's wrong with my code?

2013-01-20 Thread Stephen Bloch
function, writing test cases for it as usual, and only after it worked, consider moving it inside "f". Unless it depended on something in the containing function, which it doesn't… no, wait, it refers to n, the parameter of the outer function. Why? And why doesn't the de

Re: [racket] Visitor Pattern and Racket

2013-01-20 Thread Stephen Bloch
s skewer%, so the only legal way to build a shish-kebab is with a skewer at the end. Stephen Bloch sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

Re: [racket] novice question about expressions

2013-01-12 Thread Stephen Bloch
ld be rewritten as n*n) step 2: ((n*2) + 300), or if you meant n-squared, ((n*n) + 300) step 3: (+ (* n 2) 300), or if you meant n-squared, (+ (* n n) 300) How would you do this for the entire expression? Stephen Bloch sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

Re: [racket] Dynamically Bind Functions

2012-12-22 Thread Stephen Bloch
akes it easy to unit-test the latter function on arbitrary data. Since the former function is only about the file system, meaningful unit-testing for it it would have to be about how it handles files that exist, files that don't, unreadable files, files in unreadable directorie

Re: [racket] Dynamically Bind Functions

2012-12-22 Thread Stephen Bloch
ambda (n) (+ n 2 (add1 (add1 m)))) (add2 3) ; produces 7 or, if you prefer to do the "let"ting at define-time, (define add2 (let ((add1 (lambda (n) (+ n 2 (lambda (m) (add1 (add1 m) (add2 3) ; produces 7 Stephen Bloch sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

Re: [racket] DrRacket Crashes?

2012-12-18 Thread Stephen Bloch
I'm also not seeing these crashes in 5.3.1 in Windows in VMWare on my Mac. Stephen Bloch sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

Re: [racket] DrRacket Crashes?

2012-12-18 Thread Stephen Bloch
the 'stop' button--'user break' appears, and the animation > keeps going > 5. Press CTRL+R I'm not seeing either of these on my Mac. I'll see if Windows-on-a-Mac is willing to run today Stephen Bloch sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

Re: [racket] off-by-1 pixel error in 2htdp/image

2012-12-17 Thread Stephen Bloch
line where they meet -- which, while annoying, would at least be easier for beginners to understand. And it would mean that (rectangle 1 15 "outline" "black") draws as 1 pixel wide. Stephen Bloch sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

Re: [racket] lex-error report while reading HTML using module XML

2012-12-13 Thread Stephen Bloch
pt Web pages with certain common tags unterminated: , , , , etc. and there's a reasonable argument that Racket's XML library should be capable of accepting them too. Stephen Bloch sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

Re: [racket] novice question about parentheses and control flow

2012-12-12 Thread Stephen Bloch
but EXTRA parentheses can never hurt. In Lisp/Scheme/Racket, either one can hurt. Stephen Bloch sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

Re: [racket] cond else and

2012-12-12 Thread Stephen Bloch
in HtDP chapter 6 ten years ago, in part because of this uncomfortable confusion between imperative and functional programming. Most of us have been using the functional "image" library instead. For course materials built on this approach, see http://www.ccs.neu.edu/home/mat

Re: [racket] Math library ready for testing

2012-12-11 Thread Stephen Bloch
On Dec 11, 2012, at 9:03 AM, Jens Axel Søgaard wrote: > 2012/12/11 Stephen Bloch : > >> Would it perhaps make more sense for small-primes to contain primes >> themselves, in increasing order so one can be found by binary search, rather >> than booleans? The O(1) behavio

Re: [racket] Math library ready for testing

2012-12-11 Thread Stephen Bloch
(limit)), but perhaps you would save enough memory to put the limit higher. Stephen Bloch sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

Re: [racket] Decimal rounding problem

2012-11-29 Thread Stephen Bloch
up behavior in Java? I tried the negations of the same numbers, and they still all end in ".22", as though it were in round-towards-zero mode, but I queried the rounding mode and it says it's HALF_EVEN. The corresponding results in Racket, BTW, are ("0.23" "1.23" "2.23" "3.23" "4.22" "9.22" "17.23" "35.23" "68.22" "130.22" "250.22") Stephen Bloch sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

Re: [racket] Decimal rounding problem

2012-11-29 Thread Stephen Bloch
oblem for my computer-architecture students. Stephen Bloch sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

Re: [racket] Decimal rounding problem

2012-11-29 Thread Stephen Bloch
if you're getting the inexact 4.225 from somewhere else, again it's not really 4225/1000 so it's already too late to round it the way you want. You could work in a student language, where the reader reads decimals as exact by default :-) Seriously, I&#

Re: [racket] Doing collision detection in universe.ss

2012-11-28 Thread Stephen Bloch
wn game, and many Python-first curricula introduce nested for-loops early in order to process images pixel by pixel.) Stephen Bloch sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

Re: [racket] Doing collision detection in universe.ss (related question)

2012-11-28 Thread Stephen Bloch
; the two 65x65 images. This could be acceptable for a game with one or two > collision detections per frame. > > You could improve this *hugely* just by doing some bounding-box computation. > > Should I put this code in 2htdp/private/image-more.rkt somewhere? Sounds useful

Re: [racket] Doing collision detection in universe.ss

2012-11-27 Thread Stephen Bloch
> of doing the kinds of things that Scratch makes easy. And vice versa, of course: there are lots of things that are easy in universe, but very difficult in Scratch. Stephen Bloch sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

Re: [racket] DrRacket for the Truly Impatient V02, need help, beta testers

2012-11-21 Thread Stephen Bloch
f. It is the bare minimum to really start using it. Quite true, and I don't even use the "bare minimum" you describe. Not to say that most of the things you describe don't strike me as incredibly useful Stephen Bloch sbl...@adelphi.edu Racket U

Re: [racket] DrRacket for the Truly Impatient V02, need help, beta testers

2012-11-21 Thread Stephen Bloch
ink of it as a powerful, feature-rich editor; I think of it as an uncluttered, beginner-friendly editor. Being both of those things at once is amazingly difficult Stephen Bloch sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

Re: [racket] Function composition in Racket

2012-10-15 Thread Stephen Bloch
;to a human being" or "to the time form"). To distinguish between linear and n*log(n), I would think millions or tens of millions. But the Horner's algorithm solution is also shorter code than either of the others :-) Stephen Bloch sbl...@adelphi.edu

Re: [racket] Function composition in Racket

2012-10-15 Thread Stephen Bloch
nted by repeated squaring, the total number of multiplications would be O(n log(n)); with Horner's algorithm or your "values" approach, it's linear. Horner's algorithm gives us (lambda (poly x) (for/fold ([sum 0]) ([c (polynomial-coeffs poly)]) (+ c (* sum x

Re: [racket] cube-all

2012-10-04 Thread Stephen Bloch
ich of the other expressions resembles it most closely? (Usually the result of a recursive call.) What would you need to do to that similar value to get _exactly_ the right answer? Once you've got an expression that works for this example, try it on other examples. Stephen Bloch sbl

Re: [racket] details on hackathon after racketcon?

2012-10-04 Thread Stephen Bloch
iously, I'd love to teach with some kind of signature system in the language (not just in comments), but right now we have three or four alternative systems (contracts, signatures, TR, and probably others), none of which has really had the pedagogical bugs worked out. Stephen Blo

[racket] slow response in DrR 5.2.1

2012-10-04 Thread Stephen Bloch
a response. I'm not actually teaching a Racket-based class in those labs this semester, so I haven't taken the time to track this down to specific examples, nor tried installing 5.3 to see if the problem goes away. But is there a known performance or installation problem that would c

Re: [racket] How fast is zero? was: Find nth term of a List

2012-09-27 Thread Stephen Bloch
ressable machine, and if you tried to dereference an odd-numbered address, it would crash immediately, as one would expect of dereferencing a null pointer). And on MANY systems (including Racket), the floating-point number 0.0 doesn't necessarily resemble the integer 0. Step

[racket] an interesting article on IDE's for education

2012-09-27 Thread Stephen Bloch
. Stephen Bloch sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

Re: [racket] Find nth term of a List

2012-09-25 Thread Stephen Bloch
ms.com/download/chap25.pdf , which is entitled "Multiple recursive data". Of course, that chapter assumes that you're already fluent at writing functions that operate on ONE recursive data type, e.g. http://picturingprograms.com/download/chap22.pdf and http://picturingprogram

Re: [racket] assembly language

2012-09-25 Thread Stephen Bloch
that are interpreted as procedure calls by the Forth interpreter (which is in native executable code, but written in advance). Or are you talking about some kind of JIT compiler? Stephen Bloch sbl...@adelphi.edu who last implemented a Forth system in 1983; I presum

Re: [racket] color does not match like other structs

2012-08-29 Thread Stephen Bloch
ion: why did matching on "make-posn" work? Shouldn't posn be exposed in the same way as color? Or is this something to do with make-color, which does error-checking and has an optional argument with a default value and all sorts of complicated stuff that make-posn doesn&#x

Re: [racket] Fun with flomap: old folksy CRT televisions!

2012-08-28 Thread Stephen Bloch
quot;. For more related examples, see "map-image" and "map-image/extra". Stephen Bloch sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

Re: [racket] Fun with flomap: old folksy CRT televisions!

2012-08-28 Thread Stephen Bloch
quot;. For more related examples, see "map-image" and "map-image/extra". Stephen Bloch sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

[racket] wikipedia on IDE's

2012-08-24 Thread Stephen Bloch
mebody directly involved with DrRacket's development. Stephen Bloch sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

Re: [racket] This is too clumsy. Is there a better way?

2012-07-13 Thread Stephen Bloch
the code is very nearly a rewording of the purpose statement. As a bonus, it's also more efficient, since "ormap" does short-circuit evaluation: as soon as it finds an upper-case letter, it stops without looking at the rest of the string. Another, weirder and less efficient but ev

Re: [racket] arrangements exercise

2012-07-12 Thread Stephen Bloch
given symbol at the front of each of the given words. Maybe a better name would be "cons-each". Stephen Bloch sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

Re: [racket] why is the comparimng always false

2012-06-29 Thread Stephen Bloch
e he gets the names right. Interesting idea. It doesn't ensure that he gets the contracts right -- he still needs to actually TRY the functions for that -- but it will give him an error message if he gets the names wrong, which is helpful. Stephen Bloch Racket Users list: http://lists.racket-lang.org/users

Re: [racket] why is the comparimng always false

2012-06-29 Thread Stephen Bloch
On Jun 29, 2012, at 10:34 PM, Matthias Felleisen wrote: > > On Jun 29, 2012, at 5:30 PM, Stephen Bloch wrote: > >> This is a fairly common confusion for my students > > > This is the first time I am encountering this confusion. Really? You've never had a

Re: [racket] why is the comparimng always false

2012-06-29 Thread Stephen Bloch
> ; interp. (make-editor x h) where x is the x-coordinate of the cat and h is > the happiness of the cat. > ; make-editor Number Number -> Vcat > ; Vcat-Xcat Editor -> Number > ; Vcat-Hcat Editor -> Number > ; Vcat-Richting -> String > ; Vc

Re: [racket] why is the comparimng always false

2012-06-29 Thread Stephen Bloch
ggested in the past providing a "define-union" form in the student languages. It wouldn't do very much -- just define a discriminator for the new type as the "or" of the discriminators for the subtypes -- but it would provide students with a concrete syn

Re: [racket] HtDP for programmers?

2012-06-26 Thread Stephen Bloch
e not ready for test-driven design yet." I replied "No, you've got it backwards: the students in your software engineering course MIGHT be sharp enough and experienced enough to sometimes do without test-driven design; the freshmen are the ones who nee

Re: [racket] Racket Social/Support Groups

2012-06-14 Thread Stephen Bloch
You know, whenever the government tries to help people kick the habit, they call it a "syntax".... Stephen Bloch sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

Re: [racket] Questions about the Canvas

2012-06-13 Thread Stephen Bloch
anvas dc) (draw canvas dc))". > However, in the second case the window doesn't update unless draw is called > from REPL. Yes, that's because you're only calling draw once, at the time you define canvas. Stephen Bloch sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

Re: [racket] Congratulations

2012-06-13 Thread Stephen Bloch
awards for PLT people in one day! Mazeltov! Stephen Bloch sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

Re: [racket] recursion?? two

2012-06-06 Thread Stephen Bloch
notice that we're not actually USING n anywhere, so we might as well leave it out: (define (my-map f lst) (cond [(empty? lst) empty] [else (cons (f (first lst)) (my-map f (rest lst)))])) Stephen Bloch sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

Re: [racket] recursion??

2012-06-05 Thread Stephen Bloch
it, then assign my assistant to clean this room as well as all the rooms I was assigned. My assistant does the same, and rather than having fewer and fewer rooms left to clean, we have more and more. In other words, the function calls itself to solve A LARGER PROBLEM than it itself was given. Stephen Bloch sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

Re: [racket] Finite State Machines of Arbitrary Size using Racket's composable control

2012-05-24 Thread Stephen Bloch
ast semester's didn't get to lists at all), so I don't know how those problems actually work in the classroom. Anybody out there who's tried them? Stephen Bloch sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

Re: [racket] question about naming convention

2012-05-19 Thread Stephen Bloch
ons: you'll write at least a hundred of them in the remainder of the semester." If you have suggestions for other image utilities like this, talk to me off-list and we can include them in picturing-programs, which has the advantage of being bundled with DrRacket so there's no separate installation procedure. Stephen Bloch sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

Re: [racket] Mutable state vs RAM on fire

2012-05-03 Thread Stephen Bloch
g extra parameters to fast-expt, making it harder to understand. And, as somebody else pointed out, the recursion depth is only log_2(n) so it's really not a concern. Stephen Bloch sbl...@adelphi.edu > Racket Users list: http://lists.racket-lang.org/users

Re: [racket] Mutable state vs RAM on fire

2012-05-03 Thread Stephen Bloch
otient n 2])) This reduces O(n) many multiplications to O(log(n)) many multiplications, which will dwarf most of the other optimizations people have mentioned. Stephen Bloch sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

[racket] Beginning macro assignments?

2012-04-27 Thread Stephen Bloch
ble difficulty. For that matter, if you have good reasonably-easy exercises for the C preprocessor, that would be helpful too. Stephen Bloch sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

Re: [racket] key event problem

2012-04-18 Thread Stephen Bloch
this event handler until the event handler passes all of its test cases in isolation. My first guess was mismatched parentheses, so I copied and pasted your code into DrRacket, then inserted a bunch of newlines and tabs so I could spot mismatches by indentation. The result was clearer,

Re: [racket] extra exercises

2012-04-16 Thread Stephen Bloch
presumably hasn't gotten to lists yet. But there are lots of interesting problems to solve on fixed-sized data, including lots of interactive GUI programs. Eight or ten years ago, one of my CS1 students got bored with the class assignments and wrote a complete chess program using structs a

Re: [racket] struct change question.

2012-04-14 Thread Stephen Bloch
bang verwerker (check-with editor?) (on-key edit) (on-draw ) ) This causes the animation to check immediately after every event to make sure the "world" is still an editor, and if it isn

Re: [racket] display problem

2012-04-13 Thread Stephen Bloch
an just return the image of the text, and not worry about overlay or place-image. Stephen Bloch sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

Re: [racket] display problem

2012-04-13 Thread Stephen Bloch
se in the function body is "fixed", then the result will also be "fixed", i.e. you'll get the same answer every time -- almost certainly not what you want. However, there may well be SOME things that you want to be the same every time, such as the color "black", the background scene workspace, the font size 11, etc. Stephen Bloch sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

Re: [racket] display problem

2012-04-11 Thread Stephen Bloch
an editor instead. More broadly, you're doing the whole problem the hard way. Why do you need to know the width of anything? I would do this whole problem without an image-width, without arithmetic, without a place-image, using the functions in the 2htdp/image library. St

Re: [racket] display problem

2012-04-05 Thread Stephen Bloch
. How about (as Danny suggested) making an image of the left side text, and taking its width? Stephen Bloch sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

Re: [racket] release date for RacketCon videos?

2012-04-04 Thread Stephen Bloch
of these have earned multiple NSF grants, just as PBD has. Most of these have been presented at national and regional conferences, just as PBD has. Why isn't PBD one of the options people think of when they start a conversation about "how to teach CS1"?

Re: [racket] why here 2 functions

2012-04-03 Thread Stephen Bloch
ing letters." What is the contract of your 1 function? Stephen Bloch sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

Re: [racket] ufo structure problem

2012-04-02 Thread Stephen Bloch
ead. > Following your way of working the answer is (posn-x p) and (posn-y p) because > P is the struct which holds the position. "The answer" to what? It's true that (posn-x p) and (posn-y p) are both reasonable expressions to use; whether they're right answers

Re: [racket] ufo structure problem

2012-04-02 Thread Stephen Bloch
ollow its contract because posn-x is supposed to take a parameter. "p-x" doesn't follow the contract because it's not defined at all. "(posn-y u)" doesn't follow the contract because u is a ufo, and posn-y is supposed to take in a posn. And so on. Stephen Bloch sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

Re: [racket] string problem question

2012-03-19 Thread Stephen Bloch
;s happening. It has nothing to do with subtleties of the world teachpack; it's a simple bug in your code, related to your switching between English and Dutch words. Stephen Bloch sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

Re: [racket] eginner's question on elementary textual replacement...

2012-03-09 Thread Stephen Bloch
symbols: the symbol-table lookup should happen at compile-time (right?), so you're left with a constant-time pointer comparison at run-time. Disclaimer: I've implemented only "toy"-scale Schemes myself. Stephen Bloch sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

Re: [racket] Google Summer of Code 2012 Ideas

2012-03-02 Thread Stephen Bloch
that effectively pushes every few seconds, but only every several pushes become a distinct "commit" record. A less elaborate version wouldn't log much of anything, but would still synchronize with a server every few keystrokes. Stephen Bloch sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

Re: [racket] Antw:Re: Antw:Re: Antw:Re: multiple images problem

2012-02-23 Thread Stephen Bloch
at all. Alternatively, you can use (require picturing-programs) which includes all the same functions as 2htdp/image (such as beside, above, place-image, circle, triangle, rectangle, etc.) as well as some others like map-image and build-image. Stephen Bloch sbl...@adelphi.edu

Re: [racket] Style mistakes (was: static variables question)

2012-02-21 Thread Stephen Bloch
;if the two-function version makes more sense to you, do it that way. If the one-function version makes more sense to you, do it that way." Although for some data structures (e.g. n-ary trees) you NEED multiple functions. Stephen Bloch sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

Re: [racket] exercise problem

2012-02-21 Thread Stephen Bloch
On Feb 21, 2012, at 3:18 PM, Roelof Wobben wrote: > Op 21-2-2012 20:51, Stephen Bloch schreef: >> >> On Feb 21, 2012, at 2:43 PM, Roelof Wobben wrote: >> >>> But now I get this error message : >>> unsaved editor>:27:23: function call: expected a fun

Re: [racket] exercise problem

2012-02-21 Thread Stephen Bloch
f right and wrong answers to track down where the problem is. 3) Have you used the Stepper to watch what your program is doing? Stephen Bloch sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

Re: [racket] style: nested cond (fine!)

2012-02-21 Thread Stephen Bloch
TLY (not always) produced correct answers. Stephen Bloch sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

Re: [racket] style: nested cond (fine!)

2012-02-21 Thread Stephen Bloch
On Feb 21, 2012, at 11:40 AM, Matthias Felleisen wrote: > You are right. We must teach students how to be bad OO programmers in CS2. > Where else would they learn it? Plus they pay us for it. No, but we must teach students to read and modify code written by bad OO programmers. Stephen

Re: [racket] style: nested cond (fine!)

2012-02-21 Thread Stephen Bloch
uses null-terminated data structures instead, despite that approach's practical disadvantages, so students need to learn how to work with them too -- and CS2 seems like an appropriate place to do that. So yes, they WOULD have a conditional for the outer part. Stephen Bloch sbl...@adelphi.edu

Re: [racket] Style mistakes (was: static variables question)

2012-02-21 Thread Stephen Bloch
cture. It's a judgment call, which can go different ways in different circumstances. Stephen Bloch sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

Re: [racket] static variables question

2012-02-18 Thread Stephen Bloch
the more-legitimate world of statements. if (blah == true) { return true; } else { return false; } For those of us forced to teach in Java, CheckStyle has two modules, SimplifyBooleanExpression and SimplifyBooleanReturn, that catch things like this. Stephen Bloch sbl...@ade

Re: [racket] Making a Racket function "recallable"

2012-02-14 Thread Stephen Bloch
; "green" "blue" "violet") returns a function acting like "next-color". One suggestion: I would have mk-fib take in two parameters specifying the initial values of fib, rather than always making them -1 and 1. Stephen Bloch sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

Re: [racket] Making a Racket function "recallable"

2012-02-14 Thread Stephen Bloch
, because the teacher had decreed "no global variables". In retrospect, I should have packaged them up into a record/struct, which would not only make the code cleaner and less error-prone but also make it easy to simulate multiple instances of the OS. Stephen Bloch sbl...@adelphi.e

Re: [racket] Making a Racket function "recallable"

2012-02-14 Thread Stephen Bloch
(if (test? value) (loop (cons value vs)) vs) (define (fib-less-than-n n) (take-while (mk-fib) (lambda (value) (< value n [I haven't typed this code in and tested it, so there may be typos.] Stephen Bloch sbl...@adelphi.edu __

Re: [racket] Compound mutable list manipulation - 2 qs

2012-02-13 Thread Stephen Bloch
ows for easy replacement) and see if I can run some meaningful > comparison tests. Data are good. It would be very interesting to see whether the burden on the garbage collector really IS as heavy as you think. "Premature optimization is the root of all evil" -- somebody somewhere Stephen Bloch sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

Re: [racket] freeze and bounding boxes

2012-01-18 Thread Stephen Bloch
cept on performance. The only way I know of to implement that is for the bitmap to actually store more than width*height pixels. Stephen Bloch sbl...@adelphi.edu Racket Users list: http://lists.racket-lang.org/users

Re: [racket] Whither ProfessorJ

2012-01-17 Thread Stephen Bloch
and how to write methods on them; then Java collection classes and looping over them; etc. I think this was a lot more concrete and fulfilling than building a whole lot of different kinds of classes, through polymorphism, class composition, and recursion, before ever writing a me

Re: [racket] More than one color with draw-text?

2011-12-12 Thread Stephen Bloch
). But in a Roguelike game, you probably want a monospaced font anyway; ligatures and kerning would only confuse matters. Stephen Bloch sbl...@adelphi.edu _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users

Re: [racket] world/universe update model (functional update redux), using the I/O monad for state

2011-12-12 Thread Stephen Bloch
IS program very much, since it only makes one state change in each case of the "cond". But it would help other world/universe programs. I would very much like to see SOME kind of functional-update feature bundled -- whether it comes along with define-str

Re: [racket] More than one color with draw-text?

2011-12-12 Thread Stephen Bloch
On Dec 12, 2011, at 10:53 AM, Will Robinson wrote: > Hello, > > I'm trying to do a simple Roguelike game as an exercise in learning the > language, particularly racket/gui. I'm using draw-text to place characters > on the screen. Ideally, I'd just call this once and put up huge string full

Re: [racket] shortest paths, resource allocation/scheduling

2011-12-05 Thread Stephen Bloch
even need to sort the list; you can just use the relation to make sure you don't double-count anything. Stephen Bloch sbl...@adelphi.edu _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users

Re: [racket] shortest paths, resource allocation/scheduling

2011-12-05 Thread Stephen Bloch
cripting languages would allow you to extract the elements of p at the same time, e.g. Ruby myList.subsetsOfSize(2).each { |x,y| ...} which would take a bit of macro-wrangling in Racket. Stephen Bloch sbl...@adelphi.edu _ For list-related

  1   2   3   >