New Posts  All Forums:Forum Nav:

lisp help/discussion - Page 2

post #11 of 31
Quote:
Originally Posted by 47 Knucklehead View Post

I take it you are Lost In Stupid Parenthesis?

yes I mean what is this weirdsmiley.gif
Code:
(+ (* 78 4) 3)

can't you just do this:
Code:
(78*4) + 3

doh.gif

BTW i'm just reading on LISP right now and trying to learn it biggrin.gif why?

I don't know
    
CPUMotherboardGraphicsRAM
Intel 3930K 5040MHz @ 1.48 - 1.53v @ VTT/VCCSA ... Asus rampage extreme IV Gigabyte GTX 970 G1 @ 1580/4050MHz @ 1.325V Corsair Vengeance 64GB (8 x 8GB) DDR3 2400MHz. ... 
Hard DriveHard DriveHard DriveHard Drive
Samsung 850 Pro 256GB Seagate Barracuda ST3000DM001 3TB WD Black 1TB 64Mb Cache  WD Blue 500GB 16mb Cache 
Hard DriveOptical DriveCoolingCooling
WD Black 4TB 64mb Cache LG DVD EK-FB KIT RE4 - Acetal EK-FC970 GTX WF3 Backplate - Black 
CoolingCoolingCoolingCooling
Laing D5 Vario 12V DC Pump (MCP 655)  EK-BAY SPIN Reservoir - Plexi EK-CoolStream RAD XT (240) EK-CoolStream RAD XTX (120) 
CoolingCoolingCoolingCooling
EK-CoolStream XE 120 (Single) 8x Corsair Air SP120 PWM High Performance Edition 3x Corsair Air AF120 High Performance Edition EK-Supremacy EVO CPU Water Block (Nickel Acetal) 
CoolingOSMonitorMonitor
EK-FC970 GTX WF3 - Acetal+Nickel Windows 10 64-bit v1511 build 10586.14 BenQ RL2755HM LG W2261 
MonitorKeyboardPowerCase
Samsung S23C350 Razer BlackWidow Ultimate Cooler Master Silent Pro Gold 1000W Thermaltake Level 10 GT 
Mouse
Razer Lachesis 5600DPI 
  hide details  
Reply
    
CPUMotherboardGraphicsRAM
Intel 3930K 5040MHz @ 1.48 - 1.53v @ VTT/VCCSA ... Asus rampage extreme IV Gigabyte GTX 970 G1 @ 1580/4050MHz @ 1.325V Corsair Vengeance 64GB (8 x 8GB) DDR3 2400MHz. ... 
Hard DriveHard DriveHard DriveHard Drive
Samsung 850 Pro 256GB Seagate Barracuda ST3000DM001 3TB WD Black 1TB 64Mb Cache  WD Blue 500GB 16mb Cache 
Hard DriveOptical DriveCoolingCooling
WD Black 4TB 64mb Cache LG DVD EK-FB KIT RE4 - Acetal EK-FC970 GTX WF3 Backplate - Black 
CoolingCoolingCoolingCooling
Laing D5 Vario 12V DC Pump (MCP 655)  EK-BAY SPIN Reservoir - Plexi EK-CoolStream RAD XT (240) EK-CoolStream RAD XTX (120) 
CoolingCoolingCoolingCooling
EK-CoolStream XE 120 (Single) 8x Corsair Air SP120 PWM High Performance Edition 3x Corsair Air AF120 High Performance Edition EK-Supremacy EVO CPU Water Block (Nickel Acetal) 
CoolingOSMonitorMonitor
EK-FC970 GTX WF3 - Acetal+Nickel Windows 10 64-bit v1511 build 10586.14 BenQ RL2755HM LG W2261 
MonitorKeyboardPowerCase
Samsung S23C350 Razer BlackWidow Ultimate Cooler Master Silent Pro Gold 1000W Thermaltake Level 10 GT 
Mouse
Razer Lachesis 5600DPI 
  hide details  
Reply
post #12 of 31
Quote:
Originally Posted by Fantasy View Post

yes I mean what is this weirdsmiley.gif
Code:
(+ (* 78 4) 3)
can't you just do this:
Code:
(78*4) + 3
doh.gif
BTW i'm just reading on LISP right now and trying to learn it biggrin.gif why?
I don't know

Lisp uses the format

(func_name p1 p2 p3 pn)

each argument is evaluated before it is passed to the function
Let's apply this principle to the code you gave.

The outer function is (+ (* 78 4) 3) it says that the function is add (named "+") and it adds it's parameters together, however many there are.
The parameters are evaluated in order. The first parameter (* 78 4) is a function that multiplies it's parameters together and returns the result to the add function.
312 becomes the first parameter and 3 becomes the second parameter

(+ (* 78 4) 3) ==> (+ 312 3) ==> 315

A C-like equivalent to this would be (except for the fact that the + and * functions in lisp accept any amount of parameters and work with all number types)
Code:
int add( int x, int y){
 return x + y;
}

int mul( int x, int y){
 return x * y;
}

int my_func(){
return add(mul(78, 4), 3); /* this is the (+ (* 78 4) 3) part */
}

Notice that the difference is merely whether the function name is inside the parethesis or before the parenthesis. It's not complex, C stole the idea of functions from lisp and programmers use functions (in all their parenthesis glory) every day (whether or not the programmer claims to hate lisp).
Edited by hajile - 10/13/12 at 9:42am
post #13 of 31
Ok that is all fine and great. But why do people still use it? it was created in 1958. its so old. I can understand why people to this day use assembly for low level programming, but LISP. I just do get it.
    
CPUMotherboardGraphicsRAM
Intel 3930K 5040MHz @ 1.48 - 1.53v @ VTT/VCCSA ... Asus rampage extreme IV Gigabyte GTX 970 G1 @ 1580/4050MHz @ 1.325V Corsair Vengeance 64GB (8 x 8GB) DDR3 2400MHz. ... 
Hard DriveHard DriveHard DriveHard Drive
Samsung 850 Pro 256GB Seagate Barracuda ST3000DM001 3TB WD Black 1TB 64Mb Cache  WD Blue 500GB 16mb Cache 
Hard DriveOptical DriveCoolingCooling
WD Black 4TB 64mb Cache LG DVD EK-FB KIT RE4 - Acetal EK-FC970 GTX WF3 Backplate - Black 
CoolingCoolingCoolingCooling
Laing D5 Vario 12V DC Pump (MCP 655)  EK-BAY SPIN Reservoir - Plexi EK-CoolStream RAD XT (240) EK-CoolStream RAD XTX (120) 
CoolingCoolingCoolingCooling
EK-CoolStream XE 120 (Single) 8x Corsair Air SP120 PWM High Performance Edition 3x Corsair Air AF120 High Performance Edition EK-Supremacy EVO CPU Water Block (Nickel Acetal) 
CoolingOSMonitorMonitor
EK-FC970 GTX WF3 - Acetal+Nickel Windows 10 64-bit v1511 build 10586.14 BenQ RL2755HM LG W2261 
MonitorKeyboardPowerCase
Samsung S23C350 Razer BlackWidow Ultimate Cooler Master Silent Pro Gold 1000W Thermaltake Level 10 GT 
Mouse
Razer Lachesis 5600DPI 
  hide details  
Reply
    
CPUMotherboardGraphicsRAM
Intel 3930K 5040MHz @ 1.48 - 1.53v @ VTT/VCCSA ... Asus rampage extreme IV Gigabyte GTX 970 G1 @ 1580/4050MHz @ 1.325V Corsair Vengeance 64GB (8 x 8GB) DDR3 2400MHz. ... 
Hard DriveHard DriveHard DriveHard Drive
Samsung 850 Pro 256GB Seagate Barracuda ST3000DM001 3TB WD Black 1TB 64Mb Cache  WD Blue 500GB 16mb Cache 
Hard DriveOptical DriveCoolingCooling
WD Black 4TB 64mb Cache LG DVD EK-FB KIT RE4 - Acetal EK-FC970 GTX WF3 Backplate - Black 
CoolingCoolingCoolingCooling
Laing D5 Vario 12V DC Pump (MCP 655)  EK-BAY SPIN Reservoir - Plexi EK-CoolStream RAD XT (240) EK-CoolStream RAD XTX (120) 
CoolingCoolingCoolingCooling
EK-CoolStream XE 120 (Single) 8x Corsair Air SP120 PWM High Performance Edition 3x Corsair Air AF120 High Performance Edition EK-Supremacy EVO CPU Water Block (Nickel Acetal) 
CoolingOSMonitorMonitor
EK-FC970 GTX WF3 - Acetal+Nickel Windows 10 64-bit v1511 build 10586.14 BenQ RL2755HM LG W2261 
MonitorKeyboardPowerCase
Samsung S23C350 Razer BlackWidow Ultimate Cooler Master Silent Pro Gold 1000W Thermaltake Level 10 GT 
Mouse
Razer Lachesis 5600DPI 
  hide details  
Reply
post #14 of 31
Quote:
Originally Posted by Fantasy View Post

Ok that is all fine and great. But why do people still use it? it was created in 1958. its so old. I can understand why people to this day use assembly for low level programming, but LISP. I just do get it.

All the "new" innovations in ALGOL languages have been taken from Lisp. The age of the syntax doesn't matter (humans don't suddenly think differently). The syntax is easily extensible, easy to parse, allows all new functions to behave as though they were part of the original language, and makes functional programming ideas to be implemented easier.

LISP has the potential to be the highest-level language available while still being extremely low level (note that assembly commands wrapped in parenthesis would be indistinguishable from lisp expressions; in fact some Lisp dialects such as picolisp have built-in assembly capabilities).

The parts of C, Java, Python, etc that weren't stolen from Lisp date back to languages that came out before lisp; does this make these languages bad?

What has kept lisp around is its power. Here's a brief article (with lots of sources that I'm too lazy to add) that made an interesting point (note: it was written in 2000). Programmers were asked to write a project in their primary language (the languages of the first and follow-up studies have included lisp, java, C/C++, python, perl, and a couple of other languages). The result was that (comparing averages) lisp programs were (read PDF here) 2x faster than C/C++ (despite the fact that C is indeed faster if extra time is taken) and 40x faster than Java. Development time for the Lisp programs was half that of the C or Java programs (5hr vs 10hr on average) and this was to spite the fact that the lisp programmers overall had less experience with the language than the C or java programmers. The median size of the Lisp code was also around 1.8x smaller than the C or Java code.

I guess your question is "why does noone use it if it's so good"?

There's been several answers over the years. One is that most lisp programming used to be done for special "lisp-machines" that cost thousands of dollars to run. The second is that lots of programmers have major misconceptions about lisp (it's not compiled, it doesn't have arrays, the parenthesis are a problem, it's slow, garbage collection sucks, it's only for AI programmers, etc). Despite it being less known, many companies still use it (though lots don't like to say that they do for some reason), and I've seldom heard of a Lisp programmer lacking for a job. Another issue (a chicken and egg issue) is that of libraries. When common lisp was standardized in '84, people complained that the standard libraries were too big; now people complain that they are too small. I think that good, documented libraries (outside of expensive, proprietary solutions) is a definite problem.

Some lisp dialects such as Clojure (lisp for the Java VM) or Qi have been gaining popularity recently. Javascript is just Scheme with Java syntax (why it sucks) and without some of the great lisp features. My final explanation as to why lisp isn't popular is that your typical code monkey doesn't want to take the time to understand the advanced concepts of functional programming. As a result, inferior languages such as Java are used (in talking about java, Guy Steele (one of the creators of Java, Scheme, and Common Lisp) said, "We were not out to win over the Lisp programmers; we were after the C++ programmers. We managed to drag a lot of them about halfway to Lisp.")

In short, age and how good a language is have no correlation.
Edited by hajile - 10/19/12 at 6:26am
post #15 of 31
Quote:
Originally Posted by hajile View Post

2x faster than C/C++ (despite the fact that C is indeed faster if extra time is taken) and 40x faster than Java.

Wow bigeyedsmiley.png

Quote:
Originally Posted by hajile View Post

final explanation as to why lisp isn't popular is that your typical code monkey doesn't want to take the time to understand the advanced concepts of functional programming.
lachen.gif
    
CPUMotherboardGraphicsRAM
Intel 3930K 5040MHz @ 1.48 - 1.53v @ VTT/VCCSA ... Asus rampage extreme IV Gigabyte GTX 970 G1 @ 1580/4050MHz @ 1.325V Corsair Vengeance 64GB (8 x 8GB) DDR3 2400MHz. ... 
Hard DriveHard DriveHard DriveHard Drive
Samsung 850 Pro 256GB Seagate Barracuda ST3000DM001 3TB WD Black 1TB 64Mb Cache  WD Blue 500GB 16mb Cache 
Hard DriveOptical DriveCoolingCooling
WD Black 4TB 64mb Cache LG DVD EK-FB KIT RE4 - Acetal EK-FC970 GTX WF3 Backplate - Black 
CoolingCoolingCoolingCooling
Laing D5 Vario 12V DC Pump (MCP 655)  EK-BAY SPIN Reservoir - Plexi EK-CoolStream RAD XT (240) EK-CoolStream RAD XTX (120) 
CoolingCoolingCoolingCooling
EK-CoolStream XE 120 (Single) 8x Corsair Air SP120 PWM High Performance Edition 3x Corsair Air AF120 High Performance Edition EK-Supremacy EVO CPU Water Block (Nickel Acetal) 
CoolingOSMonitorMonitor
EK-FC970 GTX WF3 - Acetal+Nickel Windows 10 64-bit v1511 build 10586.14 BenQ RL2755HM LG W2261 
MonitorKeyboardPowerCase
Samsung S23C350 Razer BlackWidow Ultimate Cooler Master Silent Pro Gold 1000W Thermaltake Level 10 GT 
Mouse
Razer Lachesis 5600DPI 
  hide details  
Reply
    
CPUMotherboardGraphicsRAM
Intel 3930K 5040MHz @ 1.48 - 1.53v @ VTT/VCCSA ... Asus rampage extreme IV Gigabyte GTX 970 G1 @ 1580/4050MHz @ 1.325V Corsair Vengeance 64GB (8 x 8GB) DDR3 2400MHz. ... 
Hard DriveHard DriveHard DriveHard Drive
Samsung 850 Pro 256GB Seagate Barracuda ST3000DM001 3TB WD Black 1TB 64Mb Cache  WD Blue 500GB 16mb Cache 
Hard DriveOptical DriveCoolingCooling
WD Black 4TB 64mb Cache LG DVD EK-FB KIT RE4 - Acetal EK-FC970 GTX WF3 Backplate - Black 
CoolingCoolingCoolingCooling
Laing D5 Vario 12V DC Pump (MCP 655)  EK-BAY SPIN Reservoir - Plexi EK-CoolStream RAD XT (240) EK-CoolStream RAD XTX (120) 
CoolingCoolingCoolingCooling
EK-CoolStream XE 120 (Single) 8x Corsair Air SP120 PWM High Performance Edition 3x Corsair Air AF120 High Performance Edition EK-Supremacy EVO CPU Water Block (Nickel Acetal) 
CoolingOSMonitorMonitor
EK-FC970 GTX WF3 - Acetal+Nickel Windows 10 64-bit v1511 build 10586.14 BenQ RL2755HM LG W2261 
MonitorKeyboardPowerCase
Samsung S23C350 Razer BlackWidow Ultimate Cooler Master Silent Pro Gold 1000W Thermaltake Level 10 GT 
Mouse
Razer Lachesis 5600DPI 
  hide details  
Reply
post #16 of 31
Hajile, do you, by any chance, have any experience with Haskell?
MacBook Pro 13"
(6 items)
 
 
Desktop
(13 items)
 
CPUGraphicsRAMHard Drive
Intel i5 3210 @ 2.5 GHz Intel HD4000 4 GB DDR3 @ 1600 MHz 500 GB @ 5400 RPM 
OSMonitor
OSX Mountain Lion 13.3" @ 1280 x 800 
CPUGraphicsRAMHard Drive
Intel i5 480m@2.67GHz AMD Radeon Mobility 5650 4GB DDR3 500GB 
OSMonitor
Windows 7 64bit HP 15.6" 1366x768 
CPUMotherboardGraphicsRAM
E7500 Intel...:( MSI GTS250 1GB 2GB 
Hard DriveOSMonitorPower
250GB Windows XP 17" LG CRT 1280x768@85hz 400W 
  hide details  
Reply
MacBook Pro 13"
(6 items)
 
 
Desktop
(13 items)
 
CPUGraphicsRAMHard Drive
Intel i5 3210 @ 2.5 GHz Intel HD4000 4 GB DDR3 @ 1600 MHz 500 GB @ 5400 RPM 
OSMonitor
OSX Mountain Lion 13.3" @ 1280 x 800 
CPUGraphicsRAMHard Drive
Intel i5 480m@2.67GHz AMD Radeon Mobility 5650 4GB DDR3 500GB 
OSMonitor
Windows 7 64bit HP 15.6" 1366x768 
CPUMotherboardGraphicsRAM
E7500 Intel...:( MSI GTS250 1GB 2GB 
Hard DriveOSMonitorPower
250GB Windows XP 17" LG CRT 1280x768@85hz 400W 
  hide details  
Reply
post #17 of 31
Quote:
Originally Posted by {Unregistered} View Post

Hajile, do you, by any chance, have any experience with Haskell?

I have a book or two sitting around and I've read part of them, but I don't have enough experience with it to fill a small spoon. One day when I have time, I'm definitely going to learn Haskell (btw, haskell was originally written in lisp). I've heard that the coding style of haskell is (largely) implicitly parallel which can help the compiler thread the program. That interests me a lot; if only I had 30 hours in each day...
post #18 of 31
Quote:
Originally Posted by Fantasy View Post

Ok that is all fine and great. But why do people still use it? it was created in 1958. its so old. I can understand why people to this day use assembly for low level programming, but LISP. I just do get it.

The only reason why I learned it (and COBOL), was to graduate with my degree several DECADES ago.
post #19 of 31
I've wanted to learn Lisp for a while now - if just the basics. But as someone else has said already, there's never enough hours in the day
post #20 of 31
Quote:
Originally Posted by Plan9 View Post

I've wanted to learn Lisp for a while now - if just the basics. But as someone else has said already, there's never enough hours in the day

Learn Haskell instead. thumb.gif
MacBook Pro 13"
(6 items)
 
 
Desktop
(13 items)
 
CPUGraphicsRAMHard Drive
Intel i5 3210 @ 2.5 GHz Intel HD4000 4 GB DDR3 @ 1600 MHz 500 GB @ 5400 RPM 
OSMonitor
OSX Mountain Lion 13.3" @ 1280 x 800 
CPUGraphicsRAMHard Drive
Intel i5 480m@2.67GHz AMD Radeon Mobility 5650 4GB DDR3 500GB 
OSMonitor
Windows 7 64bit HP 15.6" 1366x768 
CPUMotherboardGraphicsRAM
E7500 Intel...:( MSI GTS250 1GB 2GB 
Hard DriveOSMonitorPower
250GB Windows XP 17" LG CRT 1280x768@85hz 400W 
  hide details  
Reply
MacBook Pro 13"
(6 items)
 
 
Desktop
(13 items)
 
CPUGraphicsRAMHard Drive
Intel i5 3210 @ 2.5 GHz Intel HD4000 4 GB DDR3 @ 1600 MHz 500 GB @ 5400 RPM 
OSMonitor
OSX Mountain Lion 13.3" @ 1280 x 800 
CPUGraphicsRAMHard Drive
Intel i5 480m@2.67GHz AMD Radeon Mobility 5650 4GB DDR3 500GB 
OSMonitor
Windows 7 64bit HP 15.6" 1366x768 
CPUMotherboardGraphicsRAM
E7500 Intel...:( MSI GTS250 1GB 2GB 
Hard DriveOSMonitorPower
250GB Windows XP 17" LG CRT 1280x768@85hz 400W 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming