samth changed the topic of #racket to: Racket v7.4 has been released: https://blog.racket-lang.org/2019/08/racket-v7-4.html -- Racket -- https://racket-lang.org -- https://pkgs.racket-lang.org -- Paste at http://pasterack.org
FreeFull has quit []
Codaraxis has quit [Ping timeout: 245 seconds]
Codaraxis has joined #racket
pera has quit [Ping timeout: 276 seconds]
dTal_ has joined #racket
dTal has quit [Ping timeout: 268 seconds]
fanta1 has quit [Quit: fanta1]
dTal_ is now known as dTal
acarrico has joined #racket
Codaraxis has quit [Read error: Connection reset by peer]
aidalgol has joined #racket
aidalgol has quit [Remote host closed the connection]
ziyourenxiang_ has joined #racket
iyzsong has joined #racket
efm has quit [Remote host closed the connection]
efm has joined #racket
ZombieChicken has quit [Quit: WeeChat 2.6]
ebzzry has quit [Ping timeout: 252 seconds]
efm has quit [Remote host closed the connection]
efm has joined #racket
aidalgol has joined #racket
orivej has quit [Ping timeout: 240 seconds]
iyzsong has quit [Ping timeout: 276 seconds]
iyzsong has joined #racket
ZombieChicken has joined #racket
efm has quit [Read error: Connection reset by peer]
efm has joined #racket
pera has joined #racket
Arcaelyx has joined #racket
_whitelogger has joined #racket
Arcaelyx has quit [Quit: Arcaelyx]
Arcaelyx has joined #racket
ebzzry has joined #racket
pera has quit [Ping timeout: 265 seconds]
endformationage has quit [Quit: WeeChat 2.6]
jao has quit [Ping timeout: 265 seconds]
pera has joined #racket
ebzzry has quit [Read error: Connection reset by peer]
ebzzry has joined #racket
_whitelogger has joined #racket
dddddd has quit [Remote host closed the connection]
pera has quit [Ping timeout: 240 seconds]
pera has joined #racket
ebzzry has quit [Read error: Connection reset by peer]
ebzzry has joined #racket
ebzzry has quit [Read error: Connection reset by peer]
orivej has quit [Ping timeout: 268 seconds]
Arcaelyx has quit [Quit: Arcaelyx]
sagax has quit [Read error: Connection reset by peer]
lockywolf has joined #racket
pera has quit [Ping timeout: 240 seconds]
sagax has joined #racket
manualcrank has quit [Quit: WeeChat 1.9.1]
rudybot has quit [Ping timeout: 276 seconds]
rudybot has joined #racket
fanta1 has joined #racket
fanta1 has quit [Quit: fanta1]
fanta1 has joined #racket
lockywolf_ has joined #racket
lockywolf has quit [Ping timeout: 265 seconds]
fanta1 has quit [Quit: fanta1]
libertyprime has joined #racket
aidalgol has quit [Remote host closed the connection]
<ZombieChicken> Anyone here used Racket to generate a PDF?
orivej has joined #racket
mzan has joined #racket
<bremner> ZombieChicken: only with slideshow, I guess that's not what you mean?
<ZombieChicken> not sure tbh. Was hoping someone might have a guide, but I think I need to think this through more than I have
orivej has quit [Ping timeout: 240 seconds]
Fernando-Basso has joined #racket
<dzoe> ZombieChicken: yep, here
<dzoe> Though soegaard helped :)
<dzoe> Basically I used the right dc<%> and created a PDF after I finished drawing to it...
FreeFull has joined #racket
orivej has joined #racket
lockywolf_ has quit [Ping timeout: 240 seconds]
manualcrank has joined #racket
ebzzry has joined #racket
Fernando-Basso has quit [Remote host closed the connection]
ng0 has joined #racket
dddddd has joined #racket
analogue has joined #racket
jao has joined #racket
_whitelogger has joined #racket
hkriel has joined #racket
hkriel has quit [Ping timeout: 276 seconds]
hkriel has joined #racket
iyzsong has quit [Quit: ZNC 1.7.1 - https://znc.in]
orivej has quit [Ping timeout: 268 seconds]
jao has quit [Remote host closed the connection]
hkriel has quit [Ping timeout: 250 seconds]
jao has joined #racket
orivej has joined #racket
mzan has quit [Ping timeout: 265 seconds]
orivej has quit [Ping timeout: 265 seconds]
Fernando-Basso has joined #racket
Arcaelyx has joined #racket
efm has quit [Ping timeout: 240 seconds]
orivej has joined #racket
casaca has quit [Ping timeout: 268 seconds]
pera has joined #racket
casaca has joined #racket
ebzzry has quit [Read error: Connection reset by peer]
nullman has quit [Ping timeout: 246 seconds]
nullman has joined #racket
casaca has quit [Ping timeout: 265 seconds]
casaca has joined #racket
casaca has quit [Ping timeout: 240 seconds]
casaca has joined #racket
mzan has joined #racket
jsgrant_ has joined #racket
<jsgrant_> Is it a goal of Racket2 / Rhombus to be homoiconic; Or more-so just a Lisp-like macro system?
endformationage has joined #racket
pera has quit [Ping timeout: 276 seconds]
orivej has quit [Ping timeout: 268 seconds]
pera has joined #racket
notzmv has joined #racket
pera has quit [Ping timeout: 276 seconds]
pera has joined #racket
mzan has quit [Quit: Leaving]
<erkin> I think it would look a lot like Rebol then.
pera has quit [Ping timeout: 265 seconds]
notzmv has quit [Remote host closed the connection]
jao has quit [Remote host closed the connection]
<erkin> Is there a way to force Racket's CLI REPL to read UTF-8?
<erkin> It defaults to Windows-1252 and produces mojibake when I try to input Unicode characters.
<erkin> locale-string-encoding parameter is "UTF-8"
<rs> Running 'racket -f foo.rkt -i '(hello)' runs fine, but if I run that inside of a watch i get an error 'sh: 1: Syntax error: Unterminated quoted string'. Why is this happening?
<erkin> Watch?
<rs> watch -n 3 racket -f foo.rkt -i '(hello)'
aidalgol has joined #racket
<erkin> rs: You need to escape the parentheses.
Trieste has quit [Ping timeout: 240 seconds]
<erkin> You probably want -e instead of -i there.
<erkin> % watch -n 3 racket -f foo.rkt -e '"(hello)"' should do the trick.
Trieste has joined #racket
<rs> erkin: right, I'm using an -e, I incorrectly stated above I was using an -i. I've tried escaping it and now getting an error: expected a ')' to close a '('. Here is the code I'm trying to use the watch with. https://termbin.com/t3kc
<rs> The code may not work or is ugly but the ending paren is there.
<erkin> Did you try what I said?
orivej has joined #racket
<rs> Yes, this is what I get with the additional double quotes. https://termbin.com/543i
<rs> Running this: watch -n 3 racket -f lab02.rkt -e '"\(gen-list 1 5\)"'
<rs> Moving the order of the quotes also doesn't change the outcome, E.g., "'(function)'"
<erkin> It's not related to the order of quotes.
<erkin> Nor is it related to watch.
<erkin> Is what you posted the entirety of lab02.rkt?
<rs> yes, that's the entirety.
<erkin> This code is broken...
mfiano has quit [Quit: WeeChat 2.5]
mfiano has joined #racket
<rs> Thanks, and I know. I'm not here to be critized for my broken code as I said. I'm here to understand why my work flow won't work.
<erkin> I'm trying to get it to work on my machine to help you.
<erkin> I'm not trying to criticise you.
<erkin> The intent is to figure out whether the problem lies in the code or the external utilities.
<rs> Thanks for trying to help. I do appreciate it.
mfiano has quit [Client Quit]
mfiano has joined #racket
<erkin> This works on my end with modified code % watch -n 3 racket -f h.rkt -e '"(gen-list 1 5)"'
<rs> ould you share your fix so I can try it?
<erkin> Sure thing https://clbin.com/u3y1r
<rs> I'm still getting the exact same error inside of watch.
<erkin> That's strange. What shell are you using?
<rs> bash
<rs> Oh, wait. When I remove the escapes it works.
<erkin> I should've said quote instead of escape in the first place, sorry.
<rs> And apparantly the order of the quotes '"(fucntion)"' is irrelevant and can be in either order in this example.
<rs> It works in this order as well "'(function)'"
<rs> The importance appears to be that it wants double quotes somewhere.
<rs> I'm learning: Could you explain why you would use cons in the not condition instead of using just a list as my failed code uses?
<erkin> The problem with the code wasn't actually with list/cons, but 'not' was on its own.
<erkin> In addition, car and cdr operations shouldn't be used on numbers.
<erkin> When you're consing two things, you're effectively making the first one point to the second one. That's how linked lists work. By recursively consing and going down, you're attaching a new node to the head of the list at each iteration.
<erkin> (list 5) is (cons 5 (list)), (list 4 5) is (cons 4 (list 5)), (list 3 4 5) is (cons 3 (list 4 5)) and so on
<erkin> (Note that the last node must be nil.)
<erkin> Try replacing that cons with list and you'll see that instead of '(1 2 3 4) it forms '(1 (2 (3 (4 (5))))).
<erkin> Because (list 1 2) is effectively (cons 1 (cons 2 '()))
<erkin> rs: Do you follow?
<rs> Yes. Although I haven't read enough apparantly to understand that cons was like a linked list. Yes I've seen that very output '(1 (2 ... ))))), not understanding why. How you explained it makes perfect sense.
<erkin> :-)
<erkin> Just know that cons makes a car and a cdr.
<erkin> You can make a pair if the cdr isn't a list. (cons 1 2), for instance.
<rs> That also makes sense. That last statement will take a few moments to sink in. :|
<erkin> :-)
<rs> Can you elaborate on this: (list 5) returns '(5), (cons 1 (list 5)) returns only the '(1 5) not '(1 (5)) ? Is that where you said '..cons makes a car and a cdr'? cdr is removing the parens on output?
<rs> .. For cons?
<erkin> Sorry, I was afk.
<erkin> You see, (list 5) is already (cons 5 '()).
<erkin> When you cons 1 on that, it becomes 1 -> 5 -> nil.
<erkin> That's a proper linked list.
<rs> Right.
<erkin> In this case, the car is 1 and the cdr is 5 -> nil
<erkin> cdr of 5 -> nil would be nil.
teardown has quit [Quit: leaving]
teardown has joined #racket
libertyprime has quit [Ping timeout: 268 seconds]
<rs> So car is being performed on each node? After each next node is cdr of the first node? I'm I thinking correctly?
<rs> Or rather cdr or what is left after the first node.
jao has joined #racket
<erkin> Think of it like a chain of conses.
<erkin> (cons 1 (cons 2 (cons 3 (cons 4 '()))))
teardown has quit [Client Quit]
teardown has joined #racket
<erkin> That's '(1 2 3 4)
<erkin> car is 1, cdr is (cons 2 (cons 3 (cons 4 '()))), which is '(2 3 4)
<erkin> The first element of the cons is the car, the second one is the cdr.
pera has joined #racket
<erkin> By taking the cdr over and over, you're traversing the list that keeps shrinking (from your point of view).
<erkin> It's popular to think of it like "car is the first, cdr is the rest of the list" but it's actually more accurate to think of them like the two portions of a cons cell.
<rs> Got it. Geez, why aren't you my instructor! I've learnt more in a few minutes than I have in a few weeks.
<erkin> Haha, thank you
<erkin> Yeah, for some reason this fundamental concept not very well explained in most places.
<erkin> is not*
<erkin> The cdr doesn't have to be a list either. (cons 1 2) gives you a pair, represented as '(1 . 2)
<erkin> car is 1, cdr is 2, obviously enough.
<erkin> Pairs are useful when you need your data associated with values.
<rs> I think there's this expectation or idea that everyone understands the same way. And they consequently think they are teachng it perfectly.
<rs> Yes, I was noticing that in the documentation.
<erkin> For instance, consider a list of pairs: '((cat . meow) (dog . bark) (bird . chirp)) The car would be '(cat . meow), whose car and cdr would be 'cat and 'meow respectively.
<erkin> I agree, but I suppose that problem is inherent to the education system in general.
<rs> Right. And you would want to treat them not in pairs, how?
<erkin> How do you mean?
<rs> I wholeheartdly agree.
<rs> A list such as (meow, woof, bark) not in pairs ((meow . woof) bark)
<erkin> You mean like taking the cdrs of each pair?
<rs> Well you mentioned that cons is the best way to handle numbers
<erkin> Oh it was just an example.
<rs> I assume values you meant numbers.
<erkin> It can be any value!
<rs> Or referred to.
<erkin> In this case, I'm using symbols.
<erkin> The 'cat symbol is associated with 'meow.
<erkin> This form is called an association list (called alist for short). It's the logical conclusion of the cons system being used for key/value pairs.
<erkin> To get what a dog says, you traverse through the list, checking the car of each pair and getting the cdr when you come across the symbol 'dog.
jao has quit [Remote host closed the connection]
<rs> Got it.
<erkin> Just a tidbit of info: You can omit the final nil in your list and make the last node a pair. Such as (cons 1 (cons 2 3)), instead of (cons 1 (cons 2 (cons 3 '()))). This is called an *improper* list, represented as '(1 2 . 3). It's not very useful.
<erkin> Most functions operating on lists expect the last value to be nil, so that they know when to stop. This means you can't use improper lists with them.
<erkin> I have no idea what anyone could use an improper list for, but newbies often (accidentally) come across one and get confused.
Guest48365 has joined #racket
Trieste has quit [Ping timeout: 268 seconds]
Guest48365 has quit [Remote host closed the connection]
jao- has joined #racket
Trieste has joined #racket
<rs> That is very useful.
johnjay has quit [Ping timeout: 240 seconds]
libertyprime has joined #racket
Trieste has quit [Ping timeout: 240 seconds]
johnjay has joined #racket
Trieste has joined #racket
pera has quit [Ping timeout: 268 seconds]
Arcaelyx has quit [Quit: Arcaelyx]
lavaflow has quit [Ping timeout: 245 seconds]
Fernando-Basso has quit [Quit: Leaving]
ebzzry has joined #racket
teardown has quit [Quit: leaving]
<jcowan> erkin: Lazy lists have a generator in the cdr of the last pair, so when you cdr down there, you call the generator to get the next value and splice it on the end of the list.
<jcowan> Another application is an a-list with a hashtable in the last cdr holding all the basic things, and then pairs just contain local associations.
<erkin> That generator idea is very clever. I like how it can be transparently passed to ordinary list procedures.
jsgrant_ has quit [Remote host closed the connection]
ng0 has quit [Ping timeout: 260 seconds]
Fare has joined #racket
ng0 has joined #racket
efm has joined #racket
efm has quit [Ping timeout: 250 seconds]
DGASAU has quit [Ping timeout: 240 seconds]
ZombieChicken has quit [Quit: WeeChat 2.6]
notzmv has joined #racket
vraid has joined #racket
lavaflow has joined #racket
libertyp1ime has joined #racket