freenode/lisp - IRC Chatlog
Search
22:27:09
mrcode_
what's the right way to specialize a method on an array of unsigned-byte vs a string ?
22:29:12
Xach
mrcode_: STRING is a system class, so that will get you a method that acts only on strings. but there isn't anything specific for an unsigned-byte array.
22:30:52
mrcode_
Xach: does this mean it's impossible to specialize a method for a (simple-array character *) vs (simple-array (unsigned-byte 8) *) ?
22:47:39
mrcode_
hmm, I guess a quick followup to that, how does one specialize a method on an array in general ?
22:51:14
pjb
mrcode_: the right way to do that is to define two custom classes, one that wraps the array of unsigned-byte and the other a string, and to specialize on those classes.
22:53:15
pjb
Of course, you can also specialize on the classes returned there, or rather, one of their superclasses, since the result is somewhat implementation dependent or too restrictive: (values (class-name (class-of (make-array 3 :element-type 'unsigned-byte))) (class-name (class-of (make-string 3 :element-type 'character)))) #| --> simple-vector ; simple-base-string |#
22:54:03
pjb
mrcode_: array is definitely a system class, you can specialize on it. (find-class 'array) #| --> #<built-in-class array> |#
22:54:57
pjb
mrcode_: defining wrapping classes would have to be done, assuming you don't want your method to dispatch for arrays of signed-byte or arrays of (unsigned-byte 8), say…
23:11:25
no-defun-allowed
I think the "self" column is how many samples have called that function last, and "total" is how many have that function anywhere on the stack.
23:17:47
no-defun-allowed
But then that would mean my interpreter is in the dispatch loop (as opposed to running some code) 53% of the time, which I don't believe.
23:27:30
no-defun-allowed
Could try that. My opcodes are lambda functions and thus I can't name them to trace, but I'm interested to see if that 53% number is anything near realistic.
23:29:42
no-defun-allowed
Or that could be possible, since the loop does quite a few checks to limit conses and cycles and establishes a restart too.
23:32:27
no-defun-allowed
Yep, it was that restart all along. I guess I will have to split up this loop into a setup part, then a run part, so that it's possible to continue running the interpreter when we raise a signal for some external data.
1:02:28
DrDuck
Can I expect Winston and Horn's code from their 'Lisp' book to compile even though the book was published in '89?
1:09:00
Bike
no, the garbage collector is not standard. also, if you can refer to an object and pass it to such a function, it's not garbage
1:09:02
no-defun-allowed
Well, if there was some function for it, calling it would create a reference to that object, so no.
1:09:31
no-defun-allowed
But (trivial-garbage:gc :full t) will do a full garbage collection (if you load the trivial-garbage system).
1:12:41
no-defun-allowed
It would be terribly inefficient to garbage collect only one object, when a significant proportion of the heap is scanned.
1:14:39
DrDuck
i want to force the garbage collector to clear up some memory explicitly when i tell it to
1:15:14
Bike
well, as ddefun said, the implementation usually has a hook to run the collector manually
1:16:27
Bike
in a garbage collected system memory is not really a concern directly, so you should only need to worry about it if you need to tune performance or the like
1:16:59
Bike
especially, you can't do something like (free x) (print x) like you can in C (i mean, it's invalid, but you can write it)
1:51:35
p_l
DrDuck: with automatic memory management, usually the only thing you can do is to explicitly trigger the GC, but not tell it to collect something. There are ways to handle that, though, like object caches and sometimes there are ways to get manual memory control
1:53:20
p_l
yeah, dynamic-extent hints to compiler that the specified binding will have values that live only within scope
1:54:23
p_l
analogue: "industry" is notoriously bad guideline in Lisp case. Most visible popular stuff? Clojure and Racket. Hidden in weird places doing important work? Common Lisp and helluva lot of Scheme. With occassional throwback to pre-ZetaLisp days
1:55:39
p_l
and by helluva lot of scheme I mean "significant portion of PS3 and PS4 consoles got to run a heavily Scheme-d software"
1:56:24
no-defun-allowed
Did you know...tinyscheme is used in macOS access control of some sort I forgot the name of?
1:56:46
p_l
analogue: the general guideline is that if you want to use Lisp (any lisp), take a task where nobody except you cares about language choice
1:57:24
p_l
that's surprisingly common in enterprise software, where they pay you to solve a problem, and language is last thing they are going to inquire on so long as it works on their systems
1:58:18
p_l
analogue: drew doesn't show up here much anymore, but he talked about earning money mainly by making intranet web apps for various companies
1:58:36
p_l
the companies didn't ask him to program in specific language, they asked him to solve a problem
1:59:03
p_l
and sometimes you might even end up building a new language to fit their requirements, where Lisp makes a lot of things easier :)
2:00:20
p_l
analogue: one use case you might have is to introduce dynamic programming by end user to such a codebase
2:01:30
p_l
the aforementioned blockly use case? we pitched to client that they would be able to change processing equations/rules without having a java & PL/SQL expert come and recompile the program
2:05:03
p_l
well, with exception of Allegro's "modern mode" (lowercase, case-preserving), all important implementations comply with ANSI CL standard
2:05:09
no-defun-allowed
The differences between those implementations include compilers and extensions (like exposing GC functions, FFI, threads, etc)
2:05:46
p_l
LW for example has pretty nice GUI library and AFAIK splendid delivery options (plus stuff like WHO-CALLS)
2:06:24
analogue
Scheme appeals to me the most I think, would you say it is much to transition between the languages?
2:07:27
p_l
analogue: significant differences, IMO. CL has non-hygienic macros and doesn't care that much about text representation of code. ANSI CL is also much bigger standard by itself and thus a lot of things that are "every implementation is different" in Scheme are boringly standard in CL
2:07:51
p_l
ck_: iirc, SLIME's doesn't support querying who call's function at point on all implementations
2:08:52
minion
analogue: direct your attention towards pcl: pcl-book: "Practical Common Lisp", an introduction to Common Lisp by Peter Seibel, available at http://www.gigamonkeys.com/book/ and in dead-tree form from Apress (as of 11 April 2005).
2:08:56
ck_
p_l: sure. I just wondered why you singled out the lispworks functionality -- perhaps because it works slightly differently or better.
2:09:01
minion
analogue: paip: Paradigms of Artificial Intelligence Programming. More about Common Lisp than Artificial Intelligence. Now freely available at https://github.com/norvig/paip-lisp
2:09:24
p_l
analogue: I don't have much on scheme, but "How to Design Programs" might be of interest
2:09:50
p_l
and of course the classic (light on Scheme, heavy on Computer Science) "Structure and Interpretation of Computer Programs"