freenode/lisp - IRC Chatlog
Search
17:38:49
JuanDaugherty
most of them actually. Reconstructing from an AST works for statement oriented langs.
17:48:24
jasom
some implementations save some parts ot the code in the debug information, but declaring (optimize (debug 0)) usually stops most of that
18:08:55
otjura
I started wondering why projects such as SBCL are still being developed actively. haven't they matched the ANSI spec years ago could thus be considered complete?
18:10:27
dlowe
You can always be more correct, faster, take fewer resources, behave better with threads
18:13:43
whoman
i had just been looking at sbcl changelog to see if i want to update (im on 1.3.9 and latest is 1.3.15) and they are mostly bugfixes, performance, memory footprint, etc.
18:14:29
whoman
if simply filling in the spec was all that we needed.. there might not be multiple implementations to begin with.
18:17:39
otjura
you know, I recently completed largeish university project in other language where documentation over 6 months old was considered quite obsolete so coming back to lispland for fun and recreation is such a stark contrast
18:20:06
whoman
hehe =) for me now, lisp is stark contrast to everything. thinking about parens and tree forms is my happy place. but i dont watch tv =)
18:24:20
otjura
I know the feeling. I'm so spoiled by this it was difficult to realign to assorted dot-notation with varying parens
18:25:22
otjura
that being said, I do think strong typing and varying syntax has benefits in large projects when returning to code. looking at large lisp projects I have real difficulty understanding what is going on
18:26:35
whoman
it is like the wife of my youth, if i had one. begain accidentally mingling with emacslisp right after C, a good 22+years ago, and following my wild oats to all kinds of linguistics only to end up back home where i'd essentially started. </monolog post>
18:27:42
whoman
yes i agree. being able to "inspect" the tree of a project or program i think would help immensely. but any book has to be read or written to stay fresh as it is static mysterious randomness until then
18:27:54
otjura
dlowe: definitely, always. strong typing simply makes it more intelligble what function accepts
18:28:50
whoman
but! symbolic atoms are unique by their nature. aren't those enough for any strength or strictness?
18:31:11
otjura
maybe from program's perspective. I find it much easier to deduce what goes into variable if its type is declared.
18:33:50
otjura
funny how the more I dabble with different languages the more Java starts making sense (please don't ban me)
18:35:24
TMA
I like even stricter types, like Damage Int, so that the 5 points of damage are incompatible with GoldCoins Int
18:36:56
jasom
dlowe: the limitation of type declarations is that when they aren't everywhere, then you can't have efficient recursive datatypes
18:38:37
jasom
e.g. if you could do (deftype fixnum-list (cons fixnum (or fixnum-list null))) it would be easy to show (cons 2 x) will be a fixnum list *if* x is is a fixnum list, you can't make any efficient assertions if the type of x is unknown.
18:50:16
whoman
TMA, me too. but honestly the gold ints and the damage ints should not come from or arrive at the same places in code. getting paid should not harm a player. unless, throwing money damages hp by monetary value ^_^ hmm.
18:56:06
jasom
There was a C variable naming convention to indicate this; e.g. _px for pixel distance so if you see something like position_x_in + distance_x_px; you could find the bug quickly by inspection (adding pixels to inches is meaningless)
18:58:12
nyef
Basically "our type system can't express this, so we'll shove it into the variable namespace and have the humans do the type checking."
19:02:32
pebblexe
how can I specify the limits of the type accepted for something?: https://gist.github.com/pebblexe/28473dc4b1a172e023c9d6f5a993e29c
19:05:29
pebblexe
Bike: but what's the point of declaring it after the function call except as an optimization? I would like to do something like this (defmethod test ((integer n)) ...)
19:05:46
pebblexe
I mean it would also catch errors, but I mean I am looking to dispatch on the type
19:06:08
Bike
you mean you want it to use one method if it's in that range, and another if it's an integer outside that range?
19:06:14
varjag
but whatever numeric optimization you make there, will be negligible after you cons all that into a list and (i assume) traverse it later
19:06:56
pebblexe
varjag: I am not worried about optimization, I just want to have good looking code
19:07:01
Bike
yeah, you can't do that. you can dispatch on integers and then do a basic (if (< ...) ...) in the body, of course.
19:07:31
Bike
you can't dispatch on types because any value belongs to multiple types that are not subtypes of each other.
19:09:00
pebblexe
Bike: the types are also a tree http://sellout.github.io/2012/03/03/common-lisp-type-hierarchy/
19:09:30
Bike
what is the relationship between "integers between 0 and 10" and "integers between 5 and 15"?
19:10:04
pebblexe
if I have a function that runs if 'x' is true about the variable, it makes sense to run it
19:14:00
Bike
hum, even in that image you can see non-tree-ness at simple-string and simple-bit-vector
19:26:31
scymtym
on a related note: this https://github.com/sbcl/specializable/tree/wip-type-specializer/src/type-specializer (example: https://github.com/sbcl/specializable/blob/wip-type-specializer/examples/type-specializer.lisp ) now mostly works with vanilla sbcl master. the previously mentioned problems w.r.t. sorting applicable methods remain, of course
19:29:45
pebblexe
is it possible to do it this way?: https://gist.github.com/pebblexe/1634baa131afd2c0a7cb236a3002dd89
19:30:29
Bike
no. (standard) generic functions specialize on classes. eql t and a function are not classes.
19:31:52
scymtym
pebblexe: https://github.com/pcostanza/filtered-functions may be interesting for you
19:32:33
jasom
pebblexe: usually if I want to do somethign fancy, I just use etypecase or optima or whatever.
19:33:03
pebblexe
jasom: yeah I've looked at optima, I was just hoping I could get some experience with clos
19:33:19
scymtym
iirc, fortress had a solution for this kind of applicable method ordering. i think it was something like being forced to define a method that is more specific than both of the ambiguous methods. but that seems to prohibit call-next-method
19:34:41
pebblexe
okay I am having issues where sometimes stuff doesn't compile after using defmethods to experiment, like it complains about something that I've commented out
19:35:17
pebblexe
I think it's only happened in ccl, but I think it might have happened in sbcl as well
19:35:50
Bike
when you recompile a function, you replace the definition, but when you recompile a file and you just commented out a method, there's no reason for that method to go away, you know?
19:36:09
Bike
what i do is M-x slime-inspect the generic function, and that brings up a menu where you can undefine particular methods
19:38:17
pebblexe
Bike: I am not sure what you mean, I mean functions go away when I comment them out, right? why are methods different?
19:42:50
Bike
your lisp image has a persistent state, calling load and whatnot just alters that state
19:43:03
Bike
defun adds a new function, but if it's commented out that just means it doesn't add a new function, not that it removes a function
19:43:09
daemoz
Bike: How do I undefine something from the slime-inspect menu? Just delete everything and press enter?
19:43:14
pebblexe
what does this error mean?: https://gist.github.com/pebblexe/31503c36172e43bc4c21ceb176d47d56
19:43:56
Bike
daemoz: you can remove particular methods by going to the line with the method and hitting enter. where it says [remove method]
19:44:25
nyef
pebblexe: I'm not too familiar with CCL, but I think that it's saying that the file underlying whatever stream that is was closed?
19:57:31
pebblexe
now I am getting this error trying to (ql:quickload "optima") https://gist.github.com/pebblexe/fd096a27962d9f81e6a5f7b8cac3c4b8
19:59:37
pebblexe
yeah and in sbcl I get: https://gist.github.com/pebblexe/d30811426c3a0109d6108fedaff04358
20:13:17
websterbudding
I'm having trouble parsing json strings in lisp. Both cl-json and yason require outer double quotes and escaped inner double quotes. But JSON.stringify does not generate escaped double quotes.
20:18:36
pebblexe
how do I use a package in a file that starts with in-package? for example I have (in-package #:cl-msgpack) and I would like to import optima
20:38:38
pebblexe
how do I create/append to a file? it seems that :if-exists :append causes it to error out if it doesn't exist
20:42:18
pebblexe
jackdaniel: okay, I was just going off of practical common lisp, but I'll check there too
20:45:20
pebblexe
how do I use with-open-file to point to a file specific to a directory? I mean slime starts up with what as the home directory to write to?
20:49:29
pebblexe
figured it out! it's (merge-pathnames (asdf:system-source-directory :cl-msgpack) "temp-bytes")