freenode/#lisp - IRC Chatlog
Search
19:25:17
flip214
is there some special like *print-base* that says how many digits a float number should be printed with?
19:41:53
flip214
pjb: no, in this case I only care about the first two digits (and the exponent, if not 0)
19:58:41
flip214
pjb: sorry, I'm doing electronic engineering right now... you know, using +-20% capacitors and so on....
20:11:02
pjb
flip214: perhaps it's possible to do something with the pretty printer. Otherwise, wrap your floats in a clos object, and define a print-object method for them.
20:11:36
Bike
right want to do that anyway, so you can have components with the same nominal value but different tolerqances
20:21:50
pjb
flip214: (set-pprint-dispatch (quote float) (lambda (stream value) (format stream "~,2F" value))); seems to work, for: (let ((*print-pretty* t)) (print (list pi 0.12000001d0 0.12999999d0)))
20:28:33
didi
We should decide if we want to deprecate structs or not. /me votes for no, but he is not very bright
20:34:19
buffergn0me
Structs are really useful apart from generic functions and objects. For example with the :type options to generate accessors for lists/vectors returned by various things
20:37:18
Bike
if you give defstruct :type, it mostly just defines a bunch of functions to do (aref x 0) or whatever.
20:37:27
buffergn0me
Yup. See the :type option 2/3rds of the way down the page http://www.lispworks.com/documentation/lw70/CLHS/Body/m_defstr.htm
21:37:55
aeth
:type in defstruct is a lot more widely respected than :type in defclass, and is probably more optimizable where it is respected
0:13:04
mfiano
I would like to write a macro that allows specifying types for each argument, so that I can include an ftype declaration in the expansion. Can you give me some pointers on how to use your library to do that? :)
0:14:59
Bike
i can't recommend using that library, i think it's better to use an actual parser with a grammar. i don't know if there are other independent parsers though. i know sicl has one
0:16:23
mfiano
Ha fair enough. I really don't want to parse a lambda list myself. My library is in disrepair right now ever since I ripped out the defstar library due to being GPLv3.
0:16:52
mfiano
There doesn't seem to be many choices here to just add typed arguments to a defun wrapper
3:08:29
loke
pjb: Right, but in the discussion I had the person was arguing that the object orientation in Objective C was somehow fundamentally different from that of, say, Java because it's “message passing”.
3:18:27
aeth
It's harder than it looks in edge cases. I don't currently have typed keyword/optional/rest, for instance. I'll probably copy the syntax from pillton's specialization-store there. Similar syntax already, except I don't provide a return type
3:19:25
aeth
My return-type will probably be in a keyword argument to the name-and-options instead of its own field after the lambda-list like in specialization-store because I rarely need it
3:20:56
mfiano
and typed-args can be any OLL arguments aside &aux, because I'm lazy and never use them
3:22:18
White_Flame
loke: wikipedia says the major difference is that the target method is determined at runtime by the object's code, instead of at compile-time. So that's a bit more CLOSsy, in the runtime aspect
3:22:50
aeth
specialization-store is (name-and-options typed-lambda-list result-type &body body) and mine is (name-and-options typed-lambda-list &body body)
3:26:21
aeth
All that's really missing is a defmethod that supports inline and classes for keyword/optional (which iirc are not supported, possibly because of the ambiguity in a straightforward attempt)
3:34:15
proshlo
I'd like to write a Common Lisp interpreter on a graphing calculator so I can use Macsyma on it. Where should I start? I have an almost-finished Scheme interpreter in C++. Do I add special forms to make it a Lisp-2 and add defmacro facilities to bootstrap the rest? Should I go off the Clisp source code instead?
3:36:47
aeth
Graphing calculators are essentially identical to how they were 15+ years ago, stuck in time, afaik
3:37:40
aeth
Well, you can't have a significantly better one because they're mostly used on standardized tests or in classrooms.
3:37:43
proshlo
aeth: I think the most powerful version of the TI-84s has a 15mhz CPU and 24mB of ram.
3:37:46
Bike
proshlo: i mean, a lisp interpreter isn't really much harder than a scheme interpreter. having actual library functions is more work than the basic "if you type Z that evaluates to Y" stuff.
3:37:55
blep-on-external
i'm not saying get it from arxiv, but get it from arxiv and say if it's any good
3:37:57
White_Flame
proshlo: Scheme was intended as a minimalist language. Continuations can be kinda confusing, but would be a lot easier to implement in an interpreter than in a compiler
3:38:28
Bike
i also thought modern graphing calculators had some basic CAS in them. i know mine does
3:40:38
proshlo
loke: yeah Bike: Mine can do numerical integration, but not symbolic. I'd like to have that because Calc II is hard. :)
3:43:45
loke
the HP-58 language was stack based. So { X DUP MULT } was a list of three symbols, or a program that squares X
3:44:50
aeth
And it's an old enough app that it doesn't have ads or microtransactions or other nonsense! (I don't think I would have found it in today's Android.)
3:45:09
loke
Me and a friend implemented LISP-EVAL on the hp48. It wasn't much code, and it gave us Lisp.
3:45:24
aeth
loke: Do you still have the program? It would be interesting to see if it runs in Droid 48
3:45:55
loke
aeth: LISP-EVAL? No... we wrote it on the actual device, and lost the code before we could save it.
3:47:31
loke
One interesting aspect of the HP-48 language is if A contains the symbol B, and B contains the symbol C, then evaluating A results in C.
5:52:22
makomo
i just found parse-macro-lambda-list, but i'm interested in the one using a proper grammar and an early parser