[racket] clarification for a Typed Racket error?

2012-01-05 Thread Erik Silkensen
Hi, I was wondering if someone could help me understand the problem with the following code? (struct: obj ([a : Integer] [b : Symbol])) (: f1? (obj Symbol -> Boolean)) (define (f1? o x) (and (= 0 (obj-a o)) (eq? x (obj-b o (: f2? (obj Symbol -> Boolean)) (define (f2? o x) (and (zer

Re: [racket] Making a Racket function "recallable"

2012-02-13 Thread Erik Silkensen
Another option is you could turn change your fib function to be 'mk-fib' that returns a new instance of the fib function each time it's called: (define (mk-fib) (let ([n0 -1] [n1 1]) (lambda () (let ([next (+ n0 n1)]) (set! n0 n1) (set! n1 next)) n1))) - Erik O

Re: [racket] Making a Racket function "recallable"

2012-02-13 Thread Erik Silkensen
t; (if (>= fib-val n) '() (cons fib-val (fib-less-than-n n)) > > How would I use your idea in this case? > > thanks! > -joe > > On Mon, Feb 13, 2012 at 9:18 PM, Erik Silkensen > wrote: > Another option is you could turn change your fib function

Re: [racket] Making a Racket function "recallable"

2012-02-14 Thread Erik Silkensen
specially (let loop ([vs '()]). > What exactly is going on there? > > Thanks again, > -joe > > On Mon, Feb 13, 2012 at 9:51 PM, Erik Silkensen > wrote: > Instead of calling fib-less-than-n recursively, you could add a loop inside, > for example something like, > &

Re: [racket] Any way to get "true" quasiquote behavior in match form?

2012-03-09 Thread Erik Silkensen
I wonder if define-match-expander might be what you're looking for? http://docs.racket-lang.org/reference/match.html?q=define-match-expander#(form._((lib._racket/match..rkt)._define-match-expander)) Erik On Mar 9, 2012, at 8:22 PM, rob cook wrote: > Thanks for the tips - I am new to using matc

Re: [racket] Are There More String Functions?

2012-04-11 Thread Erik Silkensen
Hi Cristian, Check out SRFI 13: http://docs.racket-lang.org/srfi-std/srfi-13.html You can load it in Racket with (require srfi/13) -- Erik On Apr 11, 2012, at 10:57 PM, Cristian Esquivias wrote: > I just started getting my hands dirty with Racket on some utility > scripts. Overall, it's been a

Re: [racket] Are There More String Functions?

2012-04-11 Thread Erik Silkensen
can I use a mix of the > built-in Racket string functions and srfi/13 functions, or will I have > to migrate completely to the srfi/13 functions? > > - Cristian > > On Wed, Apr 11, 2012 at 10:06 PM, Erik Silkensen > wrote: >> Hi Cristian, >> >> Check out SR

Re: [racket] DrRacket and The Little Schemer?

2012-05-20 Thread Erik Silkensen
Try just the Racket language by putting "#lang racket" at the top of your file. On May 20, 2012, at 9:09 PM, Olwe Melwasul wrote: > I've been working through The Little Schemer using Petite Chez Scheme and > Emacs, but now I'd like to try DrRacket. I have a large file where I've been > putting

Re: [racket] looking for a twitter library (or, failing that, OAuth 1.0)

2012-05-21 Thread Erik Silkensen
The arc page is out of date -- it will run with the MzScheme included in the current Racket download (https://sites.google.com/site/arclanguagewiki/getting-started/install-arc) On May 21, 2012, at 12:37 AM, Marijn wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On 14-05-12 08:03,

Re: [racket] unwrapping a list

2012-06-11 Thread Erik Silkensen
You could use match or match-let, e.g., (match-let ([(list year month day) (regexp-split #rx"/" "2012/06/06")]) …) http://docs.racket-lang.org/reference/match.html On Jun 11, 2012, at 8:24 PM, Jordan Schatz wrote: > > Is there a way to unwrap or explode a list? I don't see it in the docs, bu

[racket] how to define-predicate for a recursive type?

2012-08-08 Thread Erik Silkensen
Hi, The code #lang typed/racket (define-type IntList (Rec List (Pair Integer (U List Null (define-predicate int-list? IntList) > (int-list? '(1 2 3)) gives the runtime error: recursive-contract: expected a flat contract or a value that can be coerced into one, got # Is there a way to

[racket] Macro question - `let' without inferring name?

2012-09-05 Thread Erik Silkensen
Hi, I'm wondering if there's any way to have a macro like (define-syntax (m stx) (syntax-case stx () [(m expr) #'(let ([t expr]) ;; t)])) that binds expr to t, does some things, and then somehow returns t -- but with whatever name would have been inferred for e

Re: [racket] Macro question - `let' without inferring name?

2012-09-05 Thread Erik Silkensen
Cool, thanks! Erik On Sep 6, 2012, at 12:08 AM, Eric Dobson wrote: > How about: > > (define-syntax (m stx) > (syntax-case stx () >[(m expr) > #'(let ([t (values expr)]) > ;; > t)])) > > Which seems to work for me. >

[racket-users] eval and set

2015-04-04 Thread Erik Silkensen
Could someone explain how this example works? $ racket Welcome to Racket v6.1.1. -> (require racket/sandbox) -> (define racket-eval (make-evaluator 'racket)) -> (define a (racket-eval '(set 1 2 3))) -> a (set 1 2 3) -> (set? a) #f -> (define racket-eval-again (make-evaluator 'racket)) -> (equal? a

[racket-users] Package documentation category with info.rkt

2016-02-08 Thread Erik Silkensen
Hi Racket users, I'm wondering how to control the documentation category for user-defined packages? For example, I've created a YAML package and would like it to show up under "Parsing Libraries". I tried setting (define scribblings '(("yaml/yaml.scrbl" () (parsing-library in info.rkt, b

Re: [racket-users] Package documentation category with info.rkt

2016-02-09 Thread Erik Silkensen
ol: > > (define scribblings '(("yaml/yaml.scrbl" () ("Parsing Libraries" > > The only valid symbols are the category names listed here [1]. > > [1] http://docs.racket-lang.org/raco/setup-info.html?q=info > <http://docs.racket-lang.org/raco/set

Re: [racket-users] Package documentation category with info.rkt

2016-02-09 Thread Erik Silkensen
fo file, I get no links in the docs. But > changing the collection to "yaml" generates documentation under the "Parsing > Libraries" category. > > Can you use "yaml" instead of 'multi ? > > On Tue, Feb 9, 2016 at 3:33 AM, Erik Silkensen &

Re: [racket-users] Package documentation category with info.rkt

2016-02-09 Thread Erik Silkensen
, at 3:07 AM, Benjamin Greenman > <mailto:benjaminlgreen...@gmail.com>> wrote: >> >> Hm. I'm not sure what's going on. >> >> If I make a package with your info file, I get no links in the docs. But >> changing the collection to "yaml&