<jackdaniel>
all software should be named {country-of-residence}.{affiliation}.software{counter}, versioning shalt be semantic - i.e us.google.software233 (that would be android), eu.google.software244 (fuchsia)
<jackdaniel>
good morning ;)
occ has quit [Ping timeout: 265 seconds]
waleee has quit [Ping timeout: 248 seconds]
occ has joined #commonlisp
Noisytoot has quit [Ping timeout: 250 seconds]
<aeth>
all software should be named aeth
<jackdaniel>
you need to check with others whether this name does not irritate them
Noisytoot has joined #commonlisp
shka has joined #commonlisp
pjb is now known as Guest7573
pjb has joined #commonlisp
azimut has quit [Ping timeout: 255 seconds]
Cymew has joined #commonlisp
kenran has joined #commonlisp
pjb has quit [Read error: Connection reset by peer]
LW has joined #commonlisp
ahc has joined #commonlisp
MajorBiscuit has joined #commonlisp
occ has quit [Ping timeout: 255 seconds]
occ has joined #commonlisp
jeffrey has joined #commonlisp
epony has quit [Remote host closed the connection]
epony has joined #commonlisp
<splittist>
let-plus? cl-yacc?
<jackdaniel>
should be aeth.opus.1 and aeth.opus.2
<nij->
Hello :) I defined *members* and *admins* to be (list) to start with, and write a function (defun make (type name) ..) which push the newly created object to either *admins* or *members* (depending on the type 'member or 'admin).
<nij->
The problem is.. when I use (let ((list (case type ('member *members*) ..)))) it doesn't work as expected. This is because *members* points to THE empty list NIL, and pushing things into NIL doesn't really change the value of *members*.
<beach>
Will the first argument to MAKE every be form other than a quoted symbol?
<nij->
What should I do to create a unique NIL that can be mutated?
<nij->
it's always a symbol, yes.
<beach>
Then it is silly to dispatch on it, and better to have a MAKE-MEMBER and MAKE-ADMIN.
<nij->
I actually have member, admin, sub-member, teacher, coach.. etc.
<nij->
It would be verbose to write a make function for all of them.
<beach>
The solution to this problem is to use a "sentinel".
<nij->
There is no way to create a mutatable empty list?
<beach>
That's correct, you can not alter NIL.
<nij->
So I need a real empty list..
<beach>
Lists in Common Lisp are not abstract data types, so you must wrap your concrete list in an abstract data type that can be mutated.
<nij->
I can use eval instead.. not very good style but it works.
<beach>
That's a very bad idea.
<beach>
You should create an abstract data type instead.
<nij->
hmm.. but then it's hard to loop over the list later on
<beach>
Common Lisp lists should almost never be used as a substitute for a data structure in an application.
<beach>
If you loop over the list later on, your concrete data type has leaked all over your code, which is bad.
<beach>
You can create an iterator or a mapping function.
<nij->
geez
<nij->
How about make MAKE a macro?
<beach>
Your concrete data type would still leak all over the place. But if that's what you want, go ahead.
<beach>
nij-: Look, this is advice number 1 in all the literature about data representation. First define a protocol containing creators and accessors for you data. Then centralize in one place the translation between protocol operations and the concrete representation.
* beach
is off for a lunch break.
<nij->
Thanks. My takeaway is "Common Lisp lists should almost never be used as a substitute for a data structure in an application."
<nij->
Do you mean to suggest that I create my own class that models a collection, and writes an iterator function for it?
<paulapatience>
Yes, I believe that is what beach is suggesting. Your class can store the collection as a list or array or whatever you like, thus allowing you to change the representation at a later time without affecting the public API.
xaltsc has quit [Ping timeout: 265 seconds]
Noisytoot has quit [Ping timeout: 260 seconds]
<nij->
Such data type must have existed in some library right? Or should I just create it by myself?
Noisytoot has joined #commonlisp
<beach>
The official name for such a data structure is a dictionary. It supports the operations INSERT, DELETE, MEMBER. I am sure there are libraries around for that, but if your collections are small, then it is trivial to create it yourself.
<beach>
nij-: No, a hash table is another concrete data type.
occ has joined #commonlisp
<beach>
So a hash table can be used to implement a dictionary abstract data type. Or a list can be used to implement it. Or a vector.
Cymew has quit [Ping timeout: 255 seconds]
son0p has quit [Ping timeout: 240 seconds]
<beach>
I recommend: Aho, Hopcroft, Ullman: The design and analysis of computer algorithms.
<beach>
Perhaps this stuff is no longer taught in computing class.
jeffrey has joined #commonlisp
karlosz has joined #commonlisp
random-nick has joined #commonlisp
ahc has quit [Quit: Client closed]
Noisytoot has quit [Ping timeout: 246 seconds]
jmdaemon has quit [Ping timeout: 252 seconds]
Noisytoot has joined #commonlisp
Noisytoot has quit [Remote host closed the connection]
Noisytoot has joined #commonlisp
cage has joined #commonlisp
pve has joined #commonlisp
LW has quit [Quit: WeeChat 3.6]
kevingal has joined #commonlisp
kevingal_ has joined #commonlisp
tyson2 has joined #commonlisp
dipper_ has joined #commonlisp
dipper has quit [Ping timeout: 260 seconds]
nij- has quit [Ping timeout: 276 seconds]
random-jellyfish has joined #commonlisp
random-jellyfish has quit [Client Quit]
Noisytoot has quit [Ping timeout: 252 seconds]
<edwlan[m]>
Python confuses things here because it uses “dictionary” to name a concrete data type.
<beach>
Why am I not surprised.
<beach>
?
lucasta has joined #commonlisp
Noisytoot has joined #commonlisp
Volt_ has joined #commonlisp
edgar-rft has quit [Quit: Leaving]
maximaximal has joined #commonlisp
dcb has joined #commonlisp
Volt_ has quit [Quit: ]
<bjorkintosh>
beach, is that book still relevant?!
grawlinson has quit [Quit: SIGTERM]
grawlinson has joined #commonlisp
<NotThatRPG>
Corman, Leiserson and Rivest is more up to date, AHU better on the analysis, and other formal accesses (IMO)
dipper_ has quit [Remote host closed the connection]
dipper_ has joined #commonlisp
<beach>
bjorkintosh: Yes, I think it is.
<bjorkintosh>
oh fun!
<beach>
bjorkintosh: Some things have to be compensated for because they assumed some very primitive language features.
<bjorkintosh>
was it written in Pascal or C?
<bjorkintosh>
(i don't have a copy at hand)
<beach>
Neither.
<beach>
They use their own syntax.
<NotThatRPG>
CLR a better cookbook for algorithms, but AHU still worth reading. Their discussion on graphs and dynamic programming are both quite good, IIRC
<NotThatRPG>
Pseudo-Algol, I would say
<beach>
Something like that, yes.
<bjorkintosh>
I wonder why books on Algorithms and datastructures at the time (and even now) tended to use algol-like languages instead of lisp.
<bjorkintosh>
I don't think I've come across anything like that which uses lisp.
jmdaemon has joined #commonlisp
<beach>
There is still massive resistance to learning Lisp. As I often say, people go to a lot of trouble to avoid learning Lisp.
morganw has joined #commonlisp
<beach>
So an author who wants sales to be reasonable had better use something else.
<bjorkintosh>
oh right. computing is a pop culture.
<NotThatRPG>
Also typically one sees algorithms books written from an explicitly procedural frame
<mariari>
bjorkintosh: purely functional data strcutures uses SML, with Haskell in the appendex for describing algorithms
<mariari>
the book probably use lisp for laziness, as in the later half they had to make up laziness syntax for SML
azimut has joined #commonlisp
maximaximal has quit [Remote host closed the connection]
<bjorkintosh>
mariari, you're right.
<bjorkintosh>
there are only 3 such written so far.
<bjorkintosh>
Were. not Are. I was wrong. it seems a whole lot more have been written in recent times, focusing on FP
<mariari>
from purely functional data structures spawned some good papers, and advancement in data structures, it's a fairly solid book
<mariari>
bjorkintosh: is it covering abstract data types or data structures along with algorithms, as those topics are quite a bit different
nij- has joined #commonlisp
<bjorkintosh>
ADTs. the previous edition of that book used Modula-2. I think this was written to demonstrate how the same subject would be treated in a functional programming language.
<bjorkintosh>
it's a 30 year old book. thoughts about SML were rather optimistic then.
tyson2 has joined #commonlisp
LW has joined #commonlisp
LW has quit [Client Quit]
LW has joined #commonlisp
LW has quit [Client Quit]
<mariari>
SML was interesting, I'm sad about OCaml being the bigger language these days
<mariari>
as it's inherently a batch oriented language, unlike SML, which had some image based compilers
<mariari>
Out of the ML's I have some fondness for SML, even though I've mostly only written all the other MLs
<edwlan[m]>
Is the code for any MLs in CL or previous lisps around?
<mariari>
poplog implemented an environment for CL, SML, and Prolog all in pop11
<edwlan[m]>
I forgot about that
dipper_ has quit [Ping timeout: 255 seconds]
<mariari>
there is coalton as well if you count that, it's more of a haskell derivative in Lisp than proper ML
<mariari>
ML has a massive issue with their type system not really being fully algebraic, so it makes tasks like compilers a really ballach in them
<_death>
in Lisp we use list-like ADTs less than typical Algols, since cons-based lists are so ingrained and provide tough competition.. so in the original problem another solution would be to use a simple "boxed representation" (defstruct box list) that has a selector (box-list) to get at the list
<mariari>
_death: we have anonymous or types which gets around the issues presented by ML
<_death>
mariari: I'm not sure why that was directed at me?
<mariari>
just as the `box' is the tag here instead of box-list
<_death>
also in the original problem you could use the symbol as the "hook" for the list, like (set symbol ...)
<_death>
the relevant Perlisism was "9. It is better to have 100 functions operate on one data structure than 10 functions on 10 data structures."
<_death>
<_death>
kevingal has quit [Ping timeout: 252 seconds]
kevingal_ has quit [Ping timeout: 252 seconds]
zxcvz has joined #commonlisp
zxcvz has quit [Client Quit]
<_death>
the box can be thought as a degenerate ADT that has a constructor (make-box) and two operators to efficiently "convert" from/to cons-based lists
yuna has quit [Remote host closed the connection]
yuna has joined #commonlisp
<bjorkintosh>
_death, sounds like Perlis's #9 foreshadowed unix pipes.
<bjorkintosh>
text followed by as many pipes as you need.
<_death>
right, that's a unix power tool (if you get what I mean :).. a similar one was "everything is a file" that related systems took even more seriously
edgar-rft has joined #commonlisp
<bjorkintosh>
plan9.
<bjorkintosh>
also inferno.
tyson2 has quit [Remote host closed the connection]