freenode/#lisp - IRC Chatlog
Search
1:20:34
Xach
but it will be less convenient and clear. but there are ways to reclaim clarity if not convenience.
1:27:45
aeth
manualcrank: do you have to process by the line? depending on what you're doing you could write a state machine that goes character-by-character (or byte-by-byte)
1:29:59
manualcrank
i did slurp all of stdin in one attempt and subsequence individual lines out of it
1:31:31
aeth
Well subseq isn't a good idea for performance. That's why nearly everything has a start and end optional or keyword parameter (or start1 end1 start2 end2, etc.)
1:31:56
manualcrank
largest possible input is 1,000,000 trees of 126 (+1 for newline) char-length each
1:33:11
aeth
if I needed performance and I didn't need to build up buffers of lines I would just work character-by-character (or, again, maybe just byte-by-byte)
1:34:29
aeth
the only hash table has everything as a key and a value, which isn't going to benchmark well against e.g. C++
1:35:45
aeth
I thought the hash table benchmark was one of the places where SBCL was weak in the Benchmarks Game
1:36:31
manualcrank
yeah if you have to read or write a lot of stuff, all the other languages are faster
1:38:16
manualcrank
i'm happy with my alien c-gets, but i'd be happier still if i could get fgets_unlocked to work and if return values weren't converted to new string objects
1:39:33
aeth
manualcrank: I wonder if working with bytes makes a difference over working with characters? A lot of languages use really weird strings but in SBCL afaik it's just utf32 so it reads utf8 into utf32 and there's a translation. Idk if that would make a difference, though
1:45:16
manualcrank
uiop has uiop:read-file-string but that takes a filename arg and anyway uiop isn't an option on the site
1:45:18
aeth
so it takes 123 124 and turns it into 0 0 0 123 0 0 0 124. You could see this yourself reading some FASLs with a binary reader, like hexl-mode in emacs. I think, though, at some point they might have optimized the size to get rid of that, though. It looks like that's just for symbols, though
1:45:48
aeth
literal strings saved in the fasl still have the 000000 between each character (assuming ASCII subset of unicode)
1:47:23
aeth
That still interferes with CL a lot. CL is a very multi-implementation language and each implementation implements extensions subtly differently and we rely heavily on portability libraries to actually use features
1:49:05
Bike
my dipshit solution can do 2.9 mil trees in 1.04s. let me try it with bytes or sorting as it goes or something
1:51:46
manualcrank
i don't mind not being able to use portability libs, it's just a puzzle site, point is to learn some algorithms
2:53:57
manualcrank
update to <http://pasted.co/d921528c>: reason it lops off the \n is because that's what gets() does, duh (fgets() doesn't)
2:54:36
manualcrank
also, returning a c-string according to docs implies a conversion to a Lisp string
2:55:14
manualcrank
i can though specify it returns (* char) and just return the buf i used to alien call gets
2:57:03
manualcrank
in that case there's no conversion, just an array of char (i changed the code to element type (unsigned-byte 8) though)
3:07:56
manualcrank
also, base-char is better than character because the former doesn't convert going from Lisp to C
5:12:00
ck_
beach: you're like a benchmark. If I make it to my desk within let's say an hour of you saying good morning, it will probably be a good day : )
5:13:38
loke
ck_: I use him as much lunch clock. When he says good morning, I know I'm about to have lunch soon
5:17:47
loke
ck_: yes. I have watched the movie more than once, and I was never entirely happy with that conclusion.
5:18:40
loke
I do, however, feel that although I understand the words, the meaning is somewhat lost on me.
5:19:43
ck_
I take it as 'pure rationality without empathy will not lead you to a good outcome', casually interpreted
5:21:10
pjb
loke: new job, but old profession, that of watchman. They used to announce the hours during the night.
5:22:11
loke
ck_: I tend to read it as the idea that there must be harmony and understanding between the classes, and they have to understand each struggles. The understand is metaphorical heart. However, it also does imply that the classes permanent and you are born into it. That is very much a 1800's notion that feels incredibly uncomfotrable to me.
5:48:59
beach
What is the logic of using foreign code when the purpose is to compete with Common Lisp code?
6:00:20
manualcrank
many times though i'm content to just use READ because the input is always correct and there isn't enough to make a difference
6:03:06
manualcrank
for me, no, speed is irrelevant as long as the code produces the correct answer in the allotted time
6:06:40
manualcrank
i'm doing these problems on a core 2 duo from over a decade; it's always fast enough for me
6:07:55
manualcrank
some sites have a clojure option (not kattis) and that's hopeless because none of the code ever completes
6:09:42
manualcrank
but clojure is fast once it starts up; it's just not fast enough to verify your algorithm is correct on these sites
6:11:36
LdBeth
But u should always be notified the thing gets verified is the model rather than the actual code
6:13:48
manualcrank
every problem is a script that compares your output with the correct output furnished by the problem writer
6:17:31
LdBeth
If the output mismatch, there’s high probability something is wrong, but the reverse is not true
6:22:17
manualcrank
none terminating programs are terminated after they exceed the time limit (1 sec typically)
6:23:57
LdBeth
What if the program is a compiler that requires long time and a lot amount of space for execution
6:30:12
manualcrank
identifying the correct string matching algorith, graph algorithm, computational geometry algorithm, etc.
6:31:08
manualcrank
it's never the fastest language (every problem has a statistics link) but neither is it the slowest
6:33:00
manualcrank
Java is fast enough though, i mean it doesn't TLE unless your algorithm is wrong
7:00:31
ck_
http://www.acm.org/pubs/articles/journals/cacm/1999-42-10/p109-prechelt/p109-prechelt.pdf
7:03:12
no-defun-allowed
figure i don't get access to it since i don't pay ACM the big kahoonas, nor does sci-hub work for it
7:05:19
ck_
sorry about that. Try this: https://trs.jpl.nasa.gov/bitstream/handle/2014/14462/00-0900.pdf?sequence=1
7:07:22
ck_
if you like, also take a look at norvig.com/java-lisp.html , which is Peter Norvig's solution to the problem used in the study
9:17:55
dmiles
#S is generally for "structures" .. though this would be OK.. #S(HASH-TABLE :TEST EQL :SIZE 120 :CONTENTS (1 ONE 2 TWO)) Does that mean the HASH-TABLE needs to be a structure-p ?
9:23:59
jackdaniel
if it is printed as something else then it is something else. I think that it is not specified what is a class of hash-table (i.e it may be built-in-class, structure-class etc)
9:25:20
loke
About #S “...denotes a structure. This is valid only if name is the name of a structure type already defined by defstruct and if the structure type has a standard constructor function.”
9:31:44
dmiles
i was sort of hoping to reuse #S for ptrint readable of standard classes but i suppose i will choose another then
9:36:43
jackdaniel
also, if we believe it, than it would mean: if standardized notation is defined for hash-tables that means that hash tables are structures (what would be conforming)
9:37:15
dmiles
clisp> (class-of #S(HASH-TABLE :TEST EQL :SIZE 120)) ==> #<BUILT-IN-CLASS HASH-TABLE>
9:38:18
loke
It seems CLISP has implemented an extension based on the example. but the example is arguably incorrect.
9:45:19
dmiles
#.(let ((ht (MAKE-HASH-TABLE :TEST EQL :SIZE 120))) (setf (gethash 'ONE table) 1) (setf (gethash 'TWO table) 1) ht)
9:47:24
loke
*PRINT-READABLY* is not guaranteed to write a readable hashtable. And even if it does, it's not compatible across implementations.
9:52:32
jmercouris
is there a way in paredit to transform (("a" "b") ("c" "d")) to (("c" "d") ("a" "b"))?
9:54:41
loke
jmercouris: It's not a paredit function by the way. it work equally well outside parwedit (the function is command-transpose-sexps)
9:54:58
dmiles
for some objects that i really cant print readably i might do #.(nth 666 *this-instance-instances*)
9:58:10
loke
fivo: that, and dont put any closing parens on separate lines. The only valid excuse is if it's a vertical list of objects and the last line ends with a line comment.
10:01:45
fivo
I asking because I was wondering how an macro with only a &body argument would be indented.
10:03:36
loke
fivo: SLIME is clever enough to notice that the macro has a &body argument and indents accordingly
10:18:51
loke
fivo: if the definition of $ uses an entire &body, then SLIME would not format it like that. But I don't know how it's defined.
10:23:03
flip214
Is there a definition whether (CHANGE-CLASS instance 'new-class :slot "value") has to change the slot's value if instance is already of class 'new-class?
10:35:57
flip214
beach: so you think a CHANGE-CLASS to the same class is _defined_ to be a no-op too? Thanks a lot.
10:36:35
flip214
I'm not sure about "After completing all other actions, change-class invokes update-instance-for-different-class"
10:41:19
beach
I don't see anything specifically said about that. You may have to consider both possibilities.
10:43:52
flip214
Well, in absence of a CDR the behaviour is undefined, and so I can just wish for the more performant, right? ;)