This works, for instance (and I would much prefer case to hash-ref):
#lang typed/racket
(regexp-replace* #rx"[ABC]"
"ABCABC"
(λ ([c : String] . _)
(case c
[("A") "AC"]
[("B") "BA"]
I'd probably do this:
(apply string-append
(for/list ((letter (string->list str)))
(cond [(equal? letter #\A) "AC"]
[(equal? letter #\B) "BA"]
[(equal? letter #\C) "CCA"])))
--
You received this message because you are subscribed to the Google Groups
Below is another approach that may be too much Rackety for your taste: :)
http://docs.racket-lang.org/lindenmayer/
Robby
#lang lindenmayer
## axiom ##
ABCABC
## rules ##
A -> AC
B -> BA
C -> CCA
## variables ##
n=1
--
You received this message because you are subscribed to the Google
Working through the chapter on units in the Racket guide, it shows how to
translate the comment-specified contracts on toy-factory^ to enforced
contracts:
(define-signature contracted-toy-factory^
((contracted
[build-toys (-> integer? (listof toy?))]
[repaint(-> toy? symbol? toy?)]
Many thanks - that works fine! And it makes sense, to use regexp-replace* with
a hash table. (All these things I'm still finding out...) Is it possible to
do this - or something similar - in Typed Racket?
On Saturday, 8 July 2017 22:45:04 UTC+10, Neil Van Dyke wrote:
> This is one OK way
Keep reading?
#lang lindenmayer racket
## axiom ##
ABCABC
## rules ##
A -> AC
B -> BA
C -> CCA
## variables ##
n=1
(provide A B C start finish)
(define (finish l vars) (writeln l))
(define (A s vars) (cons 'A s))
(define (B s vars)
> On Jul 8, 2017, at 7:15 AM, Robby Findler wrote:
>
> Below is another approach that may be too much Rackety for your taste: :)
>
> http://docs.racket-lang.org/lindenmayer/
Or, arguably, not Rackety enough, until it's possible to embed one #lang within
That's an interesting project. It's a little too inclusive, so to speak, for
what I was thinking of implementing.
On Friday, July 7, 2017 at 7:33:32 PM UTC-7, Neil Van Dyke wrote:
> I've made a boot-to-Racket-app appliance image for x86 before, based on
> Debian Live. The bootable filesystem
This is one OK way that people are likely to do:
#lang racket/base
(define (foo str)
(regexp-replace* #rx"[ABC]"
str
(lambda (s)
(hash-ref #hash(("A" . "AC")
("B" . "BA")
Suppose I have a string "ABCABC" and I want to replace all A's with "AC", all
B's with "BA" and all C's with "CCA", so that the result is
ACBACCAACBACCA
What is the canonical way of doing this in Racket?
--
You received this message because you are subscribed to the Google Groups
"Racket
I would love to see a Racket unikernel, and be able to essentially run a
modern Lisp machine. That seems like a really big project, but I guess
I have no real understanding of how big it would be, or what parts you
could use off the shelf (eg. from OS-kit. I understand this was done
before in
Probably just on a Raspberry Pi, yes.
On Saturday, July 8, 2017 at 5:15:12 PM UTC-7, Deren Dohoda wrote:
> I actually use Racket in an embedded linux scenario on a 32-bit ARM. The
> board has Debian installed but without twiddling boots under busybox. Once
> upon a time I thought about giving a
Or, arguably, not Rackety enough, until it's possible to embed one #lang within
another (submodules at least, but hey why not lambdas?)
I've been exploring this more and more. It is related to my shell
project (rash, which does allow embedding at the expression level), and
I've been thinking
I actually use Racket in an embedded linux scenario on a 32-bit ARM. The
board has Debian installed but without twiddling boots under busybox. Once
upon a time I thought about giving a 5-minute presentation at Racketcon on
the experience of using Racket in this way but it never happened. It's very
Thanks everybody - you've given me a lot of good ideas. As to the Lindenmayer
package, I did know of it. And I am in fact exploring Lindenmayer systems from
a very fundamental perspective, which is why I don't want to use a pre-made
library or package, but write bits and pieces as I go.
William G Hatch writes:
> I would love to see a Racket unikernel [...] But I recall some talk about
> MirageOS (I think) where they said something about it taking something like 2
> years to rewrite the IP/TCP stack in OCaml.
I imagine it wouldn't be too hard to get Racket
16 matches
Mail list logo