[racket] Offtopic: Learning SML

2011-09-18 Thread Prabhakar Ragde

Grant Rettke wrote:


Are _ML for the Working Programmer_ and _Elements of ML Programming,
ML97_  a good place to start?


I am a great fan of "Working Programmer", not of "Elements".

Quite apart from its clear and sensible treatment of SML, "Working 
Programmer" has many case studies that will be valuable to functional 
programmers, even if they never write an SML program. It's a nice 
addition to a compact bookshelf. --PR

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


[racket] list in Beginning Student

2011-09-30 Thread Prabhakar Ragde
When did `list' sneak its way into Beginning Student (without List 
Abbreviations)? Or has it always been there, and I have always been just 
clueless? Thanks. --PR

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] list in Beginning Student

2011-10-01 Thread Prabhakar Ragde

On 10/1/11 8:33 AM, Todd O'Bryan wrote:

I actually wish it weren't in there. One student discovers it, and
lots of students start using list instead of cons ... empty. That
wouldn't be a problem except that most of them don't have the
conceptual chops yet and I have to fix their confusion.


Yes. I have noticed confusion of (list x y) and (cons x y). And I still 
don't know where they get (append (list x) y) and how to prevent it.


Another thing I might take out is `reverse'. They tend to use it to fix 
up recursions that they've gotten wrong. They can't write an efficient 
version using the templates, and they think that every built-in function 
is "free" in some sense, even as they carp about having to, say, do two 
recursive computations on the same list instead of putting them in "one 
loop".


But right now I am marking proofs they have done, after which it will be 
a pleasure to get back to mere programming errors. --PR

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


[racket] match in Advanced Student?

2011-10-31 Thread Prabhakar Ragde
Is there a written description (suitable for students) of which patterns 
are legal for `match' in Advanced Student, or do I have to dig into the 
implementation and then write one myself? Thanks. --PR

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] match in Advanced Student?

2011-10-31 Thread Prabhakar Ragde

On 10/31/11 3:42 PM, Shriram Krishnamurthi wrote:

I found this confusing when I first encountered it -- the patterns are
at the TOP of the page (but not linked from the match docs).  Scroll
to the top and look for "pattern" in the BNF.


Thanks, Shriram. That plus the Guide entry will probably do for my 
students, along with plenty of warnings. --PR

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


[racket] a few small Scribble questions

2011-11-06 Thread Prabhakar Ragde
If I use `racketgrammar' to define a grammar, and then want to refer to 
one of the non-terminals within it in subsequent text, can I get it to 
appear in the same font?


When using `racketblock', can I get an identifier typeset in the same 
style as a syntactic form without having previously documented it using 
`defform'?


(These two questions arise when writing about toy interpreters. I want 
to discuss grammars and give examples for the language to be 
interpreted, which is typically a close cousin of Racket.)


Is there a way to typeset unbalanced code fragments? (That's asking a 
lot, I know.)


Having required for-label bindings to get hyperlinks, can I turn them 
off selectively? (E.g., when talking about something I want students to 
implement using a teaching language that happens to have the same name 
as something in full Racket.)


Thanks. --PR
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


[racket] match and debug in Advanced Student

2011-11-08 Thread Prabhakar Ragde
I never use the Debug button, but I let my students start using Advanced 
Student today, and of course they tried it out.


The following program induces a strange error when the Debug button is 
pressed.


(match 3
  [`(,x) 3]
  [x 3])

The error is:
internal error: skipped binding is used

after which the program hangs, though it can be stopped with the Stop 
button. --PR

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Challenge: in 140 chars or less

2012-02-23 Thread Prabhakar Ragde

Neil Toronto wrote:


What's your favorite not just computable, but tweetable function?


(define (r n)
  (for/fold ([s 1] [l '()]) ([i n])
(values (/ 1 (- (* 2 (floor s)) s -1)) (cons s l

I tweeted this to make sure it fit. I had 23 characters to spare, could 
squeeze a bit of whitespace out, then use the rest to make it more 
elegant, but I have actual work to do... --PR


 Racket Users list:
 http://lists.racket-lang.org/users


[racket] Using scribble as a shim for latex

2012-05-14 Thread Prabhakar Ragde

Ian wrote:


Anyway, I now find myself wanting use the listings package to write
some pseudocode with mathescape (thus, verbatim is not good enough).
I cannot use the identity trick for the lstlisting environment for
whatever reason. It causes pdflatex to explode.


I've been using Scribble on top of LaTeX/Beamer for course slides. I 
spent some time trying to get the listings package to work without too 
much effort, and gave up. It's very sensitive, as LaTeX code can be. My 
sense is that it would require some work down at the rendering level in 
Scribble/Racket (or, worse, some LaTeX macro hacking), but I'd love to 
be proven wrong.


Those of us who are interested in using Scribble in this fashion should 
maybe try to figure out some way to coordinate efforts and share tips. --PR


 Racket Users list:
 http://lists.racket-lang.org/users


Re: [racket] release date for RacketCon videos?

2012-05-15 Thread Prabhakar Ragde

Todd wrote:


This is clearly a problem with you academic types not knowing how
things work in the real world. San Francisco is *full* of people who,
for the right price, will be happy to rifle through Mr. Dlouhy's
things until they find the videos or determine that he doesn't have
them. They might even throw in a pistol-whipping for free.


Or, you know, they could arrange to have Mr. Dlouhy wake up and find a 
severed Git HEAD in his bed. --PR


 Racket Users list:
 http://lists.racket-lang.org/users


Re: [racket] state of math expressions in Scribble?

2012-07-05 Thread Prabhakar Ragde

Jens Axel wrote:


Prabhalar Ragde's code from

http://con.racket-lang.org/pr-slides.pdf

works quite well. Code ready to use in:

https://github.com/soegaard/bracket/blob/master/docs/pr-math.rkt


Thanks for making this more accessible, Jens Axel. One caveat is that 
the MathJax approach only works if you are connected to the Internet 
while displaying the page. If you are offline, you see the raw LaTeX 
markup (which is a good fallback for me, as I use pseudo-LaTeX in 
answering student questions on forums and in email, and they seem to 
adapt to it very quickly). A MathML approach would probably be better in 
the long run, as more browsers come to support it. --PR


 Racket Users list:
 http://lists.racket-lang.org/users


[racket] Teach Yourself Racket (version 0.1)

2012-08-31 Thread Prabhakar Ragde
I've been meaning for some time to write something called Teach Yourself 
Racket, and finally scraped an alpha version together under threat of 
classes starting (I'm going to use it in my grad course). I'd appreciate 
comments to help me improve it.


https://cs.uwaterloo.ca/~plragde/tyr/

Followups by private e-mail to me, please, unless they're really 
relevant to the community at large. Thanks. --PR


 Racket Users list:
 http://lists.racket-lang.org/users


[racket] Scribble->HTML: adding to head

2012-09-11 Thread Prabhakar Ragde
How do I add a  pair of tags to the of an 
HTML document rendered from a Scribble document (though code in the 
Scribble file)? I know how to put them into the . Thanks. --PR


 Racket Users list:
 http://lists.racket-lang.org/users


Re: [racket] Scribble->HTML: adding to head

2012-09-14 Thread Prabhakar Ragde

On 2012-09-11 8:07 PM, Matthew Flatt wrote:


In the latest in the git repo, I've added `js-addition' to
`scribble/html-properties'. It's like `css-addition': you can attach it
to anything as a style property, and it bubbles up to the enclosing
section that corresponds to the HTML page. When a `js-addition' refers
to a file, the file is copied to the destination when rendering.


Just a brief comment to note that Matthew, in follow-up conversation the 
same evening, changed `js-addition' to let it take URL structures, which 
makes my code to use MathJax to put math into Scribbled HTML documents 
even simpler (and it works for servers which filter out script tags in 
the body, as was the case for my LMS). Yet another example of amazingly 
fast and effective response. Thank you! --PR


 Racket Users list:
 http://lists.racket-lang.org/users


[racket] Quarter-circle in upper right of Definitions window?

2012-09-17 Thread Prabhakar Ragde
Sorry if this is a dumb question. This small quarter-circle, with an 
arrow in it, appears from time to time, and then disappears. It contains 
some links to documentation. I cannot tell what is causing it to appear 
and what causes it to disappear...? Thanks. --PR


 Racket Users list:
 http://lists.racket-lang.org/users


[racket] redex + #lang = awesome

2012-10-24 Thread Prabhakar Ragde

David Van Horn wrote:


Then I thought, PCF's binding structure is a lot like Racket's: wouldn't
it be nice to get syntax coloring, syntax arrows, renaming, etc.  That
was about another 30 lines of code.


Can you say a few words about how you achieved this? Thanks to Matthew's 
article and RacketCon tutorial, I now know how creating languages works, 
but he didn't cover this last bit. I could start poring over the code, 
but I suspect a minute or two of your time will save me a lot more. 
Thanks. --PR


 Racket Users list:
 http://lists.racket-lang.org/users


[racket] Generating PDF from Scribble on Windows

2015-03-11 Thread Prabhakar Ragde
I'm working with our online/distance-learning people to set up a course, 
and creating my slides in Scribble using the "Scribble PDF" button. A 
change in personnel is coming up, and the new developer is using 
Windows. My current developer is using OS X like I am, and he reports 
with some alarm that DrRacket in Windows is missing the "Scribble PDF" 
button when editing a Scribble file. The buttons that are visible (I 
have a screenshot if anyone needs it) are Debug, Check Syntax, Macro 
Stepper, Scribble HTML, Run, Stop. The Windows machine has LaTeX 
installed. Can anyone diagnose this issue? Thanks. --PR


 Racket Users list:
 http://lists.racket-lang.org/users


[racket-users] Re: Removing duplicates from a list while maintaining order

2015-06-03 Thread Prabhakar Ragde
This is a homework question of mine (though I don't think the OP is 
doing homework for a course for credit; I'd be curious to know where he 
found it). I usually state the restrictions on 'reverse' and 'remove', 
but not 'member?'. The restriction on 'reverse' is so that students 
don't write one of the functions by reversing, calling the other, 
reversing again. Also sometimes when students violate structural 
recursion, they get a reversed result, and I don't want them applying 
'reverse' as a quick fix. The restriction on 'remove' is on the built-in 
function of that name, because it only removes one element, and using it 
leads students away from structural recursion. Recently I have taken to 
hinting that they should write something like remove*. --PR


--
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 options, visit https://groups.google.com/d/optout.


[racket-users] TeX- and LaTeX-inspired keybindings

2015-07-14 Thread Prabhakar Ragde
Is there a simple way to extend the list of these and/or provide 
synonyms? (DrRacket documentation, section 3.3.8.) I would like to, for 
example, be able to type \and, or at least \land, rather than \wedge. 
Thanks. --PR


--
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 options, visit https://groups.google.com/d/optout.


[racket-users] Scribble PDF button on OS X 10.11

2016-01-12 Thread Prabhakar Ragde
I upgraded to OS X 10.11 (El Capitan), and now when I launch DrRacket 
from the Dock, the "Scribble PDF" button cannot find the pdflatex 
executable. Upgrades tend to mess things up but in this case 
/usr/local/texbin no longer exists and cannot be created in the new OS. 
It was a symlink to /usr/local/texlive/... before, and I put a symlink 
to that where I could create one and put that path in my .bash_profile 
and in /etc/paths. Now I can launch DrRacket from Terminal and it works. 
But not from the Dock.


This is not really a Racket problem, but I hope someone reading this has 
encountered and has a solution. Thanks. --PR


--
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 options, visit https://groups.google.com/d/optout.


[racket] What is inexactness about?

2010-09-01 Thread Prabhakar Ragde

Stephen Bloch writes:


An example in my textbook is

(define TANK-CAPACITY-GALLONS #i13.6) (define MPG #i28)

because the capacity of a gas tank, and miles-per-gallon fuel
efficiency, are based on physical measurements and therefore
inherently inexact.


I think this is misguided. The proper response to uncertainty in data is 
to use something like interval arithmetic (which is, of course, beyond 
scope for an introductory course).


"Inexact" in Racket is code for IEEE double-precision floating point. 
This represents a fixed set of numbers in such a way that many 
computations that would mathematically produce a value not in that set 
will instead produce as close a value in the set as possible.
That value may have little to do with the uncertainty in the original 
data, and may display in a peculiar way (e.g. 5.99 when 6.0 would be 
more readable and just as "inexact"), so I don't think it's a good idea 
to use inexact values in the given circumstance, if all you're doing 
with the data are elementary arithmetic operations.


The one place I tell my students to use inexact arithmetic with 
elementary operations is if the exact computation will result in values 
with a large representation -- for example, in doing some sort of simple 
physical simulation where the position or velocity of a particle is 
updated by some method involving division or multiplication. It's 
another "CS requires not only the creation of abstractions, but their 
systematic violation" teaching moment. --PR

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Looking for feedback on code style

2010-09-09 Thread Prabhakar Ragde

Noel Welsh wrote:


I think this is great code -- very clear. For production use you have
the wrong data structure (Lists are O(n) random access and length; you
want O(1) vectors), but that doesn't matter for your use.


I don't think vectors help very much in this case (median-finding). For 
the given code, the O(n) access to the middle of the list is dominated 
by the cost of the sorting, which is at least O(n log n) [*].


It is theoretically possible to compute the median in O(n) time, but the 
method is complicated and not very practical. But sorting definitely 
does too much work. If only the median (or the kth largest, a problem 
called "selection") is needed, a method which is both practical and of 
pedagogical interest stems from adapting Quicksort, which is a good 
exercise after section 25.2 of HtDP. This has expected cost O(n) on 
random data, and vectors offer no asymptotic advantage over lists. --PR


[*] Technically, "at least Omega(n log n)".
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Looking for feedback on code style

2010-09-09 Thread Prabhakar Ragde

On 9/9/10 11:26 AM, David Van Horn wrote:


The original post got me interested in median algorithms and I started
to read up on the selection problem. Wikipedia (I know, I know) says the
same thing as you: medians can be computed in O(n) time and points to
selection as the way to do it. But I don't see how to use selection to
achieve a O(n)-time median algorithm -- selection (of the kth
largest/smallest element) is O(n), but that's were k is some fixed
constant. To compute the median, you let k=n/2 (right?), so it's no
longer constant. Can you point me to (or sketch) a O(n) method? Or just
correct me if my reasoning is going astray.


Selection can be done in O(n) time regardless of the value of k. It's 
not at all obvious, and is a classic result from 1975 or so.


The idea is to split the n elements into sets of 5, find the median of 
each set by an ad-hoc method, recursively find the median of the 
medians, and use that to partition the n elements as in the Quicksort 
method. That is guaranteed to remove about 3n/10 elements (every median 
smaller than the median of the medians, and two elements from each 
associated set). So you get a recurrence like


T(n) = T(n/5) + T(7n/10) + O(n)

which has a solution that is O(n). The constant is pretty high, though.

It occurred to me while writing my earlier response that, while I have 
taught this in a third-year algorithms course (eliciting mostly blank 
stares), Racket makes it possible for the average student to actually 
implement it. Not that there's any point in doing that, besides being a 
nice programming exercise. --PR

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Looking for feedback on code style

2010-09-09 Thread Prabhakar Ragde

On 9/9/10 11:33 AM, Phil Bewig wrote:

http://programmingpraxis.com/2009/12/11/selection/


This method takes O(n) time with high probability if the partitioning 
element is chosen deterministically and the data is randomly permuted 
(with all permutations equally likely) or if the partitioning element is 
chosen uniformly at random. Its deterministic worst-case cost is O(n^2). 
However, for a site called "Programming Praxis", it's definitely the 
right choice.


Our attitude towards randomness in computer science is a bit strange. 
I'm convinced most of our students graduate thinking that Quicksort is 
an O(n log n) algorithm, but this is only true in a probabilistic model. 
On the other hand, the shortest, cleanest, and most elegant method I 
know of to balance binary search trees (which underlies non-hash 
efficient set and map implementations) uses randomness, but no one talks 
about it or knows it. --PR

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Looking for feedback on code style

2010-09-09 Thread Prabhakar Ragde

Will M. Farr wrote:


Looks like Phil beat me to it, but here's some code that finds the
n-th element of a list in O(N) time.  The algorithm is similar to
quicksort, but you don't sort both the sub-lists: partition the list
into elements less than and greater or equal to a pivot.  By counting
the number of elements less than the pivot, you know whether the one
you're looking for will be found in that set, or in the greater or
equal set.  Repeat the search in the appropriate set.  The partition
takes O(N) time.  On average, it cuts the number of elements searched
in half each time, so we have

total time = N + N/2 + N/4 + ... = 2*N as N --> infty


Not quite. Consider the case of the median. If the pivot is the smallest 
element, the recursion is on N-1 elements. If the pivot is the second 
smallest, on N-2; and so on. If the pivot is the median, you can stop 
(not all provided code does this, but it doesn't matter much for the 
analysis). But the situation is symmetric on the other side: if the 
pivot is the largest element, the recursion is on N-1 elements, and so 
on down. So the expected number of elements the recursion is performed 
on is about 3N/4.


And then what? Are we justified in saying T(N) = T(3N/4) + O(N)? Really, 
we have T(N) = T(X) + O(N), where X is a random variable uniformly 
distributed over [0..N-1]. With a suitable induction hypothesis, we can 
dig ourselves out of this, but it's not simple, unfortunately. --PR

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Looking for feedback on code style

2010-09-09 Thread Prabhakar Ragde

On 9/9/10 12:09 PM, Phil Bewig wrote:

I did treaps, too: http://programmingpraxis.com/2009/06/26/treaps/.  And
I use them all the time, including where most people probably use hash
tables, because so often you need the keys in order somewhere in your
program.


I'm sorry, I shouldn't have said "no one"; I should have said "almost no 
one". I have seen references to it in various code bases. But it isn't 
the first thing that comes to most people's minds.


Your hints, and the solutions provided, use rotations, which is the way 
the original Aragon-Seidel paper presented the material. (Aragon and I 
were fellow grad students.) The split-join implementation of Blelloch 
and Reid-Miller [SPAA 1998] is better suited to a purely functional 
implementation and results in cleaner, shorter code -- simple enough 
that I can use it as enrichment material for a first-year class, and 
present it in a single tutorial session. --PR

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Looking for feedback on code style

2010-09-09 Thread Prabhakar Ragde

On 9/9/10 1:27 PM, Will M. Farr wrote:

Nevertheless, it sure feels like it's O(N) (I've experimented quite a
bit with timing tests, and the simple argument about averages I gave
before "feels right").


Your intuition is correct; it's a bit tricky, but not too tricky, to 
show that the algorithm runs in expected time O(N), and that can be 
strengthened to "with high probability". You can Google "randomized 
selection" to find PDFs or PPTs of lectures at major universities that 
show the calculations. (The ones I checked assume monotonicity -- that 
is, assuming that the recursion on the larger piece is more costly -- 
which really should be proved also.) I think we can end this part of the 
thread now, or at least take it to private e-mail, as what we're talking 
about no longer has a connection to Racket! --PR

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Looking for feedback on code style

2010-09-13 Thread Prabhakar Ragde

On 9/13/10 1:34 PM, Phil Bewig wrote:

Fixed.  See the comment at
http://programmingpraxis.com/2009/12/11/selection/.

Prabhakar:  You are correct that shuffling once at the beginning is
sufficient.  But I am interested in your critique of shuffling.  Do you
know a better way to shuffle a list than to convert it to a vector,
shuffle in place, then convert back to a list?  You might look at this
discussion:
http://groups.google.com/group/comp.lang.scheme/browse_thread/thread/24270db01f684439/e54c99564028efec.
  The list-vector-list method is O(n); any functional method appears to
be O(n log n).


I don't know of a purely-functional way to shuffle a list of length n 
(where every permutation is equally likely) in o(n log n) time 
("little-o"). It's an interesting problem.


But the reason that the randomized selection algorithm takes O(n) time 
with high probability is that it discards chunks of the original list, 
avoiding the overhead of going over them again and again. The depth of 
the recursion is still Omega(log n) with high probability, but the size 
of the recursion is getting small fast enough that that doesn't matter.


By choosing a random pivot each time, instead of a deterministic pivot 
after an expensive shuffling operation, you reap the same benefit, you 
get the O(n) running time (w.h.p), the code is clearer, and the analysis 
is easier (because each pivot choice is independent of earlier ones). --PR

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] [BULK] Re: Looking for feedback on code style

2010-09-13 Thread Prabhakar Ragde

On 9/13/10 2:46 PM, Stephen Bloch wrote:


Do you know a better way to shuffle a list than to convert it to a
vector, shuffle in place, then convert back to a list? You might look
at this discussion:
http://groups.google.com/group/comp.lang.scheme/browse_thread/thread/24270db01f684439/e54c99564028efec.
The list-vector-list method is O(n); any functional method appears to
be O(n log n).


In fact, ANY method to do this (even with a vector) takes Omega(n log n)
time. It needs to be able to produce any of n! different answers, so it
needs to make at least log(n!) decisions, which is Theta(n log n).
Otherwise there wouldn't be enough leaves on the decision tree.


Sure, in a decision-tree model. But the computational model of Scheme 
isn't that restrictive. Indexing into a vector takes O(1) time and can 
be used to replace a decision tree with n leaves.


One of the things that irritates me about a conventional algorithms 
course is that the underlying model is so fuzzy. When we talk about an 
input of size n, we are really assuming a RAM model with word size c log 
n for some constant c big enough to implement our algorithm without too 
much pain, even though no real machine has an arbitrarily expandable 
word size. And we're not very clear, in these days of powerful languages 
with powerful libraries, about what exactly can be assumed to take O(1) 
time. --PR

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] [BULK] Re: Looking for feedback on code style

2010-09-13 Thread Prabhakar Ragde

Chris Stephenson wrote:


But, on the other hand, O(log n) is, for most practical purposes, very
close to O(1), so why worry?


Because we're not consistent about when we worry and when we don't. This 
thread, for example, is mostly about logarithmic factors. And we 
wouldn't accept a statement like "Sorting n numbers takes O(n) time". 
But we ask our students to implement in, say, C++, where it's obvious 
that log n <= 32 or 64, and bit-twiddling tricks that are hard to resist 
fall outside the rules, really. Working in a purely functional language 
delays these issues, thankfully. --PR

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


[racket] [plt-edu] Re: SIGCSE AWARDS

2010-10-06 Thread Prabhakar Ragde

> Now I have to figure out how to get to Dallas to hear Matthias's
> address...

What is the likelihood that the address will be put on-line?


I don't know about SIGCSE, but last week Matthias gave an invited talk 
at the International Conference on Functional Programming (ICFP) with 
the title "TeachScheme! -- A Checkpoint", and it was videotaped. Last 
year's ICFP videos are online, so I expect that this year's will be too, 
shortly. Of course, the audiences are quite different, and what he has 
to say to a roomful of AP Java fans may be more helpful to many here 
than what he has to say to a roomful of people already convinced of the 
merits of functional programming. Still, I think you will find the ICFP 
talk valuable (I certainly enjoyed it), and it will help fill the gap 
until the SIGCSE one is available (if it is). --PR

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


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

2011-03-30 Thread Prabhakar Ragde

Matthias wrote:


Do you think these give a better explanation of macros? On the
whole, I have found Teach Yourself Scheme relatively easy to
follow.

Yes, but when it comes to macros, it espouses a view that was never
compatible with any Report on Scheme and is even old-school for plain
Lisp. If you care about Scheme per se, see Dybvig's book. If you wish
to study the most powerful macro technology in the world, study the
Guide. -- Matthias


This comment is about more than macros: Since students are often drawn 
to TYS even though I never mention it to them, I've always been tempted 
to "translate" TYS into what is now Racket, not just literally but with 
some of the HtDP philosophy infused. While I think the Guide is great, 
as are HtDP and HtDP/2e, I wonder if there is some value in a document 
of the length of TYS, and whether TYS can serve as a model. --PR

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Meeting

2011-05-09 Thread Prabhakar Ragde

On 5/9/11 5:54 PM, Colette Fortin wrote:


I hope you are enjoying this beautiful sunshine. I was wondering if you
had time to come in on Wednesday to have a first look at the financial
information?

I have time at 1:00 or 11:00.


I'll take 11:00, thanks.


Also we have our parenting seminar on Wed. May 18 from 6-9 pm. Zazuki is
older now but I wanted to invite you just the same. Totally optional for
you.


Thanks, but I'll pass.

I argued to Z that I should get Mother's Day gifts. She countered that 
she was effectively parenting herself, so she should get the gifts. 
Maybe I should send her to the seminar. --PR

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


[racket] sorry for the spam (was: Meeting)

2011-05-09 Thread Prabhakar Ragde
I will be better about checking autocompletions in future. My apologies. 
--PR

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] #lang

2011-05-15 Thread Prabhakar Ragde

Shriram wrote:


(Btw, could you use a mail reader that preserves threads?)


I read the digest versions of Racket mailing lists, and I have to 
explicitly do this (as with this message) by manually copying the 
Message-ID field. Furthermore, I had to learn how to configure 
Thunderbird to give me the choice of an In-Reply-To header field to copy 
the message ID into. (And I have to manually copy subject and quoted 
text, but that's more straightforward.)


I know, I should move into the twenty-first century some time, and set 
up proper mail filters, so that I wouldn't need the digest. But I 
suspect then I would never get around to reading individual messages.


By the way, I have learned important lessons from this thread and its 
predecessor about how to respond rationally to criticism. My compliments 
to all involved. --PR

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


[racket] a couple of trivial Scribble questions

2011-05-15 Thread Prabhakar Ragde
I put the first example in section 1.1 of the Scribble documentation in 
Help Desk into a file test.scrbl in DrRacket (5.1.1). I can run it, and 
nothing happens. Should something? (I'll accept "No" as an answer, but 
then what does the Run button do?) And shouldn't there be a Check Syntax 
button? I only see Run and Stop.


Also, when I render this file into PDF on the command line, there's a 
date. How do I get rid of it? In LaTeX, I'd just say \date{}.


Thanks. --PR
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] a couple of trivial Scribble questions

2011-05-15 Thread Prabhakar Ragde

On 5/15/11 9:44 PM, Matthew Flatt wrote:


Yes, Check Syntax should be there. More importantly, you should see
buttons to generate HTML and PDF.

If you open the document source again in DrRacket, do the buttons
appear? Does editing and reverting the `#lang' line make them appear?


That did it. Thanks. I should have realized that it would be bound to 
the #lang line, not the file extension.



I've added a `#:date' argument to `title', so you can write

  @title[#:date ""]{On the Cookie-Eating Habits of Mice}

with the very latest from the git repo.

For any earlier version, use

   @(require scribble/core)
   @(make-paragraph (make-style 'pretitle '())
(make-element "date" ""))


Thanks. I was trying to use make-element but I couldn't get the binding. 
I guess I assumed that scribble/core was loaded by scribble/base, 
without actually checking. --PR


_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


[racket] Scribble: exact-chars in multiarg-element

2011-05-18 Thread Prabhakar Ragde
The 'exact-chars style property works with `element', but not with 
`multiarg-element'. (I can see why, in scribble/latex-render.rkt.) Was 
there a reason for this? I need to render something like


\setbeamerfont{myfont}{size={40}{44}}

and the braces around the numbers are being escaped, which of course 
does the wrong thing. How do I get behaviour like this? Thanks. --PR

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Scribble: exact-chars in multiarg-element

2011-05-19 Thread Prabhakar Ragde

On 5/18/11 11:32 PM, Robby Findler wrote:

Can you set up a helper macro that is just the identity and end up
with something like this?

   \newcommand{\somethingorother}[1]{#1}
   \setbeamerfont{myfont}{\somethingorother{size={40}{44}}}


You would think so, but \setbeamerfont is finicky about the form of that 
argument. However, in perusing the Beamer manual, I discovered that what 
I wanted to say (there was a * missing in my original question as quoted 
above):


\setbeamerfont{myfont}{size*={40}{44}}

is equivalent to

\setbeamerfont{myfont}{size=\fontsize{40}{44}}

and I can build that in Scribble, since there are no escapes in the 
arguments of \fontsize.


But before I realized that, I spent some time looking for alternatives 
involving \bgroup and \egroup in the TeXBook last night, which I first 
read in detail in 1984. Talk about an unhygenic macro system!


There's a bug in the rendering of multiarg-element in latex-render.rkt. 
The 'exact-chars property is not "inherited" by the list of elements 
during the recursive rendering. --PR

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


[racket] commenting out unbalanced parts of Scribble programs

2011-05-20 Thread Prabhakar Ragde

In Scheme I can comment out unfinished, unbalanced code:

#|

(define (my-function

|#

How do I do this in Scribble? Thanks. --PR
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] commenting out unbalanced parts of Scribble programs

2011-05-20 Thread Prabhakar Ragde

On 5/20/11 9:42 AM, Matthew Flatt wrote:


Eli made Scribble's at-exp notation more general: It lets you pick the
brackets for a comment after `@;', so you can pick a closer that isn't
used in the region to comment out.

For example, to comment out a single "}",

  @;{
}
  }

would not work, but

  @;|{
}
  }|

works.


Thanks! In the Scribble documentation, section 2.4.1 introduces 
alternative body syntax `@|whatever{ ... }whatever|' for @-expressions, 
but it wasn't clear to me from section 2.4.3 on comments that this 
applied to comments (though I suppose it may be implicit in the 
parenthetical remark "following the same rules for @-forms"). --PR

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


[racket] Gambit Scheme for the iPhone and iPad

2011-06-04 Thread Prabhakar Ragde
I stopped reading comp.lang.scheme some time ago, so I wasn't aware 
until just now that in early May, Marc Feeley succeeded in placing a 
Gambit Scheme universal app (iPhone/iPad) in the App Store.


http://itunes.apple.com/us/app/gambit-repl/id434534076?mt=8

This is the first indication I had that Apple had relaxed their App 
Store restrictions sufficiently to permit real programming language 
interpreters. I thought others on this list might be interested in 
knowing this fact. --PR

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Gambit Scheme for the iPhone and iPad

2011-06-05 Thread Prabhakar Ragde

On 6/4/11 10:55 PM, Nevo wrote:


Have you by chance bought that app and
actually run on your iPhone/iPad?


Yes. It's only 99 cents. I have not used it extensively, since I only 
noticed it yesterday afternoon. Also I have not used my iPad in general 
extensively! I put it on my iPhone also, just for the amusement factor.



I just wonder whether this is console
based REPL only, or having graphics support as DrRacket does, how is the
performance (pure interpreter mode or JIT enabled?).


Console-based REPL, with a script editor, as Richard has pointed out. I 
have not tested performance, but the iPad 2 is fairly powerful, and 
Gambit Scheme has always had good performance, so I expect it will be 
quite credible.



I'm not clear if
Apple actually ever has explicitly restricted applications bundled with
a programming language interp, but they seems disallowing application to
download *script* or other executable files from other places.


I believe that Apple's restrictions in the past made this impossible, 
but they relaxed them last June, and people are testing the waters. You 
can currently cut-and-paste to/from the script editor, and I have found 
a port of an older version of Python to the iPhone/iPad that in its 
first revision supports file syncing through iTunes (which Gambit Scheme 
does not, yet). But dynamic downloading of code is not permitted, still. 
So, while Gambit has an open-url function, there is probably no way to 
get data from the Web into a Scheme program, as opposed to bringing up a 
browser.



I think we can provide a DrRacket like programming/educating/developing
environment.


I can't speak to how easy this might be to achieve, or whether it's 
really worth the effort, but having the student languages available in 
an iPhone/iPad app would be quite compelling. --PR

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


[racket] Integrating scribble and LaTeX

2011-06-21 Thread Prabhakar Ragde

Don Blaheta wrote:


I was looking to put some Racket code into a set of course notes I'm
writing up in LaTeX, and rather than just using verbatim, I thought this
would be a perfect time to figure out (at least the basics of) Scribble.

Only, I can't figure out how to integrate it with LaTeX.


Faced with the same decision a few weeks ago, I first decided, after 
learning what I could do with Scribble, to write everything in Scribble 
and render through LaTeX.


Then, after learning that I could use MathJax to display math in HTML, I 
decided to do my course notes (summaries for the students) in Scribble 
and render to HTML. This takes literally ten lines of pretty obvious 
Scribble code to set up.


I am producing slides in Scribble by rendering to LaTeX (Beamer) and 
then to PDFs.


I'd much rather write Scribble than LaTeX. --PR
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Integrating scribble and LaTeX

2011-06-21 Thread Prabhakar Ragde

On 6/21/11 9:07 PM, Robby Findler wrote:

FWIW, there is a way to pull in arbitrary latex code in, but it has to
interoperate with what scribble generates and setting it up, while not
difficult, does require some familiarity with the way scribble works
in a big picture kind of a way.


But he wants it the other way around: he wants to write small pieces in 
Scribble, render to LaTeX, and \include in a larger LaTeX document. 
Which would require some sort of scripted postprocessing of the 
LaTeX-from-Scribble fragment (not bad -- just removing the first several 
lines and the \end{document}), plus various includes in the larger 
document that the Scribble output expects. Can be done, but so far I'm 
not finding it hard to go the other way, converting LaTeX documents to 
Scribble. Of course, I haven't tried to do serious math, or serious 
tables. --PR


(PS I'm curious as to what Matthias intends to do when HtDP/2e gets to 
the point where people want a paper version.)

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Integrating scribble and LaTeX

2011-06-22 Thread Prabhakar Ragde

Don Blaheta wrote:


I certainly don't expect that a feature be implemented just because I
want it, and even good features may take a while due to being low
priority or whatever.  And there may well be some technical impediment
to just creating a scribble.sty and working from there that I (a
newcomer to the scene) can't see yet.  But even if you're attempting
evangelism (and perhaps especially then), the correct answer to "How do
I X" should in general not be "You shouldn't even want to X, you should
Y instead".  This response feels a lot like the rightly-derided
responses of "install linux!" whenever anyone asked "how to I get
Windows to..." on certain message boards a few years back: unhelpful and
annoying.


I'm sorry if my response was unhelpful and annoying. I've only glanced 
at Scribble internals and I've only been scribbling for a few weeks, but 
it has gone fairly quickly for me. So let me try to be more helpful.


What would be the impediment to just \including a Scribble-generated 
LaTeX file in another? The generated file would use a bunch of macros 
that need to be defined, and would load a bunch of packages in the 
preamble. You need those macro definitions and those package declarations.


So, in an empty directory, create a file called empty.scrbl, with the 
single line:


#lang scribble/manual

Run:

scribble --latex empty.scrbl

Now look at empty.tex, which has been generated. Looking at 
machine-generated LaTeX, or even a human-written class file, can be a 
horrible experience, but this isn't at all bad. It's pretty easy to see 
what is in the preamble here and what should go in your preamble. The 
document body is almost empty: two hooks (\preDoc and \postDoc) that you 
can ignore, and a \label that you can probably ignore. So take 
everything from the first \usepackage to just before the 
\begin{document}, and save it in the file from-scribble.tex. Make sure 
your LaTeX document has \include from-scribble.tex in its preamble.


Then, for each example.scrbl written in Scribble, render it to LaTeX, 
open it up in an editor, strip off everything from the start to the 
\preDoc and \label commands, and from \postDoc to the end (last two 
lines), save it, and \include example.tex at the right spot in your 
document. (Warning: I haven't done this myself, since I haven't even had 
breakfast yet. Other stuff might break. But I doubt it, given my 
experience with writing my own prefix files for Scribble-generated LaTeX.)


You can see that the last bit is easily scripted, if you have lots of 
examples. And you can see that the feature you want shouldn't be too 
hard to include as an option to `scribble' on the command line, with 
some thought as to how that might be best achieved. But until then, you 
have a workaround that's not too bad, I think. --PR

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


[racket] inter-column space in Scribble tables (LaTeX)

2011-06-24 Thread Prabhakar Ragde
Is there a simple way to put space between columns in Scribble tables 
rendered to LaTeX? Thanks. --PR

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Images in Scribble?

2011-07-01 Thread Prabhakar Ragde

Sam Tobin-Hochstadt wrote:


You can see examples of using images in scribble examples in the
documentation for the `2htdp/image' teachpack:
  
https://github.com/plt/racket/blob/master/collects/teachpack/2htdp/scribblings/image.scrbl
and the results:
  http://docs.racket-lang.org/teachpack/2htdpimage.html


I want to underline how awesome this is. I've already used this to 
prepare summaries for my early lectures, one of which involves a demo of 
universe.ss. I wrote this in my Scribble file:


@(define img-eval (make-base-eval))
@(interaction-eval #:eval img-eval (require racket))
@(interaction-eval #:eval img-eval (require 2htdp/image))

@interaction[#:eval img-eval
(place-image (circle 20 "solid" "red")
 150
 100
 (empty-scene 300 200))
]

and the resulting output, rendered perfectly in both HTML and PDF (via 
LaTeX), pretty-prints the code followed by the image that results from 
evaluating the code. This is going to make maintaining these summaries 
through various course offerings much easier than before. --PR

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Macros and literal-id

2011-08-09 Thread Prabhakar Ragde

Neil Van Dyke wrote:


The hardest macro tasks, in "syntax-rules",
become opportunities to show off how well one can do scary-looking CPS
that's really expensive at expansion time.


For my edification, as well as that of other macro newbies, can you give 
some examples of this, and how syntax-case can be more expressive? 
Thanks. --PR

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


[racket] match in Advanced Student?

2011-08-17 Thread Prabhakar Ragde
Why does this expression successfully evaluate in #lang racket but gives 
a syntax error in Advanced Student?


(match 1
  [(or 1 2) 'pass]
  [else 'fail])

The or-clause is highlighted and the error is "match: expected a 
pattern, but found a part".


Thanks. --PR
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] match in Advanced Student?

2011-08-17 Thread Prabhakar Ragde

On 8/17/11 10:30 AM, Shriram Krishnamurthi wrote:

My experience last year was that the restrictions on some of these
sub-forms were arbitrary and not helpful. It also makes it harder for
students because if they click on the "wrong" documentation, they
don't understand why the thing that the docs say should work doesn't.


Well, I certainly didn't. The Advanced Student documentation doesn't 
really explain `match', so one has to go to the Guide or Reference 
anyway (e.g. for quasipatterns). It takes some careful peering at the 
grammar of Advanced Student to notice that ASL `match' is restricted, 
and to figure out what is permissible.


I would like to use `and', `or', and `?' patterns, at least. But to do 
so I have to take the students into Advanced Student earlier than I want 
(just after functional abstraction) and forbid them to use all the `!' 
functions and I/O. However, if I'm only going to get a restricted 
version of `match' by doing that, I might as well take them into #lang 
racket.


Okay, maybe I won't go to that extreme yet. Let me see how far I can get 
without full `match'. --PR

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] match in Advanced Student?

2011-08-17 Thread Prabhakar Ragde

On 8/17/11 6:02 PM, Robby Findler wrote:

Could you just require match into bsl/isl?


I had problems with BSL at some point, I think, but it hardly matters, 
there's no point in doing it before BSL+, where it does work, except not 
with posns. Which I don't think I'll use with my students in the fall, 
but I can't guarantee that none of them will fall into that relatively 
minor pit. (If it were up to me, I would take the built-in definition of 
posns out. I don't think being able to use `make-posn' for a few minutes 
before introducing `define-struct' is worth the hassle.) --PR

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] match in Advanced Student?

2011-08-17 Thread Prabhakar Ragde

On 8/17/11 9:30 PM, Shriram Krishnamurthi wrote:

This is indeed a very confusing thread because we're talking about
requiring match but also requiring require, and while most "it"s refer
to a "require", some are to the former kind and some to the latter
kind.


Just before I was tempted to point out that one can require match but 
cannot require require without providing require, I realized that this 
thread was the Racket equivalent of the "Who's On First?" routine. --PR

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


[racket-users] Re: Getting young children started with Racket

2018-03-04 Thread Prabhakar Ragde
On Saturday, March 3, 2018 at 8:41:16 AM UTC-5, Paulo Matos wrote:
>
> Hello, 
>
> I have a 7yo daughter currently in 1st grade (Germany) and she was given 
> a password for the school computer. Having never touched a computer 
> before she is now being introduced to typing and the mouse. 
>
> I wonder if anyone has any experience with the following: 
>
> 1. Is it useful for a child this age to get introduced to programming if 
> they are not actively looking to learn? 
> 2. Is racket a good way to introduce it? 
> 3. Is 7yo / 1st grade a good time or too early and I should wait?
>

I used Racket with both my children at age 9. Here is a short writeup about 
it originally posted to this mailing list.

https://web.archive.org/web/20080612194829/http://home.adelphi.edu/sbloch/class/hs/testimonials/prabhakar.shtml

In answer to your questions, I would say (1) Demo it and see what they 
think, but let it be their decision; (2) Yes, the best one I know of!; (3) 
They need the potential to grasp the abstractions that an identifier may 
refer to a specific value or may range over all values, and the ability to 
distinguish those two situations. Seven might be a bit young, but you know 
your child best. Bootstrap did not exist when my children were the right 
age, and I would definitely think about that now.

Neil is right that some light instruction combined with suggested but not 
required exercises and encouragement to explore is best. Of course that has 
to be tailored to the situation. Exploration can be frustrating if things 
are obscure or counterintuitive. And my younger child wanted to learn how 
to use Terminal in OS X by typing things into it. I had to explain why that 
was dangerous! --PR


-- 
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 options, visit https://groups.google.com/d/optout.


[racket-users] slow LaTeX error output while using Scribble?

2016-03-29 Thread Prabhakar Ragde
I've started to do Scribble work within DrRacket with 6.4, and I've 
noticed that when I use the "Scribble PDF" button, and something goes 
wrong, the copious LaTeX error output that shows up in the Interactions 
window is much slower to scroll to completion than before (on the order 
of tens of seconds, where it used to be nearly instantaneous once it 
started to appear). Has anyone else noticed this? --PR


--
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 options, visit https://groups.google.com/d/optout.


[racket-users] Good Data Structures Book?

2016-12-14 Thread Prabhakar Ragde

Lawrence Bottorff wrote:


Can someone suggest a good text for data structures that would
compatible with Racket? All I see are treatments using C/C++, Java,
Python, i.e., the usual suspects. Or, how do you people at
Racket-friendly/based universities teach undergrad data structures?


I am developing such a course for a spring term (May-August) offering at 
the University of Waterloo (though it will probably use OCaml). There 
does not appear to be an ideal textbook; I plan to synthesize materials. 
There are FP books which cover some of the material in various 
languages: Simon Thompson's Haskell book, Algorithms by Rabhi and 
Lapalme (also Haskell), Larry Paulson's ML book. (In my opinion, Okasaki 
and Bird are too advanced for a first DS course.) Mark Allen Weiss's DS 
book in C is the best conventional book I have found; it is not afraid 
of recursion.


One issue is that an early FP approach may well cover some topics from a 
typical DS course, since it is possible to do so earlier. Examples from 
my own experience include various sorting algorithms, O-notation and 
algorithm analysis, various heap implementations of priority queues, 
treaps, AVL trees, RB trees, AA trees, tries, and KMP text search. I 
have covered these in various incarnations of first-year Racket courses 
(not all at once).


I'd be happy to consult if you are considering developing a course. --PR

--
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 options, visit https://groups.google.com/d/optout.


Re: [racket] Prabhalar Ragde's code

2013-12-06 Thread Prabhakar Ragde

On 2013-12-06 9:48 AM, John Clements wrote:


Yes, that code definitely has a dependency on an outside file called
"math-utilities.rkt".


The contents of Jens Axel's file:


https://github.com/soegaard/bracket/blob/master/docs/pr-math.rkt


is pretty much my "math-utilities.rkt". --PR

 Racket Users list:
 http://lists.racket-lang.org/users


[racket] Y combinator

2014-02-06 Thread Prabhakar Ragde

Matthew Johnson wrote:


My question is really a plea for someone to fill in the gaps in a
derivation of the Y combinator.


This is the source I use as a basis for my classroom presentations, with 
a few more details thrown in.


http://www.dreamsongs.com/Files/WhyOfY.pdf

--PR

 Racket Users list:
 http://lists.racket-lang.org/users


Re: [racket] Tail recursive module cons

2014-03-16 Thread Prabhakar Ragde

Matthias wrote:


What does tail-recursion modulo cons mean?


Some of my favourite academic paper titles:
Friedman and Wise, "CONS should not evaluate its arguments"
Baker, "CONS should not CONS its arguments"

--PR

 Racket Users list:
 http://lists.racket-lang.org/users


Re: [racket] Tail recursive module cons

2014-03-29 Thread Prabhakar Ragde

Yuhao Dong wrote:


The thing is, Racket's "stack" is a list of continuations. I don't see
how explicitly keeping the "stack" in an accumulator would help. Stack
overflow won't be a problem since the "stack" is a list on the heap, and
unless memory runs out you wont overflow.



I think that tail recursion doesn't help at all, and introduces
conceptual overhead. Racket doesn't use the stack, and converts to
continuation-passing, which is surprise-surprise *tail recursive* at
runtime anyway.


Yuhao, I think you got some of these ideas from lectures I gave almost 
exactly a year ago, but you may have forgotten or misunderstood some 
points I made at the time:


* Simply making an interpreter tail-recursive does not guarantee that 
that the interpreted program will use memory wisely. It only ensures 
that there is no stack overhead due to recursive applications of the 
interpreter itself (either through tail-call optimization [TCO] in the 
language the interpreter is written in, or trampolining/looping in a 
language that does not support TCO).


* The way in which we made the interpreter tail-recursive, by using a 
zipper on the AST which introduced a list of continuations to manage 
control, did ensure that if the interpreted program was tail-recursive, 
the list of continuations would not grow. We could see this by looking 
at the interpreter code and noting that continuations grow only when 
arguments are evaluated down to values and not when a function is 
applied to a value. However, if the interpreted program is not 
tail-recursive, the list of continuations will grow, because of the 
pending computation in the interpreted program. Furthermore, because 
that list of continuations is on the heap instead of the stack, there 
will be overhead associated with allocation and garbage collection.


* The development in lecture was an illustration of one way of achieving 
the goal of TCO in an imperative implementation that could be understood 
after six months of exposure to functional programming in Racket. But 
Racket itself has a more sophisticated implementation that incorporates 
more advanced ideas and optimizations. It does use the stack as well as 
the heap, but not in the simple way that a direct translation of the 
naive (non-tail-recursive) interpreter would.


I hope that helps clarify things. The lecture material was my attempt at 
giving you a sense of the ideas behind Racket's implementation, but it 
was not a description of what Racket actually does under the hood. That 
would probably take a whole course on its own, and a better teacher. --PR


 Racket Users list:
 http://lists.racket-lang.org/users


Re: [racket] set!: eval-ing to lvalues

2014-04-23 Thread Prabhakar Ragde

Stephen Chang wrote:


Reminds me of this:
http://james-iry.blogspot.com/2009/05/brief-incomplete-and-mostly-wrong.html

1990 - A committee formed by Simon Peyton-Jones, Paul Hudak, Philip
Wadler, Ashton Kutcher, and People for the Ethical Treatment of
Animals creates Haskell, a pure, non-strict, functional language.
Haskell gets some resistance due to the complexity of using monads to
control side effects. Wadler tries to appease critics by explaining
that "a monad is a monoid in the category of endofunctors, what's the
problem?"


Philip Wadler retro-legitimized this quote by saying it during a panel 
discussion at the Haskell Symposium 2013 (affiliated with ICFP), which 
made my whole month. --PR


 Racket Users list:
 http://lists.racket-lang.org/users


[racket] Python creep

2014-06-27 Thread Prabhakar Ragde

On 2014-06-26, 1:29 AM, users-requ...@racket-lang.org wrote:

I heard Cornell and Harvard use OCaml, of all things. . . .


Cornell appears to use Python and MATLAB in their first courses; I don't 
see OCaml until third year. Harvard uses OCaml in a second course; C, 
PHP, Javascript in a first.  Even CMU uses OCaml in a second or third 
course, after Python and a safe version of C.


We use Racket by choice in our first courses at Waterloo, and I use 
Haskell as well in my advanced version, but I wouldn't be unhappy if I 
had to use OCaml (though the students might be more unhappy). And if I 
were forced to use an imperative language, I would choose Python, 
probably (though I'd probably just stop teaching the first course). --PR


 Racket Users list:
 http://lists.racket-lang.org/users


Re: [racket] ] Converting symbols to procedures?

2014-08-11 Thread Prabhakar Ragde

Deren wrote:


Don't quote. You want to pass the class in a list, pass the class in a list.


You can also quasiquote and unquote. (list + *) can be written `(,+ ,*). 
This is overkill for such a small example, but is useful if you want to 
mix literal quotation and expressions while maintaining the readability 
of quote. --PR


 Racket Users list:
 http://lists.racket-lang.org/users


[racket] proof assistants, DrRacket and Bootstrap

2014-09-27 Thread Prabhakar Ragde

I have a few questions that might be off-topic.  Are you interested
in formal proofs?  Have you considered adapting DrRacket to give an
integrated editor for a proof assistant?  The proof assistants Coq
and Isabelle use jedit and ProofGeneral, which I think aren't nearly
as nice as DrRacket.  I actually use HOL Light, which nobody uses an
integrated editor for.  Here are the slides for a talk I gave at the
Institut Henri Poincar? in the workshop ``Formalization of
mathematics in proof assistants''
http://www.math.northwestern.edu/~richter/RichterIHPslide.pdf


I am teaching a grad course using Coq right now, and using Proof General 
within Emacs for it. That is not bad, but I would love to have a 
DrRacket interface. I know something like this is possible, because at 
Brown they used DrRacket to prepare and run OCaml programs, a few years 
ago. I really don't have the time to work on this, though. (And if I 
did, I would first work on teaching language subsets of Haskell, which I 
also would like to have inside DrRacket.)



HOL Light and Coq are written in OCaml, a dialect of ML, which is
therefore similar to Scheme, but it has one difference that I wonder
if anyone here's knows how to deal with.  Scheme is well-suited for
writing a Scheme interpreter, because of the quote feature.  OCaml
doesn't have a quote feature, so the question arises how to write an
OCaml interpreter inside OCaml.  That's not quite what I want to do,
but if anyone could explain how to do it, I'd be grateful.


In my senior undergraduate programming language course, I have them 
write various interpreters and typecheckers in various languages, 
including Racket, OCaml, and Haskell. In the latter two, you need to use 
algebraic datatypes to build an abstract syntax tree, and interpret 
that. So the expression (* (+ 1 2) (- 3 4)) might become


(Mult (Plus (Num 1) (Num 2)) (Minus (Num 3) (Num 4)))

Writing an interpreter for such an AST is even easier than in 
Racket/Scheme, due to concise pattern-matching syntax. But parsing an 
expression written in faux OCaml/Haskell is quite complicated. I don't 
ask students to do that, since it really is part of a separate course 
(both languages come with general parsing tools that can be used). 
Parsing is much easier in Racket/Scheme because of the similarity of 
code/data and the presence of 'read'.



I have a 7th grade student I'm trying to teach Racket, and I'm a bit
confused about Bootstrap and Program By Design.  Is there any reason
for my student not to just read HtDP?


You should view word from the authors/developers as definitive, but I 
would say that if your student has good algebraic skills, then using 
HtDP/2e is the right path. If not, Bootstrap may be a way to help 
develop those skills. --PR


 Racket Users list:
 http://lists.racket-lang.org/users


Re: [racket] proof assistants, DrRacket and Bootstrap

2014-09-27 Thread Prabhakar Ragde

Bill Richter wrote:


>Carl Eastlund developed Dracula for Rackety use of the ACL2 theorem
>prover.

Thanks, Ian!  May I suggest that you try to handle Coq, Isabelle or
HOL Light?  I believe these are the foremost proof assistants.  The
fields medalist Vladimir Voevodsky uses Coq, in which the 4-color
theorem and the Feit-Thompson theorem was formalized by Georges
Gonthier.  Tom Hales just finished formalizing his proof of Kepler
conjecture in HOL Light and Isabelle (which is HOL as well).  I'm no
expert, but I think that ACL2 (also Prover9) is an FOL prover, and
the bulk of activity in formal proofs uses type theories.  HOL is
simple, it's Church's simple types (a version of the Lambda
Calculus), and Coq uses a much more complicated type theory.


I'm sorry, I forgot about Carl's Dracula work when composing my earlier 
reply. ACL2 is more limited, but its advantage (besides being probably 
far and away the theorem prover that has had the most industrial impact) 
is that its language (Applicative Common Lisp, hence the acronym) is 
much closer to Racket, allowing for stronger integration both with 
DrRacket and into a Racket-based curriculum. A DrRacket interface to Coq 
or Isabelle would, in contrast, be more superficial, in the style of 
Proof General. --PR


 Racket Users list:
 http://lists.racket-lang.org/users


Re: [racket] proof assistants, DrRacket and Bootstrap

2014-09-27 Thread Prabhakar Ragde

On 2014-09-27, 5:50 PM, Bill Richter wrote:

Thanks, Prabhakar, this is exactly what I wanted, and you know something about 
it (I was barely able to install Coq):


I struggled with installing it also, especially since I'm using a Mac. 
Racket has spoiled us in that respect.



But parsing an expression written in faux OCaml/Haskell is quite
complicated. [...] Parsing is much easier in Racket/Scheme because
of the similarity of code/data and the presence of 'read'.

I think it's a parsing question I'm stuck on.  I think I need to use camlp to 
avoid the following hack/kludge which I learned from the HOL Light experts, 
found in my file
hol_light/RichterHilbertAxiomGeometry/readable.ml
which is part of the HOL Light distribution:

(* From update_database.ml: Execute any OCaml expression given as a string.  *)


I don't have enough practice in OCaml to grasp what your code does (and, 
yes, it is way off-topic), but I do know that about once every month or 
two, someone posts to this list about using 'eval' in Racket, and they 
are warned not to use it unless they really know what they are doing and 
have a suitable application (which is rare). That warning probably is 
doubled in a statically-typed language, in which 'eval' should not even 
be possible without subverting the type system (I gather this is what 
you are doing). Translating the gist of suggestions to such posters, I 
would say: do you really need to execute *any* expression? If not, use 
OCamllex and/or OCamlyacc (maybe Menhir, or a smaller and cleaner parser 
combinator library) to write a parser for your language subset, and then 
write an interpreter for the resulting ASTs. --PR


 Racket Users list:
 http://lists.racket-lang.org/users


Re: [racket] proof assistants, DrRacket and Bootstrap

2014-09-28 Thread Prabhakar Ragde

On 2014-09-28, 12:57 AM, Bill Richter wrote:


I'm making a dialect of HOL Light with different syntax by
interpreting one of my programs as a string and then breaking the
string up into the component pieces, but then I need this
Toploop/exec hack to evaluate my variables.  That sounds like the
Scheme eval, and in Scheme you can solve that problem nicely with the
quote feature.


A Racketeer would probably tell you to use macros to define your 
dialect, instead of using an eval hack. The corresponding tool for OCaml 
is camlp4, and it sounds as if it would be worth your time to learn it 
thoroughly. --PR


 Racket Users list:
 http://lists.racket-lang.org/users


[racket] Curious error messages

2014-12-03 Thread Prabhakar Ragde
I'm currently using Racket 6.1. For some time now, when editing Scribble 
files in DrRacket, I've been getting "file has changed on disk" messages 
when trying to save or render - not consistently, just every so often. 
These are files I am not editing in anything other than DrRacket. I 
click "ignore" and everything works fine, but it is annoying.


Just now, when rendering a Scribble document, I see in the Interactions 
window the error "libpng warning: iCCP: Not recognizing known sRGB 
profile that has been edited". The rendering proceeds just fine. This is 
rendering to PDF using some included images that have been created using 
OmniGraffle. The same images used in render to HTML do not give such 
warnings. --PR


 Racket Users list:
 http://lists.racket-lang.org/users


Re: [racket] Curious error messages

2014-12-04 Thread Prabhakar Ragde

On 2014-12-04 7:35 AM, Jens Axel Søgaard wrote:

By any chance: is the file saved inside a Dropbox ?
When Dropbox synchronizes it might set a flag/time somewhere.


I'm not using Dropbox on these files. I am using OS X. About the only 
thing that might be looking at these files is Spotlight (and any other 
OS X admin process of that sort) but it shouldn't be changing the file. 
It tends to happen when I am doing fairly tight edit-render or edit-save 
cycles, so I figured it was some sort of timing issue between threads. --PR


 Racket Users list:
 http://lists.racket-lang.org/users


Re: [racket] Curious error messages

2014-12-04 Thread Prabhakar Ragde

On 2014-12-03 11:43 PM, Stephen De Gabrielle wrote:

I've had the same thing using scribble, but including screenshot images
I just assumed it was pdflatex that was calling libpng, and the problem
was either pdflatex how it was passing the image to libpng, or libpng
itself, rather than anything in racket. (It seemed like a rabbit-hole
that I was unlikely to navigate successfully)


For what it's worth, it happens when I run scribble --pdf from the 
command line, but not when I run scribble --latex and then pdflatex on 
the resulting .tex file. I can live with it, since it is only two lines 
in my case and just a warning I can ignore. It might get intrusive if it 
happens with a lot of images. --PR


 Racket Users list:
 http://lists.racket-lang.org/users


[racket] An easy route to define-datatype in BSL?

2012-11-04 Thread Prabhakar Ragde
I'm debating trying to use something like define-datatype, as used in 
EOPL and PLAI (and available in the Racket languages that support those 
books) early in my first-year undergraduate class. (Opinions on the 
wisdom of this, or on my sanity in general, by direct e-mail, please.)


In a teaching-language program, just using `require' to include 
define-datatype and type-case or 'cases' from plai/datatype.rkt or 
eopl/datatype.rkt appears to work so long as the teaching language is 
ISL or higher. In BSL or BSL+, I seem to be running into a thicket of 
rules designed to protect students. I'm using as my exploratory example 
the trivial arithmetic expression evaluator from the beginning of PLAI 
(2007 edition). Using plai/datatype.rkt generates an error because a use 
of define-datatype involves function names in expression positions (as 
contracts for field names). If I wrap these in applications of 
first-order->higher-order from lang/prim, which seems to be designed for 
this task, I get an error the first time I try to use a variant 
constructor (in the PLAI example, in 'parse'). The constructors seem to 
be defined, but also seem to be regarded as variables instead of 
functions. This is also what happens with eopl/datatype.rkt (the other 
error does not seem to arise).


Do I have a hope of pulling this off, and if so, how? Many thanks. --PR

 Racket Users list:
 http://lists.racket-lang.org/users


Re: [racket] An easy route to define-datatype in BSL?

2012-11-05 Thread Prabhakar Ragde

On 2012-11-05 6:43 AM, Matthew Flatt wrote:


Here's a first cut at a module that you can import into BSL programs.

The least obvious part is defining a new `define-type' and `type-case'
that invents hidden names for the variants and them maps between them
while expanding to the original forms.


Wow, thanks. I will study the code and do my best to understand it, and 
test it for deployment next fall. I can already see the outline of how 
your code achieves what you describe, but could you please say a few 
words about why that's necessary, to improve my understanding of BSL? 
Thanks again. --PR


 Racket Users list:
 http://lists.racket-lang.org/users


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

2012-11-28 Thread Prabhakar Ragde

Shriram wrote:


Yaron, this summer my students, Kathi Fisler, and I built a block-based,
functional language with types (expressed as colors) and testing. It runs
in the browser, uses the WeScheme runtime and can express most Bootstrap
programs.

It needs more polish before we can release it to the world. We would be
happy to give previews to anyone who wants to see them.


If this is DrBlocket, then Danny Yoo gave a 10-minute talk on it at 
RacketCon this October; slides and video are here:


http://con.racket-lang.org

--PR

 Racket Users list:
 http://lists.racket-lang.org/users


Re: [racket] A primitive more fundamental than a continuation?

2012-12-02 Thread Prabhakar Ragde

Matthias wrote:


The documentation (See Guide s10.3) says "A continuation is a value
that encapsulates a piece of an expression context"


Someone should submit a doc bug report to the Guile people. The
'expression' should be replaced (or supplemented) with 'evaluation'.


Not "Guile", "Guide". This is in the Racket Guide, first sentence of 
10.3 (Continuations). The same phrase ("expression context") appears in 
the Racket Reference, 1.1.1 (Evaluation Model / Sub-expression 
Evaluation and Continuations). "Evaluation context" definitely resonates 
more with those who understand the formal semantics, but I am not sure 
it makes much difference to someone trying to learn from the more 
informal Guide, which is vague about the evaluation model. --PR


 Racket Users list:
 http://lists.racket-lang.org/users


[racket] Scribble to PDF in Racket 5.3.2

2013-02-02 Thread Prabhakar Ragde
Scribble will not render to PDF for me with Racket 5.3.2. It works fine 
with Racket 5.3.1. As is typical with LaTeX, I cannot find the exact 
source of the error in all the verbiage. There are several warnings 
associated with packages.


My TexLive distribution is from 2008. Is 5.3.2 doing something that 
would not work with it? Thanks. --PR


 Racket Users list:
 http://lists.racket-lang.org/users


Re: [racket] Scribble to PDF in Racket 5.3.2

2013-02-02 Thread Prabhakar Ragde

On 2013-02-02 4:13 PM, Robby Findler wrote:

If you run scribble --latex --dest x file.scrbl and then cd into the
newly created "x" directory and run "pdflatex file.tex" you should get a
more readable transcript that will help us understand what's going on.


Thanks. The relevant lines in the transcript are these:

(/usr/local/texlive/2008/texmf-dist/tex/latex/koma-script/tocstyle.sty

Package tocstyle Warning: THIS IS AN ALPHA VERSION!
(tocstyle)USAGE OF THIS VERSION IS ON YOUR OWN RISK!
(tocstyle)EVERYTHING MAY HAPPEN!
(tocstyle)EVERYTHING MAY CHANGE IN FUTURE!
(tocstyle)THERE IS NO SUPPORT, IF YOU USE THIS PACKAGE!
(tocstyle)Maybe it would be better, not to load this 
package.


! Extra \fi.
l.135 \fi

I think I will go ahead and upgrade TeX to the 2012 distribution and see 
if that makes a difference. --PR


 Racket Users list:
 http://lists.racket-lang.org/users


Re: [racket] Scribble to PDF in Racket 5.3.2

2013-02-02 Thread Prabhakar Ragde

On 2013-02-02 4:59 PM, Prabhakar Ragde wrote:


I think I will go ahead and upgrade TeX to the 2012 distribution and see
if that makes a difference. --PR


That fixed the problem. Thanks. --PR

 Racket Users list:
 http://lists.racket-lang.org/users


Re: [racket] DrRacket editor behaviour change

2013-03-23 Thread Prabhakar Ragde

Robby wrote:


Just to double check: you mean shift-down, not just down, right?

DrRacket does indeed implement those keystrokes itself, but I'm seeing what
you describe as the 5.3.1 behavior in 5.3.3 and in the git head under mac
os x and under a relatively recent git version under linux.

When you choose the Edit | Keybindings | Show Active Keybindings menu item
and search for home, do you see "select-to-beginning-of-file" as the
c:s:home key and when you search for "s:down" do you see "select-down" as
the corresponding keystroke?


No, I think he meant down. I noticed something similar some time after 
upgrading to 5.3.2. I use c:space to "set mark" and c:n to move forward 
a character in Emacs with the intention of later doing a selection 
between mark and point. In 5.3.1, I was able to do this in DrRacket, 
that is, the Emacs cursor commands extended the selection. Now it 
doesn't happen any more. I did look in the keybindings and notice that 
shift seemed to be needed now. Still haven't figured out if I want to 
change the keybindings or change my behaviour. --PR


 Racket Users list:
 http://lists.racket-lang.org/users


Re: [racket] DrRacket editor behaviour change

2013-03-23 Thread Prabhakar Ragde

On 2013-03-23 1:59 PM, Robby Findler wrote:


Meanwhile, control-space, control-n works in the way you would seem to
want it to work. Is there some more complex sequence that causes trouble?


Yes: control-space, control-n, control-n. This used to move down and 
extend the blue selection highlight. Now the first control-n does this, 
but the second one erases the selection highlight. At least it does for 
me on 5.3.2. --PR


 Racket Users list:
 http://lists.racket-lang.org/users


Re: [racket] DrRacket editor behaviour change

2013-03-23 Thread Prabhakar Ragde

On 2013-03-23 3:00 PM, Robby Findler wrote:

I'm not seeing that (in any version). Nothing is happening in between
the two control-n's, right?

Do you see the words "auto extend" in the corner of the drracket window?
Can you coordinate some action you're taking with them disappearing?


Hmmm. I checked this behaviour just before I sent my last message, but 
I've since closed those windows (but kept the same DrRacket running). I 
reopened one of the files I was working on, and I cannot get the 
behaviour to happen now. I do see the "auto-extend" notification, but 
I've never noticed it before (doesn't mean it wasn't there).


Assuming it recurs at some point in the future, what should I do to 
gather information? (Since, heh, DrRacket doesn't let me save an image 
and mail it to you...) --PR


 Racket Users list:
 http://lists.racket-lang.org/users


Re: [racket] Redex question: parameterizing a language definition

2013-04-04 Thread Prabhakar Ragde

Robby wrote:


Yes, David's right. The (a bit more long-term than I hoped) plan is to
essentially improve and automate parts of what you call the rabbit hole in
your stackoverflow question (as also discussed in the link David posted).


I ran into this problem in a much simpler context while teaching a grad 
course using the Redex textbook last fall. What I wanted to do was to 
use define-extended-language to add an "ifzero" construct to the basic 
ISWIM language. But then I needed to define a new substitution 
metafunction, with a new name, because I couldn't extend or override the 
old one. And then, because the substitution metafunction is used in the 
beta_v reduction relation, I had to create a new version of that as 
well, rather defeating the point of extension. Robby's answer to my 
email question was much the same, namely that some sort of module system 
for Redex would help. The solution that the book uses is to write a very 
general substitution function right from the start, but this is a bit of 
a kludge. My conclusion was that define-extended-language is a feature 
in progress. But Redex has already moved on from what the textbook 
describes (with define-judgment), and I'm guessing that the next time I 
use this material in lecture, this issue will have been addressed. --PR


 Racket Users list:
 http://lists.racket-lang.org/users


[racket] Third CfP for the International Workshop on Trends in Functional Programming In Education (TFPIE)

2013-04-08 Thread Prabhakar Ragde

Philip wrote:


It should be noted that BYU's "Honor Code" applies only to students & staff. It 
does *not* apply to visitors.


Does that mean there will be coffee at "coffee breaks"? --PR

 Racket Users list:
 http://lists.racket-lang.org/users


[racket] odd background expansion warning

2013-08-28 Thread Prabhakar Ragde

Just downloaded Racket 5.3.6.

When I open a new DrRacket tab and type the following:

#lang racket

(require (for-label racket))

I get the following warning in large red letters at the bottom of the
window where the background expansion messages are shown:

+: contract violation expected: number? given: #f argument position: 1st
other arguments...: 0

It doesn't seem to have any other effect (my programs that had that
require line in them still work fine) but it's annoying and persistent.
Any ideas on what's causing it and how to get rid of it? Thanks. --PR

PS I started DrRacket from the command line, and this keeps showing up 
in the terminal window:


  (handle-phaseless-spec . #(struct:srcloc #v5.3.6/collects/drracket/private/syncheck/traversals.rkt> 379 17 21528 900))
  (for-loop . #(struct:srcloc #v5.3.6/collects/drracket/private/syncheck/traversals.rkt> 363 24 20541 125))
  (for-loop . #(struct:srcloc #v5.3.6/collects/drracket/private/syncheck/traversals.rkt> 393 17 22464 115))
  (for-loop . #(struct:srcloc #v5.3.6/collects/drracket/private/syncheck/traversals.rkt> 340 17 19252 116))
  (#f . #(struct:srcloc #v5.3.6/collects/drracket/private/expanding-place.rkt> 97 7 3546 4509))


 Racket Users list:
 http://lists.racket-lang.org/users


[racket] Scribble and/or Latex?

2013-08-30 Thread Prabhakar Ragde

Dave wrote:


I'm an apprenticing high school math teacher looking for a
documentation tool for use in preparing lesson plans and class
presentations. I've been advised to use Latex.  But as a former
HtDP'er, I've been looking for an excuse to get back into Racket, and
I thought learning Scribble might be a good route to take.  I've
poked through the docs a bit, and can't find any reference on math
typesetting.  Can that be done in Scribble?  Or is Scribble not the
right tool, and should I commit my learning efforts to Latex?  Or
both?


I have been typesetting lecture slides (PDF) and lecture summaries 
(HTML) using Scribble and using math. Rendering to PDF goes through 
LaTeX, so its math capabilities are theoretically accessible, but this 
involves not only knowing how to write math in LaTeX but how to convince 
the rendering engine to produce the right LaTeX macros. To display the 
math equations in a browser, I use MathJax, which can handle LaTeX math. 
Jens Axel Søgaard has gisted my code here (very short):


http://lists.racket-lang.org/users/archive/2012-July/052972.html

If you use this code, you still have to learn LaTeX math, which I would 
advise anyway. You probably should learn first using a text editor and 
invoking LaTeX on the command line, because if you make a mistake using 
my code, you get a horrific amount of LaTeX error output in DrRacket's 
Interactions window (this is the Scribble renderer's way of dealing with 
backend problems). After a couple of decades of Emacs/LaTeX I am quite 
enjoying writing things up in DrRacket using Scribble. If I could clone 
myself, I'd set one of the clones to replacing the LaTeX backend, or at 
least making the process more friendly.


I think there is scope here for using DrRacket to have students write up 
math using Scribble. They can edit easily and you can view easily after 
they submit their Scribble files to you. MathJax does not show a 
horrific amount of error text; it just fails silently. So if they make 
mistakes in their math, their formula simply won't show in the browser 
when they hit the "Scribble HTML" button in DrRacket, and they will have 
to figure out why by trial and error. But if they are already using 
DrRacket, the only additional thing they need is a bit of Scribble 
boilerplate. --PR



 Racket Users list:
 http://lists.racket-lang.org/users


[racket-users] Re: Understanding P. Ragde's Proust

2020-03-16 Thread Prabhakar Ragde


On Sunday, March 15, 2020 at 10:00:59 AM UTC-4, Adrian Manea wrote:
>
>
> I'm a mathematician delving into type theory and proof assistants and with 
> special interests in Racket.
>
> I'm now trying to understand and implement P. Ragde's Proust 
>  "nano proof assistant" and work 
> through the examples in his article. However, I'm pretty much a beginner in 
> Racket and I'm getting some errors.
>

Hi! Sorry, I only get this list as a digest, so I didn't see your message 
until this morning. The code in the paper is not complete, and the paper 
isn't written so that a beginner in Racket could easily extract a working 
program from it. When I teach students this material, I give them a working 
starter file, and I will send that to you by private email, where we can 
also continue to discuss as needed.

I am at this moment working on converting my course materials on this topic 
into a free online resource similar to the one I did for functional data 
structures. But this is not ready yet. I hope to finish it in the next few 
months and I will post here when it is ready. --PR

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/55610873-9554-4ce5-b5a6-33a7d29524bb%40googlegroups.com.


[racket-users] Re: Understanding P. Ragde's Proust

2020-06-30 Thread Prabhakar Ragde
The "free online resource" I alluded to earlier is up on my Web page now.

https://cs.uwaterloo.ca/~plragde/flaneries/LACI/

I call it a "flânerie", but it's a mini-textbook on logic and proof 
assistants, using Racket to first construct a small proof assistant 
(Proust), expanding it to handle propositional and predicate logic, and 
then moving into discussion of the much larger Agda and Coq systems. --PR

On Monday, March 16, 2020 at 8:25:38 AM UTC-4, Adrian Manea wrote:
>
> Dear Prof. Ragde,
>
> Thank you very much for the reply! I watched your talk at the Racket con 
> more carefully today and noticed you specifically point out that you don't 
> give your students the whole code and that the entire project is presented 
> as a "proof of concept" and used especially for didactic purposes.
>
> I totally appreciate this approach and I have to say I don't feel quite 
> prepared to fill in the details myself. So I'm doing my best to learn some 
> preliminaries and general Racket first!
>
> Thank you,
> Adrian
>
> On Monday, March 16, 2020 at 12:08:51 PM UTC, Prabhakar Ragde wrote:
>>
>>
>> Hi! Sorry, I only get this list as a digest, so I didn't see your message 
>> until this morning. The code in the paper is not complete, and the paper 
>> isn't written so that a beginner in Racket could easily extract a working 
>> program from it. When I teach students this material, I give them a working 
>> starter file, and I will send that to you by private email, where we can 
>> also continue to discuss as needed.
>>
>> I am at this moment working on converting my course materials on this 
>> topic into a free online resource similar to the one I did for functional 
>> data structures. But this is not ready yet. I hope to finish it in the next 
>> few months and I will post here when it is ready. --PR
>>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/1f0d4dd7-6534-4a66-9d45-525e31c1b436o%40googlegroups.com.


[racket-users] Re: Removing duplicates from a list while still maintaining order in Dr. Racket.

2020-07-21 Thread Prabhakar Ragde
Could you point us to the original homework question so we can be sure of 
the requirements? Thanks.

On Monday, July 20, 2020 at 12:04:45 PM UTC-4, JJ C wrote:
>
> In Beginning Student with List Abbreviations
>
> I am struggling to come up with functions to remove duplicates from a list 
> while maintaining the order of the list.
>
> one function to remove duplicates from the left,
>
> i.e. 1 2 1 3 2 4 5 -> 1 2 3 4 5
>
> and one from the right.
>
> i.e. 1 2 1 3 2 4 5 -> 1 3 2 4 5
>
> What are the functions for removing duplicates from each left and right 
> side? If you need to, use helper functions and append, cond, cons, equal?, 
> etc but not using reverse or any built-in functions.
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/d99af45d-b59c-4878-83b8-c77d145858bbo%40googlegroups.com.