Re: [racket-users] Storing functions in a hash

2015-05-20 Thread Matthias Felleisen
Yes, this is over-engineered. What do you not like about (define h1 (hash 'foo (lambda () (random 100)) 'bar (lambda () (random 500 (displayln h1) (displayln ((hash-ref h1 'foo))) (displayln ((hash-ref h1 'foo))) (displayln ((hash-ref h1 'bar))) (displayln ((hash-ref h1 'bar))) Onc

Re: [racket-users] Doing pattern matching by reader macro

2015-05-18 Thread Matthias Felleisen
Your best bet is to define a new language that overrides define after taking over the body of the module. This may even be an example in the docs. On May 18, 2015, at 9:39 AM, Mianlai Zhou wrote: > Hi Matthias, > > Thanks for answer. However, this is not what I wanted: >

Re: [racket-users] Doing pattern matching by reader macro

2015-05-18 Thread Matthias Felleisen
#lang racket (define/match (f n) [(#t) 2] [(#f) 3] [(_) 0]) (list (f #t) (f #f) (f "where's my homework")) On May 18, 2015, at 9:04 AM, Mianlai Zhou wrote: > Hi Racketeers, > > I am a new user of Racket. > > I would want to be able to write the following segment of code: > > (defin

Re: [racket-users] Strange behaviour of the eq? operator in racket repl

2015-05-18 Thread Matthias Felleisen
SICP isn' the bible, especially not on programming language knowledge. I'd recommend checking out relevant literature instead. On May 18, 2015, at 8:24 AM, Michael Tiedtke wrote: > Structure and Interpretation of Computer Programs (sicp2) about sameness: > > https://mitpress.mit.edu/

Re: [racket-users] constant propagation

2015-05-18 Thread Matthias Felleisen
Constant propagation is not a property of a language but its implementation. Few implementations document which transformations they currently implement. -- Matthias On May 18, 2015, at 7:11 AM, Jos Koot wrote: > Very nice constant propagation in Racket. > For example the Racket co

Re: [racket-users] A typo? HTDP2e/draft exercise 50 and the show function

2015-05-13 Thread Matthias Felleisen
Correct. The question is meaningless. Thanks for the correction. -- Matthias On May 13, 2015, at 11:44 AM, Li Junsong wrote: > Hello, > > The `show' function above exercise 50 in HTDP2e draft (or exercise 52 in > HTDP2e) is: > > (define (show x) &g

Re: [racket-users] Environment Shuffling and 3D Syntax

2015-05-10 Thread Matthias Felleisen
Probably off-topic: you might be interested in http://repository.readscheme.org/ftp/papers/sw2003/Scmxlate.pdf Start with the title and then the summary at the end. Dorai has used this package to make his programs available in Schemes and Common Lisps. -- Matthias On May 8, 2015, at 10

[racket-users] Re: [racket] Unsafe version of require/typed?

2015-05-01 Thread Matthias Felleisen
What I'd much prefer at the moment over speculative solutions are reports of actual performance bottlenecks. -- Matthias On May 1, 2015, at 1:09 AM, michael.ballantyne wrote: > I've started using Typed Racket several times recently only to flip the > switch to #lang typed

Re: off-topic --- Re: [racket-users] Racketeer - Continuous Testing Plugin for DrRacket

2015-04-26 Thread Matthias Felleisen
Yes, at least one. See Racket manifesto. Any takers? Start with Shriram's dissertation perhaps we need to go back there. On Apr 26, 2015, at 4:43 PM, Neil Toronto wrote: > On 04/26/2015 02:39 PM, Matthias Felleisen wrote: >> >> Once again, this is an instance where

Re: off-topic --- Re: [racket-users] Racketeer - Continuous Testing Plugin for DrRacket

2015-04-26 Thread Matthias Felleisen
On Apr 26, 2015, at 3:13 PM, Alexander D. Knauth wrote: > > On Apr 26, 2015, at 2:39 PM, Matthias Felleisen wrote: > >> >> On Apr 26, 2015, at 9:18 AM, Alexander D. Knauth wrote: >> >>> I wanted to see if it could work for tests within (module+ test …),

Re: [racket-users] Racketeer - Continuous Testing Plugin for DrRacket

2015-04-26 Thread Matthias Felleisen
ALex, Mira might be best served if you submitted all these things as issues via github. -- Matthias On Apr 26, 2015, at 1:04 PM, Alexander D. Knauth wrote: > Also DrRacket doesn’t seem to want to quit. I click on the quit option in > the menu, it asks me if I really want to quit, I

off-topic --- Re: [racket-users] Racketeer - Continuous Testing Plugin for DrRacket

2015-04-26 Thread Matthias Felleisen
well for BSL, which is for students who never programmed before. Once again, this is an instance where you'd really like to abstract the library over the language into which its exports are imported. This is a constant struggle for me, and I'd like to solve it. -- Matthias --

Re: [racket-users] Racketeer - Continuous Testing Plugin for DrRacket

2015-04-25 Thread Matthias Felleisen
Mira, you exist. I just submitted a bug report after installing the package and playing with it. -- Also once you get the tool to work on HEAD, please enter it into the catalog so it is easier to install. Thanks, this is really neat and great to have -- Matthias On Apr 25, 2015, at 9:43 PM

Re: [racket-users] Racketeer - Continuous Testing Plugin for DrRacket

2015-04-25 Thread Matthias Felleisen
NICE! On Apr 25, 2015, at 8:10 PM, Mira Leung wrote: > Racketeer is a plugin for DrRacket that integrates continuous testing with > Racket development. This is aimed primarily at the context of usage within > university-level programming courses, and has been tested on computer science > f

Re: [racket-users] define-language, trouble with parentheses.

2015-04-25 Thread Matthias Felleisen
(n + n + n + t)) (n number)) (redex-match? jk t 1) (redex-match? jk t (+ 1 1)) (redex-match? jk t (+ 1 1 1)) with the tools you have in Redex? -- Matthias On Apr 24, 2015, at 5:30 PM, Jos Koot wrote: > I have trouble translating the following into a define-language form: > >

Re: [racket-users] convert to/from Sribble

2015-04-22 Thread Matthias Felleisen
No need for that. You can write your own renderer :-) On Apr 22, 2015, at 1:02 AM, Gour wrote: > > Matthias Felleisen writes: > >> We'd love to have an additional renderer for Scribble. > > Good. > > Btw, is there something like Scribble-2 pl

Re: [racket-users] convert to/from Sribble

2015-04-21 Thread Matthias Felleisen
We'd love to have an additional renderer for Scribble. On Apr 21, 2015, at 7:05 AM, Neil Van Dyke wrote: > Gour wrote on 04/21/2015 06:50 AM: >> >>> Another way to get to lots of different formats from Scribble would be >>> to make Scribble generate more-plain HTML5 (i.e., less tag-heavy t

Re: [racket-users] Typed analog of "integer-in" contract

2015-04-21 Thread Matthias Felleisen
#lang typed/racket (define-type NDigit (U 0 1 2 3 4 5 6 7 8 9)) (define-type SDigit (U 'zero 'one 'two 'three 'four 'five 'six 'seven 'eight 'nine)) (: to-string (-> NDigit SDigit)) (define (to-string i) (case i [(0) (displayln i) 'zero] [(1) (displayln i) 'zero] [(2) (displayln i

Re: [racket-users] Organizing tests

2015-04-16 Thread Matthias Felleisen
with integration tests, import the former into the latter.) -- Matthias On Apr 16, 2015, at 11:17 AM, Konrad Hinsen wrote: > Hi everyone, > > I want to put some order into my tests, but after looking at various > published Racket packages, I am not sure if there any ac

Re: [racket-users] How to find most efficient constructs/instructions beside benchmarking?

2015-04-13 Thread Matthias Felleisen
iscuss off-topic ideas to some extent. You will get good and honest answers. -- Matthias On Apr 7, 2015, at 3:31 AM, Giuseppe Luca Scrofani wrote: > When, some day I will be, maybe, capable of really understand all of what you > told me, I will dismiss my questions like this by mys

Re: [racket-users] Struggling with macros

2015-04-13 Thread Matthias Felleisen
Take a look at the PLAI language and define-type. I recommend you elaborate your syntax into PLAI constructs. On Apr 13, 2015, at 12:40 PM, Nils Van Geele wrote: > On Monday, April 13, 2015 at 6:26:38 PM UTC+2, Alexis King wrote: >> What exactly is the difference here between your define-o

Re: [racket-users] How to find most efficient constructs/instructions beside benchmarking?

2015-04-13 Thread Matthias Felleisen
e with your analysis otherwise.) -- Matthias -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more opti

Re: [racket-users] Constant syntax coloring?

2015-04-09 Thread Matthias Felleisen
In #lang languages syntax coloring happens on-line and is almost always close to correct. If you see a red dot in the bottom right of drracket, mouse over it, click to enable syntax checking. On Apr 9, 2015, at 2:59 AM, Jack Firth wrote: > The DrRacket Check Syntax button colors syntax in

Re: [racket-users] compliment given to Racket's macro system from Haskell programmer

2015-04-08 Thread Matthias Felleisen
Jesse is a product of our NU lab. After a tour of Harvard (2x), he's back here so he sees good syntax extensions at work every day. -- Matthias On Apr 8, 2015, at 9:54 AM, "Geoffrey S. Knauth" wrote: > See: > http://www.quora.com/What-are-the-main-weaknesses-of-Has

Re: [racket-users] How to find most efficient constructs/instructions beside benchmarking?

2015-04-06 Thread Matthias Felleisen
You almost never have to worry about the efficiency of (second x) (cadr x) and (car (cdr x)). There are always bigger fish to fry than that. On Apr 6, 2015, at 3:37 AM, Lux wrote: > It is more efficient (second myList) or (car (cdr myList)) if it is any > difference at all? > What are the p

Re: [racket-users] htdp/2e: exercises 336-338, feedback desired and questions

2015-04-05 Thread Matthias Felleisen
bundle-string (explode "mumble") 2) (bundle-string (explode > "mumble") 2)) I would be very surprised if (f x) were not equal (f x) for all functions f and arguments x. Please re-consider your example (formulated as test). This is where you went wrong, including setting up

Re: [racket-users] Using Redex

2015-03-31 Thread Matthias Felleisen
you state and refute/validate such claims. But as I say, this is a conjecture. -- Matthias On Mar 31, 2015, at 12:23 PM, Jonathan Schuster wrote: > Forgot to reply to the list, so I'm forwarding here. > > -- Forwarded message -- > From: Paul van der Walt > Da

Re: [racket-users] Arcs and lines being half-drawn

2015-03-30 Thread Matthias Felleisen
You need to provide a running program, including inputs. (You may also wish to read the style guide for Racket.) On Mar 26, 2015, at 10:39 AM, chia kang ren wrote: > http://pasterack.org/pastes/75790 > http://pasterack.org/pastes/11360 > http://pasterack.org/pastes/10455 -- You received th

Re: [racket-users] manifesto move

2015-03-30 Thread Matthias Felleisen
Thanks. Fixed -- Matthias On Mar 30, 2015, at 8:32 AM, Daniel Bastos wrote: > Matthias, at least in this new address the PDF is a broken link. It currently > points to > > http://www.ccs.neu.edu/home/matthias/manifesto/manifesto.pdf > > which yields a "file

[racket-users] manifesto move

2015-03-28 Thread Matthias Felleisen
Now that the scribble is mostly cleaned up, I have moved the manifesto to a less temporary place: http://www.ccs.neu.edu/home/matthias/manifesto/ -- Matthias -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from

Re: [racket-users] the Racket manifesto

2015-03-27 Thread Matthias Felleisen
On Mar 27, 2015, at 4:11 AM, Konrad Hinsen wrote: > Matthias Felleisen writes: > >>>> A web site is an ad. >>> >>> As is a research paper. It's the audience that differs. >> >> I am sorry but you embrace modern CS departments too much, &g

Re: [racket-users] the Racket manifesto

2015-03-26 Thread Matthias Felleisen
[I am sorry for replying again on this sub-thread, but your first statement makes me very sad and the second one points out a serious flaw in our web prose.] On Mar 26, 2015, at 11:02 AM, Konrad Hinsen wrote: >> A web site is an ad. > > As is a research paper. It's the audience that differs

Re: [racket-users] Projects (was: the Racket manifesto)

2015-03-26 Thread Matthias Felleisen
Thanks for sending this, again. I was writing a response very much along these lines when your post came in. 1. No, we cannot and will not replace all tools. Quite the opposite, I foresee a future in which we will produce many more tools. [Your effort will make me think twice before I write a

Re: [racket-users] Re: Arcs and lines being half-drawn

2015-03-26 Thread Matthias Felleisen
Could you point to the complete code base? Thanks -- Matthias On Mar 26, 2015, at 9:38 AM, chia kang ren wrote: > Here is a clearer photo. In the original (and working) graphical editor you > can select the entities to highlight them in red. The entities are weirdly > cut off. The

Re: [racket-users] the Racket manifesto

2015-03-26 Thread Matthias Felleisen
nting of a big picture for people who explore the intellectual landscape of programming languages (as a whole and in principle) (especially w/o every programming much beyond latex). So please keep context in mind when you read our prose. -- Matthias -- You received this message because y

Re: [racket-users] the Racket manifesto

2015-03-26 Thread Matthias Felleisen
But yes, section 3 is the hard part and work on 4 and 5 is "substitution" as Daniel Kahneman would say. -- Matthias -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emai

Re: [racket-users] Projects (was: the Racket manifesto)

2015-03-25 Thread Matthias Felleisen
Thank you Greg. I couldn't have said it any better (probably worse). This is exactly the point -- Matthias On Mar 25, 2015, at 12:07 PM, Greg Hendershott wrote: > My personal/casual take on this: > > There are language systems where you to need to run some > make-a

Re: [racket-users] the Racket manifesto

2015-03-25 Thread Matthias Felleisen
On Mar 24, 2015, at 11:15 PM, Matthias Felleisen wrote: > On Mar 24, 2015, at 10:34 PM, Neil Van Dyke wrote: > >> Shortly after I declare that Racket is not a cult, Racket goes and issues a >> manifesto. >> >> Neil V. Neil, I wrote this paper _because_ acade

[racket-users] the Racket manifesto

2015-03-24 Thread Matthias Felleisen
We have just submitted the Racket manifesto for publication. If you'd like to take a look at what has been on our mind, here is scribbled version: http://www.ccs.neu.edu/home/matthias/Tmp/manifesto/ The PDF is linked in. -- Matthias Typos/scribbelos: to matth...@ccs.ne

Re: [racket] the typed Values restriction

2015-03-18 Thread Matthias Felleisen
On Mar 18, 2015, at 5:20 PM, Benjamin Greenman wrote: > Switching to cons was an easy fix. Not a fix. You get different errors at different times. Don't think "it works"; think "does it work for errors, too?" Racket Users list: http://lists.racket-lang.org/users

Re: [racket] Using define-runtime-path from *SL

2015-03-18 Thread Matthias Felleisen
Are you sure? I had a drracket open in ISL and here is what I got: > Welcome to DrRacket, version 6.1.1.8--2015-03-11(-/f) [3m]. > Language: Intermediate Student with lambda. > > (require racket/runtime-path) > > (define-runtime-path y "hello world") > > -

Re: [racket] Discussion of racket on HN

2015-03-18 Thread Matthias Felleisen
they should use their time to read up on things that they know nothing about (lack of types in Racket) instead of speculating about these things. Argh. -- Matthias On Mar 18, 2015, at 8:53 AM, Sean Kemplay wrote: > For those that are interested- > > https://news.ycombin

Re: [racket] Can I get some feedback / a code review for some simple game code?

2015-03-17 Thread Matthias Felleisen
http://en.wikipedia.org/wiki/Zipper_(data_structure) On Mar 17, 2015, at 1:14 PM, Alexis King wrote: > That’s probably a good idea. I’m not quite sure what you’re referring to by > “zippers”, though—could you elaborate? > >> On Mar 17, 2015, at 06:44, Matthias F

Re: [racket] Can I get some feedback / a code review for some simple game code?

2015-03-17 Thread Matthias Felleisen
This is indeed exemplary. One thing I'd like to request in the README file is a description of the "game's" idea. As for inefficiencies, consider using zippers to lower the syntactic overhead; it may also help with allocation. -- Matthias On Mar 17, 2015, at 12:17 A

Re: [racket] Nearly all of the functionality from the 2htdp teachpacks is now available in 2htdp-typed

2015-03-15 Thread Matthias Felleisen
ble to read Typed Racket’s error > messages would probably be able to handle these ones. I’m not discounting > your point—you’re right that this is probably less accessible for > students—but I guess using it would be out of their grasp, anyway, at least > for now. > >> On Mar 1

Re: [racket] Nearly all of the functionality from the 2htdp teachpacks is now available in 2htdp-typed

2015-03-15 Thread Matthias Felleisen
ld package did not.] -- Matthias On Mar 14, 2015, at 8:39 PM, Alexis King wrote: > I’ve had the 2htdp-typed package available for a little while now, which is a > Typed Racket wrapper for the HtDP/2e teachpacks. It was missing big-bang, > since it is implemented as a macro, b

Re: [racket] TLS "atom?" definition for Scheme does not work in DrRacket

2015-03-12 Thread Matthias Felleisen
On Mar 5, 2015, at 5:16 PM, Rufus wrote: > Alex > >> [racket processes variable definitions first, then functions] > > Got it. That's not true. When you evaluate a definitions area, you evaluate a module body and that process proceeds top to bottom for Racket definitions and expressions.

Re: [racket] TLS "atom?" definition for Scheme does not work in DrRacket

2015-03-04 Thread Matthias Felleisen
On Mar 4, 2015, at 1:18 PM, Rufus wrote: > To All > > Using BSL-Lists: > > Matt't basic test works. > > (define rufus 0) > > Run, then type and execute "rufus" in the I-pane which displays 0 > > > > If I then add Alexander's example define so the def file appears as follows: > - >

Re: [racket] TLS "atom?" definition for Scheme does not work in DrRacket

2015-03-04 Thread Matthias Felleisen
All of this should work out of the box, w/o any problem. 1. Please report on the following experiment. In the Definitions pane, type (define rufus 0) 2. Click Run 3. In the Interactions pane, type > rufus 4. Please report the response of DrRacket. Racket Users lis

Re: [racket] TLS "atom?" definition for Scheme does not work in DrRacket

2015-03-03 Thread Matthias Felleisen
Use BSL with List Abbreviation. On Mar 3, 2015, at 3:50 PM, Rufus wrote: > Alexander > > Well, in fact, I thought it worked for me, too. And then it stopped > working; DrR threw an "application: not a procedure;" error saying it > was given a null list instead of an application. Removing th

Re: [racket] DrR w/TLS: Definitions

2015-03-03 Thread Matthias Felleisen
comfirm and play w/the examples and exercises in TLS, first > chapter. If it proves useful I'll add more definitions or else just let > it quiesce. > > Matthias, All: > So far I don't find any advantage to using "BSL w/List Abbrv". Since the > quote characte

Re: [racket] pre Realm of Racket

2015-03-03 Thread Matthias Felleisen
If the students are quick with it, move on to the first two parts of HtDP/2e. See http://www.ccs.neu.edu/home/matthias/HtDP2e/index.html 3. If that's challenging, work thru it slowly. Supplement with games you can make up that match that level of design. 4. If that's boring, move

Re: [racket] updated trycode.io

2015-03-03 Thread Matthias Felleisen
Thanks. This is really neat. When (if really) I ever find time, I would love to help with putting more of Realm out there like this. -- Matthias On Mar 2, 2015, at 10:10 PM, Floyd Arguello wrote: > trycode.io has been updated with the Guess My Number game from Realm of > Racket.

Re: [racket] How can I dump (display) the variables defined in current the global environment

2015-03-03 Thread Matthias Felleisen
The Little Lisper/Schemer uses ' (quote) for lists and that is not available in plain BSL. You need BSL-with-list-abbreviations to follow along TLS/TLL. On Mar 2, 2015, at 9:21 PM, Rufus wrote: > Matthias > >> best advice > > Yes. Said as much to Jordan but my email

Re: [racket] How can I dump (display) the variables defined in current the global environment

2015-03-02 Thread Matthias Felleisen
the -> Language -> Choose Languages menu. -- Matthias On Mar 1, 2015, at 7:54 PM, Jordan Johnson wrote: > On Mar 1, 2015, at 5:37 PM, Rufus wrote: >> And also >> a function to save this state (variables in the global environment) in a >> fashion that could be q

Re: [racket] racket-mode

2015-02-28 Thread Matthias Felleisen
ccasion it would be neat to say "stop here and let me explore/modify the environment and the store." Most of the time though you get away with printf because the language is safe I just don't consider it high priority until someone shows me a really good use case. -- Matthias

Re: [racket] run big-bang universe server on headless server?

2015-02-27 Thread Matthias Felleisen
The server doesn't need a GUI. It shows state windows and debugging windows only when you specify appropriate clauses in its description. But, it pulls in a shared library from 'world' that relies on racket/gui. So the answer is 'currently not possible but doable in princ

Re: [racket] Inconsistency of `in-range` and numerical issues

2015-02-27 Thread Matthias Felleisen
On Feb 27, 2015, at 8:37 AM, Konrad Hinsen wrote: > - A teaching and research language for numerical problems, with > first-class syntactical support for rationals, floats, bigfloats, > and (dreaming...) exact reals. I am sure Neil is working on this. --

Re: [racket] New and lost

2015-02-26 Thread Matthias Felleisen
Some well-known hackers tell you to learn "Lisp" to become a better programmer. The idea of "Lisp" comes with several different connotations, only one of them is "functional programming." Otherwise, as Neil says -- Matthias On Feb 26, 2015, at 7:35 PM, Sergio

Re: [racket] try-racket alternative

2015-02-26 Thread Matthias Felleisen
This is dang cool. How much of Realm can you get into this format? -- Matthias On Feb 25, 2015, at 4:11 PM, Floyd Arguello wrote: > I found that my daughters had a lot of questions when they went through the > tutorial at http://try-racket.org/ - what’s a function? What’s a b

Re: [racket] racket-mode

2015-02-25 Thread Matthias Felleisen
Don't make me want to go back to programming Racket in Emacs :-) But thanks for mapping Emacs back into the fold. -- Matthias On Feb 24, 2015, at 5:02 PM, Greg Hendershott wrote: > Just a heads-up on some progress with racket-mode over the last couple > months: > > - Suppo

Re: [racket] Inconsistency of `in-range` and numerical issues

2015-02-24 Thread Matthias Felleisen
I am not offended. I am saddened. On Feb 24, 2015, at 1:25 PM, Andrew Kent wrote: > I just grabbed two separate witnesses showing the result of the relevant > floating point math - I apologize for any offense. > > On Tue Feb 24 2015 at 1:15:01 PM Matthias Felleisen > wro

Re: [racket] Inconsistency of `in-range` and numerical issues

2015-02-24 Thread Matthias Felleisen
That's the saddest argument in support of anything Racket I have ever seen (even with the smiley). On Feb 24, 2015, at 1:05 PM, Andrew Kent wrote: > Racket: > (+ .1 .1 .1 .1 .1 .1 .1 .1) > 0.7999 > > Python: > >>> .1 + .1 + .1 + .1 + .1 + .1 + .1 + .1 > > 0.7999 >

Re: [racket] typed racket: how to define a binding as both a runtime var and a type?

2015-02-22 Thread Matthias Felleisen
Why do you want that? It's confusing to write x : x. I'd prefer x : X anyways. On Feb 22, 2015, at 2:43 PM, Alexander D. Knauth wrote: > Using #:omit-define-syntaxes doesn’t work because then when other modules > import it it forgets about the type: > > def.rkt: > #lang typed/racket > (provi

Re: [racket] HTML Code/Web Authentication

2015-02-21 Thread Matthias Felleisen
For the first half of the question, see http://www.ccs.neu.edu/home/matthias/HtDP2e/part_4.html#%28part._sub~3areading-xml%29 from the book for absolute novices. It explains how to design a simple stock ticker by reading (X)HTML off the web. The book emphasizes systematic design. You can

Re: [racket] thread-through ?

2015-02-21 Thread Matthias Felleisen
Here are some realistic, non-contrived examples where I use macros like thread-through [called build-scene] a lot: ;; Image Number Number -> Image ;; (x0,y0) is where we want to add a branch (define (fork s0 x0 y0) (define xB (x-B x0)) (define yB (y-B y0)) (define xC (x-C x0)) (define

Re: [racket] Why choose the 'let*' construct over the 'define' construct when both can have sequential scope?

2015-02-19 Thread Matthias Felleisen
abuse `let` to have your >> `define`s: >> (let () >> (define x 3) >> (define y 4) >> (list x y)) >> >> It's even more vicious if you use `let*` instead of `let`, but quite less if >> you use `begin` instead ;) >> >> >> &

Re: [racket] Why choose the 'let*' construct over the 'define' construct when both can have sequential scope?

2015-02-19 Thread Matthias Felleisen
In some places, you are allowed only one expression, and for that situation, you need let*. On Feb 19, 2015, at 12:40 PM, Don Green wrote: > What is/are the reason(s) for choosing the 'let*' construct over the 'define' > construct? > > (define (print-two f) > (let* ([_ (print (first f)

Re: [racket] number->string in the HtDP student languages

2015-02-18 Thread Matthias Felleisen
compromise between those two concepts and have an obligation to show learners that there is an issue. I consider *SL in a sweet spot, despite the warts that occasionally show up. -- Matthias On Feb 18, 2015, at 8:28 AM, Nadeem Abdul Hamid wrote: > And you can use > > > (number-&

Re: [racket] Problem with structs and #lang racket/signature

2015-02-04 Thread Matthias Felleisen
recommend developing small units in one DrRacket buffer. It's the easiest way to get used to their syntax. -- Matthias On Feb 4, 2015, at 9:14 PM, Justin Zamora wrote: > There seems to be a problem exporting struct constructors when using #lang > racket/signature. This works:

Re: [racket] Simple Chat system in Racket

2015-02-04 Thread Matthias Felleisen
First, you figure out the sections on designing programs and functions. Second, you move on to the editor sections: http://www.ccs.neu.edu/home/matthias/HtDP2e/part_one.html#%28part._sec~3aedit1%29 http://www.ccs.neu.edu/home/matthias/HtDP2e/part_two.html#%28part._list-edit._sec~3alis%29

Re: [racket] Hello and a few questions

2015-02-04 Thread Matthias Felleisen
the math library and I am sure he will pipe in soon. -- Matthias Racket Users list: http://lists.racket-lang.org/users

Re: [racket] Global Learning XPRIZE -- and Racket?

2015-01-29 Thread Matthias Felleisen
ed by Racket. Our experience with that angle is great. Of course, this is not the same as building apps with Racket (for Android). But I agree that there is a chance and I encourage you to pursue this idea -- Matthias On Jan 29, 2015, at 3:34 AM, Byron Davies wrote: > The XPRI

Re: [racket] Drawing in the Canvas from outside

2015-01-27 Thread Matthias Felleisen
ent itself inside [pain-callback (lambda ... functions > ) under definition of canvas, but it looks strange and clumsy. > Sometimes I need just to run computations, but sometimes I need also to do > visualization with animation. > > How could I achieve this? > > Best regards

Re: [racket] Drawing in the Canvas from outside

2015-01-27 Thread Matthias Felleisen
define (my-draw) (send (send canvas get-dc) draw-line 100 100 0 200)) -- Matthias On Jan 27, 2015, at 12:09 PM, Alexandr M wrote: > Hello, > > How can I draw the line (for example) in the canvas object defined as: > > (define frame (new frame% [label ""] [width 7

Re: [racket] macro pattern problem

2015-01-26 Thread Matthias Felleisen
1. You should make your macro robust and deal with fewer than two elements in your uses. 2. Here is the same idea w/ syntax-rules: #lang racket (define-syntax quote-even (syntax-rules () [(_) '()] [(_ zero) (list 'zero)] [(_ zero one two ...) (list* 'zero one (quote-even two .

Re: [racket] Scribble: fake section links

2015-01-26 Thread Matthias Felleisen
Try that: @(toc-element #f "" (hyperlink "http://www.ccs.neu.edu/home/matthias/"; "Home")) -- Matthias On Jan 26, 2015, at 4:19 PM, David Van Horn wrote: > On 1/26/15 4:14 PM, Stephen Chang wrote: >>> Is there a way to make @link that appea

Re: [racket] htdp/2e: exercise 302, difficulties

2015-01-25 Thread Matthias Felleisen
Just a few MF-labeled comments -- Matthias ; An Xexpr.v0 (short for X-expression) is ; (cons Symbol '()) (define sv0.0 (cons 'machine empty)) (define sv0.1 (cons 'another empty)) ;These v0 I'm confident. ; An Xexpr.v1 is ; (cons Symbol [List-of Xexpr.v1]) (define

Re: [racket] htdp/2e: on types and popular scripting languages

2015-01-25 Thread Matthias Felleisen
mes -- and here it breaks this rule, so a comment is in order. -- Matthias On Jan 22, 2015, at 11:37 AM, Daniel Bastos wrote: > Near exercise 305, HtDP/2e says that "[in] ISL+ (... and in the currently > popular scripting languages) such an informal signature with a definite > me

Re: [racket] htdp/2e: exercise 197, a solution, feedback welcome

2015-01-25 Thread Matthias Felleisen
ines above and below). Good start. Mostly: cut junk, organize top down (most important to less important to least important functions). -- Matthias (require 2htdp/image) (require 2htdp/universe) ;Exercise 197. Consider the following data representation for finite state machines: (define-struc

Re: [racket] 2htdp/image: Silent cropping?

2015-01-24 Thread Matthias Felleisen
I prefer leaving it alone but documenting the limitation -- Matthias On Jan 23, 2015, at 9:30 PM, Robby Findler wrote: > Maybe the right thing to do is leave the arbitrary limit in there, but > make it based on the area, not based independently on the width and > height. Then you

Re: [racket] Typed Racket frustration

2015-01-24 Thread Matthias Felleisen
t would be superfluous to repeat every TR function in the documentation, > it still could be valuable to document some of the major departures from > Racket. I mean, I would read that, for sure ;) Actually it would not be superfluous. We just don't have the ma

Re: [racket] Very simple animation in #racket/gui

2015-01-23 Thread Matthias Felleisen
If you are new to Racket, you may wish to read How to Design Program 2e's Prologue: http://www.ccs.neu.edu/home/matthias/HtDP2e/ On Jan 23, 2015, at 11:48 AM, Alexandr M wrote: > Hello dear community members, > > I am trying to build a GUI with a very simple animation - jus

Re: [racket] Calculating cumulative sum of the list

2015-01-22 Thread Matthias Felleisen
an believe this, the documentation for that function even > *gives example code* for computing cumulative sums! > > Stupid git. > > Neil ⊥ > > On 01/22/2015 07:35 PM, Matthias Felleisen wrote: >> >> NOTE TO EVERYONE: The OP asked for "without usage of any

Re: [racket] typed/racket, promises, and type dispatch

2015-01-22 Thread Matthias Felleisen
it cannot dispatch in response to Racket. -- Matthias On Jan 22, 2015, at 11:39 AM, Luke Whittlesey wrote: > Hello, > > I've been learning TR, but I seem to have gotten myself into a corner that I > haven't been able to find a workaround for. I'm looking for some

Re: [racket] Calculating cumulative sum of the list

2015-01-22 Thread Matthias Felleisen
NOTE TO EVERYONE: The OP asked for "without usage of any libraries". I am sure that sooner or later we will find a library so that we can say (require lib/cumulative) cumulative-sum. On Jan 22, 2015, at 7:16 PM, William James wrote: > Here's a way using map-accum in Gauche. > > (use gauche.

Re: [racket] Calculating cumulative sum of the list

2015-01-22 Thread Matthias Felleisen
l + 0) >(build-list (length xs) >(compose (curry take xs) > add1)))) > > On Thu, Jan 22, 2015 at 6:34 AM, Matthias Felleisen > wrote: > > #lang racket > > ;; [Listof Number] -> [L

Re: [racket] Scribble and itemlists

2015-01-22 Thread Matthias Felleisen
I think these non-standard situations could be dealt with by an optional keyword argument to @item: @item[#:label "3a"]{...} -- Matthias On Jan 22, 2015, at 7:49 AM, Matthew Flatt wrote: > Oh, good point. I had checked Latex and HTML, but I didn't think to >

Re: [racket] Calculating cumulative sum of the list

2015-01-22 Thread Matthias Felleisen
#lang racket ;; [Listof Number] -> [Listof Number] ;; given (a b c ...) produce (a (+ a b) (+ a b c) ...) (define (cumulative-sum l #;"final private:" [so-far 0]) (cond [(empty? l) '()] [else (define next (+ so-far (first l))) (cons next (cumulative-sum (rest l) next))])) (

Re: [racket] About rendering to PDF under Scribble but from DrRacket IDE

2015-01-21 Thread Matthias Felleisen
for your support, and congratulations to the > Scribble designers: its really a great environment to work with. This is how I run a draft or a release version of HtDP/2e: #! /bin/sh #| exec /Users/matthias/plt/racket/bin/racket -tm "$0&q

Re: [racket] Why don't you tackle a universe-based pong game?

2015-01-21 Thread Matthias Felleisen
tp://www.ccs.neu.edu/racket/pubs/#esop14-gjthf (which is a conference publication) and follow the link to supplemental information. Marketplace and Minimart are of course available as packages. Warning: both are prototypes and will evolve (probably into another language). -- Matthias

Re: [racket] htdp/2e: exercise 48, drracket highlighting

2015-01-19 Thread Matthias Felleisen
I have replaced the second "occurrence" of cases with "complete conditional." Perhaps this will help a future reader. Thanks -- Matthias On Jan 19, 2015, at 7:55 AM, Daniel Bastos wrote: > Exercise 48. If you copy and paste the above function definition into the

Re: [racket] TR: Polymorphic types

2015-01-17 Thread Matthias Felleisen
thing as moving from the typed to the untyped world (and vice versa). Perhaps an example like Jordan's could be included in the docs. -- Matthias Racket Users list: http://lists.racket-lang.org/users

Re: [racket] racket/gui : How to properly code a two window system ?

2015-01-17 Thread Matthias Felleisen
t-field an-instance-of-add-item) ... ;; And further down you add a method add: (define/public (callback event . x) (send an-instance-of-add-item add-item ... stuff ...)) )) -- Matthias On Jan 17, 2015, at 8:15 AM, mazert wrote: > Hello, > > I have two files : >

Re: [racket] htdp/2e: on the choice of some names

2015-01-15 Thread Matthias Felleisen
On Jan 15, 2015, at 10:56 AM, Daniel Bastos wrote: > (*) Curiosity > > 1. I wonder what BS stands for in this definition. > > ; A BS is one of: > ; — "hello", > ; — "world", or > ; — pi. > > Is it just a synonym for nonsense? Nothing in particular but I should change it because of its bad c

Re: [racket] ok what's wrong there 'syntax-rule' evaluating its operand (??)

2015-01-14 Thread Matthias Felleisen
[cc user@ again] There is no bug in syntax-rule/s. Macros do not evaluate anything. They rewrite code. Code refers to identifiers. This relation must remain apparent. That's it. -- Matthias On Jan 14, 2015, at 9:57 PM, Thomas Lynch wrote: > As for the demonstrative

Re: [racket] ok what's wrong there 'syntax-rule' evaluating its operand (??)

2015-01-14 Thread Matthias Felleisen
On Jan 14, 2015, at 8:14 PM, Thomas Lynch wrote: > Matthias thank you for fielding my question, though two things are not clear. > I hope you or someone might clarify. > > Firstly, is there a reason to prefer the macro you present over the first > one given in the or

Re: [racket] ok what's wrong there 'syntax-rule' evaluating its operand (??)

2015-01-14 Thread Matthias Felleisen
You want something like this: (define-syntax (with-tables stx) (syntax-case stx () [(with-tables stem body ...) (let ([table-author (datum->syntax stx 'table-author)] ;; ... ditto for other identifiers for which you wish to break lexical scope ) #`(let

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

2015-01-08 Thread Matthias Felleisen
x27;t appear: to the left of a ) > ; readline-input:4:8: read: unexpected `)' > -> (+ 10 x' ) Same here. ;; --- In principle, ' would be good to use as part of a name but I prefer to use it for quoted S-expressions if that's the choice I have. Then again, I

[racket] Racket Winter Release

2015-01-08 Thread Matthias Felleisen
cycle instead (3) resume our regular release rhythm this spring. Thanks for your patience. Matthew, Robby, Sam, Ryan, Jay, and Matthias Racket Users list: http://lists.racket-lang.org/users

<    3   4   5   6   7   8   9   10   11   12   >