I’m trying to create a fresh variable in the conclusion of a judgement form, I tried (where c (varaible-not-in T_0 'mappername))
but that does not work for some reason
Does anyone here have another suggestion?
I think it should be (where c ,(variable-not-in (term T_0) 'mappername))
The RHS of where
is at the “term” level, but variable-not-in
is at the Racket level so you need unquote.
Aaah
It works, thank you
The issue count on the main racket GitHub repo just dropped below 400 for the first time in …a long time! @mflatt is on a tear
I’ve found a new way to procrastinate for all the other things I’m supposed to be doing.
structured procrastination
immutable collections I think should iterate in insertion order by default anyway
Is there a straight forward way to prepend a newline as the first byte of a port? I’m trying to replicate what the input-prefix
argument to regexp-match
does with parser-tools
so that I don’t have to special case handling for the beginning of files, but looking at the source for how it is implemented in regexp leaves me a bit concerned. Is there maybe a way that it can be done using the special result from the port or some other simpler way?
You could use input-port-append
Erm, except my test of it doesn’t seem to be working… and I don’t know why
#lang racket/base
(require racket/port)
(define main-port (open-input-bytes #"hello world"))
(define prefix-port (open-input-bytes #"\n"))
(define the-port (input-port-append prefix-port main-port))
It seems to me that the-port
should be a port containing #"\nhello world"
, but the bytes from prefix-port
seem to be lost.
hrm, from the description that should work at least for testing, but I’ll have to find a way to reset the offset after the first read, I think I know how I can do it, I’ll see whether I encounter the same issues you describe here
I’m seeing the same issue with the first port’s input being discarded (on a string port)
a workaround seems to be to just include an empty first port?
oh right
pesky close-at-eof?
#lang racket/base
(require racket/port)
(define main-port (open-input-bytes #"hello world"))
(define prefix-port (open-input-bytes #"\n"))
(define the-port (input-port-append #f prefix-port main-port))
@jaz, solution is perfect, thanks!
oh — that’s a required argument :face_palm:
I was clearly not paying close enough attention
those darned legacy function signatures that don’t use keywords