freenode/#lisp - IRC Chatlog
Search
6:37:16
pjb
It's only the printed representation. Since there are no list and no a-list in lisp (paradox!), you need to interpret the bunch of cons cells as you wish.
6:37:40
pjb
When you consider a-lists, ((colors red blue white)) is interpreted as ((colors . (red blue white))).
6:37:55
beach
montxero: Maybe there is something I don't understand, but the CDR of an alist is always a proper list.
6:39:19
beach
My brain is too small to interpret what people utter in a way that contradicts what they actually did utter.
6:40:50
pjb
There's not much difference between an association and a property, it's just how they're represented: plist: (k1 v1 k2 v2 … kn vn) alist: ((k1 . v1) (k2 . v2) … (kn . vn)).
6:42:03
pjb
Furthermore, alist (the CL functions working with a-lists) can use keys of any class (there's a :test argument to use the equality you want), while plist (the CL functions working with p-lists) use only symbols (normally) and always use EQL to compare the keys).
6:44:26
pjb
fengshaun: note that both a-list and p-lists use the same number of cons cells, and are as efficient one as the other.
6:45:10
aeth
Scheme uses alists because they usually don't have a plist equivalent, and definitely don't portably. In CL, plists tend to be more common than alists.
6:46:15
aeth
The main disadvantage of plists is that you can't use map/mapcar, but you can loop by #'cddr and use a few other things
6:46:36
aeth
The main advantage of plists is that you can use &key in destructuring-bind, essentially treating plists like keyword arguments.
6:47:07
pjb
Well, you need more parentheses to write a-lists. But there's less risk of desynchronisation with a-lists than p-lists. If you miss two keys or values in a p-list, you can mix it almost entirely: (k1 k2 v2 k3 v3 k4 v4 v5) vs. ((k1) (k2 . v2) (k3 . v3) (k4 . v4) (nil . v5))
6:53:24
aeth
That can get confusing when the key and value are of the same type, usually a keyword in that case. It's the same issue with function calling with keyword arguments. You're basically requiring newlines for clarity at that point.
6:54:07
aeth
On the other hand, plists mirror keyword arguments so closely (see my previous two lines) so that's probably why they're more common than alists
6:56:50
montxero
beach: nice play the cdr of an a-list is always a proper list. I meant the cdr of an element of an alist
7:12:41
Cymew
aeth: Are you sure plists are more common? I find alists are mentioned so often as a suggested solution. I actually struggled to find a plist when I needed an example.
7:14:39
pjb
a-list might be more common, because you can map other types than symbols (or other EQL-able objects).
7:15:13
pjb
(cdr (assoc "hello" '(("HELLO" . "SALUT") ("BYE" . "AU REVOIR")) :test 'string-equal)) #| --> "SALUT" |#
7:18:14
Cymew
Shinmera: Huh. That is propably making them more common. I wonder how often they are used intentionally, though, rather than that indirect manner. Like pjb say, alists have some flexibility.
7:20:41
aeth
Cymew: only someone who has all of Quicklisp installed can know for sure, but unlike most things, this would be pretty hard to search. Effectively impossible to get exact numbers on because so many macros implicitly would use plists/alists/etc.
7:21:18
aeth
any destructuring-bind with &key in a macro is using a plist tail at the very least, if not a full plist
7:22:46
Cymew
I'm learning more about implementing lisp cores than I expected. I have never given plists much thought before. I have been enlightened.
7:36:09
pjb
And of course, it was an essential implementation data structure, since symbol themselves were implemented as a plist (we still have symbol-plist, but the symbol name, the function slot, the value slot, and others were stored on the symbol plist in LISP 1.5).
7:56:19
p_l
hmmm. Separate the values from identity, so symbols in different environments are still EQ?
7:58:19
beach
The trick was to make function calls fast, i.e. to avoid doing a hash-table lookup for each call of the form (f ...).
8:00:14
beach
The static environment of a function contains disembodied function cells (in the form of CONS cells) containing the function object.
8:01:26
beach
But this way, I will be able to isolate implementation code from user code, for better safety. And I'll be able to do sandboxing a bit easier.
8:03:45
beach
This feature can also be used to separate the compilation environment from the run-time environment.
8:07:29
beach
Anyway, I'll add "symbols have function cells" to a list of misconceptions along with "Lisp is interpreted".
8:08:22
p_l
beach: well, symbols being structures are implementation detail, what matters I guess is that there's "illusion" of symbols having a set of standard "slots" of information
8:09:27
beach
p_l: It is better seen as just another protocol. Once one realizes that, then there is more freedom of choice with implementation.
8:09:55
beach
p_l: Maybe so. All I could find in the literature was Scheme environments with hash-table lookups for each function call.
8:10:36
p_l
beach: that sounds like very inefficient implementation for language that explicitly pushed lexical environments
8:13:09
ggole
Why would fetching the function stored in a symbol require a table lookup? Wouldn't the code for (f ...) load the function from the symbol for f (which is looked up at read time)?
8:15:20
p_l
if you push max perf, you can even remove the indirection without disabling redefinition, at the cost of making redefinitions slow (but possibly enabling safe redefinition of inlined functions)
8:19:36
beach
ggole: It can't be redefined by changing the field of a symbol if the goal is to have different environments that allow different values for the property.
10:05:54
specbot
Tilde E: Exponential Floating-Point: http://www.lispworks.com/reference/HyperSpec/Body/22_ccb.htm
10:05:58
phoe
> If the parameter d is omitted, then there is no constraint on the number of digits to appear. A value is chosen for d in such a way that as many digits as possible may be printed subject to the width constraint imposed by the parameter w, the constraint of the scale factor k, and the constraint that no trailing zero digits may appear in the fraction, except that if the fraction to be printed is zero then a
10:06:22
phoe
If I am reading this correctly, then "if the fraction to be printed is zero then a single zero digit should appear after the decimal point" applies in this case.
10:07:33
phoe
K is defaulted to one and therefore positive, so we should print one decimal digit after the decimal point.
10:10:25
pjb
phoe: there's one constraint that must be respected, when k is absent, it defaults to 1, and the constraint is k<d+2 ; since d is absent, any value of d is possible, such as k<d+2, ie. 1<d+2 ie.-1<d ie. 0<=d ie. any value is possible, such as the number can be printed.
10:11:34
phoe
pjb: in this case, we may choose any value of D that lets us accurately print the number. Most implementation choose the minimum required number of digits.
10:12:41
pjb
1.e+0 is valid reader syntax for a floating point number, so I guess it can be printed as such (contrarily to my expectation).
10:14:17
phoe
However my question is about "except that if the fraction to be printed is zero then a single zero digit should appear after the decimal point.".
10:14:59
pjb
oops, I missed the except. Yes, it clearly indicates that it should be printed as 1.0e+0
10:15:49
phoe
"If k is positive, then it must be strictly less than d+2; k significant digits are printed before the decimal point, and d-k+1 digits are printed after the decimal point."
10:16:25
pjb
and d being absent, you can choose any convenient value, but subject to the following constraints, including the except.
10:18:10
pjb
But since it must also be at least 1 to print the 0 when it's 1.0, then we have (and (<= 0 d) (<= 1 d)) <=> (<= 1 d).
10:18:46
phoe
This implies that an implementation may want to print 1, 2, 5, or MOST-POSITIVE-FIXNUM zeroes, and all of these are correct.
10:21:00
phoe
So if the fraction to print is zero, we must print at least one zero to satisfy the part about "if the fraction to print is zero" and at most one zero to satisfy the "no multiple trailing zeroes" rule.
10:21:24
phoe
And this implies that "1.0e+0" is the correct way to go, which in turn clashes with the body of the ANSI-TEST.
10:22:04
phoe
Which still doesn't make sense. I need to figure out the rationale that this test follows, since it is possible that this clashes with our understanding so far.
10:25:34
phoe
So is mine, but ansi-test should be consistent with the spec. That is why I ask a question - the way I read it, this test is not correct, so either that test is not correct, or I am not reading something correctly.
11:56:35
refusenick
quickloading clws failed because g++ tried to compile a file with "#include <lfp.h>"
13:32:00
lukego
drat I would love to be at SBCL20 but it doesn't seem doable. Damn you all who manage to attend.
13:34:29
Shinmera
Meanwhile for ELS20 I'm currently busy getting the food organisation in order. Consulting all the various options is quite time intensive.
13:36:39
lukego
Is there much of a Lisp contingent at FOSDEM btw? that's been my hangout the past couple of years
13:37:17
mercourisj
anyone know of a markup templating language that uses CL directly? (or perhaps cl-markup or some other similar technology)
13:40:17
jackdaniel
I suspect that every now and then someone writes such thing so I wouldn't be surprised if there are many nih libraries doing the same thing
13:40:39
mercourisj
they are simple, but their syntax is strange and there are fun gotchas all the time
15:10:22
jeosol
My application loads tens of systems, some of these systems are libraries, layered on each other, and I have examples to test different aspects. Sometimes I have two examples (different complexity) to test some system. I can't have two system loaded.
15:11:00
jeosol
Lately, with the application grown so large, I have been trying to have the examples test cases, as separate systems, which loads all required application cases.
15:12:24
phoe
jeosol: which libraries are those? If they mutate some global state upon load, this will make it harder for other systems to load nicely. This warrants a bugticket.
15:12:26
jeosol
Now, I am able to separate the system, but because of the size, there is still a system still loading an example. Is there a hack with asdf or quicklisp to let me know what system is being load so I can track the issue easily
15:13:46
phoe
The question is basically, you want a list of all systems being loaded when you (asdf:load-system :foo). Correct?
15:13:48
jeosol
I meant by application global variables. To given an example, my application works with 3d grids for fluid modeling. I have simple example 100x1x1 grid that runs fast for testing, and I have another case, 100x100x50 that is slower
15:14:23
jeosol
So I have to test with the smaller, if things work, I go the larger one. There globals, e.g., the size of the grid that are different in both cases
15:15:36
jeosol
Some of you are probably aware of my project, thats the link. It's not been updated for a while, but hopefully that shows the size of files in the repo.
15:16:20
jackdaniel
jeosol: try inspecting the plan from (asdf:make-plan 'asdf:sequential-plan (asdf:make-operation :load-op) (asdf:find-system "alexandria"))
15:20:39
jeosol
I hope the above is clear. In summary, I am disentangling the examples/applications to be loadable as separate systems apart from the libraries so I can test cases consistently without clobbing global variables.
15:24:26
test12300001
i am testinjg out a clim (comon lisp interface maganger) irc client called bbeirc in mezzanoi
15:26:32
jeosol
phoe, jackdaniel: thanks for the suggestions. I will report back once I resolve the issue
15:40:08
jeosol
phoe: yeah me too. But I had some chat with Fare a while back when he was looking hands to support. From that convo, I started using the :package-inferred-system for my setup.
15:41:18
jeosol
phoe, jackdaniel: I was able to figured out the errant system manual, by loading system one by one (will explore a better way).
16:24:05
jeosol
phoe,jackdaniel: the system loads correctly with latest SBCL now and saved a core file for quick restart.
16:24:19
specbot
Tilde E: Exponential Floating-Point: http://www.lispworks.com/reference/HyperSpec/Body/22_ccb.htm
16:40:26
matthewzmd
hey guys, for anyone familiar with emacs lisp. Is it possible to write a function with parameter f that creates a function with the name f
16:43:02
edgar-rft
matthewzmd: it's posible with a function, but it sounds more as if ou want an elisp macro for that. See you on #emacs :-)