[racket] side-effect-free DFS of k-ary tree?

2013-12-29 Thread Ben Dean
I'm trying to do a simple depth-first search of a tree in Racket, ultimately returning a list of nodes up to the node I'm searching for. I want to do this side-effect-free, if possible, and I'm running into a wall with the approach I started on... This is my current implementation: ---

[racket] Datalog extensions

2013-12-29 Thread Evan Donahue
Hello, I am curious about the current status and future plans for the datalog package. I am working on an interactive system that uses datalog for its internal data storage, and am finding it difficult to map dynamic user actions onto the available datalog syntactic abstractions even with the rack

Re: [racket] How to view source code of procedures? MIT scheme "pp" equivalent?

2013-12-29 Thread Matthias Felleisen
That's precisely what (2) was getting at. Good luck and SOS as much as you need -- Matthias On Dec 29, 2013, at 6:23 PM, Scott Klarenbach wrote: > I think I have a much simpler approach for my purposes. I can have a > (define-expression ...) macro that basically just stores the expression a

Re: [racket] s-expression syntax for regular expressions

2013-12-29 Thread Harry Spier
Found it http://www.ccs.neu.edu/home/shivers/papers/sre.txt On Sun, Dec 29, 2013 at 2:50 PM, Harry Spier wrote: > > A while ago I found a link in a post in the Racket user forum to an > article where a CS prof was describing a suggested a new syntax for regular > expressions based on s-expressi

Re: [racket] How to view source code of procedures? MIT scheme "pp" equivalent?

2013-12-29 Thread Scott Klarenbach
I think I have a much simpler approach for my purposes. I can have a (define-expression ...) macro that basically just stores the expression as a quoted list. This largely emulates c#'s expression trees, but with a lot less hassle and ugly syntax. I can then achieve the composition I desire thro

Re: [racket] How to view source code of procedures? MIT scheme "pp" equivalent?

2013-12-29 Thread Scott Klarenbach
Thanks Greg. > Geiser mode for Emacs provides both of these things. I use Geiser mode but find it pretty lacking for this purpose. Some of the time it provides documentation, but a lot of the time it doesn't provide anything. It may be that I have to upgrade my version or look into the config

[racket] s-expression syntax for regular expressions

2013-12-29 Thread Harry Spier
A while ago I found a link in a post in the Racket user forum to an article where a CS prof was describing a suggested a new syntax for regular expressions based on s-expressions. But I haven't been able to locate it in the forum again. If anyone knows the link I'm talking about could they post i

Re: [racket] define-match-expander

2013-12-29 Thread Jens Axel Søgaard
2013/12/29 Alexander D. Knauth : > I was seeing if it would work with nested patterns and quasiquoted patterns > and it didn't, so I had to change the rewrite function and use (vector? > (syntax-e pat)) to check for a vector written like `#(,a:num ,b:num ,c:num). > > like this: > > (define (rewrit

Re: [racket] define-match-expander

2013-12-29 Thread Jens Axel Søgaard
2013/12/29 Alexander D. Knauth : > I'm not really sure why this works either, but try this: > > (define-syntax (:match stx) > (syntax-case stx () >[(:match val-expr [pat . more] ...) > (with-syntax ([(new-pat ...) (for/list ([pat-stx (in-list (syntax->list > #'(pat ...)))]) >

Re: [racket] define-match-expander

2013-12-29 Thread Alexander D. Knauth
I was seeing if it would work with nested patterns and quasiquoted patterns and it didn't, so I had to change the rewrite function and use (vector? (syntax-e pat)) to check for a vector written like `#(,a:num ,b:num ,c:num). like this: (define (rewrite pat) (cond [(identifier? pat) (

Re: [racket] contracts on functions that take arbitrary keyword arguments

2013-12-29 Thread Matthias Felleisen
Rackety but otherwise okay #lang racket (require rackunit) (define (make-keyword-procedure-contract kws/c kw-args/c rest/c range/c) (define all-contracts (list kws/c kw-args/c rest/c range/c)) (make-contract #:name `(make-keyword-procedure-contract ,@all-contracts) #:first-order proc

Re: [racket] How to view source code of procedures? MIT scheme "pp" equivalent?

2013-12-29 Thread Matthias Felleisen
On Dec 28, 2013, at 2:01 PM, Scott Klarenbach wrote: > I'm playing around with the idea of a sort of "Language Integrated Query" > like LINQ. For example: > > > (sql (query 'my-table > #:where (λ (row) (> (hash-ref row 'id) 3 > "select * from my-table where id > 3" > I understand yo

Re: [racket] define-match-expander

2013-12-29 Thread Alexander D. Knauth
I'm not really sure why this works either, but try this: (define-syntax (:match stx) (syntax-case stx () [(:match val-expr [pat . more] ...) (with-syntax ([(new-pat ...) (for/list ([pat-stx (in-list (syntax- >list #'(pat ...)))]) (datum->syntax pat-stx

Re: [racket] How to view source code of procedures? MIT scheme "pp" equivalent?

2013-12-29 Thread Greg Hendershott
On Sat, Dec 28, 2013 at 2:01 PM, Scott Klarenbach wrote: > It would be really nice to print the source code of a known procedure on the > repl, in order to get a quick view of what it does. Or, the "pa" function > which prints out the arguments of a procedure is even more useful. A few ideas her

Re: [racket] define-match-expander

2013-12-29 Thread Jens Axel Søgaard
Hi Alexander, I extended your example to allow other patterns than symbols inside :pat. > (match '(42 x) [(:pat (list n:num s:sym)) (list n s)]) (list 42 x) This works fine. I now want to "hide" the :pat, that is I want to write: (:match '(42 x) [(list n:num s:sym) (list n s)]

Re: [racket] DrRacket submodules to run

2013-12-29 Thread Manfred Lotz
On Sat, 28 Dec 2013 22:42:48 -1000 Ryan Davis wrote: > If I look at the language setting details I can choose what > submodules to run (main / test / others). But what I can't control is > the _order_ of the submodules. I simply don't want to run main if my > tests are going to fail but for some

[racket] DrRacket submodules to run

2013-12-29 Thread Ryan Davis
If I look at the language setting details I can choose what submodules to run (main / test / others). But what I can't control is the _order_ of the submodules. I simply don't want to run main if my tests are going to fail but for some reason tests run afterwards, not before. My questions: 1) I