evdubs has quit [Remote host closed the connection]
evdubs has joined #racket
Sgeo has quit [Read error: Connection reset by peer]
Sgeo has joined #racket
manicennui has joined #racket
endobson has joined #racket
iyzsong has joined #racket
badkins has quit [Remote host closed the connection]
zmt01 has joined #racket
zmt00 has quit [Ping timeout: 260 seconds]
endobson has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
endobson has joined #racket
manicennui has quit [Quit: Connection closed for inactivity]
orivej has joined #racket
rubic88 has quit [Ping timeout: 265 seconds]
ephemeron has quit [Ping timeout: 265 seconds]
ephemeron has joined #racket
rubic88 has joined #racket
aidalgol has joined #racket
FreeFull has quit []
narimiran has joined #racket
endformationage has quit [Ping timeout: 240 seconds]
Lowl3v3l has quit [Quit: Leaving.]
ArthurStrong has joined #racket
<ArthurStrong>
Hi all. Excuse me, but what is the function to construct a list out of function's result? For example, I want a list of 10 random variables returned by (random) function
<ArthurStrong>
Like inverse of (for-each)
_whitelogger has joined #racket
<ecraven>
you could use map and iota, ignoring the index value: (map (lambda (_) (random)) (iota 10))
<ArthurStrong>
ecraven: thanks!
<ecraven>
racket probably has a more succinct way of doing this though ;)
<erkin>
build-list passes the index of the element it's consing that iteration to the proc, so the formals are _ (ie don't-care). You can also use thunk* there.
<erkin>
(thunk foo) is equivalent to (λ () foo) whereas (thunk* bar) is equivalent to (λ _ bar).
<notnotdan>
oh TIL about thunk*
teardown has joined #racket
endobson has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
aidalgol has quit [Quit: Using Circe, the loveliest of all IRC clients]
<ArthurStrong>
What is the simplest way to update structure member? Failed with set!...
orivej has joined #racket
Fernando-Basso has joined #racket
vraid has joined #racket
vraid has quit [*.net *.split]
teardown has quit [*.net *.split]
Sgeo_ has quit [*.net *.split]
ephemeron has quit [*.net *.split]
jmiven has quit [*.net *.split]
banjiewen has quit [*.net *.split]
Trieste has quit [*.net *.split]
acarrico has quit [*.net *.split]
theruran has quit [*.net *.split]
bchar has quit [*.net *.split]
ziyourenxiang has quit [*.net *.split]
epony has quit [*.net *.split]
thallada has quit [*.net *.split]
meimeix has quit [*.net *.split]
evdubs has quit [*.net *.split]
zmt01 has quit [*.net *.split]
hexagoxel has quit [*.net *.split]
greghendershott has quit [*.net *.split]
samth has quit [*.net *.split]
Irenes[m] has quit [*.net *.split]
BitPuffin has quit [*.net *.split]
jackhill has quit [*.net *.split]
siel has quit [*.net *.split]
eagleflo_ has quit [*.net *.split]
iyzsong has quit [*.net *.split]
lexi-lambda has quit [*.net *.split]
winny has quit [*.net *.split]
mzan has quit [*.net *.split]
cky has quit [*.net *.split]
Blkt has quit [*.net *.split]
ullbeking has quit [*.net *.split]
bartbes has quit [*.net *.split]
tazjin has quit [*.net *.split]
hoek has quit [*.net *.split]
krono has quit [*.net *.split]
fridim has quit [*.net *.split]
juanfra has quit [*.net *.split]
<ArthurStrong>
... sovled
<ArthurStrong>
how to add a simple contract: a function's argument must be a list of integers?
cartwright has quit [Remote host closed the connection]
cartwright has joined #racket
samlamamma has joined #racket
<samlamamma>
Is there any way to convert a pict into a vector format like SVG?
<samlamamma>
You know what? The library included PostScript generation, thank goodness :)
<erkin>
A pict interface would be a nice addition to the simple-svg library.
<ArthurStrong>
please... can anyone suggest a simple examples of contracts?
<ArthurStrong>
TIA
<samlamamma>
Anyone here got experience with Redex? I'm trying to generate fresh variables in a reduction-relation context and I'm not sure how to do it as a side-expression (using (fresh fresh-clause ...)).
<samlamamma>
Hm. Actually I might be screwing it up in a different way
<samlamamma>
Okay, so (fresh sym-var-) (the prefix of my variables) work, but that's just weird. I might just generate my own variables using a metafunction instead.
<samlamamma>
Nah, it works :-D
wpdevelopment11 has joined #racket
gour_ has joined #racket
notzmv has quit [Ping timeout: 268 seconds]
<erkin>
ArthurStrong: What are you having trouble with?
<ArthurStrong>
erkin: I have a function that receives a list of integer as argument. I want to be sure it always be so
gour has quit [Ping timeout: 268 seconds]
<ArthurStrong>
list of integers
<erkin>
Go on
<ArthurStrong>
This is it.
<erkin>
Well, functions have return values too.
<ArthurStrong>
I want to Racket to trigger exception if argument has different type
<ArthurStrong>
In C/C++ I would use assert
<ArthurStrong>
in Python: if type(arg)!=... raise...
<erkin>
Yes, I got that.
<erkin>
I'm asking for the return type.
<erkin>
A contract requires the type of all arguments and also the return value.
<ArthurStrong>
erkin: there is no return type... yet.. but if it would be present... what to do?
<erkin>
Let's say it returns a boolean.
<erkin>
And takes no other arguments.
<erkin>
The contract would be (-> (listof integer?) boolean?)
<ArthurStrong>
erkin: thanks, how to add this?
<erkin>
Depends on how you design your project.
<erkin>
If you just want to attach a contract to a single procedure, you can use the define/contract form.