Re: [racket-users] simple question about call/cc
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 you evaluated the expression, which leads to the duplication. To avoid this, put the expression in a procedure: #lang racket (define ret #f) (define ret2 (lambda (c) (add1 c))) (define (haha) (add1 (call/cc (lambda (k) (set! ret k) ;; Now ret should be equivalent to ret2. 2 Then you get what you expect, because the continuation is delimited by the procedure definition: Welcome to DrRacket, version 7.8 [3m]. Language: racket, with debugging; memory limit: 128 MB. > (haha) 3 > (ret 9) 10 > (ret2 5) 6 On Mon, Dec 7, 2020 at 9:26 PM Tim Meehan wrote: > > I've read a lot about call/cc, and each time wind up just moving on. So this > is an early New Year's resolution: getting a better understanding of it. > > According to Wikipedia's page on continuations, the continuation of the > statement: > > ((call/cc f) e2) > > is: > > (lambda (c) (c e2)) > > #lang racket > (define ret #f) > (define ret2 (lambda (c) (add1 c))) > > (add1 > (call/cc > (lambda (k) > (set! ret k) ;; Now ret should be equivalent to ret2. > 2))) > > (ret 9) ;; Why does this print twice? > (ret2 5) ;; This only prints once, like I would have expected. > > -- > 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/CACgrOx%2BnXZpQv_MbDwdAZJSGpMiD%2BE1gB4YH8Rsb_y3%3D6RaAnQ%40mail.gmail.com. -- 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/CA%2B80D0XpFgieuANWieS7NEoe%3DOHweZXsgB9wjvQmg1j-aggumQ%40mail.gmail.com.
Re: [racket-users] Racket GUI: text aligned to the left of other text
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 with Racket. Overall Racket's > GUI tools are quite comfortable, and I'm just using Rakcet's text editor > stuff to build the chat. But a fairly standard thing to do with chat > applications is to have text like: > > (Beware, fixed width ascii art ahead) > > .. > | FooChat Deluxe [X]| > || > | File Blah | > || > | | It's snowing outside!! | alice | > || In August | bob | > | | Nevermind, the snow is a representation of | carol | > | | collective anxiety about the world | | > || Oh okay it is snowing then | | > || > | [Better go get some snow shoes then___] [Send] | > '' > > The core idea there being that usernames left-align to the text. > > I'm not sure what's the nicest way to do this, though I've taken a guess > that maybe the "Show/Hide Line Numbers" in DrRacket is the best example. > I'd be happy to look at that but I can't really find it in the drracket > repository and am not sure where it would be? > > (I guess one other complication is that if you copy-pasta text it would > be great to still be able to copy paste the names too, but I can think > of some kludgery that might make that possible.) > > - Chris > > -- > 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/87lfime1pm.fsf%40dustycloud.org. -- 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/CA%2B80D0XvAXnGsWL8vEkOm4JGO50rad2rPWnqwc-ywODKPcGKww%40mail.gmail.com.
Re: [racket-users] How to implement a hash function for different types?
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 limited to less than 30 or 62 (depending on the platform), log N can be treated reasonably as a constant." See. https://docs.racket-lang.org/reference/hashtables.html Justin On Fri, Aug 2, 2019 at 9:22 PM Jesse Wang wrote: > > Racket allows different types of keys in a single hash, so there must be a > hash function that works for different types(different primitive types), I > wonder how Racket implements this under the hood. > Also, If I want to implement a hash table which allows different types of > keys, how can I implement such a hash function in Racket? > > Thanks! > > -- > 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/ad183814-d9f1-454b-b1a2-d1a9b394f49d%40googlegroups.com. -- 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/CA%2B80D0W3sAX0h-QQvZ-6tiZZo6QFzNZNOGxxYhGHJ07LhtPVwQ%40mail.gmail.com.
[racket-users] [standard-fish] Lightsabers!
[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 before, so it was also an interesting learning experience. I created a lightsaber function that produces a pict of a lightsaber. The only required argument is a color, which can be either a color name or a color% object. A length can be provided as an optional argument, as well as a style for the lightsaber hilt. The default hilt is Luke Skywalker's (#:style 'luke), but you can also select Darth Vader's (#:style 'vader), Kylo Ren's (#:style 'kylo), or Darth Maul's (#:style 'maul). See the attached picture for examples of each. The code is available at https://github.com/zamora/lightsaber Thanks to Stephen De Gabrielle for providing the incentive to learn about pict and have some fun! 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-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/CA%2B80D0WkdQR0ExV0zZU2XGBj9ifGmaewLTi7utk2fqMJkUdNew%40mail.gmail.com.
[racket-users] [standard-fish] Lightsabers!
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 pict of a lightsaber. The only required argument is a color, which can be either a color name or a color% object. A length can be provided as an optional argument, as well as a style for the lightsaber hilt. The default hilt is Luke Skywalker's (#:style 'luke), but you can also select Darth Vader's (#:style 'vader), Kylo Ren's (#:style 'kylo), or Darth Maul's (#:style 'maul). See the attached picture for examples of each. The code is available at https://github.com/zamora/lightsaber Thanks to Stephen De Gabrielle for providing the incentive to learn about pict and have some fun! 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-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/CA%2B80D0Xhbq8VTvNLL3CsA6zgQEXmj8uWzY_JzzRVZNboMVaYbg%40mail.gmail.com.
Re: [racket-users] The case, and a proposal, for elegant syntax in #lang racket2
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 "After years of effort, > now you can program in Racket without using so many parens!" does not > seem compelling to me. The discussions about changing syntax are not about aesthetics. There are some genuine pain points in Racket that could be fixed with alternate syntax. For instance, it's easy for structure and array access to become unwieldy in practice. Even a simple example can show how awkward it can be. Suppose you have: (struct person (first middle last)) (define john (person "John" "Allen" "Smith")) Now you want the person's initials. In Racket, the code is: (string (string-ref (person-first john) 0) (string-ref (person-middle john) 0) (string-ref (person-last john) 0)) There's a load of cognitive and syntactic overhead compared to something like: john.first[0] + john.middle[0] + john.last[0] Even as someone who has programmed in Scheme for 30 years, I have to spend a couple seconds to grasp what the Racket code is doing, while the alternative syntax is almost instantly understandable. Making changes to eliminate such pain points may help new users to consider Racket, but even if they don't, there is still plenty of benefit to existing Racket programmers. 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-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/CA%2B80D0UStMcFACb1mS%2BR%3D6GNH_9s1uubrgi1S4HCh%2BZKEf%2BF6A%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] color-maps for the plot package
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 contrasting colors instead of a gradient, you could use philogenic colors, the way Pyret does for its error messages. http://blog.brownplt.org/2018/06/11/philogenic-colors.html 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-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Types of languages Re: [racket-users] the list of languages made with racket [Hacker News]
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: >> >> >> >> > On Mar 1, 2019, at 12:05 PM, Stephen De Gabrielle >> > wrote: >> > >> > Hi Matthias, >> > (or anyone else who is available to answer :)) >> > >> > I'm trying to get my head around the range of possible languages in Racket. >> > >> > You got me thinking how many languages seem to have embedded little >> > languages. >> > I was wondering how they fit into your categories of languages? >> > >> > 3. The nature of languages ranges from >> > — stand-alone languages with ugly syntax (example: datalog) >> > — #lang stand-alone DSLs (config, scribble) >> > >> > Does '#lang video' fit in this group? >> >> Yes. >> >> >> > >> > — #lang language mixins (s-expr, 2d) >> > >> > Do regular #px""/#rx expressions fit in this category? >> >> I don’t understand how #px is similar to the s-expr or at-expr or 2d #lang >> mixins. I am referring to lines such as #lang at-exp scribble. >> >> [...] >> p.s. In my mind, format and regexp-match (and similar functions) are >> interpreters for programs in DSLs that are written down as strings. That’s >> my opening slides for HtDL (from last year). > > > The example from Greg Hendershot, below, gave the impression they were like > at-exp and the #2dcond syntax extension seems to fit the same pattern as #px > , but I see what you mean about regex-match and format being interpreters. > @pregexp{\d\.\d} ; #px"\\d\\.\\d" (from > https://www.greghendershott.com/2015/08/at-expressions.html ) > (I do use that trick to make regexp more readable - at-exp is great) > > leaving aside my confusion, my goal here is to a page to the racket website > that showcases an selection of languages made with Racket, that is better > than a search of things that define a #lang > > #lang stand-alone languages with non-s-exp syntax (I'm inclined not to > include 'ugly syntax' on a PR for the racket website) > > Algol 60 > Datalog > Scratchy > ProfessorJ (deliberately included as ~30% of job ads in the UK specify Java) > Rash: The Reckless Racket Shell > Riposte > > #lang stand-alone DSLs (config?, scribble) > > (I don't know a 'config' lang apart from #lang info) > > Scribble > Hackett > Heresy > Lindenmayer > Parenlog > Pie > Video > > > #lang language mixins (s-expr, 2d) > > #lang s-exp [module] > #lang 2d racket > #lang at-exp > > embedded DSLs with mostly coarse-grained interactions with Racket (redex) > > Redex (require redex) > [need to identify another example] > > > embedded DSLs with fine-grained interaction with Racket (the language of > class syntax; syntax-parse: the pattern and templated languages, which > interact via syn-pattern vars) > > (require racket/class) > syntax-parse > syntax-case patterns and templates etc. > > > string interpreters > > regexp > format > > > Languages with other targets > > Asi64 > Pollen > Scribble (?) > Racket-script > > > Are these good categories? > > Kind regards, > > Stephen > > -- > 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. -- 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-users] Re: How To Design Classes text not available?
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 Zamora wrote: >> >> 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 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. -- 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] How To Design Classes text not available?
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 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-users] Byte Order Mark: alter display of symbols containing nonprinting characters?
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 sort of thing, and people will need to learn that they can't necessarily trust their eyes. #lang racket (define cyrillic (string->symbol "\u0410\u0412\u0421")) (define english (string->symbol "ABC")) cyrillic english (equal? cyrillic english) (eq? cyrillic english) Welcome to DrRacket, version 6.9 [3m]. Language: racket, with debugging; memory limit: 128 MB. 'АВС 'ABC #f #f > Justin On Wed, Dec 27, 2017 at 10:33 PM, Jay McCarthy wrote: > Okay. I think I understand. > > The behavior of "two things print the same but are actually different" > that Racket has seems to be the same as my editor and Web browser > which don't render the BOM as anything unless I fiddle something in > Emacs. Additionally, it seems painful to make it do it a different > way. > > On Wed, Dec 27, 2017 at 10:26 PM, John Clements > wrote: > > > > > >> On Dec 27, 2017, at 19:06, Jay McCarthy wrote: > >> > >> This seems to be consistent with my Web browser and editor. Are the > >> symbols eq? or equal? > > > > Neither. Am I misunderstanding you? Here’s code: > > > > #lang racket > > > > (define bad-symbol (string->symbol "\uFEFFhello")) > > > > (define regular-symbol 'hello) > > > > bad-symbol > > regular-symbol > > (equal? bad-symbol regular-symbol) > > (eq? bad-symbol regular-symbol) > > > > this evaluates in DrR to: > > > > Welcome to DrRacket, version 6.11.0.5--2017-12-20(-/f) [3m]. > > Language: racket, with debugging; memory limit: 4096 MB. > > 'hello > > 'hello > > #f > > #f > >> > > > > If you copy and paste these from the interactions into the definitions > window, you can even get this: > > > > #lang racket > > > > (equal? 'hello 'hello) > > (eq? 'hello ‘hello) > > > > evaluates to: > > > > Welcome to DrRacket, version 6.11.0.5--2017-12-20(-/f) [3m]. > > Language: racket, with debugging; memory limit: 4096 MB. > > #f > > #f > >> > > > > Did you misunderstand me, or did I misunderstand you? > > > > John > > > > > > > > > > > >> > > > >> On Wed, Dec 27, 2017 at 3:54 PM, 'John Clements' via Racket Users > >> wrote: > >>> I was working with files containing a Byte Order Mark today, and in > the process of writing a test case, I discovered that > >>> > >>> (string->symbol “\uFEFF”) > >>> > >>> produces a symbol whose printed representation is > >>> > >>> ‘hello > >>> > >>> … which seems unfortunate; I guess I would have expected something like > >>> > >>> ‘|\uFEFFhello| > >>> > >>> (… although I see now that this kind of escaping is not currently > enabled inside vertical bars). > >>> > >>> This leads to situations where two symbols with the same printed > representation may not be equal?, which seems unfortunate. > >>> > >>> Am I overlooking a good reason why this is the desired behavior? > >>> > >>> John > >>> > >>> > >>> > >>> -- > >>> 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. > >> > >> > >> > >> -- > >> -=[ Jay McCarthy http://jeapostrophe.github.io]=- > >> -=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=- > >> -=[ Moses 1:33: And worlds without number have I created; ]=- > >> > >> -- > >> 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. > > > > > > > > > > -- > -=[ Jay McCarthy http://jeapostrophe.github.io]=- > -=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=- > -=[ Moses 1:33: And worlds without number have I created; ]=- > > -- > 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. > -- 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-users] Re: Proper non-tail recursion?
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 memory available to the program. > (Whereas in OCaml you can, because it uses a fixed-size stack.) > How common is it to have a fixed-size stack? I thought it was normal practice for the heap and stack to be on opposite ends of memory and to grow towards each other, so that either can use all available memory. 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-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] Recursevly processing a list with "wholes"
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))) ; Leave non-lists alone (cons (first lst) (remove-empty-lists (rest lst)))] [else ; Process the sublists recursively (cons (remove-empty-lists (first lst)) (remove-empty-lists (rest lst)))])) (check-expect (remove-empty-lists '()) '()) (check-expect (remove-empty-lists '(a)) '(a)) (check-expect (remove-empty-lists '(a b c)) '(a b c)) (check-expect (remove-empty-lists '(())) '()) (check-expect (remove-empty-lists '(() a)) '(a)) (check-expect (remove-empty-lists '(a ())) '(a)) (check-expect (remove-empty-lists '(a (b () c) d)) '(a (b c) d)) (check-expect (remove-empty-lists '((a) (b c) () (e () f (g ())) h (() i j))) '((a) (b c) (e f (g)) h (i j))) (test) Justin On Tue, Nov 15, 2016 at 10:52 PM, wrote: > Hi, > > I have a list of sublists. Some of the sublists are empty. > The list should be processed recursevly and the resulting > list should no longer contain empty sublists. > > The code I have so far looks like: > > (define (step-through-list lst) > (if (empty? lst) > lst > (cons (process-sublist (car lst)) (step-through-list (cdr lst))) > > but "car" would feed empty sublists to process-sublist as any other > sublist. How can I "silently" skip empty sublists and even get out of > the recursion without harm (if the last sublist is empty) without > switching to iteration? > Is there something like "car-not-empty" ? ;) > Or do I oversee the obvious here...? ;))) > > Thank you vary much for any help in advance! > Cheers > Meino > > > -- > 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. > -- 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-users] Funtional programming and the maximum of something
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 all. Justin On Oct 22, 2016 3:15 PM, wrote: > Hi, > > (I am still a newbie ... ) > > If I remember one rule of functional programming > correctly, it says: > Instead of changeing data - create new data. > > Suppose I have a list of list. Each "sublist" is > made of a greater amount (but identical count) of > exact numbers (integers). > > I want to process these data recursively and if > all is done I want to get back a list of numbers > (same count of numbers as in each sublist), which > represents the maximum of all numbers of that "position" > in all sublists. > > If I want to make this purely (may be inpractical) functional,.. > I see (as a newbie) the following problem. > From two numbers as input I have to build a maximum and > have to feed that into the next circle of recursion as > one of the numbers to compare. > Each time a new maximum is found I have to overwrite the > old one. > This contradicts the rule "Dont change data, create new one." > > How can I get out of this? > > Cheers > Meino > > > > > -- > 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. > -- 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-users] Help writing a simple lexer/tokenizer
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. > > I want to write a simple tokenizer, which is just a function that takes a > string as input and outputs a list of "tokens", which to keep thing simple > is a tuple of NAME and VALUE. > > So, for example: > > (tokenize "foo = 1") => '((IDENTIFIER . "foo") (EQUALS . "=") (NUMBER . 1)) > > I didn't want to use global variables to keep things functional, so my > solution doesn't use any, but I wouldn't mind much using them. This is some > code for my current implementation, I omit some code for brevity as it's > quite repetitive for now: > > (define (match-identifier input) > (regexp-match #rx"^[a-zA-Z_]+")) > > (define (consume-identifier input) > (let ([match (first (match-identifier input))]) > (cons `(IDENTIFIER . ,match) (tokenize (substring input (string- > length match)) > > ;; some more matchers and consumers, all pretty similar > ;; ... > > (define (tokenize input) > (cond > ((match-identifier input) (consume-identifier input)) > ((match-equals input) (consume-equals input)) > ((match-number input) (consume-number input)) > (else '( > > What bothers me is that it's calling the matchers twice for each token, > which isn't very good for performance and it's not pretty :p > > I want to get rid of that double-check. I figured I could use some globals > in order to do it but I'd rather not. > > Does anyone have a suggestion/fix on my implementation? > > Thank you for your time :) > > -- > 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. > -- 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] PSA for DrRacket users who like Emacs keybindings
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-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] Applying functions to mutable lists
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 > support functions but I'd like to be able to apply racket functions to the > lists I've constructed and I don't see any "mapply". I understand that the > use of mutable cons cells is discouraged but I don't currently know of a > better way to do lazy lists. If there is a different recommended way, I'd > like to know about it. If not: > > 1) Is there an equivalent of mapply that I just haven't found or > 2) Is there a reason it's a really bad idea or > 3) Was it just left out because nobody so far needed it? > > Thanks for any help, > > --Jerry Jackson > > -- > 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. > -- 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] compiling Racket to android and ios apps
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 months take > what I say with a grain of salt... > > Re-reading the OP's post it sounds like you've actually done Racket based > Phonegap/Cordova apps... I was going to mention Moby and/or Whalesong but > it sounds like been there/done that? > > Otherwise I too had briefly looked at Lamdbanative as mentioned above. > > That was interesting to me as a newbie to Racket and scheme both in seeing > how much of my Racket learning helped me to follow their code, as well as > how much does not. :) i.e. I'm new enough I'm not always appreciating what > in Racket is standardized and what is not... > > Glancing at this example game Lamdbanative includes: > https://github.com/part-cw/lambdanative/blob/master/apps/uSquish/main.scm > > My first reaction was "great I can read this code!" then my second > reaction was "oh yeah that's right big-bang ain't gonna be here... hmmm I > don't see require anywhere I guess modules work differently too ok..." > > Which is not to be negative it was just to recognize that gambit scheme > and lambdanative isn't racket so seemingly wouldn't be able to benefit from > a lot of Racket modules or it's community etc... > > Otherwise did you notice Lambdanative has it's own widget set built atop > OpenGL - that's how it achieved portability across iOS and Android with the > same code. But of course those widgets are a tradeoff - depending on what > you're doing (e.g. a game) they may be fine, but if you really want the > look and feel of native widgets that's not what you're getting. > > Lastly (maybe you know this) Gambit by design is a scheme to C translator > apparently that's why it was chosen for doing these mobile apps i.e. the > resulting code is comparable size wise and performance wise to something > you might have written in C, and obviously C is portable across iOS and > Android. > > I don't really know but I'm guessing porting the Racket VM to operate well > on iOS and Android is a bigger job than this (i.e. than getting Gambit's C > code to compile on IOS and Android). i.e. Maybe that's why there's not a > better Racket on iOS/Android story already. :) > > Chicken scheme uses a similar compile-to-C approach (they call it "Cheney > on the MTA" you can google it if you're interested). They seem to have a > good community too with lots of these packages (they call "eggs"). And I > know there's at least this one effort to do android native apps with > Chicken: https://github.com/chicken-mobile/android-chicken > > But in the end I didn't find any perfect answer either. > > I came away wishing that somehow Gambit/Lambdanative could be enhanced to > be Racket compatible... if only I had a magic wand. :) > > > > > > > > On Sat, Feb 21, 2015 at 4:06 AM, Stephen De Gabrielle < > spdegabrie...@gmail.com> wrote: > >> FWIW this project targets both android and IOS: >> https://github.com/part-cw/lambdanative >> >> On Fri, 20 Feb 2015 at 19:32, Jens Axel Søgaard >> wrote: >> >>> 2015-02-13 23:08 GMT+01:00 Neil Van Dyke : >>> > Anyone have any current/planned projects on compiling Android and iOS >>> apps >>> > from Racket? >>> >>> > So, as an alternative for smartphone/tablet apps, to keep handy as a >>> backup >>> > to HTML5, I'm interested again in the idea of compiling Racket to >>> native iOS >>> > and Android apps. Typical polished commercial-grade apps, so pedagogic >>> > graphics worlds alone usually aren't enough. >>> >>> I'd be interested in helping with iOS apps (writing bindings etc) >>> provided someone >>> solves the initial hurdle: getting Racket to cross compile to iOS and >>> get it >>> running on an emulator (and later an actual phone/tablet). >>> >>> There might be some hints (wrt compiler switches) here: >>> >>> https://github.com/feeley/gambit/blob/master/misc/build-gambit-iOS >>> >>> /Jens Axel >>> >>> Racket Users list: >>> http://lists.racket-lang.org/users >>> >> >> >> Racket Users list: >> http://lists.racket-lang.org/users >> >> > > > Racket Users list: > http://lists.racket-lang.org/users > > Racket Users list: http://lists.racket-lang.org/users
Re: [racket] Units and serializable-struct
That makes sense. Thanks. Justin On Feb 5, 2015 2:35 AM, "Matthew Flatt" wrote: > The `struct` form in a signature describes a structure type that will > be implemented by some unit. It can't work to have a similar > `serializable-struct` form in a signature, because different units can > implement a signature with different structure types, and a > deserializer can't know which one to create. > > Using `define-serializable-struct` in a `unit` form won't work, either. > That's because each instantiation of the unit create a different > 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. > > At Wed, 4 Feb 2015 16:19:23 -0500, Justin Zamora wrote: > > 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 structs and writing my own read-struct and > > write-struct routines)? What is the best course of action? > > > > Justin > > > > Racket Users list: > > http://lists.racket-lang.org/users > Racket Users list: http://lists.racket-lang.org/users
Re: [racket] Problem with structs and #lang racket/signature
Yes, I had a copy/paste error in my previous message. The struct definition in the unit matches the one in the signature. I think that Daniel identified the core problem that the constructor is defined differently in #lang racket/signature. Justin On Feb 4, 2015 9:31 PM, "Matthias Felleisen" wrote: > > This works: > > ;; - > #lang racket/signature ;; b-sig.rkt > > (struct spelling-word (word sentence word-number lesson word-list)) > b-value > > ;; - > #lang racket/unit ;; b-unit.rkt > > (require "b-sig.rkt") > > (import) > (export b^) > > (define-struct spelling-word (word sentence word-number lesson word-list)) > > (define b-value 3) > > > ;; - > The signature of a component (unit) describes the names of the exports > (or imports). So when you write > > (struct my-struct (a b c)) > > in a signature, your exporting unit must define something like > > (define-struct my-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. > > -- Matthias > > > > > > > > On Feb 4, 2015, at 9:14 PM, Justin Zamora wrote: > > > There seems to be a problem exporting struct constructors when using > #lang racket/signature. This works: > > > > - 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) > > (export b^) > > > > (struct spelling-word > > (word sentence word-number lesson word-list)) > > > > (define b-value 3) > > > > But if you change b-sig to use #lang racket/signature: > > #lang racket/signature > > > > (struct my-struct (a b c)) > > b-value > > > > then running b-unit produces the error: > > > > Welcome to DrRacket, version 6.1 [3m]. > > Language: racket/unit; memory limit: 512 MB. > > define-unit: undefined export make-my-struct in: (define-unit b@ > (import) (export b^) (struct my-struct (a b c)) (define b-value 3)) > > > > Is this a just a bug or am I missing something? > > > > > > Racket Users list: > > http://lists.racket-lang.org/users > > Racket Users list: http://lists.racket-lang.org/users
[racket] Problem with structs and #lang racket/signature
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) (export b^) (struct spelling-word (word sentence word-number lesson word-list)) (define b-value 3) But if you change b-sig to use #lang racket/signature: #lang racket/signature (struct my-struct (a b c)) b-value then running b-unit produces the error: Welcome to DrRacket, version 6.1 [3m]. Language: racket/unit; memory limit: 512 MB. define-unit: undefined export make-my-struct in: (define-unit b@ (import) (export b^) (struct my-struct (a b c)) (define b-value 3)) Is this a just a bug or am I missing something? Racket Users list: http://lists.racket-lang.org/users
[racket] Units and serializable-struct
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 structs and writing my own read-struct and write-struct routines)? What is the best course of action? Justin Racket Users list: http://lists.racket-lang.org/users
Re: [racket] A beginner's question re drawing on a canvas
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 model. A controller is used to update the model in response to input. In your example, the canvas is the view. Your on-draw method needs to draw the model. Your buttons will send a message to your controller, and the controller will update the model accordingly. Then, when on-draw is called, it will draw the updated model. Justin On Oct 1, 2014 10:17 PM, "Chris Wright" wrote: > Thanks Matthias and Sean > > It's often helpful when people asking questions ask them clearly ! :) > I'll now attempt a clarification... > > say I have a button in the window, and when that button is pressed, I want > to draw on the canvas - and later, another button is pressed, and I might > want to draw something else somewhere else on the canvas. > > I think I'm wanting to get hold of the dc outside of the definition of > on-paint in the initialisation code > > cheers and thanks again > > Chris > > On 2 October 2014 11:57, Matthias Felleisen wrote: > >> >> Does this help? >> >> #lang racket/gui >> >> (define frame >> (new frame% >>[label "Example"] >>[width 300] >>[height 300])) >> >> (define top-canvas >> (new (class canvas% >> (inherit get-dc) >> (super-new [parent frame]) >> (define/override (on-paint) >>(define dc (get-dc)) >>(send dc draw-rectangle >> 0 10 ; Top-left at (0, 10), 10 pixels down from >> top-left >> 30 10) ; 30 pixels wide and 10 pixels high >>(send dc draw-line >> 0 0; Start at (0, 0), the top-left corner >> 30 30) ; and draw to (30, 30), the bottom-right corner >>(send dc draw-line >> 0 30 ; Start at (0, 30), the bottom-left corner >> 30 0) ; and draw to (30, 0), the top-right corner >> >> >> (send frame show #t) >> >> >> >> >> On Oct 1, 2014, at 9:51 PM, Chris Wright wrote: >> >> > I would like to draw on a canvas in a window at various times during >> program execution. >> > My first attempt was to combine two examples: >> > >> > #lang racket/gui >> > >> > (define frame (new frame% >> >[label "Example"] >> >[width 300] >> >[height 300])) >> > (define top-canvas (new canvas% [parent frame])) >> > >> > (send frame show #t) >> > >> > (define dc (send top-canvas get-dc)) >> > >> > (send dc draw-rectangle >> > 0 10 ; Top-left at (0, 10), 10 pixels down from top-left >> > 30 10) ; 30 pixels wide and 10 pixels high >> > (send dc draw-line >> > 0 0; Start at (0, 0), the top-left corner >> > 30 30) ; and draw to (30, 30), the bottom-right corner >> > (send dc draw-line >> > 0 30 ; Start at (0, 30), the bottom-left corner >> > 30 0) ; and draw to (30, 0), the top-right corner >> > >> > >> > >> > The cross and box are drawn, but "instantly" over-written by a blank >> canvas. I suppose this is because on-paint is triggered? (not sure by >> what..) >> > If I put the (send frame...) form at the end of the code, the cross and >> box aren't seen. >> > >> > I am sure this is due to me not understanding the model properly - I'd >> be grateful for some help... >> > >> > many thanks >> > >> > Chris >> > >> > Racket Users list: >> > http://lists.racket-lang.org/users >> >> > > > -- > A/Prof Chris Wright > MBBS, FRACP, FCICM, GradDipiSc(Physics) > Academic Coordinator, Years III - V Central MBBS > Intensive Care Specialist > Faculty of Medicine, Nursing and Health Sciences, > Monash University > Clayton VIC > > > Racket Users list: > http://lists.racket-lang.org/users > > Racket Users list: http://lists.racket-lang.org/users
Re: [racket] "if" and internal definitions
Ok, but why is "cond" defined to behave differently? I expected "cond" to behave the same as "if". Justin On Mar 16, 2014 4:59 PM, "Jens Axel Søgaard" wrote: > The problem is that begin does not introduce a new scope. > You can use (let () ...) 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 "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 7) > > a]) > > > > I notice that the expansion of "cond" encloses the clauses inside > > (let-values () ...). Why doesn't "if" allow this? > > > > Justin > > > > > > Racket Users list: > > http://lists.racket-lang.org/users > > > > > > -- > -- > Jens Axel Søgaard > Racket Users list: http://lists.racket-lang.org/users
[racket] "if" and internal definitions
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 7) a]) I notice that the expansion of "cond" encloses the clauses inside (let-values () ...). Why doesn't "if" allow this? Justin Racket Users list: http://lists.racket-lang.org/users
Re: [racket] FYI: A new Racket-powered startup
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
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 no)) > '(n no) > > (memq 'racket '(y yes n no)) > #f > > > > By the way, I wrote a procedure as follows: > > (require srfi/13) > > (define (yes-or-no? arg) > ; expected it returns #t or #f > ; depending on input such as yes or no > (letrec ((y-or-n? > ; if argument is either Y or YES, > ; it returns #t otherwise #f > (lambda (sym) > (and (memq sym '(Y YES)) #t))) >(symbol-upcase > ; confirm any symbol into uppercase > (lambda (arg) > (if (symbol? arg) > (string->symbol (string-upcase (symbol->string arg))) > (yes-or-no? (read)) > (let ((sym (symbol-upcase arg))) > (if (memq sym '(Y YES N NO)) > (y-or-n? sym) > (yes-or-no? (read)) > > I expected that (cond ((I input y or yes) returns #t) >((I input n or no) returns #f) >(else this procedure waits something)) > > However, result is so strange: > > > (yes-or-no? (read)) > 3 > 2 > 4 > foo > bar > baz > yes > y > no > n > #f > > Notice that even though yes, y or no is entered, the procedure ignores and > it never returns #f until n is entered. > Strange. > Does anyone know why this doesn't work? > > Thanks. > > > Racket Users list: > http://lists.racket-lang.org/users > > Racket Users list: http://lists.racket-lang.org/users
Re: [racket] R7RS and Racket in the (far) future
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, untenable, or completely unnecessary. I think the point is that Racket should not be thought of as a "Scheme variant." It follows its own rules and has its own goals and is not beholden to RnRS in any way. As such, it is able to go in directions that RnRS can't. As Matthias said, it is better to think of Racket as a separate language in the Lisp/Scheme family rather than an implementation of Scheme per se. Justin Racket Users list: http://lists.racket-lang.org/users
Re: [racket] the most functional man in the world
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 point; something like, "He dates all the girls... in parallel." Without the humor, it feels more like a blatant ripoff. Justin Racket Users list: http://lists.racket-lang.org/users
Re: [racket] [racket-ide] Can the split view be made to be vertical as well?
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.. At least, for me, having that > vertical view makes it easier in terms of reading and comparing. > > > Racket Users list: > http://lists.racket-lang.org/users > > Racket Users list: http://lists.racket-lang.org/users
Re: [racket] [plt-edu-talk] Does a Scheme procedure "return" a value?
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 that's a more advanced topic.) Justin On Sep 7, 2012 8:47 PM, "Ellen Spertus" wrote: > I can't help feeling a twinge when I refer to a Scheme procedure > "returning" a value, since I think my own teachers instead spoke of a > procedure application as having, not returning, a value. Is it wrong to > speak of a procedure returning a value? If so, how bad is it, and what is > it recommended that I say instead? FWIW, we use PLAI as our textbook. > > Thanks. > > Ellen > > > PLT Educators talk list: > http://lists.racket-lang.org/plt-edu-talk > > Racket Users list: http://lists.racket-lang.org/users
[racket] Frames within Frames?
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?
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 > returns #f if the string has at least one uppercase alphabetic > character, else returns #t. > > Examples: > (all-lower-case? "asdf12#@") => #t > (all-lower-case? "asDf12#@") => #f > > Here is how I have written it: > > (define (all-lower-case? str) > (not (memq #t > (map (lambda (i) > (if (and (char-alphabetic? i) (char-upper-case? i)) > #t #f)) > (string->list str) > > This looks rather clumsy to me. I am converting the string into > a list of characters, then I check the case of each character > and issue the requisite verdict. It seems to me that there > ought to be a neater way. Any suggestions? > > -- > Rouben Rostamian > > Racket Users list: > http://lists.racket-lang.org/users Racket Users list: http://lists.racket-lang.org/users
Re: [racket] `def' ?
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 useful. It can be written quickly and is read and understood easily The overloading of "+" (or your operator of choice) and the implicit coercion of characters to strings is exactly what is wanted here. Even evaluating person[i] more than once doesn't clutter up the expression. Compare this to the equivalent Racket: (define initials (string-append (string (string-ref (id-firstname (vector-ref person i)) 0)) (string (string-ref (id-lastname (vector-ref person i)) 0 For this sort of thing, the Racket version is much harder to write, read, and verify. It would be nice to have something akin to at-expressions that would allow such expressions to be written more clearly. Justin On Thu, May 10, 2012 at 4:00 PM, Matthias Felleisen wrote: > > I will assert something about readability: > > Racket programs look heavy when compared with Haskell programs. > > This is probably true for Python instead of Haskell, too. It is also true for > ML. I conjecture that part of that heaviness comes from wide lines, long > names, deep nesting. Who knows. I don't even know how to measure this kind of > property. > > At this point, I can express certain ideas more easily in Racket than in > Haskell, Python, ML or whatever, which is why I am fine. But if this > advantage ever disappeared, heaviness would definitely be a factor to weigh. > > -- Matthias > > > > > > > On May 10, 2012, at 3:49 PM, ozzloy-racket-users wrote: > >> i didn't assert that word length has nothing to do with readability, just >> that word frequency has more impact on reading time than word length. >> >> On Thu, May 10, 2012 at 3:39 PM, Luke Vilnis wrote: >> I can only speak for myself but I think it's a bit much to assert that word >> length has nothing to do with readability. Heck, maybe that's even true for >> you, but not for everyone. I have certainly felt it to be an issue. If the >> "define" keyword was 50 letters long it would definitely have an impact on >> my ability to read code - it seems to be an issue of degree, not existence. >> >> On Thu, May 10, 2012 at 3:26 PM, ozzloy-racket-users >> wrote: >> am i the only one that thinks not having abbreviated names for anything is >> good? >> i like not having "def". especially if it's going to be redundant. >> i see this as a slippery slope i don't want to go down. >> it annoys me when switching to other languages to have to ask: which way of >> shortening "function" does this language go with? was it "fn"? maybe "fun"? >> if the language has a strict policy of not using short versions of words, i >> don't have to guess. >> >> as for "def" being easier to read than "define", that's not true. word >> frequency has more impact on reading time than word length for normal >> reading. having more aliases makes both less frequent, so adding "def" >> could plausibly make reading both take longer. most people read whole words >> at a time, rather than letter-by-letter. >> >> >> On Thu, May 10, 2012 at 2:56 PM, Grant Rettke wrote: >> There is always pretty mode in Emacs. >> >> On Thu, May 10, 2012 at 1:45 PM, Ray Racine wrote: >> > FYI for those who may not know. Racket supports λ as an alias for lambda. >> > ctrl-\ in DrRacket. >> > >> > >> > On Thu, May 10, 2012 at 1:59 PM, Nikita B. Zuev wrote: >> >> >> >> +1 for `def' as alias for `define'. >> >> May I also suggest `fun' for `lambda' alias? >> >> Three letter names are the best =) >> >> >> >> (well one can always do it with require rename-in) >> >> >> >> -- >> >> Regards, >> >> Nikita B. Zuev >> >> >> >> Racket Users list: >> >> http://lists.racket-lang.org/users >> > >> > >> > >> > >> > Racket Users list: >> > http://lists.racket-lang.org/users >> > >> >> >> >> -- >> http://www.wisdomandwonder.com/ >> ACM, AMA, COG, IEEE >> >> >> Racket Users list: >> http://lists.racket-lang.org/users >> >> >> >> Racket Users list: >> http://lists.racket-lang.org/users >> >> >> >> >> Racket Users list: >> http://lists.racket-lang.org/users > > > > Racket Users list: > http://lists.racket-lang.org/users Racket Users list: http://lists.racket-lang.org/users
Re: [racket] spirit of Racket?
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-999 (define (pe-004) (for*/fold ([greatest 0]) ([first (in-range 101 1000)] [second (in-range 101 1000)] #:when (palindrome? (* first second))) (max greatest (* first second Justin On Sun, Mar 11, 2012 at 4:12 PM, Joe Gilray wrote: > Hi, I'm redoing the ProjectEuler problems to learn Racket (great fun!). > Below are three solutions to PE#4. Which is most in the spirit of Racket? > Of course, I'd love to see solutions that are more idiomatic too. Is there > a better way that doesn't use "for" at all? > > Thanks! > -Joe > > ; function that turns a positive integer into a list of digits (in reverse > order) > ; invoke as (listize 234511) or (set-count (list->set (listize 112342))) > (define (listize num) > (if (= num 0) > '() > (cons (remainder num 10) (listize (quotient num 10) > > ; function that returns #t if the passed number is palindromic > ; invoke as (palindromic? n) > (define (palindromic? n) > (if (equal? (listize n) (reverse (listize n))) #t #f)) > ) > > ; ProjectEuler problem #4 > (define (euler4a) > (let ([max 10]) > (for ([i (build-list 899 (lambda (x) (+ 100 x)))]) > (for ([j (build-list (- 999 i) (lambda (y) (+ i y)))]) > (let ([prod (* i j)]) > (when (palindromic? prod) > (begin > (when (> prod max) (set! max prod)) > (printf "~a * ~a = ~a~n" i j prod)) > (printf "Max palindromic product is ~a~n" max))) > > ; ProjectEuler problem #4 using for* > (define (euler4b) > (let ([max 10]) > (for* ([i (build-list 899 (lambda (x) (+ 100 x)))] > [j (build-list 899 (lambda (y) (+ 100 y)))] > #:when (and (>= j i) (palindromic? (* i j > (let ([prod (* i j)]) > (when (> prod max) (set! max prod)) > (printf "~a * ~a = ~a~n" i j prod))) > (printf "Max palindromic product is ~a~n" max))) > > ; ProjectEuler problem #4 - a mix of 4a and 4b > (define (euler4c) > (let ([max 10]) > (for* ([i (build-list 899 (lambda (x) (+ 100 x)))] > [j (build-list (- 999 i) (lambda (y) (+ i y)))] > #:when (palindromic? (* i j))) > (let ([prod (* i j)]) > (when (> prod max) (set! max prod)) > (printf "~a * ~a = ~a~n" i j prod))) > (printf "Max palindromic product is ~a~n" max))) > > > Racket Users list: > http://lists.racket-lang.org/users > Racket Users list: http://lists.racket-lang.org/users
[racket] paint-callback and dc
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 Users list: http://lists.racket-lang.org/users
[racket] Named let and multiple values
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 given the expansion of named let, but it would be nice if this worked. Using (call-with-values (lambda () (values (add1 a) b)) loop) works, but that seems to defeat the point of using a named-let form for clarity. I could also use let-values to deconstruct the values and pass them individually to the loop, but that hardly seems better. Is there a better way? Justin _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users
[racket] Exiting a for loop early
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 administrative tasks: http://lists.racket-lang.org/listinfo/users
Re: [racket] Injecting HTML into a scribble document?
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 Scribble-generated HTML. Justin _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users
Re: [racket] Three questions related DrRacket
One of the nice things about Racket is that it works a lot like algebra. You combine Racket expressions the same way you combine mathematical expressions. In math, you would write a single expression that's built out of smaller expressions, such as 10 * (x + 1). In Racket, you would write this as: (* 10 (+ x 1)). Just as in algebra, the innermost expressions are evaluated first, and the the results are used by the outer expressions to compute a final result. You will get farther in Racket by thinking in terms of evaluating expressions and reducing them to a result than by thinking in terms of executing a sequence of steps. You may be interested in looking at some video lectures I made. The class got cancelled, so there are only a few lectures, but they deal with the basics of Racket expressions. They are at http://www.youtube.com/playlist?p=PL3F392F068BECB707 Justin On Wed, Jun 1, 2011 at 11:09 PM, Yingjian Ma wrote: > Thank you both for your reply. > > My real need is to use the result of the first function in the second > function. Is there a standard way to pass a variable into the next > function? > > On Wed, Jun 1, 2011 at 6:24 PM, Shriram 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, Justin Zamora wrote: >> > 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 >> > the last expression, the value gets returned as the value of the >> > function. When there is more than one expression in a function body, >> > all of them get evaluated, but only the last is returned. If you want >> > to use the results of both expressions, then you need to use two >> > functions, one for each expression, as Shriram said. >> > >> > Justin >> > >> > _ >> > For list-related administrative tasks: >> > http://lists.racket-lang.org/listinfo/users >> > > > > _ > For list-related administrative tasks: > http://lists.racket-lang.org/listinfo/users > _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users
Re: [racket] Three questions related DrRacket
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 the last expression, the value gets returned as the value of the function. When there is more than one expression in a function body, all of them get evaluated, but only the last is returned. If you want to use the results of both expressions, then you need to use two functions, one for each expression, as Shriram said. Justin _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users
Re: [racket] repl parsing question
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 delimiter that the reader can use to detect the end of the boolean. Justin On Tue, Feb 1, 2011 at 9:59 AM, qld3303 wrote: > Hello, > I'm a beginner trying to write a simple Scheme interpreter to help > understand Racket better. I try to mimic the results from the repl as best > possible however in some cases I'm not sure how to reproduce them, this > being one such case. It seems to imply that an identifier or something > other than a boolean could begin with #t but I'm not sure. I tried this > using Guile and got the opposite results: > guile> (+ 3 1)#t+ > 4 > #t > # > guile> (+ 3 1)#\t+ > 4 > ERROR: In procedure scm_lreadr: > ERROR: #:2:1: unknown character name t+ > ABORT: (read-error) > > Currently, my naive repl will work for both characters and booleans but > perhaps it shouldn't? > > Thanks > > On Mon, Jan 31, 2011 at 9:13 PM, qld3303 wrote: >> >> I'm not clear as to why the following occurs: >> >> > (+ 3 1)#t+ >> 4 >> readline-input::183: read: bad syntax `#t+' >> >> > (+ 3 1)#\t+ >> 4 >> #\t >> # >> >> Why doesn't it recognize that #t is a boolean value? > > > _ > For list-related administrative tasks: > http://lists.racket-lang.org/listinfo/users > _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users
[racket] Embedding Video in Scribble HTML
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.com/embed/J3WIPS3Uh_A?rel=0"; > frameborder="0">}| > > But since the element passes through the renderer, I get the above > string displayed as is on the HTML page. > Is there a loop hole that allows one to pass HTML untouched through > the renderer? I didn't see a solution to this, and I would like to do the same thing? Is there a way to do this? Ideally, I would like a conditional form that allows me to embed the video in HTML output or an image (such as a screenshot from the video) if the output is PDF. Justin _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users
Re: [racket] Couldn't find a step matching that criterion
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 issue with the stepper. Maybe the programs are too simple > so far for the stepper, but it doesn't step. > > The check syntax feature is great. for the check-color game should the > stepper work? What is the trick? I just wanted to check the flow by stepping > through. > Each time I use it I get "Couldn't find a step matching that criterion" > No matter what I change select or do. > > ;check-color > ;colour guessing game (target target)(guess guess) > ;symbol symbol symbol symbol -> string > ;four color symbols > (define (check-color target1 target2 guess1 guess2) > (cond > [(eq? target1 guess1) 'Perfect] > [(or (eq? target1 guess1)(eq? target2 guess2)) > 'OneColorAtCorrectPosition] > [(or (eq? target1 guess2)(eq? target2 guess1)) 'OneColorOccurs] > [else 'NothingCorrect])) > > ;(check-color 'red 'green 'green 'red) > ;'OneColorOccurs > > Sayth > > _ > For list-related administrative tasks: > http://lists.racket-lang.org/listinfo/users > _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users
Re: [racket] unification
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 in racket? > Thanks, > yc > > _ > For list-related administrative tasks: > http://lists.racket-lang.org/listinfo/users > _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users
Re: [racket] Exploratory programming?
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 indexing is not very good. For example, this query returns no matches: http://docs.racket-lang.org/search/index.html?q=sine This is especially frustrating for students who know what kind of function they want but don't know its name. Justin _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users
Re: [racket] 26.1.1 tabulate-div
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 are really doing a structural recursion on n, not a generative recursio. The point of generative recursion is that there are problems that are not based on the structure of the input and need to recurse on something else. For example, the move-ball example of Section 25.1 recurses on the position of the ball, not on the structure of the ball itself. To solve this problem, you need to stop thinking about breaking down n, and think about another method of finding out which numbers are the divisors of n. Justin On Thu, Nov 4, 2010 at 9:16 PM, Ken Hegeland wrote: > > I had made a previous post on this subject and have spent a few days trying > to work out this problem but I feel like I have hit a dead end, and I am > hoping I can get some advice from a few people with more experience than I. > > The code I have managed to create so far is: > (define(find-div n i) > (cond > [(=(remainder n i)0)i] > [else(find-div n(sub1 i))])) > ;(find-div 20 3) > > (define(tabulate-div n) > (cond > [(= n 1)(list 1)] > [else(append > (cons n empty) > (tabulate-div(find-div n(sub1 n])) > (tabulate-div 20) > > I believe that I understand how generative recursion, and I have spent a lot > of time attempting to figure this problem out in a much more complex way. The > above code seems much easier to read and understand, but, it suffers similar > problems as the other things I have tried. Mainly, it doesn't produced the > wanted answer, it's close, but not quite there. > > (tabulate-div 20) should equal (list 1 2 4 5 10 20) > However, with this code the answer given is (list 20 10 5 1). > I have figured out that if I somehow divide 20 by each number in the list I > get > (list(/ 20 20)(/ 20 10)(/ 20 5)(/ 20 1))=(list 1 2 4 20) which seems a little > closer, but still not quite there. Although this would only be close and not > all the way there, I feel its a step in the right direction. My problem is > that if I add a local definition of: > (local((define q(/ n (find-div n n > it produces an incorrect answer. This would give me(list(/ 20 20)(/ 10 10)(/ > 5 5)(/ 1 1)) > > Maybe I don't understand how generative recursion works exactly. I could > really use some advice, this problem is starting to aggravate me. > > > > _ > For list-related administrative tasks: > http://lists.racket-lang.org/listinfo/users _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users
Re: [racket] a small programming exercise
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) >(next (* base base) (* i i))) >((> next n) (leftmost-digit (floor n i) base) I tried a comparison of your method to the string-conversion method and was surprised that the string-comparison version ran 3 times faster! I think I implemented your method correctly (at least it appears to produce correct results). Any insights? (define (first-digit-string n) (- (char->integer (string-ref (number->string n) 0)) (char->integer #\0))) (define (first-digit-fast n) (if (> 10 n) n (let loop ([i 10] [next 100]) (if (> next n) (first-digit-fast (floor (/ n i))) (loop next (* i i)) (define *the-list* (filter positive? (build-list 1000 (lambda (i) (random (+ i 1)) > (time (for-each first-digit-string *the-list*)) cpu time: 3969 real time: 4016 gc time: 718 > (time (for-each first-digit-fast *the-list*)) cpu time: 11875 real time: 11907 gc time: 391 Justin _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users
Re: [racket] a small programming exercise
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://lists.racket-lang.org/listinfo/users
Re: [racket] a small programming exercise
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) (inexact->exact (floor (/ n (expt 10 (floor (log10 n))) ; Table of occurrences (define table (make-vector 10 0)) ; Update the table of occurrences (define (update-table n) (let ([i (first-digit n)]) (vector-set! table i (add1 (vector-ref table i) ; Display the table (define (distribution count) (map (lambda (n) (list n (exact->inexact (/ (vector-ref table n) count '(1 2 3 4 5 6 7 8 9))) ; Display the distribution of first digits in a list (define (benford l) (begin (for-each update-table l) (distribution (length l ; Display the distribution of a list of random numbers (benford (filter positive? (build-list 1000 (lambda (n) (random (add1 n)) ==> '((1 0.25075528700906347) (2 0.1782477341389728) (3 0.15709969788519637) (4 0.11379657603222558) (5 0.08459214501510574) (6 0.07653575025176233) (7 0.050352467270896276) (8 0.044310171198388724) (9 0.044310171198388724)) _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users
Re: [racket] a little macro exercise
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 Device relies on, for > example. Duff's Device also relies on the fact that C's "case" keyword is really a label used as a jump target . This lets the switch jump into the middle of an expression. I don't think any of the solutions posted so far could be used to implement Duff's Device. Justin _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users
Re: [racket] Is there a name for: (lambda (x) (x)) ?
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 to iterate over the results of these > using a high-order function ... map, for-each, filter (et al). > > The only way I can find to do it is: > > (map (lambda (x) (x)) > (list > (lambda () 1) > (lambda () 2) > (lambda () 3))) -> '(1 2 3) > > Is there a standard name for the (lambda (x) (x)) in racket? > > Or do I have to write my own (define (call x) (x))? > > Tim > > -- > Tim Brown | City Computing Limited | > T: +44 20 8770 2110 | City House, Sutton Park Road | > F: +44 20 8770 2130 | Sutton, Surrey, SM1 2AE, GB | > ---| > BEAUTY: What's in your eye when you have a bee in your hand | > ---' > City Computing Limited registered in London No. 1767817. > Registered Office: City House, Sutton Park Road, Sutton, Surrey, SM1 2AE > VAT number 372 8290 34. > _ > For list-related administrative tasks: > http://lists.racket-lang.org/listinfo/users > _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users
Re: [racket] 2htdp/image question
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, 2010 at 5:23 PM, Mark Engelberg wrote: > Why is it that > (empty-scene 100 100) produces a white scene with a black border > around all four edges, but > (place-image (circle 10 'solid 'red) 10 10 (empty-scene 100 100)) > produces a scene with a black border only on its top and left edges? > > (This is in Racket 5.0.1 on Windows) > _ > For list-related administrative tasks: > http://lists.racket-lang.org/listinfo/users > _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users
[racket] Stepper and application in BSL
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, if I instead click on "Application >", I get "All of the definitions have been successfully evaluated." I expected to get (+ 4 1). I thought the stepper would replace (f 3) with the result of the application. Why didn't I see what I expected? Justin _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users
Re: [racket] Problem with get-slides-as-picts
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" > To: users@racket-lang.org > Sent: Sunday, August 8, 2010 3:11:20 PM GMT -05:00 US/Canada Eastern > Subject: [racket] Problem with get-slides-as-picts > > 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: glyph-exists? > > What am I doing wrong? > > Justin > _ > For list-related administrative tasks: > http://lists.racket-lang.org/listinfo/users > _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users
[racket] Problem with get-slides-as-picts
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: glyph-exists? What am I doing wrong? Justin _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users
[racket] Bug in Algol 60 procedure calls
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 P := 3; end; printn(P); end printn: expected argument of type ; given # Is this a bug or am I doing something wrong? Justin _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users
[racket] What #lang to use for Algol 60?
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?
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