<lf94>
they are conceptually the same as using assoc lists tho, yes?
<sebastianlin>
almost, i would say
<sebastianlin>
combine a "tag" with an assoc list you'll get one implementation of record types
<sebastianlin>
assoc lists are more like key-value maps, actually
<aeth>
Conceptually you could even implement numbers with lists. '() is 0, '(()) is 1, '(() (())) is 2, etc.
<lf94>
Why the distinction of pair vs list in any lang?
<lf94>
sebastianlin, what do you mean combine a tag? What's a tag?
<lf94>
I'm looking at gambit/gerbil. Damn, very clean language.
<colelyman>
lf94: If I understand correctly, in Scheme a pair is just a special case of a list where the next element being pointed to is atomic, instead of being another list
<nisstyre>
colelyman: it's called an improper list
<colelyman>
nisstyre: but is still a list, right? Thus there is no distinction between pairs and lists
<jcowan>
Lists are either the empty list (a unique object) or are made of pairs whose cdr component is either another pair or the empty list.
<lf94>
I just wonder why language design calls for a distinction
pera has quit [Read error: Connection reset by peer]
<lf94>
I understand, one is supposed to be an atomic type, and one not
<jcowan>
Improper lists are basically just a side effect of the way lists are made out of pairs. Most of the time they are a corner case, though there are a few uses of them
<lf94>
But you can still have these semantics...
<jcowan>
() is atomic, pairs and lists are not
<jcowan>
lists aren't actually a datatype, just a conventional way of using pairs.
<lf94>
Oh that is great to know
<lf94>
So when you add to a list
<lf94>
in theory you are adding to a pair
<lf94>
err
<lf94>
creating a new pair
<jcowan>
yes
<lf94>
that holds, say, 3 instead of 2 elements now
<lf94>
cool cool
<jcowan>
the list (a b c) is implemented as (a . (b . (c . ())))
<lf94>
Like this is all super basic stuff for anyone, I've just never really got to ask some lang peeps :)
* jcowan
nods
<lf94>
For me I was imagining the other way around
<lf94>
But this makes more sense
<lf94>
lists are pairs, but pairs cannot be lists...
<lf94>
Actually I guess they...can?
<lf94>
[a [b [c [] ] ] ]
<lf94>
The issue with this is: not homogenous
<lf94>
homogeneous
<jcowan>
the pair (a . ()) is the list (a)
<lf94>
I know I know
<lf94>
I'm talking about trying to "make it work" vice versa
<jcowan>
no, lists are not homogeneous in Lisp (or at least they don't have to be)
<lf94>
in reverse: construct a pair type out of lists
<lf94>
but lists being homogeneous is a nice property
<lf94>
and pairs are explicitly (element . ())
<lf94>
So I see now why the distinction exists and why it's important
<lf94>
If your lang supports heterogenous lists you can do it
<lf94>
But unfortunately it'll also be possible to create "bad" lists
<lf94>
[a b [c []]]
<lf94>
vs (a b . (c . ())), which is incorrect in lisp/scheme
<lf94>
and incorrect by the definition of a pair
<lf94>
<lf94> But unfortunately it'll also be possible to create "bad" lists <- I mean bad pairs.
<sebastianlin>
lf94: e.g. if you have two record types with common fields you sometimes might want to discriminate them
<sebastianlin>
something like '(type1 . ((:field1 . value1) (:field2 . value2))) '(type2 . ((:field1 . value3) (:field2 . value4))) etc.
<sebastianlin>
the tag need not to be actual symbols though
DGASAU has quit [Read error: Connection reset by peer]
<lf94>
ah yes
<lf94>
sebastianlin, to me, this is just an assoc list with another assoc list.
<lf94>
Does scheme use nominal or structural typing
<lf94>
When comparing types
<lf94>
(Note: I'm not even sure you can compare types.)
<jcowan>
In addition, very few Schemes don't have bignums nowadays, except for Picrin, TinyScheme/S7 (which is meant specifically for embedding into C), and some toy Schemes.
<bremner>
aren't bignums part of the various scheme standards?
<jcowan>
R5RS and R7RS-small, no; R6RS and R7RS-large, yes.
efm has quit [Read error: Connection reset by peer]
nckx has quit [Quit: Updating my GNU Guix server — https://guix.info]
nckx has joined #racket
soegaard has quit [Quit: soegaard]
ym555 has joined #racket
nckx has quit [Quit: Updating my GNU Guix server — https://guix.info]
nckx has joined #racket
<lf94>
What's the main difference between r5 and r7?
<lf94>
And should I use r7 anyway over r5?
<bremner>
r7 is 2 better. s;cnr
nckx has quit [Quit: Updating my GNU Guix server — https://guix.info]
FreeFull has joined #racket
nckx has joined #racket
badkins_ has quit [Ping timeout: 245 seconds]
selimcan has joined #racket
badkins_ has joined #racket
<lf94>
lol
<bremner>
I hesitate to give a serious answer because jcowan is really an R7 expert, and I only use racket, not RxRS
* greghendershott
makes the obligatory Spinal Tap R11 joke
soegaard has joined #racket
<lf94>
I hope he chips in then
ubLIX has joined #racket
sauvin has quit [Remote host closed the connection]
libertyprime has joined #racket
<jcowan>
lf94: R7RS-small is 99% backward compatible with R5RS, adds a reasonable number of things: libraries, exception raising and catching, records, bytevectors, some I/O extensions, a few more standard syntax keywords, vector and string counterparts of all R5RS list procedures, and some other bits and bobs.
selimcan has quit [Ping timeout: 246 seconds]
nckx has quit [Quit: Updating my GNU Guix server — https://guix.info]
<lf94>
jcowan, gotchya. Definitely going with r7 then.
evdubs has quit [Remote host closed the connection]
evdubs has joined #racket
ubLIX has joined #racket
ym555 has quit [Ping timeout: 268 seconds]
<Duns_Scrotus>
the IDE seems like a pretty small reason to use racket
<Duns_Scrotus>
also that post predates free chez
ym555 has joined #racket
<Duns_Scrotus>
racket and chez have tab completion in the CLI repl, somehow drracket doesn't have t ab completion (!!)
ym555 has quit [Quit: leaving...]
Fernando-Basso has joined #racket
<evdubs>
Duns_Scrotus, have you tried Ctrl+/ ?
<Duns_Scrotus>
in drracket?
<evdubs>
yes
<Duns_Scrotus>
whatever that's doing, it isn't cmopletion
<efm>
thank you jcowan that was worth reading
johnjay has quit [Ping timeout: 268 seconds]
orivej has quit [Ping timeout: 244 seconds]
DGASAU has quit [Read error: Connection reset by peer]
DGASAU has joined #racket
efm has quit [Ping timeout: 246 seconds]
DGASAU has quit [Read error: Connection reset by peer]
ym555 has joined #racket
YuGiOhJCJ has joined #racket
badkins_ has joined #racket
selimcan has quit [Ping timeout: 244 seconds]
soegaard has quit [Quit: soegaard]
ubLIX has quit [Quit: ubLIX]
Fernando-Basso has quit [Remote host closed the connection]
<nisstyre>
Duns_Scrotus: the reason I like DrRacket so much is the tight integration with the REPL and the editor. Especially things like how it lets you do online expansion or whatever it's called
<nisstyre>
Duns_Scrotus: don't you need to install xrepl, which includes GNU readline?
<nisstyre>
I'm fairly sure the stock racket repl does not include that because it would violate the license or something
efm has joined #racket
<Duns_Scrotus>
the racket repl that you run in the commandline does have completion
<nisstyre>
without xrepl it kinda sucks
<bremner>
xrepl is the default now, I believe
<nisstyre>
ah okay
<nisstyre>
it used to be that you had to install it
<nisstyre>
I still have it in my .racketrc
<bremner>
using editline to avoid license problems, iirc