Re: [racket-users] simple question about call/cc

2020-12-07 Thread Justin Zamora
The duplication is because you're evaluating the expression at top level, so the repl is part of the continuation. The continuation isn't (lambda (c) (c e2); it's actually something like (lambda (c) (evaluate-in-repl (c e2)). So when you run (ret 9), you're actually re-running the repl you had when

Re: [racket-users] Racket GUI: text aligned to the left of other text

2020-08-10 Thread Justin Zamora
Another, less lightweight way is to use panels for different parts of the chat windows. I put together a sample at https://gist.github.com/zamora/1cfc6480f7703735dffa3169facfbf10 On Mon, Aug 10, 2020 at 3:32 PM Christopher Lemmer Webber wrote: > > Hello, > > I'm building a little chat application

Re: [racket-users] How to implement a hash function for different types?

2019-08-02 Thread Justin Zamora
Racket doesn't implement hash tables using a hash function. If I recall correctly, it uses b-trees as the representation for a hash table. The Racket reference states that "Immutable hash tables actually provide O(log N) access and update. Since N is limited by the address space so that log N is l

[racket-users] [standard-fish] Lightsabers!

2019-07-30 Thread Justin Zamora
[Apologies if this gets sent twice. I accidentally sent the first one to the googlegroups email address] Stephen De Gabrielle announced this a few days ago on racket-dev, so I spent my weekend embracing my inner Star Wars nerd and made lightsabers in Racket. I had never used the pict library befor

[racket-users] [standard-fish] Lightsabers!

2019-07-30 Thread Justin Zamora
Stephen De Gabrielle announced this a few days ago on racket-dev, so I spent my weekend embracing my inner Star Wars nerd and made lightsabers in Racket. I had never used the pict library before, so it was also an interesting learning experience. I created a lightsaber function that produces a pic

Re: [racket-users] The case, and a proposal, for elegant syntax in #lang racket2

2019-07-18 Thread Justin Zamora
On Thu, Jul 18, 2019 at 1:48 PM Brian Adkins wrote: > I think more people (both existing users and new users) could get > excited about Racket2 if it was primarily about making Racket > objectively better and only secondarily about overcoming the > aesthetic objection to parens. The message of "Af

Re: [racket-users] color-maps for the plot package

2019-03-19 Thread Justin Zamora
On Tue, Mar 19, 2019 at 10:35 PM Ben Greenman wrote: > I'm thinking a color-map% object would define a possibly-infinite > sequence of colors that look nice in some way. The colors might be > useful anywhere where someone wants a "rainbow" of colors ... maybe > for: If you're interested in contra

Re: Types of languages Re: [racket-users] the list of languages made with racket [Hacker News]

2019-03-01 Thread Justin Zamora
You should include Danny Yoo's Brainfudge in the "stand-alone languages with non-s-exp syntax". https://www.hashcollision.org/brainfudge/index.html Justin On Fri, Mar 1, 2019 at 6:15 PM Stephen De Gabrielle wrote: > > > > On Fri, 1 Mar 2019 at 18:00, Matthias Felleisen > wrote: >> >> >> >> > O

Re: [racket-users] Re: How To Design Classes text not available?

2019-02-02 Thread Justin Zamora
Thanks! I always forget about archive.org! Justin On Sat, Feb 2, 2019 at 3:29 PM Greg Trzeciak wrote: > > Try > > https://web.archive.org/web/20181228174204/http://www.ccs.neu.edu/home/matthias/HtDC/htdc.pdf > > On Saturday, February 2, 2019 at 9:26:15 PM UTC+1, Justin Zam

[racket-users] How To Design Classes text not available?

2019-02-02 Thread Justin Zamora
I tried to download the draft of "How to Design Classes" from http://www.ccs.neu.edu/home/matthias/htdc.html and got a "Failed to load PDF document" error. Is this text still available? Justin -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To

Re: [racket-users] Byte Order Mark: alter display of symbols containing nonprinting characters?

2017-12-27 Thread Justin Zamora
There are many characters that have different Unicode values but use the same glyphs. Many Cyrillic characters look like their English characters, so they appear the same visually, but equal? and eq? reveal that they are actually distinct. It seems to be that the BOM is just another example on this

Re: [racket-users] Re: Proper non-tail recursion?

2017-04-27 Thread Justin Zamora
On Thu, Apr 27, 2017 at 8:06 PM, Jon Zeppieri wrote: > > OCaml does handle tail calls properly. But proper tails calls are not > the subject of this discussion. The original post was explicitly about > non-tail calls and how, in Racket, you cannot exhaust the stack > without exhausting all of the

Re: [racket-users] Recursevly processing a list with "wholes"

2016-11-16 Thread Justin Zamora
I think you are looking for something like this: #lang racket (require test-engine/racket-tests) (define (remove-empty-lists lst) (cond [(null? lst) '()] ; Check for end of list [(null? (first lst)) (remove-empty-lists (rest lst))] ; Skip null sublist [(not (list? (first lst))) ; L

Re: [racket-users] Funtional programming and the maximum of something

2016-10-22 Thread Justin Zamora
A clue to the answer is in your statement that you "feed that [maximum] into the next circle of recursion." Notice that you're not overwriting the value in the current call, you're creating a new value that you feed into the new call in the "next circle". So the old one isn't being overwritten at a

Re: [racket-users] Help writing a simple lexer/tokenizer

2016-02-22 Thread Justin Zamora
You can also try using a state machine using the approach described in https://cs.brown.edu/~sk/Publications/Papers/Published/sk-automata-macros/paper.pdf On Feb 22, 2016 4:46 PM, "Federico Ramírez" wrote: > Hello everyone! I'm new to Scheme, and I need some help wrapping my head > around it. > >

[racket-users] PSA for DrRacket users who like Emacs keybindings

2016-02-01 Thread Justin Zamora
The sequence C-a C-x C-s does something very different when Emacs keybindings are not active. :( Justin -- 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-u

Re: [racket-users] Applying functions to mutable lists

2015-04-09 Thread Justin Zamora
Why not use streams? http://docs.racket-lang.org/reference/streams.html Justin On Apr 9, 2015 11:22 AM, "Jerry Jackson" wrote: > Hello, > > I'm building a language with racket that includes lazy lists. I'm building > lazy lists with mcons cells. The compatibility/mlist module has lots of > suppo

Re: [racket] compiling Racket to android and ios apps

2015-02-21 Thread Justin Zamora
There is also Clojure on Android, which might be a promising alternative. http://clojure-android.info/ Justin On Feb 21, 2015 1:24 PM, "Darren Cruse" wrote: > I could chime in I've also been interesting in Racket for mobile apps. > Though I've just been learning Racket (and scheme) the last few

Re: [racket] Units and serializable-struct

2015-02-05 Thread Justin Zamora
> structure type (assuming that the structure type is not prefab), which > leads to the same problem for the deserializer. > > So, `define-serializable-struct` needs to be used outside of a > signature and outside of any unit. It could be in its own module, for > example. > &

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

2015-02-04 Thread Justin Zamora
struct (a b c)) > > [You can also use the struct syntax but you then need to define the > alternative constructor.] > > ;; - > I recommend developing small units in one DrRacket buffer. It's the > easiest way to get used to their syntax. >

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

2015-02-04 Thread Justin Zamora
There seems to be a problem exporting struct constructors when using #lang racket/signature. This works: - b-sig.rkt- #lang racket (define-signature b^ ((struct my-struct (a b c)) b-value)) (provide b^) - b-unit.rkt - #lang racket/unit (require "b-sig.rkt") (import) (expo

[racket] Units and serializable-struct

2015-02-04 Thread Justin Zamora
I am writing a program using units and got this message: define-signature: unknown signature form in: serializable-struct Sure enough, the docs show that serializable-struct is not allowed in a signature. Is this something that can be fixed or do I have to work around it (maybe by using regular st

Re: [racket] A beginner's question re drawing on a canvas

2014-10-01 Thread Justin Zamora
You should learn about Model-View-Controller architecture (for example at http://en.m.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller). Briefly, the model is a data structure that represents the information you are working with. The view is able to produce a visual representation of the m

Re: [racket] "if" and internal definitions

2014-03-16 Thread Justin Zamora
..) or block instead. > > > http://docs.racket-lang.org/reference/block.html?q=block#%28form._%28%28lib._racket%2Fblock..rkt%29._block%29%29 > > /soegaard > > > 2014-03-16 21:38 GMT+01:00 Justin Zamora : > > What is the reason for not allowing internal definitions in the &q

[racket] "if" and internal definitions

2014-03-16 Thread Justin Zamora
What is the reason for not allowing internal definitions in the "then" and "else" parts of an "if"? This fails with "define: not allowed in an expression context": (if (< 3 4) 5 (begin (define a 7) a)) But the equivalent "cond" works fine: (cond [(< 3 4) 5] [else (define a

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

2014-02-05 Thread Justin Zamora
On Feb 5, 2014 10:02 AM, "Pierpaolo Bernardi" wrote: > > Can you make an example of something that's worse than C? > Perl Justin Racket Users list: http://lists.racket-lang.org/users

Re: [racket] Strange Behavior around memq、memv、and member

2013-12-30 Thread Justin Zamora
Your comment says that y-or-n? returns either #t or #f. I see the line where you return #t. Where do you return #f? Justin On Dec 30, 2013 4:04 PM, "亀田馬志" wrote: > Hello. > > I think I understand how memq, memv, member works: > > > (memq 'y '(y yes n no)) > '(y yes n no) > > (memq 'n '(y yes n n

Re: [racket] R7RS and Racket in the (far) future

2013-02-10 Thread Justin Zamora
On Feb 10, 2013 5:51 PM, "Da Gamer" wrote: > Third, as someone who hasn't been in the Racket community long but knows that it is a Scheme variant, I don't see why there is an issue of asking such a question. Is there any need to be defensive and hostile? I can't see the idea being that outrageous,

Re: [racket] the most functional man in the world

2012-12-19 Thread Justin Zamora
On Dec 19, 2012 11:02 PM, "Matt Jadud" wrote: > And, watching a bunch of the videos, they are funny because they are *extremely* over the top. "He dates all the girls in the CS department" isn't over-the-top, and just came across slightly skeezy. I tend to agree. I was expecting a joke at this po

Re: [racket] [racket-ide] Can the split view be made to be vertical as well?

2012-12-12 Thread Justin Zamora
Select "Use Horizontal Layout" in the View menu. Justin On Dec 12, 2012 9:17 PM, "Da Gamer" wrote: > The way it is now -- file on top and instarepl at the bottom -- is ok. But > I was wondering if the instarepl view could be also set so it is vertical > as well. Somewhat like a split screen view

Re: [racket] [plt-edu-talk] Does a Scheme procedure "return" a value?

2012-09-07 Thread Justin Zamora
I think you hit on the distinction when you use the terms "procedure" and "procedure application". It is correct to say that a procedure returns a value and that an application of that procedure has a value. (since Scheme has first-class procedures, it's also true that a procedure has a value, but

[racket] Frames within Frames?

2012-07-16 Thread Justin Zamora
How can I put frames inside of a master frame to implement multiple documents (e.g. http://images.appleinsider.com/win7task-090206-7.png)? Justin Racket Users list: http://lists.racket-lang.org/users

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

2012-07-13 Thread Justin Zamora
You can use something like this: (define (all-lower-case? str) (string=? str (string-downcase str))) > (all-lower-case? "haha") #t > (all-lower-case? "haHa") #f Justin On Fri, Jul 13, 2012 at 9:02 AM, Rouben Rostamian wrote: > The function `all-lower-case?' defined below takes a string and >

Re: [racket] `def' ?

2012-05-10 Thread Justin Zamora
In my experience, the heaviness of Racket doesn't come from words like "define", etc. It comes in certain categories of programs that deal extensively with strings, vectors, and structured data. For example, initials = person[i].firstname[0] + person[i].lastname[0] This is very readable and use

Re: [racket] spirit of Racket?

2012-03-11 Thread Justin Zamora
This is a great situation to use Racket's advanced list comprehensions. There is no need to use set!. You can keep track of the maximum as you loop. Here is my solution. ; Problem 4 ; Find the largest palindrome made from the product of two 3-digit numbers. ; 3-digit numbers are the numbers 100

[racket] paint-callback and dc

2011-12-31 Thread Justin Zamora
Is the dc% that is passed to the paint-callback for a canvas always the same dc% returned by (send canvas get-dc)? In other words, are the following equivalent? [paint-callback (lambda (canvas dc) (send dc clear))] [paint-callback (lambda (canvas dc) (send (send canvas get-dc) clear))] Justin __

[racket] Named let and multiple values

2011-07-27 Thread Justin Zamora
I'd like to be able to write something like this: (let loop ([a 1] [b 2]) (if (= a b) 3 (loop (values (add1 a) b This would match the way for/fold works with more than one value. However, I get a message, "context expected 1 value, received 2 values: 2 2", which makes sense giv

[racket] Exiting a for loop early

2011-07-19 Thread Justin Zamora
Is there a built in way to exit the various kinds of for loops early? I've been using code like: (let/ec break (for ([i (in-range 1 100)] #:when (condition? i)) (break i Is there a better way? Justin _ For list-related admi

Re: [racket] Injecting HTML into a scribble document?

2011-06-23 Thread Justin Zamora
On Thu, Jun 23, 2011 at 11:56 AM, Danny Yoo wrote: > I'd like to be able to inject some HTML fragments into a Scribble > document, so that when the Scribble documentation renders to html, > those fragments are carried along. +1 It would also be useful for putting tags to insert video into Scrib

Re: [racket] Three questions related DrRacket

2011-06-01 Thread Justin Zamora
ram Krishnamurthi > wrote: >> >> Also note that if you programmed in the Student Language levels, this >> function would be illegal (and it might give you some insight into how >> this programming style works). >> >> On Wed, Jun 1, 2011 at 9:19 PM, Justi

Re: [racket] Three questions related DrRacket

2011-06-01 Thread Justin Zamora
On Wed, Jun 1, 2011 at 7:22 PM, Yingjian Ma wrote: > > In my question > (define (p x) >   (+ x 10) >   (* x 10) >   ) > It seems it only executes (* x 10) No, it executes both of them. It evaluates (+ x 10), then throws away the value it just computed. Then it evaluated (* x 10), since that is

Re: [racket] repl parsing question

2011-02-01 Thread Justin Zamora
You'll want to read http://docs.racket-lang.org/reference/reader.html In particular, section 12.6.4, "A #true, #t, #T followed by a delimiter is the input syntax for the boolean constant 'true'. Section 12.6.4 talks about what can be used as a delimiter. Your example fails because + is not a delim

[racket] Embedding Video in Scribble HTML

2011-01-18 Thread Justin Zamora
In December, Jens Axel Søgaard asked about embedding a YouTube video in the Scribble HTML output: > It (finally) dawned on me that I have two problems. > I thougt this would display a YouTube player on the HTML page: > > @exact|{ type="text/html" width="480" height="390" > src="http://www.youtube.c

Re: [racket] Couldn't find a step matching that criterion

2011-01-09 Thread Justin Zamora
The stepper works fine on simple programs. You can try watching this video tutorial I made for my students. It's basic, but it covers the essentials of using the stepper. http://www.youtube.com/watch?v=j3X07a-7YRM Justin On Sun, Jan 9, 2011 at 9:02 AM, Sayth Renshaw wrote: > I am having a real

Re: [racket] unification

2010-12-10 Thread Justin Zamora
There is one in Kent Dybvig's book, "The Scheme Programming Language." It's online at http://www.scheme.com/tspl3/examples.html#./examples:h10 Justin On Fri, Dec 10, 2010 at 5:33 PM, YC wrote: > Hi all - > does anyone know where I can find code for implementations of the > unification algorithm

Re: [racket] Exploratory programming?

2010-11-30 Thread Justin Zamora
On Tue, Nov 30, 2010 at 12:25 PM, Luke Jordan wrote: > Yes, using DrRacket it's really really easy to interface with help, explore > libraries, etc., at least as far as I have found for my humble needs.  It > uses racket/doc/search/search-context.html. The main problem with searching is that the

Re: [racket] 26.1.1 tabulate-div

2010-11-07 Thread Justin Zamora
Your problem is that you are not using generative recursion. Structural recursion is based on breaking down the structure of the input into its parts, recursing on the parts, then combining the results to get the final answer. Since your solution is based on breaking down n into its divisors, you

Re: [racket] a small programming exercise

2010-10-14 Thread Justin Zamora
On Thu, Oct 14, 2010 at 2:26 PM, Joe Marshall wrote: > Here's a fast way to get the leftmost digit of a number: > ... > This version is slightly slower for small numbers, but much much better > for large ones: > (defun leftmost-digit (n base) > (if (> base n) > n > (do* ((i base next) >

Re: [racket] a small programming exercise

2010-10-14 Thread Justin Zamora
Since Shriram seemed to be encouraging cleverness in representation, I submit the following solution, which assumes the inputs and outputs are in binary. (define (benford l) '(1 1.0)) Justin _ For list-related administrative tasks: http:/

Re: [racket] a small programming exercise

2010-10-14 Thread Justin Zamora
Mine's basically the same as everyone else's, except I find the first digit using math instead of string conversion. #lang racket ;; Compute the base-10 logarithm of a number (define (log10 x) (/ (log x) (log 10))) ; Compute the first (base-10) digit of a number (define (first-digit n) (inex

Re: [racket] a little macro exercise

2010-10-09 Thread Justin Zamora
On Sat, Oct 9, 2010 at 8:00 PM, David Herman wrote: > Ah, yes, I didn't see Carl's solution, which is pleasantly concise and > particularly nice because of the single case. > But I still think the point about fall-through is important to the > performance model of `switch' -- it's what Duff's De

Re: [racket] Is there a name for: (lambda (x) (x)) ?

2010-09-23 Thread Justin Zamora
Depending on why you're using thunks, you could replace them with promises: (map force (list (delay 1) (delay 2) (delay 3))) => '(1 2 3) Justin On Thu, Sep 23, 2010 at 8:35 AM, Tim Brown wrote: > Folks, > > Am I missing something really basic here? > > I have a list of thunks. I want

Re: [racket] 2htdp/image question

2010-09-10 Thread Justin Zamora
This is a bug/limitation of the Windows implementation. I filed a bug report against this a few months ago (http://bugs.racket-lang.org/query/?cmd=view&pr=10969). It apparently has something to do with the way 1-pixel lines are drawn and clipped on different platforms. Justin On Fri, Sep 10, 20

[racket] Stepper and application in BSL

2010-08-29 Thread Justin Zamora
I put the following in my definitions window (Beginning Student Language). (define (f x) (+ x 1)) (+ (f 3) 1) When I open the Stepper, (f 3) is highlighted in green, as expected. If I click "Step >", the expression changes to (+ (+ 3 1) 1), as expected (it stepped into the function). However,

Re: [racket] Problem with get-slides-as-picts

2010-08-08 Thread Justin Zamora
Thanks! That worked. Justin On Sun, Aug 8, 2010 at 3:41 PM, Hari Prashanth wrote: > You must use #lang slideshow. If you use #lang racket you get that error. > I dont know why or what it means. > > HTH > Hari > > - Original Message - > From: "Justin Zamora&

[racket] Problem with get-slides-as-picts

2010-08-08 Thread Justin Zamora
I'm using the simple "Hello, World" slideshow from the docs: #lang slideshow (slide #:title "How to Say Hello" (t "Hello World!")) When I run get-slides-as-picts, I get the following error: > (get-slides-as-picts "simple-slide.rkt" 1024 768 false) send: target is not an object: #f for method:

[racket] Bug in Algol 60 procedure calls

2010-08-05 Thread Justin Zamora
The Algol 60 language doesn't seem to work with procedures of no arguments. For example, the following works as expected: begin integer procedure P(x); begin P := 3; end; printn(P(2)); end But if I change P to take no arguments, I get an error: begin integer procedure P; begin

[racket] What #lang to use for Algol 60?

2010-08-05 Thread Justin Zamora
What #lang line do I need to use for the Algol 60 language? Justin _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users

[racket] How do I uninstall a teachpack?

2010-07-23 Thread Justin Zamora
How can I remove a teachpack from the list of User-installed teachpacks? Justin _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users