22 ms·
For one, the service that performs the vast majority of airfare searches -- formerly ITA Software, now Google Flights. Having spent time at the MIT AI Lab and
by dmbaggett 11y ago
For one, the service that performs the vast majority of airfare searches -- formerly ITA Software, now Google Flights.
Having spent time at the MIT AI Lab and having co-founded a company whose principal product was a Lisp/C hybrid, I think the challenge with mainstream adoption of both Lisp-like and functional languages is the syntax. There's an element of "don't use a programming language that's hard to hire for" but I think that's secondary as it never bothered us or posed a real problem.
Naughty Dog's Crash Bandicoot games (which I also worked on) used Lisp for all the character control logic.
- kruhft 11y ago> I think the challenge with mainstream adoption of both Lisp-like and functional languages is the syntax Ironic(?) considering there is almost no syntax to Lisp.
- reitanqild 11y agoI know almost nothing about lisp, but what comes to mind is car, cdr which aren't exactly the most descriptive keywords of programming languages I have seen. (I think they are replaced in modern versions but my point still stands as I remember the old ones, not the new)
- kruhft 11y agoYes, sometimes 'car' and 'cdr' are replaced with 'first' and 'rest' and are some of the first things you cover when learning the language, so I don't think the names would really be hindering adoption for those that try to learn the language. The benefits of car and cdr are that they can be composed: (caadr l) instead of (car (car (cdr l))) for example.
- AnimalMuppet 11y agoWell, if you use "first" and "rest", then (caadr l) could become (firrest l) or something like that...
- bhrgunatha 11y agoI like Racket's second, third, fourth,... etc. [1] I don't think there's an equivalent to cddadr for example, but at that level of deconstruction you're better off abstracting the data structure (maybe a struct [2]) or using some other mechanism like match [3] [1] http://docs.racket-lang.org/reference/pairs.html?q=second#%28def._%28%28lib._racket%2Flist..rkt%29._second%29%29 http://docs.racket-lang.org/reference/pairs.html?q=second#%2... [2] http://docs.racket-lang.org/reference/define-struct.html?q=struct#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._struct%29%29 http://docs.racket-lang.org/reference/define-struct.html?q=s... [3] http://docs.racket-lang.org/reference/match.html?q=match#%28form._%28%28lib._racket%2Fmatch..rkt%29._match%29%29 http://docs.racket-lang.org/reference/match.html?q=match#%28...
- defgeneric 11y agoYes but can you do caaaaaar or caaddaar or cdaar, etc. with head and tail? In 5 characters with cadar you can express walking along a tree structure to get exactly the node you want.
- davexunit 11y agocar, cdr, cadr, and friends are discouraged in some Lisp communities where pattern matchers are available.
- AnimalMuppet 11y agoSure. caaaaaar -> heaaaaaad. cadar -> heaiad. It's one more character, but if you really want to express yourself that way, there's no reason you couldn't...
- dmbaggett 11y agoThat's exactly the problem: until you're used to it, it looks nothing like psuedocode. Contrast with Python. I'm not saying it's right, I just think this is the issue.
- kruhft 11y agoReally, the major difference syntactically is: (f x) vs. f(x) I've never really understood why people seem to have such a hard time with that.
- xrange 11y agoc = sqrt(a*a + b*b) (set! c (sqrt (+ (* a a) (* b b))))
- klibertp 11y ago(define c (sqrt (sum (sqr a) (sqr b)))) Which you read out loud like this: "c is a square root of a sum of two values, squared". Easy to read as you see and easy to understand. This: c = sqrt(a*a+b*b) is way harder to read.
- mahyarm 11y agoI think the thing about lisp isn't the fact that it's functions start with a paren. It's the fact it uses function composition to write everything that makes it harder to keep track of. Most languages don't define their functions like this: c = sqrt(a^2+b^2) vs. define(c, sqrt(sum(sqr(a),sqr(b)))) def getMaxValue(numbers): answer = numbers.first() for (i in xrange(numbers.length)): if (numbers[i] > answer): answer = numbers[i] return answer vs. (defun get-max-value (list) (let ((answer (first list))) (do ((i 1 (1+ i))) ((>= i (length list)) answer) (when (> (nth i list) answer) (setf answer (nth i list)))))) if you could only use python functions: defun(get-max-value, [list], let(answer,first(list)), do( (i,1,(1+ i)), (>=(i, length(list)), ans), when( >(nth(i,list),answer), setf(answer,nth(i,list))))) defun(get-max-value, [list], let(answer,first(list)), do( (i,1,(1+ i)), (>=(i, length(list)), ans), when( >(nth(i,list),answer), setf(answer,nth(i,list)))))
- lawpoop 11y agoI guess that's ironic, but with people coming up used to all the ornate syntax, one of the common balks is "all those parenthesis, it all looks the same" and "there is no syntax, how do you read this." It's like going from Arabic numerals to counting by groups of five; initially, it feels like you're losing expressive power. And, of course, at a glance, you can't read "|||||||||||||||||||||||||||||" as quickly as you can "28".
- kruhft 11y agoHere's a good wiki on the topic: http://c2.com/cgi/wiki?LispLacksVisualCues http://c2.com/cgi/wiki?LispLacksVisualCues After a brief period of usage 'the parens disappear' and you just read the code by indentation.
- marssaxman 11y agoSo, uhh... why not use a notation where nesting is expressed via indentation, then? I don't understand how the syntax can be considered superior if the way people actually cope with it is to hide another syntax inside it. I was dumping ASTs as part of a little language project recently and my first impulse was to render them as S-expressions. Alas, it just wasn't readable; I couldn't make any sense of it. Indented YAML style lists, though? The structure pops right out and the information I wanted was immediately obvious. There were no constraints here, I was free to render text in any way that suited me; the Lisp style syntax just wasn't helpful.
- scentoni 11y agoA Lisp with significant indenting (like Python) would bear a strong resemblance to Haskell.
- adrianm 11y agoIf you mean Lisp as a straightforward expression of "Lambda calculus" then I would agree. However, Lisp as in Common Lisp most certainly has a good amount of syntax. And let's not forget macros which amount to user defined syntactic extensions. Here are some examples of syntax built into the standard: Lambda lists have varying syntax depending on context. http://www.lispworks.com/documentation/lw70/CLHS/Body/03_d.htm http://www.lispworks.com/documentation/lw70/CLHS/Body/03_d.h... Declarations have both standardized and implementation defined syntax for introducing information into the compile-time environment: http://www.lispworks.com/documentation/lw70/CLHS/Body/03_c.htm http://www.lispworks.com/documentation/lw70/CLHS/Body/03_c.h... Type specifiers introduce new syntax for both standardized and user-defined types: http://www.lispworks.com/documentation/lw70/CLHS/Body/04_bc.htm http://www.lispworks.com/documentation/lw70/CLHS/Body/04_bc.... Logical pathnames: http://www.lispworks.com/documentation/lw70/CLHS/Body/19_ca.htm http://www.lispworks.com/documentation/lw70/CLHS/Body/19_ca.... Feature expressions: http://www.lispworks.com/documentation/lw70/CLHS/Body/24_aba.htm http://www.lispworks.com/documentation/lw70/CLHS/Body/24_aba... And of course, programmable reader macros which is how syntax for every single language primitive in the language is introduced: http://www.lispworks.com/documentation/lw70/CLHS/Body/02_d.htm http://www.lispworks.com/documentation/lw70/CLHS/Body/02_d.h... Here's an example of a complex standardized macro with its own domain specific syntax (loop): http://www.lispworks.com/documentation/lw70/CLHS/Body/06_a.htm http://www.lispworks.com/documentation/lw70/CLHS/Body/06_a.h... Let's not forget that most of what one might think of as built-in features in Common Lisp are actually standardized extensions to the language built with macros. All of the power, expressivity, and extensibility of Common Lisp is what makes it my favorite programming language. It's what makes everything like above possible and gives power back to the user. But ignoring the syntactic complexity will not win us any followers! TLDR: Common Lisp isn't simple, but it exposes one of the most powerful and empowering programming environments we have.
- kruhft 11y ago> If you mean Lisp as a straightforward expression of "Lambda calculus, then I would agree. That's what I was talking about. The language, being programmable, especially with read macros, can be used to create a very syntactically full language, but at it's basic core level, there is really just '(', ')', '.' and symbols.
- defgeneric 11y agoIt's really such a simple syntax change from f(x) to (f x) yet it makes an enormous difference and opens up a whole new world of possibilities. Sure, there are homoiconic languages in which you can write macros that aren't lisps but the expressive power and ease of use suffers. Take for example macros in Julia (itself heavily lisp-inspired), they're possible but ugly and not nearly as seamless as macros in lisp.
- Avshalom 11y agoThere aren't a lot of symbols to Lisp but there's plenty of syntax Using Racket: (if bool then else) instead of (if bool then) or (if (bool then) (bool else)) (if (> x y) (x) (y)) ;fails for numbers because (x) is considered a function call (even though 3 is an invalid identifier and thus can be assumed to be always be a number). (define (fun x y) (...)) instead of (define fun (x y) (...)) or (define ((fun (x y)) (...))) That's syntax. Just because I'm not using {}'s here and infix there doesn't make it any less syntax. That's just the two most basic forms too; bring in loop? forget about it. This also ignores things like '(@,) or (x . y) but I'm not a lisper so I don't know how often that actually comes up
- mroll 11y agoLisp as the idea has no syntax. Racket is a dialect of that idea, and the authors have decided to add syntax.
- Avshalom 11y agoLisp "as the idea" is not a programming language. Racket is a language, Common Lisp* is a language. No one writes code in the IDEA of lisp, indeed no one can because no computer yet can pull instructions out of what ever aether contains platonic ideals. * using SBCL: (defun foo (x y) (...)) instead of Racket (define (foo x y) (...)) is again an example of syntax.
- stray 11y agoI think you're conflating syntax with semantics.
- stray 11y agoIt's probably because in algol derived languages -- when you encounter parentheses, something weird is happening -- something you've got to put extra thought into. Maybe the ordering of something is being forced. Maybe something else is going on, but whatever it is requires more thought than things that are parentheses free. So you look at Lisp and your brain locks up the brakes, with "WTF is going on here??? I'm out".
- tilt_error 11y agoI prefer having a parser produce an abstract syntax tree. From an expressiveness viewpoint, you get a good deal of raw power from being able to manipulate this directly instead of having to instruct a lexer/parser to do it for you. I don't necessarily think this is a good thing though.
- aidenn0 11y agowith regards to Naugty Dog, The Jak & Daxter games were written entirely in GOAL, an in-house scheme implementation that compiled down to assembly.
- viperscape 11y agomight like this: http://practical-scheme.net/docs/gdc2002.html http://practical-scheme.net/docs/gdc2002.html it's about using scheme in production house for final fantasy movie
- chadzawistowski 11y agoGOAL and GOOL were both used by that studio: "Game Oriented Action Lisp" and "Game Oriented Object Lisp". They switched to C++ because it was too hard to find good lisp devs.
- samth 11y agoThat's not quite right. These days Naughty Dog uses a DSL called DC built in Racket to write all the "data" in the game (everything from cut scenes to character attributes). Running DC produces data files shipped on the DVD of the game, and used by the big C++ engine that's running on the PlayStation. Dan Leibgold gave a talk about their system at RacketCon a few years ago: https://www.youtube.com/watch?v=oSmqbnhHp1c https://www.youtube.com/watch?v=oSmqbnhHp1c
- lispm 11y agoThey switched to C++ because they were bought by Sony and integrated into their landscape. They thought that sharing C++ code would be useful. As it turned out, they put Scheme back into their production pipeline.
- chadzawistowski 11y agoOh, good to know!