slack1
2017-11-15 18:09:18

I was particularly confused about first and rest vs. car and cdr


slack1
2017-11-15 18:09:42

For example, (cons '() 3) is apparently not a list, and first and rest won’t work on it


slack1
2017-11-15 18:10:04

but car and cdr work just fine


abmclin
2017-11-15 18:10:34

That is because car and cdr operate on a low level, they see a list as a linked list of pairs


slack1
2017-11-15 18:11:10

But to me, the structure looks all very list-like


abmclin
2017-11-15 18:11:21

cons always return a pair, (cons '(), 3) will return ('() . 3) which is a pair


abmclin
2017-11-15 18:11:50

first and rest operates on a more abstract level, they expect their parameters to be lists


abmclin
2017-11-15 18:12:27

the reason cons, car, and cdr work fine on a list is because they sees a list just as linked pairs


slack1
2017-11-15 18:12:32

So a list of size 2 is different from a pair?


slack1
2017-11-15 18:12:58

(list '() 3) versus (cons '() 3)


abmclin
2017-11-15 18:13:07

yes, they are different


abmclin
2017-11-15 18:13:30

why don’t you write out (list '() 3) using pair notation like I did in yesterday’s message?


abmclin
2017-11-15 18:13:47

and compare to what (cons '() 3) looks like in pair notation


slack1
2017-11-15 18:13:50

Racket spits it back out without the period


slack1
2017-11-15 18:14:00

But conceptually I thouht they are the same


slack1
2017-11-15 18:14:14

I thought my (list '() 3) is built out of a pair


slack1
2017-11-15 18:14:34

so I thought the smallest list and a pair should be identical


abmclin
2017-11-15 18:14:41

there is more than one pair involved in (list '() 3)


abmclin
2017-11-15 18:15:21

written out in pair notation, (list '() 3) would look like ('() . (3. '()))


abmclin
2017-11-15 18:15:52

(cons '() 3) in pair notation would look like ('() . 3)


slack1
2017-11-15 18:16:26

Oh I see you’re saying there’s an implicit hidden '()


abmclin
2017-11-15 18:16:27

as you can see, (list '() 3) and (cons '() 3) look nothing like each other when viewed as pairs


slack1
2017-11-15 18:16:48

My Dr. Racket doesn’t give out those periods


slack1
2017-11-15 18:16:56

I mean, it normally does, but not for list


abmclin
2017-11-15 18:17:22

the Racket printer hides the underlying pair nature of a list from you by printing as (’() 3) without any periods


slack1
2017-11-15 18:18:33

Is there a Racket tool to more easily visualize the linked pairs underneath?


abmclin
2017-11-15 18:18:49

I think so yes, there’s an option to configure the Racket printer


abmclin
2017-11-15 18:18:51

let me see


abmclin
2017-11-15 18:22:31

not able to find it at the moment, maybe others will be able to point it out for us


slack1
2017-11-15 18:23:02

Ah well on your hint I dived into 1.4.5 of the Reader docs


slack1
2017-11-15 18:23:15

but it appears my Dr Racket is on maximum verbosity


samth
2017-11-15 18:23:33

@slack1 if you’re new to lists and pairs, you might find the “Beginning Student Language” helpful, and trying things out there


abmclin
2017-11-15 18:23:40

if you’d like to practice in your DrRacket, try (cons 'a 'b) and (cons 'a '()) and compare the two results


samth
2017-11-15 18:23:46

where you will only be able to use cons to construct lists


rick.moynihan
2017-11-15 22:56:52

Sorry for the noob question but what is the difference between the top window in DR Racket and the bottom/REPL one?

In particular why can’t I evaluate this form (include-book "j-bob-lang" :dir :teachpacks) in the bottom window but can in the top?

(I’m trying to go through the little prover)


rick.moynihan
2017-11-15 22:57:09

(so have installed Dracula/ACL2)


samth
2017-11-15 22:59:05

@rick.moynihan what does DrRacket say the Language is?


rick.moynihan
2017-11-15 23:01:45

ACL2


rick.moynihan
2017-11-15 23:03:03

rick.moynihan
2017-11-15 23:04:33

@samth: I use emacs/clojure mainly - so am familiar with having a file/buffer and a repl. I’m assuming that’s going on here, but would’ve expected the include-book form to evaluate the same in both places. So mainly curious about that aspect.


samth
2017-11-15 23:05:17

@rick.moynihan It looks like you can do include-book in the top but not the bottom?


rick.moynihan
2017-11-15 23:05:25

yes


rick.moynihan
2017-11-15 23:06:26

oh that’s strange doing it now it works


samth
2017-11-15 23:06:27

So I assume that the ACL2 language only allows new books in the definitions area, but I don’t know why


rick.moynihan
2017-11-15 23:06:48

not sure what has changed


apg
2017-11-16 00:34:02

i feel as though i’ve seen something, even recently but can’t find it… has someone done a language usage survey — like that of http://taylor.fausak.me/2017/11/15/2017-state-of-haskell-survey-results/ before?


apg
2017-11-16 00:34:17

(obviously for racket)


samth
2017-11-16 00:34:31

@apg no, I don’t think we’ve done anything like that


apg
2017-11-16 00:35:04

@samth ah. ok.


apg
2017-11-16 00:35:26

for some reason I though I remembered something like that happening recently.. obviously I’m wrong. :slightly_smiling_face:


apg
2017-11-16 00:36:29

The survey questions from the Haskell survey linked above are actually quite interesting and I think mostly applicable to Racket… aside maybe from the different packages servers and tools, of course.


apg
2017-11-16 00:36:49

I’m tempted to try to put something like this together for racket — any interest?


samth
2017-11-16 00:37:31

@apg I think something like that would be cool


apg
2017-11-16 00:39:00

yeah, me too. if anyone is interested in helping, let me know. I’ll start thinking about how to pull it off.


slack1
2017-11-16 01:41:57

You mean a State of Racket survey? That would be interesting


slack1
2017-11-16 01:59:02

Can anyone point me in the right direction on making a simple http get request in Racket?


slack1
2017-11-16 01:59:25

The docs for the http client are a little terse ~_~


samth
2017-11-16 03:12:36

@slack1 #lang racket (require net/url) (port-&gt;string (get-pure-port (string-&gt;url "<https://google.com/>")))


stamourv
2017-11-16 03:37:25

@apg: Maybe you were thinking of the recent RacketCon survey?


stamourv
2017-11-16 03:37:35

Also, seconding the “this would be great” comment!


apg
2017-11-16 03:58:32

@stamourv it wasn’t the racketcon survey. I must have dreamed about a results post, because I swear Ben wrote it. Apparently, I dream about racket surveys? idk.