chris613
2019-12-2 09:40:20

i think i remeber seeing essentially with-input-from-file but it would call with each line, but i cant find it again, am i dreaming ?


chris613
2019-12-2 09:40:42

attempting advernt of code with rust this year :smile:


samth
2019-12-2 09:41:20

@chris613 I’d use a for loop with in-lines for that


chris613
2019-12-2 09:41:38

in-lines i think thats maybe the magic bit i was thinking of


stefan.kruger
2019-12-2 11:31:11

Is there a way of getting a sub-list from the beginning of a list of length n, or a number < n if the list is too short? e.g (my-take '(1 2 3 4 5) 2) ; =&gt; '(1 2)


stefan.kruger
2019-12-2 11:31:31

(my-take '(1 2 3 4 5) 20) ; =&gt; '(1 2 3 4 5)


stefan.kruger
2019-12-2 11:32:02

“take of length n, unless there ain’t enough, then give me what you have”


stefan.kruger
2019-12-2 14:23:30

Answering my own question after rtfm: (for/or ([chunk (in-slice length data)]) ....


badkins
2019-12-3 02:57:38

What’s the best way to convert 1234567.8 to 1,234,567.80 ? I found the racket-locale package which gets close with 1,234,567.8 but that looks goofy as a currency number.


badkins
2019-12-3 02:58:08

I know how to get the .80 part with ~r but it doesn’t do the commatizing


samdphillips
2019-12-3 03:00:24

I too would like to know that. I wrote a bad hack (that only works with formatting integers) the other day to solve this.


badkins
2019-12-3 03:02:39

It’s not that difficult, but if I’m going to code something up, it seems like it might be best to add a keyword arg to ~r