Re: [racket-users] Stack trace

2019-05-03 Thread Mark Engelberg
oach that > Krishnamurthi et al. have been working on[*] for Pyret, which shows the > evaluation of a term as a single large tree, allowing you to inspect each > call and the arguments that were passed to each call. > > John > > [*] I thought of it independently, but they t

[racket-users] Stack trace

2019-05-02 Thread Mark Engelberg
Working with a student in DrRacket for the first time in a while. I notice that in BSL, an error in a function does not tell you what input to the function caused the error, nor does it show the stack trace by drawing arrows in the definitions window the way I remember. When did this behavior cha

Re: [racket-users] IO in racket is painful

2016-03-22 Thread Mark Engelberg
On Tue, Mar 22, 2016 at 9:20 PM, Stephen Chang wrote: > :) I had started writing up a parsack example, and I was all set to > admonish the OP for not creating a parser when you want a parser but > then I saw it was for a programming contest where I guess this sort of > scanf/regexp hackery is ok?

Re: [racket-users] IO in racket is painful

2016-03-22 Thread Mark Engelberg
Hi, I have coached several teams on using Racket in programming contests. In our local contests, the most common input format is to have one line per dataset, and each dataset is typically several pieces of data separated by spaces. For this common input format, the 2htdp/batch-io teachpack is th

Re: [racket] Bothersome solution to HtDP/2e Rocket Landing Discussion

2014-02-23 Thread Mark Engelberg
Take a look at the function put-pinhole, which will allows you to create a version of the rocket image with the "pinhole" at the bottom center of the rocket. If you do that, I think you'll be able to easily create place-image logic for the rocket example that is more to your liking. On Sun, Feb

Re: [racket] Y combinator

2014-02-06 Thread Mark Engelberg
For me, I didn't fully appreciate the Y combinator until I had had an opportunity to play with and explore other combinators. The book that made this fun for me was "To Mock a Mockingbird", a puzzle book by Raymond Smullyan. Chapters 9 and 10 give you all the building blocks you need to appreciat

[racket] License question

2013-11-04 Thread Mark Engelberg
I must admit that I have no idea how to interpret the legalese associated with different software licenses. Is it okay to port portions of Racket's math library to other languages? Thanks, Mark Racket Users list: http://lists.racket-lang.org/users

Re: [racket] Why experienced programmers don’t use comments?

2013-07-08 Thread Mark Engelberg
Experienced coders tend to find the meaning of code more readily apparent, so they tend to think that their code "speaks for itself" (which may or may not be an accurate perception). On Mon, Jul 8, 2013 at 6:41 PM, Ben Duan wrote: > Dear All, > > I have a question here. There’s an extensive use

Re: [racket] Offtopic: Favorite resources for mastering SML?

2013-07-05 Thread Mark Engelberg
While we're on the topic of exploring from Racket to alternative languages, what's the friendliest way to dip into Prolog coming from a Racket background? Racket Users list: http://lists.racket-lang.org/users

Re: [racket] Size matters

2013-06-08 Thread Mark Engelberg
This tension between clarity and line length is precisely why I wish camelCase were more common in Lisp languages. When using clear multi-word names, those hyphens between words can really eat up a significant percentage of your line width. Racket Users list: http://lists.

Re: [racket] Requiring SRFI

2012-11-01 Thread Mark Engelberg
OK, I get it now. subtract-in does exactly what I want. Thanks, Mark Racket Users list: http://lists.racket-lang.org/users

Re: [racket] Requiring SRFI

2012-11-01 Thread Mark Engelberg
My point being that I'm worried if I have to itemize all the names, I might miss a potential conflict. On Thu, Nov 1, 2012 at 11:43 AM, Mark Engelberg wrote: > Thanks. Is there a simple way to do it without itemizing the specific > function names? > > I was caught off guard be

Re: [racket] Requiring SRFI

2012-11-01 Thread Mark Engelberg
Thanks. Is there a simple way to do it without itemizing the specific function names? I was caught off guard because I was using the new string-trim function. When I included srfi/13, I didn't realize it was going to replace string-trim with a version that was really just a "trim left" function.

[racket] Requiring SRFI

2012-11-01 Thread Mark Engelberg
Is there an easy way to require everything in a given SRFI, while specifying that in a case of name conflict, I want to use the built-in racket version? I'm specifically thinking about srfi/13, the string library. I want to include that, but I think Racket's newly added string functions (such as

Re: [racket] Getting started with Scribble

2012-03-17 Thread Mark Engelberg
On Sat, Mar 17, 2012 at 11:44 AM, Eli Barzilay wrote: > Note that what Haskell does is *semi*-literate-programming, something > that has little to do with literate programming. Neil Van Dyke is > working on a tool that is going to be more like > semi-literate-programming. > > I understand that l

Re: [racket] Getting started with Scribble

2012-03-17 Thread Mark Engelberg
On Sat, Mar 17, 2012 at 5:36 AM, Robby Findler wrote: > That is now how scribble/lp works. You need to make another file and > use @lp-include on the first to get a document that actually > scribbles. There is more explanation of this in the docs, right below > that first example. > > Robby > > OK

Re: [racket] Getting started with Scribble

2012-03-17 Thread Mark Engelberg
I'm still curious to get scribble/lp working, but I've figured out an immediate solution to my question. I was able to get the behavior I want with just a simple macro: @(define-syntax-rule (code l) (begin @schemeblock[l] l)) Below is a sample of its use to get the behavior I want wh

Re: [racket] Getting started with Scribble

2012-03-16 Thread Mark Engelberg
OK, I pasted in the code from the docs just to make sure it wasn't something in my code. Then I hit the "Scribble HTML" button that appears in the upper-right corner of DrRacket. I see the following in the interactions window: Welcome to DrRacket, version 5.2 [3m]. Language: scribble/lp; memory

Re: [racket] Getting started with Scribble

2012-03-16 Thread Mark Engelberg
Ugh, scratch my scratching that. I'm still getting the error. On Fri, Mar 16, 2012 at 7:47 PM, Mark Engelberg wrote: > On Fri, Mar 16, 2012 at 7:45 PM, Mark Engelberg > wrote: > >> scribble/lp is related, but more involved to use. Specifically, I just >> tried it a

Re: [racket] Getting started with Scribble

2012-03-16 Thread Mark Engelberg
On Fri, Mar 16, 2012 at 7:45 PM, Mark Engelberg wrote: > scribble/lp is related, but more involved to use. Specifically, I just > tried it and it doesn't seem to work with the scribble html button that > appears in DrRacket. I keep getting the following error: > scrib

Re: [racket] Getting started with Scribble

2012-03-16 Thread Mark Engelberg
I'm sort of thinking along the lines of Haskell's version of literate programming, where if you use the file suffix of lhs instead of hs, rather than having a file that is mostly code with occasional comments, you can easily write a document that is mostly text with occasional code. In that mode,

Re: [racket] Getting started with Scribble

2012-03-16 Thread Mark Engelberg
;; The zero test [else (* n (factorial (sub1 n)))])) ] But when I hit Run, it doesn't seem to recognize factorial in the interactions window. On Fri, Mar 16, 2012 at 6:41 PM, David Van Horn wrote: > On 3/16/12 8:42 PM, Mark Engelberg wrote: > >> So I'm trying to fi

[racket] Getting started with Scribble

2012-03-16 Thread Mark Engelberg
So I'm trying to figure out the simplest way to create a document that is mostly text with a few Racket snippets. When I hit Run, I want the code to be evaluated for the interactions window. When I hit the scribble button, I want it to generate html that displays the formatted text along with the

Re: [racket] Mark Tarver is the man!

2012-01-01 Thread Mark Engelberg
On Sun, Jan 1, 2012 at 4:50 PM, Raoul Duke wrote: > horses for courses, to some degree - Shen is all about portability, > and it is very young. No doubt. I have my eye on Shen. It could mature into something very cool, and I'm hoping that happens. I meant my opinion to be about the breadth of

Re: [racket] Mark Tarver is the man!

2012-01-01 Thread Mark Engelberg
The PLT team clearly cares passionately about creating and maintaining real, usable languages and tools. That is why Racket exists. Very few academic projects produce anything nearly as useful and professional. I find your comparison to Shen somewhat ironic, because, as much as I admire Shen, I

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

2011-12-05 Thread Mark Engelberg
Check out Algorithm T in chapter 7.2.1.3 of Knuth, volume 4A part 1. Put your items into a vector, and use Algorithm T to generate the indices of the elements to extract. _ For list-related administrative tasks: http://lists.racket-lang.org/listin

[racket] Disable/Enable Tests

2011-11-27 Thread Mark Engelberg
In the latest version of Racket, I see a menu item to disable and enable tests. What testing library does this work with? The htdp testing library, rackunit, something else? Thanks, Mark _ For list-related administrative tasks: http://lists.ra

Re: [racket] Why internal definitions?

2011-11-16 Thread Mark Engelberg
I frequently find myself wishing that you could use internal definitions in cond without introducing additional indentation, for example something like: (define (fun-for-list l) (cond [(empty? l) ...] (define fst (first l)) [(even? fst) ...] [(odd? fst) ...])) rather than (defi

Re: [racket] Question about round

2011-09-30 Thread Mark Engelberg
I'm amazed at how long I've gone with the misconception that: Exact Numbers = Integers union Rationals Inexact Numbers = Floating Point numbers (Frankly, I never really thought much about what infinities were. I assumed they were a separate, distinct type). When I saw in the docs for round that i

[racket] Question about round

2011-09-29 Thread 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 expect the answer to both of these tests to be true. Thanks, Mark _ For list-related ad

Re: [racket] future

2011-08-28 Thread Mark Engelberg
On Sun, Aug 28, 2011 at 9:34 AM, Shriram Krishnamurthi wrote: > (I believe Clojure already breaks with tradition in this way.) Yes, in Clojure, future is a macro, and future-call is a function that takes a thunk. _ For list-related administrative

Re: [racket] For new Racket users

2011-08-27 Thread Mark Engelberg
I think such things can be hugely motivating! Although not as puzzley as pythonchallenge, recently I've been hearing some buzz about Clojure's puzzle intro site called 4clojure.com. All the "puzzles" are just fill in the blank programming problems. Nothing that seems like it would be hugely excit

Re: [racket] Racket in the large

2011-08-19 Thread Mark Engelberg
On Fri, Aug 19, 2011 at 3:26 PM, Matthias Felleisen wrote: > Correction: Scheme (current standard) is the third-best language. Racket is > the second-best language. OK, this is clearly a setup for someone to ask, so I'll ask :) What's the first-best language?

Re: [racket] Image teachpack -> svg?

2011-08-07 Thread Mark Engelberg
Thanks, that's great! On a somewhat related note, is there any way to use the slideshow/pict library's ability to draw an arrow between picts in conjunction with images formed with the image teachpack? _ For list-related administrative tasks: htt

[racket] Image teachpack -> svg?

2011-08-07 Thread Mark Engelberg
Is there any way to get the image teachpack to export images in svg format, or is png the only option? Thanks, Mark _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users

Re: [racket] Cannot open file in Racket 5.1.2

2011-08-03 Thread Mark Engelberg
A related problem that is easy to replicate (I have not reported it through the submit bug report yet, because I would like to know if this is some quirk of my installation): Open DrScheme. Type Ctrl-= to open a new tab. Click on first tab. This causes the following error on my system: send: tar

[racket] Cannot open file in Racket 5.1.2

2011-08-03 Thread Mark Engelberg
Whenever I try to open a file in the new version of Racket (on Windows), I get the following error. Anyone else having this problem, or could this be related to the other virus-checking problems I had with the install? sequence-contract-violation: negative: method end-edit-sequence cannot be call

Re: [racket] overlay and overlay/xy

2011-08-03 Thread Mark Engelberg
Just getting ready for the new year, and looking closely at the changes to the image teachpack. I like that there is now a version of overlay that works as an offset from the middle-middle point, but it doesn't address Don's second observation that the semantics of overlay/offset feel backwards.

Re: [racket] Advice: simulating stateful API in functional setting

2011-07-16 Thread Mark Engelberg
On Sat, Jul 16, 2011 at 7:33 AM, Stephen Bloch wrote: > These functions would presumably maintain the invariant that each name > corresponds to at most one sprite in a world.  Letting the kids manipulate > the list of sprites directly does NOT maintain that invariant, so I think I > have to do

Re: [racket] Advice: simulating stateful API in functional setting

2011-07-15 Thread Mark Engelberg
On Fri, Jul 15, 2011 at 11:56 AM, Stephen Bloch wrote: > Last Monday I attended Dan Garcia's workshop on BYOB.  He kept pointing out > (presumably for the benefit of Emmanuel and me) that it really is a > functional language.  And yes, it has "map", "filter", "foldl", and > "lambda"... but most

Re: [racket] Advice: simulating stateful API in functional setting

2011-07-15 Thread Mark Engelberg
On Fri, Jul 15, 2011 at 12:24 PM, Nadeem Abdul Hamid wrote: >  Why don't you just have the picture generated based on the state of the > sprite each tick of the animation, just as in HtDP "world"? Functions like > move, rotate, etc. produce a modified sprite, and when that sprite gets > passed to

Re: [racket] Again on bindings visibility in eval

2011-07-15 Thread Mark Engelberg
OK, so here are the main points I'm gathering from this discussion. 1. Clojure's quasiquote system does some extra things behind the scenes in terms of generating temporary variables and qualifying variable names with their namespace in such a way that the macros you write are reasonably hygienic

Re: [racket] Again on bindings visibility in eval

2011-07-14 Thread Mark Engelberg
On Thu, Jul 14, 2011 at 4:35 AM, Thomas Chust wrote: > While Clojure *mitigates* the problems of non-hygienic macros using > namespaces and a shorthand syntax for freshly generated identifiers, it > doesn't *solve* the problems. Racket's macro system, on the other hand, > does solve the problems a

Re: [racket] Tutorial: writing a language (brainf*ck) in Racket

2011-06-13 Thread Mark Engelberg
Excellent tutorial. This really helped me understand how to write a language with a non-lispy syntax within Racket. Thanks. _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users

Re: [racket] Functional struct update with subtypes

2011-05-11 Thread Mark Engelberg
I played around briefly with define-local-member-name but it seemed like a rather awkward way to achieve "protected"-ness. From the example in the help desk, it seems like the classes need to have some sort of let wrapped around them to share a non-public method between them. It seems like to set

Re: [racket] Functional struct update with subtypes

2011-05-11 Thread Mark Engelberg
On Wed, May 11, 2011 at 1:10 PM, David Van Horn wrote: > Here are some struct definitions and a function, based on Land of Lisp: > > (struct monster (id [hit #:mutable]) #:transparent) > (struct orc monster (club) #:transparent) > (struct hydra monster () #:transparent) > (struct slime monster (sl

Re: [racket] generating 0 or more than 1 additions in the body of for/list, for/vector, for/hash

2011-04-15 Thread Mark Engelberg
Where is this sequence->list function of which you speak? Did you mean the stream->list function, which despite its name, actually behaves like you'd expect a function called sequence->list function to behave? On Fri, Apr 15, 2011 at 12:30 PM, Jay McCarthy wrote: > I thought of something else yo

[racket] Question about modules

2011-04-06 Thread Mark Engelberg
The following two lines trigger an error: (require (planet dherman/memoize:3:1)) (require (planet soegaard/math:1:4/math)) The error says something along the lines that the soegaard package requires an older version of the memoize library, and the two can't coexist. Shouldn't modules protect me

[racket] Slideshow preview mode

2011-03-11 Thread Mark Engelberg
Is there a way to trigger the preview mode from within the slideshow's racket file (so that it goes to preview mode when I hit the Run button while viewing the file in DrRacket) as opposed to "slideshow -d myslideshow.rkt" from the command line? _ F

Re: [racket] stream-cons from racket/stream isn't lazy

2011-03-05 Thread Mark Engelberg
I've had some email discussions about this with the Racket team in the past, so here's a quick unofficial summary of what I've learned, while you're waiting for a more official response: racket/stream is not really a "stream library" by the typical Scheme definition of stream. It's really a libra

Re: [racket] Making animations in racket (or, why racket is hard to transition to from scratch)

2011-02-05 Thread Mark Engelberg
There are projects that are trivial in Scratch that are hard in Racket, and vice versa. Porting your Scratch projects to Racket is not likely to be a very productive use of your time because they have such different strengths and weaknesses. I think your best bet is to pick some projects which ar

Re: [racket] Lazy take is the identity?

2011-01-26 Thread Mark Engelberg
I get an error in 5.0.2, rather than 0. --Mark P.S. I was surprised to see that list-ref in #lang lazy takes the args in opposite order than in #lang racket (which takes the list first). On Tue, Jan 25, 2011 at 11:27 PM, John Clements wrote: > I would expect this program to signal an error: > >

[racket] Question about Moby

2011-01-25 Thread Mark Engelberg
This program: #lang racket (require (planet dyoo/moby:3:9)) gives me this error: ..\..\Documents and Settings\Mark\Application Data\Racket\planet\300\5.0.2\cache\dyoo\js-vm.plt\1\12\private\translate-bytecode-structs.rkt:25:8: compile: unbound identifier in module in: internal:indirect? Any i

Re: [racket] This is not a solution! Re: A puzzle

2011-01-21 Thread Mark Engelberg
On Wed, Jan 19, 2011 at 5:29 PM, Hendrik Boom wrote: > I see a lot of code, but what's the puzzle.  Presumably there's some > kind of question that has to be answered about it? > > -- hendrik The program is a multithreaded program that crashes unless the executions of the threads are interleaved

Re: [racket] A puzzle

2011-01-19 Thread Mark Engelberg
Hmm, I don't think the greedy approach will work. The first line of the second thread, (set! a (list c)), will execute without error immediately, but it really needs to happen between the evaluation of a and (first a) in the first line of the first thread. Probably needs to be done by hand. _

Re: [racket] A puzzle

2011-01-19 Thread Mark Engelberg
It looks like the puzzle is to find an interleaving of execution that makes sense. Other than solving it by hand, one idea I have is to wrap around each line of code some sort of error handler that keeps trying that line until it succeeds. This should work if the puzzle has been designed so that

[racket] Question about fields in Racket OO

2010-12-15 Thread Mark Engelberg
I'm playing around with the object-oriented subset of Racket, and have a couple of questions. Ideally, I'd like to equip a class with a field that is visible only to it and its subclasses. As far as I can tell, though, this isn't possible. It seems that I have to make a choice between a complete

Re: [racket] member et al.

2010-11-11 Thread Mark Engelberg
On Thu, Nov 11, 2010 at 10:57 AM, Jay McCarthy wrote: > This 'if' introduces a stack frame that is not otherwise needed. > > Jay OK, I see your point now. I was thinking of it as one more test at the end so I wasn't thinking of it as having a real cost, but I see how this makes the fold-like imp

Re: [racket] member et al.

2010-11-11 Thread Mark Engelberg
On Thu, Nov 11, 2010 at 9:56 AM, Jay McCarthy wrote: > (define (andmap f l) >  (if (empty? l) >     #t >     (and (f (first l)) (andmap f (rest l) > > If and has to return a boolean, then it leaves space on the stack to > check if andmap returns a bool or to convert "truth" to #t. Thus this >

Re: [racket] member et al.

2010-11-10 Thread Mark Engelberg
On Wed, Nov 10, 2010 at 6:41 PM, Sam Tobin-Hochstadt wrote: > No. There's no reason that contracts or types need to have any > trouble with Racket's generalized booleans. In particular, the Typed > Racket type system is designed to cope with exactly these sorts of > idioms. Consider the followi

[racket] member et al.

2010-11-10 Thread Mark Engelberg
Racket still offers several primitives, such as member, that are primarily used as predicates, but don't actually return a Boolean. Racket's cond handles any of these return values as true, but now that Racket is gravitating towards contracts and typed modules, shouldn't Racket's predicates actuall

Re: [racket] Racket v5.0.2

2010-11-06 Thread Mark Engelberg
On Sat, Nov 6, 2010 at 10:22 PM, Eli Barzilay wrote: > * The `when', `unless', `cond', `case', and `match' forms (in >  `racket/base' and derived languages) now allow immediate internal >  definitions. Can you point me to some examples of this? I can't find any in the documentation. Thanks, Ma

Re: [racket] pregexp vs regexp

2010-11-02 Thread Mark Engelberg
It sounds like it's mostly a backwards-compatibility issue. So when teaching students from scratch about regular expressions, is it reasonable to only mention pregexps? Is there anything lost by doing that? _ For list-related administrative tasks:

[racket] pregexp vs regexp

2010-11-02 Thread Mark Engelberg
As far as I can tell, pregexp functionality is a superset of regexp functionality. Furthermore, the added functionality uses patterns that are unlikely to occur by accident in normal regular expressions. So is there any advantage to using regexp over pregexp? Why is there a need for both to coexi

Re: [racket] SIGCSE AWARDS

2010-10-05 Thread Mark Engelberg
It's always a delight to see Matthias being appreciated outside of our little community. Congrats! _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users

Re: [racket] News flash! Racket once again a legal choice for developing iPhone apps!

2010-09-14 Thread Mark Engelberg
Just curious, does wescheme support "universe" programs? If so, what does that support entail? Do you run both the server and client on the wescheme website, or can you run the universe server on wescheme and connect to it via desktop Racket running a universe client?

[racket] 2htdp/image question

2010-09-10 Thread Mark Engelberg
Why is it that (empty-scene 100 100) produces a white scene with a black border around all four edges, but (place-image (circle 10 'solid 'red) 10 10 (empty-scene 100 100)) produces a scene with a black border only on its top and left edges? (This is in Racket 5.0.1 on Windows) ___

Re: [racket] text formatting questions

2010-08-22 Thread Mark Engelberg
I don't know how DrRacket is implemented, but you might want to look at this article for ideas about ways to represent strings in a manner that allows for efficient editing: http://www.cs.ubc.ca/local/reading/proceedings/spe91-95/spe/vol25/issue12/spe986.pdf

Re: [racket] Nested scope in D vs Racket

2010-08-21 Thread Mark Engelberg
On Sat, Aug 21, 2010 at 8:39 AM, Shriram Krishnamurthi wrote: > Or if you prefer the new direction we're going in: > (define (bar x) >  (lambda () >    (define x x) >    x)) I like the new direction. Where are all the possible places that a define can go without wrapping it in a local? How do

Re: [racket] All black images...Ahhh

2010-07-21 Thread Mark Engelberg
I recently reported a bug that sounds extremely related: (Problem Report 11033) where empty white scenes were sometimes showing up as black. Also on Windows. You might want to check whether this fix addresses that bug as well, and if so, you can close out that problem report.