A simple Stardict client1 in python2, 21 lines with comments. How easy would it be to write an equivalent program in Common Lisp? I think Lisp is not suitable for practical problems.
Probably could be made more readable by something like
when in range of 666, show death, saying dead, doing: act "remove" self
But it would obfuscate meaning with vague english words.
>>1
It's reasonably simple to implement that in CL, although I would use my own binary file library for parsing the data, oh and using regular expressions to parse binary data? Yuck.
regular expressions to parse binary data? Yuck.
It's not exactly binary data, it's a list of words with a bit of bytes near them. Binary parts are parsed with struct.unpack.
Name:
Anonymous2011-03-31 9:43
http://docs.python.org/library/struct.html ([\w\W]+?)\x00([\w\W]{8}) '>ii' @ native native native = native standard none < little-endian standard none big-endian standard none ! network (= big-endian) standard none
Wow! Where is your prized readability now?
Name:
Anonymous2011-03-31 9:52
An example, how this can be done with a macro DSL (unpack)
bytes | unpack order=MSB [a:4 b:4]
>>40
You have go(to)'s and all kinds of local/non-local exit stuff, along with various options for stack unwinding. TCO is nice, but not absolutely needed. Most implementations provide it.
>>18 It's not about me, it's about facts. And it remains a fact until you actually prove it otherwise. With code.
How cute, you believe that something happens to the facts when you subjectively experience a proof.
>>46,48 HAHAHAHA
YOU THINK YOURE THOUGH UH ?
I HAVE ONE WORD FOR YOU THE FORCED INDENTATION OF THE CODE
GET IT ?
I DONT THINK SO
YOU DONT KNOW ABOUT MY OTHER CAR I GUESS ?
ITS A CDR
AND IS PRONOUNCED ``CUDDER''
OK YOU FUQIN ANGERED AN EXPERT PROGRAMMER
THIS IS /prog/
YOU ARE ALLOWED TO POST HERE ONLY IF YOU HAVE ACHIEVED SATORI
PROGRAMMING IS ALL ABOUT ``ABSTRACT BULLSHITE'' THAT YOU WILL NEVER COMPREHEND
I HAVE READ SICP
IF ITS NOT DONE YOU HAVE TO
TOO BAD RUBY ON RAILS IS SLOW AS FUCK
BBCODE AND ((SCHEME)) ARE THE ULTIMATE LANGUAGES
ALSO
WELCOME TO /prog/
EVERY THREAD WILL BE REPLIED TO
NO EXCEPTION
50+ posts and still not a single Common Lisp implementation was posted. Something that takes only 20min to write in Python can't be reproduced in Lisp for more than a day! Common Lisp and its fans are pathetic.
>>53
I'm too busy doing real work to bother implementing your toy dict lookup. If I were to implement it, it'd be slightly smaller than >>9's scheme implementation.
The only real "autism dialect" is Lojban. Everything else is amateur scribbles and incoherent imitations.
Name:
Anonymous2011-04-01 11:44
>>64
confirmed. i learned lojbn ND GOT AUTISM IN 4 DAYS
Name:
Anonymous2011-04-01 11:49
>>64
Extremely synthetic Ithkuil is much more precise and concise, which proves that analtic languages are inferior.
Name:
Anonymous2011-04-01 12:00
a fluent speaker of Ithkuil, accordingly, would think “about five or six times as fast” as a speaker of a typical natural language.
Name:
Anonymous2011-04-01 12:12
>>67
Ok, thinking very fast but having no ability to communicate with others. Maximal autism.
Name:
Anonymous2011-04-01 12:16
>>67
WRONG! Visual representation of ideas, which is typical of HFA spectrum, is faster and more precise. Ithkuil only reduces the semantic noise, which makes faster writing and speaking, thinking with same lexemes does not magically become faster.
What you are thinking of is verbalization speed. You can train faster reading and verbalization skills with speed reading without any Ithkuil.
c.f. http://en.wikipedia.org/wiki/Speed_reading
Now ($eval "generate 'sentence")
(the woman hit the ball)
NIL ($eval "generate 'sentence")
(a ball saw the woman)
NIL ($eval "generate 'sentence")
(a woman hit a ball)
grammar = Dict(
S = [['NP','VP']],
NP = [['Art', 'N']],
VP = [['V', 'NP']],
Art = ['the', 'a'],
N = ['man', 'ball', 'woman', 'table'],
V = ['hit', 'took', 'saw', 'liked']
)
def generate(phrase):
"Generate a random sentence or phrase"
if isinstance(phrase, list):
return mappend(generate, phrase)
elif phrase in grammar:
return generate(choice(grammar[phrase]))
else: return [phrase]
>>72
(define grunnur
'((sentence (noun-phrase verb-phrase))
(noun-phrase (article noun))
(verb-phrase (verb noun-phrase))
(article the a)
(noun man ball woman table)
(verb hit took saw liked)))
(define (list-ref/random l)
(list-ref l (random (length l))))
>>103
He uses some non-portable FFI to cast a buffer to an integer. I wrote my own portable implementation of this last time I needed to write a similar binary data parser, and I've also used a portable floats implementation as well (on SBCL, I have a conditional reader macro which implements this a lot more efficiently using only 1-2 assembly instructions, it's also possible to use the FFI to do it more efficiently, but I have yet to try).
>>103
It's trivial to implement if you've got bytevectors/bytestrings and know how integers are stored in memory and the difference between signed/unsigned, big/little endian. (read: basic knowledge).
Let's say it's left as an exercise for the reader.
>>104
Not exactly FFI, but implementation dependent, true.
Name:
Anonymous2011-06-16 6:06
Lisp can only be useful with tons of FFI code for everything...
Name:
Anonymous2011-08-14 2:51
C++ can only be useful with tons of external libraries for everything.