Is the vector basically what I’m thinking of reaching for when I’m looking for a multidimensional array?
It seems to have awkward access syntax
@slack1 vectors are one dimensional arrays
the math/array
library has multi-dimensional arrays
Oh I see, I’m surprised it would be tucked there and not somewhere more general
Is the best way to do an immediately-invoked procedure just to wrap a lambda with more parens?
Why would you want an immediately-invoked procedure?
I wanted to use a lambda right away for its results
I suppose that’s a code smell and I should just define the function somewhere else?
I just don’t understand why you would wrap your code in a lambda if you wanted to evaluate it immediately.
That is, if you had ((lambda () (+ 1 2)))
, why wouldn’t you just write (+ 1 2)
, instead?
What if you wanted a lambda that takes an input?
Then you should probably use let
or an internal define
.
That is, instead of ((lambda (x) (+ x 2)) 3)
, write (let ([x 3]) (+ x 2))
.
ah that is clearer
that almost makes let look like lambda too
Indeed, you can implement let
as a macro in terms of lambda
.
Many blocks also accept internal definitions, so you could write (let ()
(define x 3)
(+ x 2))
instead.
thanks!
Is there a way to get non-buffered keyboard input from a console window in racket? I basically want behavior identical to get-key-press
from graphics/graphics
(https://docs.racket-lang.org/graphics/Keyboard_Operations.html#%28def._%28%28lib._graphics%2Fgraphics..rkt%29._get-key-press%29%29), but without the viewport. I.e., the console window should block and wait for the next keypress it detects.
@samth I think this PR got missed in the 6.11 release: https://github.com/racket/main-distribution/pull/1
nothing’s broken, but I think the rackunit-typed
package now isn’t locked to release catalogs. Or maybe it is? I’m not sure how the main-distribution
package interacts with transitive dependencies