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
Thanks for the tips - I am new to using match, the answers are
illuminating, and so close...
I perhaps oversimplified my example. What I actually need to do is to match
on an arbitrary expression bound earlier., e.g.
(match foo
(bar #t)
(_ #f))
Where bar is bound to some valid *match* expression
On 03/09/2012 06:37 PM, rob cook wrote:
That is, without using a macro or eval. Id like to do:
(define a 4)
(define l1 '(1 2 3))
(match l1
(`(1 2 ,a) #t)
(_ #f))
So that this example would result in #f, and #t if a bound to 3.
Since of course match has its own quasiquote behavior, this d
On Fri, Mar 9, 2012 at 7:44 PM, Robby Findler
wrote:
> You can write
>
> (match l1
> [`(1 2 ,(? (lambda (x) (equal? x a #t]
> [_ #f])
The following also means the same as what Robby wrote:
(match l1
[`(1 2 ,(== a)) #t]
[_ #f])
--
sam th
sa...@ccs.neu.edu
Rac
You can write
(match l1
[`(1 2 ,(? (lambda (x) (equal? x a #t]
[_ #f])
Robby
On Friday, March 9, 2012, rob cook wrote:
> That is, without using a macro or eval. Id like to do:
>
> (define a 4)
> (define l1 '(1 2 3))
> (match l1
> (`(1 2 ,a) #t)
> (_ #f))
>
> So that this example would
That is, without using a macro or eval. Id like to do:
(define a 4)
(define l1 '(1 2 3))
(match l1
(`(1 2 ,a) #t)
(_ #f))
So that this example would result in #f, and #t if a bound to 3.
Since of course match has its own quasiquote behavior, this does not seem
possible w/o making a macro for
On Fri, Mar 9, 2012 at 2:43 PM, Asumu Takikawa wrote:
> Hi all,
>
> Previously on this list I mentioned that the Scala developers are
> designing a macro system. Today I heard from one of the developers that
> they now have a beta version of their proposal out and that they are
> looking forward t
Hi all,
Previously on this list I mentioned that the Scala developers are
designing a macro system. Today I heard from one of the developers that
they now have a beta version of their proposal out and that they are
looking forward to feedback.
The proposal document is here:
https://docs.google.co
On Mar 9, 2012, at 12:48 PM, Rüdiger Asche wrote:
> it's in part a matter of taste which "final" form one prefers
No. Once again: it's a question of being able to measure the performance
(space, time, temperature, energy) of various implementation of FSMs. It's not
taste, it's quantifiable at
ok, I did study your code fragments (for which I am very grateful, thanks!)
Actually, control flow in my opinion is just a minor piece of the puzzle - I
like your idea, but in terms of readability, it doesn't really make all the
difference in the world whether one represents each possible state
On Mar 9, 2012, at 8:16 AM, Brian Mastenbrook wrote:
> On 03/04/2012 12:20 AM, John Clements wrote:
>> I have a bunch of students planning to run racket web-servers on a single
>> machine. I just ran a few tests (on my mac, not on the target machine), and
>> it looks like separate web-server in
- Original Message -
From: "Matthias Felleisen"
To: "Rüdiger Asche"
Cc: "Stephen Bloch" ; "users Users"
Sent: Friday, March 09, 2012 5:28 PM
Subject: Re: [racket] eginner's question on elementary textual
replacement...
On Mar 9, 2012, at 11:00 AM, Rüdiger Asche wrote:
see my
On Mar 9, 2012, at 11:00 AM, Rüdiger Asche wrote:
> see my responses to Matthias for that)
I didn't see a response.
> ... so I wonder what a more natural or Schemish way there wsould be to tackle
> such an issue…
Here is what I had in mind:
#lang racket
#| you write things like this:
On 03/04/2012 12:20 AM, John Clements wrote:
I have a bunch of students planning to run racket web-servers on a single
machine. I just ran a few tests (on my mac, not on the target machine), and it
looks like separate web-server instances chew up about 72M apiece, but that
running 10 web-serve
True, there is no need for any particular way of representing the states as
long as there is some way to test two things for equality. However, unless
the compiler can be told to disregard the internal representation of the
symbol, it won't eat up lookup time but representation space - ie if I
On Fri, Mar 9, 2012 at 5:59 AM, Thomas Chust wrote:
> Anyway, if one worries about the performance cost of constants inlined
> at compile time versus constants inlined by the JIT, then using a
> language as high-level as Racket may be a mistake.
Not really related to the rest of this discussion,
Rüdiger, if you want to encode FSMs, you don't want to worry about in-lining
constants. You want a macro that helps you write down the ENTIRE FSM and then
compiles to small, efficient code. Think back to your Formal Languages course.
A regexp is some alphabet Sigma, States, Initial States, Fina
On Fri, 2012-03-09 at 06:06 -0500, Neil Van Dyke wrote:
> [...]
> I meant that all-caps was appropriate for CPP macros because of the
> grievous syntactic breakage, such as unbalancing grouping token pairs,
> and worse.
> [...]
Hello,
yes, that's certainly less of an issue in a world of hygieni
On Mar 9, 2012, at 6:25 AM, Rüdiger Asche wrote:
> (define (vendingmachine currentstate)
> (let ((newstate
> (case currentstate
> [(VENDINGMACHINE_IDLE)
> (if (CoinInserted)
> VENDINGMACHINE_INSERTED_COIN
> VENDINGMACHINE_IDLE
>
Hi there,
#1: My graduate thesis (in 1988) was an implementation of Scheme. I do
feel reasonably comfortable with tail recursion, continuations,
closures and the "basics," even the basic notion of hygienic macros
(which Eugene Kohlbecker had just finished his doctorate on when I
studied S
Thomas Chust wrote at 03/09/2012 05:41 AM:
On Fri, 2012-03-09 at 05:16 -0500, Neil Van Dyke wrote:
[...]
CPP macros can cause many kinds of grievous syntactic breakage and
surprising bugs, and so all-caps as a warning is a great idea; Java
constants, on the other hand, are one of the safest
On Fri, 2012-03-09 at 05:48 -0500, Neil Van Dyke wrote:
> First of all, sounds like you have a substandard C compiler, and that
> you must be targeting a 4-bit microcontroller. :)
> [...]
Hello,
unfortunately, crazy proprietary microcontrollers do tend to have
sub-standard compiler support ;-)
First of all, sounds like you have a substandard C compiler, and that
you must be targeting a 4-bit microcontroller. :)
Regarding these micro-optimizations in Racket: if you are fairly new to
Racket (I don't know), my suggestion is to avoid trying to optimize
every word of allocation and every
On Fri, 2012-03-09 at 05:16 -0500, Neil Van Dyke wrote:
> [...]
> CPP macros can cause many kinds of grievous syntactic breakage and
> surprising bugs, and so all-caps as a warning is a great idea; Java
> constants, on the other hand, are one of the safest constructs.
> [...]
Hello,
although slig
Thanks, Neil -
of course I could always use variables - one could do the same thing
in C, using
const unsigned char ONE = 1;
The reason why one doesn't do it in C is that it costs you useless
storage, execution time overhead (the compiler can generally generate
more efficient code assign
On Fri, 2012-03-09 at 10:39 +0100, Rüdiger Asche wrote:
> [...]
> I need a counterpart for the C #define statement, meaning a way to
> textually replace every instance of id at preprocessor time with its
> defined value, as in
> [...]
Hello,
in most cases you should probably simply use a regu
Rüdiger Asche wrote at 03/09/2012 04:39 AM:
(let-syntax [(ONE 1)]
((lambda (x) (+ ONE x))
2))
won't work... so how do I do it?
If you really want to do this, here are two ways:
(let-syntax [(ONE (syntax-rules () ((ONE) 1)))]
((lambda (x) (+ (ONE) x))
2))
(let-syntax [(ONE (syntax
Hi there,
I need a counterpart for the C #define statement, meaning a way to
textually replace every instance of id at preprocessor time with its
defined value, as in
#define ONE 1
unsigned int addone(unsigned int theArg)
{
return (theArg + ONE);
}
I understand that Scheme's macro sy
Hi All,
I have found out what caused my problems.
When starting Maxima with -s one must read the output from
input port return by (tcp-accept listener) in the snippet.
But one must write to the output port returned by
(process (format "... maxima.sh -s ~a" PORT))
in order to send c
29 matches
Mail list logo